Further work on notificaton types for edit and add page.
$haveTransactions = false;
$transactions = false;
$haveTransactions = false;
- $this->transactionID = false;
+ $this->transactionID = false;
$transactionsUpdated = false;
$transactionsUpdateError = false;
$transactionsAdded = false;
public function modelAction ($actionData = false)
{
+ $id = 0;
$option = 'list';
$view = 'notificationTypes';
$success = true;
switch($_REQUEST['option']) {
case 'add':
- $this->newEntry();
+ $notificationTypes = $this->newEntry();
$view = 'editNotificationType';
break;
case 'insert':
$view = 'editNotificationType';
- $this->insertEntry();
+ $test = $this->insertEntry();
+ echo '<pre>$test: ' . print_r($test, true) . '</pre>';
$notificationTypes = $this->getList();
break;
case 'edit':
- $notificationTypes = $this->editEntry( $this->notification_id );
+ $notificationTypes = $this->editEntry( $id );
+ $view = 'editNotificationType';
break;
case 'update':
}
- 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;
// Compile template data
$templateData = array(
+ 'notification_id' => $id,
'action' => $_REQUEST['glm_action'],
'enable_members' => $enable_members,
'haveNotificationTypes' => $haveNotificationTypes,
Show error header here
-<form action="{$thisUrl}?page={$thisPage}&glm_action=notificationTypes">
- {if $haveNotificationTypes}
+<form action="{$thisUrl}?page={$thisPage}&glm_action=notificationTypes" method="post">
+ {if $notification_id}
<input type="hidden" name="option" value="update">
+ <input type="hidden" name="id" value="{$notification_id}">
{else}
<input type="hidden" name="option" value="insert">
{/if}
<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>
+ {if $notificationTypes.fieldFail.name}<p>{$notificationTypes.fieldFail.name}</p>{/if}<br>
</td>
</tr>
<th colspan="2">Due Date</th>
</tr>
<tr>
- <th class="glm-required"><input type="radio" name="send_by" value="date" required></th>
+ <th class="glm-required"><input type="radio" name="send_by" value="date" required{if $notificationTypes.fieldData.send_by_date.value} checked{/if}></th>
<td>
<input
type="number"
<th colspan="2">Immediate Action</th>
</tr>
<tr>
- <th><input type="radio" name="send_by" value="action" required></th>
+ <th><input type="radio" name="send_by" value="action" required{if $notificationTypes.fieldData.send_by_action.value} checked{/if}></th>
<td>
<select name="send_action">
{foreach $send_action as $id => $val}
<tr>
<td colspan="2">
- <input class="button button-primary" type="submit" value="{if $haveNotificationTypes}Update{else}Add{/if} Notification Type">
+ <input class="button button-primary" type="submit" value="{if $notification_id}Update{else}Add{/if} Notification Type">
</td>
</tr>
<td>{$t.id}</td>
<td>
<div>
- <a class="editNotificationType"
+ <a
+ href="{$thisUrl}?page={$thisPage}&glm_action=notificationTypes&option=edit&id={$t.id}"
data-notification-id="{$t.id}"
data-notification-name="{$t.name}"
data-notification-sendbydate="{$t.send_by_date.value}"