public function modelAction ($actionData = false)
{
+ $option = 'list';
+ $view = 'notificationTypes';
$success = true;
$haveNotificationTypes = false;
$notificationTypes = false;
}
}
- // If there's an action option
+ // Get any provided option
if (isset($_REQUEST['option'])) {
+ $option = $_REQUEST['option'];
+ }
- switch($_REQUEST['option']) {
-
- case 'addNew':
-
-
- $this->insertEntry();
- break;
-
- case 'update':
- if ($id > 0) {
- $this->updateEntry($id);
- }
- break;
-
- case 'delete':
- if ($id > 0) {
- $this->deleteEntry($id, true);
- }
- break;
+ switch($_REQUEST['option']) {
+ case 'add':
+ $this->newEntry();
+ $view = 'editNotificationType';
+ break;
+
+ case 'insert':
+ $view = 'editNotificationType';
+ $this->insertEntry();
+ $notificationTypes = $this->getList();
+ break;
+
+ case 'edit':
+ $notificationTypes = $this->editEntry( $this->notification_id );
+ break;
+
+ case 'update':
+ if ($id > 0) {
+ $this->updateEntry($id);
+ }
+ $notificationTypes = $this->getList();
+ break;
+ case 'delete':
+ if ($id > 0) {
+ $this->deleteEntry($id, true);
}
+ case 'list':
+ default:
+ // Get a current list of members
+ $notificationTypes = $this->getList();
+ break;
}
- // Get a current list of members
- $notificationTypes = $this->getList();
- // echo '<pre>$notificationTypes: ' . print_r( $notificationTypes, true ) . '</pre>';
+ echo '<pre>$notificationTypes: ' . print_r( $notificationTypes, true ) . '</pre>';
// If we have list entries - even if it's an empty list
$success = true;
'status' => $success,
'menuItemRedirect' => false,
'modelRedirect' => false,
- 'view' => 'admin/settings/notificationTypes.html',
+ 'view' => 'admin/settings/' . $view . '.html',
'data' => $templateData
);
--- /dev/null
+{include file='admin/settings/header.html'}
+
+{include file='admin/settings/subHeader.html'}
+
+Show error header here
+
+<form action="{$thisUrl}?page={$thisPage}&glm_action=notificationTypes">
+ {if $haveNotificationTypes}
+ <input type="hidden" name="option" value="update">
+ {else}
+ <input type="hidden" name="option" value="insert">
+ {/if}
+
+ <table class="glm-admin-table glm-event-table">
+
+ <tr>
+ <th {if $notificationTypes.fieldRequired.name} class="glm-required"}{/if}>Name</th>
+ <td {if $notificationTypes.fieldFail.name}class="glm-form-bad-input" data-tabid="glm-name"{/if}>
+ <input type="text" name="name" value="{$notificationTypes.fieldData.name}" class="glm-form-text-input-medium">
+ {if $notificationTypes.fieldFail.name}<p>{$notificationTypes.fieldFail.name}</p>{/if}<br>
+ </td>
+ </tr>
+
+ <tr>
+ <th colspan="2" class="glm-required">Send Notification based on</th>
+ </tr>
+ <tr>
+ <th colspan="2">Due Date</th>
+ </tr>
+ <tr>
+ <th class="glm-required"><input type="radio" name="send_by" value="date" required></th>
+ <td>
+ <input
+ type="number"
+ step="1"
+ min="0"
+ max="100"
+ name="send_date_number"
+ class="glm-form-text-input-veryshort">
+ <select name="send_date_period">
+ {foreach $send_date_period as $id => $val}
+ <option value="{$id}">{$val}</option>
+ {/foreach}
+ </select>
+ <select name="send_date_when">
+ {foreach $send_date_when as $id => $val}
+ <option value="{$id}">{$val}</option>
+ {/foreach}
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <th colspan="2">Immediate Action</th>
+ </tr>
+ <tr>
+ <th><input type="radio" name="send_by" value="action" required></th>
+ <td>
+ <select name="send_action">
+ {foreach $send_action as $id => $val}
+ <option value="{$id}">{$val}</option>
+ {/foreach}
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <th {if $notificationTypes.fieldRequired.subject} class="glm-required"}{/if}>Subject</th>
+ <td {if $notificationTypes.fieldFail.subject}class="glm-form-bad-input" data-tabid="glm-subject"{/if}>
+ <input type="text" name="subject" value="{$notificationTypes.fieldData.subject}" class="glm-form-text-input-medium">
+ {if $notificationTypes.fieldFail.subject}<p>{$notificationTypes.fieldFail.subject}</p>{/if}<br>
+ </td>
+ </tr>
+
+ <tr>
+ <th {if $notificationTypes.fieldRequired.from_header} class="glm-required"}{/if}>From</th>
+ <td {if $notificationTypes.fieldFail.from_header}class="glm-form-bad-input" data-tabid="glm-fromheader"{/if}>
+ <input type="text" name="from_header" value="{$notificationTypes.fieldData.from_header}" class="glm-form-text-input-medium">
+ {if $notificationTypes.fieldFail.from_header}<p>{$notificationTypes.fieldFail.from_header}</p>{/if}<br>
+ </td>
+ </tr>
+
+ <tr>
+ <th {if $notificationTypes.fieldRequired.replyto} class="glm-required"}{/if}>Reply-To</th>
+ <td {if $notificationTypes.fieldFail.replyto}class="glm-form-bad-input" data-tabid="glm-replyto"{/if}>
+ <input type="text" name="replyto" value="{$notificationTypes.fieldData.replyto}" class="glm-form-text-input-medium">
+ {if $notificationTypes.fieldFail.replyto}<p>{$notificationTypes.fieldFail.replyto}</p>{/if}<br>
+ </td>
+ </tr>
+
+ <tr>
+ <th {if $notificationTypes.fieldRequired.message}class="glm-required"{/if}>Message:</th>
+ <td {if $notificationTypes.fieldFail.message}class="glm-form-bad-input" data-tabid="glm-message"{/if}>
+ {php}
+ wp_editor('{$notificationTypes.fieldData.message|escape:quotes}', 'glm_descr', array(
+ 'media_buttons' => false,
+ 'textarea_name' => 'message',
+ 'editor_height' => 200,
+ ));
+ {/php}
+ {if $notificationTypes.fieldFail.message}<p>{$notificationTypes.fieldFail.message}</p>{/if}
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <input class="button button-primary" type="submit" value="{if $haveNotificationTypes}Update{else}Add{/if} Notification Type">
+ </td>
+ </tr>
+
+
+ </table>
+</form>
+
+
+{include file='admin/footer.html'}
{include file='admin/settings/subHeader.html'}
<!-- Add NotificationTypes Button and Dialog Box -->
-<div id="newNotificationTypeButton" class="button button-primary glm-right">Add a Notification Type</div>
+<a href="{$thisUrl}?page={$thisPage}&glm_action=notificationTypes&option=add" class="button button-primary glm-right">Add a Notification Type</a>
<div id="newNotificationTypeDialog" class="glm-dialog-box" title="Enter a New NotificationType">
<form action="{$thisUrl}?page={$thisPage}&glm_action=notificationTypes" method="post" enctype="multipart/form-data">
<input type="hidden" name="glm_action" value="notificationTypes">
dialogClass: "glm-dialog-no-close"
});
- $('#newNotificationTypeButton').click( function() {
- $("#newNotificationTypeDialog").dialog("open");
- });
+ // $('#newNotificationTypeButton').click( function() {
+ // $("#newNotificationTypeDialog").dialog("open");
+ // });
$('.editNotificationType').click( function() {
$('#editRecurring').prop( 'checked', false );