}
+ /**
+ * Archive this message.
+ *
+ * @param int id Message id to archive
+ *
+ * @return void
+ */
+ public function archive( $id )
+ {
+ $this->wpdb->update(
+ $this->table,
+ array( 'archived' => true ),
+ array( 'id' => $id ),
+ array( '%d' ),
+ array( '%d' )
+ );
+ }
+
+ /**
+ * Restore this message.
+ *
+ * @param int id Message id to restore
+ *
+ * @return void
+ */
+ public function restore( $id )
+ {
+ $this->wpdb->update(
+ $this->table,
+ array( 'archived' => false ),
+ array( 'id' => $id ),
+ array( '%d' ),
+ array( '%d' )
+ );
+ }
+
}
'paging' => $paging,
];
break;
+
case 'search':
$view = 'search';
$searchResults = array();
);
break;
- case 'editTemplate':
- $error = false;
- $view = 'editTemplate';
- $newEntry = false;
- $Templates = new GlmDataEmailTemplates( $this->wpdb, $this->config );
- if ( isset( $_REQUEST['id'] ) && $id = filter_var( $_REQUEST['id'], FILTER_VALIDATE_INT ) ) {
- $template = $Templates->editEntry( $id );
- } else {
- $template = $Templates->newEntry();
- $newEntry = true;
- }
- $tData = array(
- 'template' => $template,
- 'newEntry' => $newEntry,
- 'error' => $error,
- );
- break;
-
- case 'updateTemplate':
- $error = false;
- $success = false;
- $templateData['thisOption'] = 'listTemplates';
- $Templates = new GlmDataEmailTemplates( $this->wpdb, $this->config );
- if ( isset( $_REQUEST['id'] ) && $id = filter_var( $_REQUEST['id'], FILTER_VALIDATE_INT ) ) {
- $newEntry = false;
- $template = $Templates->updateEntry( $id );
- } else {
- $newEntry = true;
- $template = $Templates->insertEntry();
- }
- if ( $template['status'] != 1 ) {
- $error = true;
- $view = 'editTemplate';
- $tData = array(
- 'template' => $template,
- 'newEntry' => $newEntry,
- 'error' => $error,
- 'success' => $success,
- );
- } else {
- $success = true;
- $view = 'editTemplate';
- $tData = array(
- 'template' => $template,
- 'newEntry' => $newEntry,
- 'error' => $error,
- 'success' => $success,
- );
- }
- break;
-
- case 'deleteTemplate':
- $view = 'list';
- $Templates = new GlmDataEmailTemplates( $this->wpdb, $this->config );
- if ( $option == 'deleteTemplate' && isset( $_REQUEST['id'] ) && $id = filter_var( $_REQUEST['id'], FILTER_VALIDATE_INT ) ) {
- $Templates->deleteEntry( $id, true );
- }
-
- case 'listTemplates':
- $view = 'listTemplates';
- $Templates = new GlmDataEmailTemplates( $this->wpdb, $this->config );
- $templates = $Templates->getList();
- $tData = array(
- 'templates' => $templates,
- );
- break;
-
case 'editHtmlEmail':
$view = 'editHtmlEmail';
$newEntry = false;
$this->deleteEntry( $id, true );
}
+ case 'archive':
+ $view = 'list';
+ if ( $option == 'archive' && isset( $_REQUEST['id'] ) && $id = filter_var( $_REQUEST['id'], FILTER_VALIDATE_INT ) ) {
+ $this->archive( $id );
+ }
+
+ case 'restore':
+ $view = 'list';
+ if ( $option == 'restore' && isset( $_REQUEST['id'] ) && $id = filter_var( $_REQUEST['id'], FILTER_VALIDATE_INT ) ) {
+ $this->restore( $id );
+ }
+
case 'list':
$view = 'list';
<th align="left">Last Updated</th>
<th align="left">Last Sent</th>
<th align="left">Queued</th>
+ <th align="left">Archive</th>
<th align="left" width="50">Preview</th>
</tr>
</thead>
<td> {$message.last_updated.timestamp|date_format:"%D %r"} </td>
<td> {$message.sent|date_format:"%D %r"} </td>
<td> {$message.stats|date_format:"%D %r"} </td>
+ <td>
+ {if $message.archived.value}
+ <a href="{$thisUrl}?page={$thisPage}&option=restore&id={$message.id}&filterArchived=1">Restore</a>
+ {else}
+ <a href="{$thisUrl}?page={$thisPage}&option=archive&id={$message.id}">Archive</a>
+ {/if}
+ </td>
<td>
<a href="{$thisUrl}?page={$thisPage}&option=preview&id={$message.template_id.value}&message_id={$message.id}" class="preview" data-id="{$message.template_id.value}" data-message="{$message.id}" >Preview</a>
</td>