Update to notification views.
Showing
4 changed files
with
26 additions
and
18 deletions
| ... | @@ -59,6 +59,7 @@ function display_page() { | ... | @@ -59,6 +59,7 @@ function display_page() { |
| 59 | $validation->set_rules('text','Text Version','trim|min_length[16]'); | 59 | $validation->set_rules('text','Text Version','trim|min_length[16]'); |
| 60 | $validation->set_rules('html','HTML Version','trim|min_length[16]'); | 60 | $validation->set_rules('html','HTML Version','trim|min_length[16]'); |
| 61 | 61 | ||
| 62 | $validation->set_rules('system_message_type','System Message Type','trim'); | ||
| 62 | $validation->set_rules('system','System Message','trim|min_length[16]'); | 63 | $validation->set_rules('system','System Message','trim|min_length[16]'); |
| 63 | $validation->set_rules('sms','SMS Message','trim|min_length[16]'); | 64 | $validation->set_rules('sms','SMS Message','trim|min_length[16]'); |
| 64 | 65 | ||
| ... | @@ -87,6 +88,7 @@ function display_page() { | ... | @@ -87,6 +88,7 @@ function display_page() { |
| 87 | } | 88 | } |
| 88 | 89 | ||
| 89 | // system | 90 | // system |
| 91 | $system_message_type = $_POST['system_message_type']; | ||
| 90 | $system = $_POST['system']; | 92 | $system = $_POST['system']; |
| 91 | 93 | ||
| 92 | // SMS | 94 | // SMS |
| ... | @@ -106,8 +108,13 @@ function display_page() { | ... | @@ -106,8 +108,13 @@ function display_page() { |
| 106 | , 'html' => $html | 108 | , 'html' => $html |
| 107 | , 'attachments' => $attachments | 109 | , 'attachments' => $attachments |
| 108 | )); | 110 | )); |
| 109 | update_post_meta($id, "system", $system); | 111 | update_post_meta($id, "system", array( |
| 110 | update_post_meta($id, "sms", $sms); | 112 | 'system_message_type' => $system_message_type |
| 113 | , 'message' => $system | ||
| 114 | )); | ||
| 115 | update_post_meta($id, "sms", array( | ||
| 116 | 'message' => $sms | ||
| 117 | )); | ||
| 111 | 118 | ||
| 112 | $update = array(); | 119 | $update = array(); |
| 113 | $update['ID'] = $id; | 120 | $update['ID'] = $id; |
| ... | @@ -238,7 +245,6 @@ function notification_settings() { | ... | @@ -238,7 +245,6 @@ function notification_settings() { |
| 238 | $validation = new Notifications\Validation; | 245 | $validation = new Notifications\Validation; |
| 239 | $validation->set_rules('company','Company','required|trim'); | 246 | $validation->set_rules('company','Company','required|trim'); |
| 240 | $validation->set_rules('address','Address','required|trim'); | 247 | $validation->set_rules('address','Address','required|trim'); |
| 241 | $validation->set_rules('address2','Apt/Unit/Suite','required|trim'); | ||
| 242 | $validation->set_rules('city','City','required|trim'); | 248 | $validation->set_rules('city','City','required|trim'); |
| 243 | $validation->set_rules('province','Province','required|trim'); | 249 | $validation->set_rules('province','Province','required|trim'); |
| 244 | $validation->set_rules('postal','POstal Code','required|trim'); | 250 | $validation->set_rules('postal','POstal Code','required|trim'); |
| ... | @@ -279,9 +285,8 @@ function create_notification() { | ... | @@ -279,9 +285,8 @@ function create_notification() { |
| 279 | 285 | ||
| 280 | $validation->set_rules('system','System Message','trim|min_length[16]'); | 286 | $validation->set_rules('system','System Message','trim|min_length[16]'); |
| 281 | $validation->set_rules('sms','SMS Message','trim|min_length[16]'); | 287 | $validation->set_rules('sms','SMS Message','trim|min_length[16]'); |
| 282 | 288 | ||
| 283 | 289 | if ($_POST && ($_POST['subject']=="" && $_POST['sms']=="" && $_POST['system']=="")) { | |
| 284 | if ($_POST && (($_POST['subject']=="" || $_POST['text']) && $_POST['sms']=="" && $_POST['system']=="")) { | ||
| 285 | $form_error = true; | 290 | $form_error = true; |
| 286 | require_once(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'create.php'); | 291 | require_once(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'create.php'); |
| 287 | } else { | 292 | } else { | ... | ... |
| ... | @@ -16,14 +16,13 @@ const OPTION_NAME = "notif_options"; | ... | @@ -16,14 +16,13 @@ const OPTION_NAME = "notif_options"; |
| 16 | }); | 16 | }); |
| 17 | 17 | ||
| 18 | 18 | ||
| 19 | |||
| 19 | /** | 20 | /** |
| 20 | Send Notifications | 21 | Send Notifications |
| 21 | @trigger = notification unique slug name | 22 | @trigger = notification unique slug name |
| 22 | @user = user id (to get email and name) | ||
| 23 | @type = instant or cron | ||
| 24 | */ | 23 | */ |
| 25 | function send_notification($trigger="NO_TRIGGER",$user=0,$type="instant") { | 24 | function send_notification($trigger="NO_TRIGGER") { |
| 26 | 25 | // if the system notification has set current user than get current user otherwise loop through the users needed. | |
| 27 | } | 26 | } |
| 28 | 27 | ||
| 29 | 28 | ... | ... |
| ... | @@ -130,6 +130,17 @@ use Tz\WordPress\Tools; | ... | @@ -130,6 +130,17 @@ use Tz\WordPress\Tools; |
| 130 | </thead> | 130 | </thead> |
| 131 | <tbody style="<?php echo ($validation->set_value('system',$entry->system)=="") ? "display:none" : "";?>;"> | 131 | <tbody style="<?php echo ($validation->set_value('system',$entry->system)=="") ? "display:none" : "";?>;"> |
| 132 | <tr> | 132 | <tr> |
| 133 | <td>Message Type</td> | ||
| 134 | <td> | ||
| 135 | <select name="system_message_type"> | ||
| 136 | <option value="none" <?php echo ($validation->set_value('system_message_type',$entry->details['system_message_type'])=="none") ? 'selected="selected"' : "";?>>General Message</option> | ||
| 137 | <option value="action_required" <?php echo ($validation->set_value('system_message_type',$entry->details['system_message_type'])=="action_required") ? 'selected="selected"' : "";?>>Action Required</option> | ||
| 138 | <option value="eflash" <?php echo ($validation->set_value('system_message_type',$entry->details['system_message_type'])=="eflash") ? 'selected="selected"' : "";?>>E-Flash</option> | ||
| 139 | <option value="newevent" <?php echo ($validation->set_value('system_message_type',$entry->details['system_message_type'])=="newevent") ? 'selected="selected"' : "";?>>New Event</option> | ||
| 140 | </select> | ||
| 141 | </td> | ||
| 142 | </tr> | ||
| 143 | <tr> | ||
| 133 | <td>Message (Text/HTML)</td> | 144 | <td>Message (Text/HTML)</td> |
| 134 | <td><textarea name="system" class="wide-input-field" rows="4" style="width:100%;" ><?php echo $validation->set_value('system',$entry->system);?></textarea><?php echo $validation->form_error('system');?></td> | 145 | <td><textarea name="system" class="wide-input-field" rows="4" style="width:100%;" ><?php echo $validation->set_value('system',$entry->system);?></textarea><?php echo $validation->form_error('system');?></td> |
| 135 | </tr> | 146 | </tr> | ... | ... |
| ... | @@ -3,9 +3,6 @@ use Tz\WordPress\Tools\Notifications\Settings; | ... | @@ -3,9 +3,6 @@ use Tz\WordPress\Tools\Notifications\Settings; |
| 3 | use Tz\WordPress\Tools\Notifications; | 3 | use Tz\WordPress\Tools\Notifications; |
| 4 | use Tz\WordPress\Tools; | 4 | use Tz\WordPress\Tools; |
| 5 | 5 | ||
| 6 | |||
| 7 | register_settings | ||
| 8 | |||
| 9 | ?> | 6 | ?> |
| 10 | 7 | ||
| 11 | <link type="text/css" href="<?php echo Tools\url('assets/css/smoothness/jquery-ui-1.8.4.custom.css', __FILE__)?>" rel="stylesheet" /> | 8 | <link type="text/css" href="<?php echo Tools\url('assets/css/smoothness/jquery-ui-1.8.4.custom.css', __FILE__)?>" rel="stylesheet" /> |
| ... | @@ -41,10 +38,6 @@ register_settings | ... | @@ -41,10 +38,6 @@ register_settings |
| 41 | <td><input type="text" name="address" class="wide-input-field" /></td> | 38 | <td><input type="text" name="address" class="wide-input-field" /></td> |
| 42 | </tr> | 39 | </tr> |
| 43 | <tr> | 40 | <tr> |
| 44 | <td width="150">Apt/Unit/Suite:</td> | ||
| 45 | <td><input type="text" name="address2" class="wide-input-field" /></td> | ||
| 46 | </tr> | ||
| 47 | <tr> | ||
| 48 | <td width="150">City:</td> | 41 | <td width="150">City:</td> |
| 49 | <td><input type="text" name="city" class="wide-input-field" /></td> | 42 | <td><input type="text" name="city" class="wide-input-field" /></td> |
| 50 | </tr> | 43 | </tr> |
| ... | @@ -86,7 +79,7 @@ register_settings | ... | @@ -86,7 +79,7 @@ register_settings |
| 86 | </tr> | 79 | </tr> |
| 87 | <tr> | 80 | <tr> |
| 88 | <td width="150">OPT-OUT Message::</td> | 81 | <td width="150">OPT-OUT Message::</td> |
| 89 | <td><textarea name="opt_message" class="wide-input-field" rows="4" style="width:100%;color:#999" onkeydown="this.style.color = '#000000';" >If you do not wish to further receive emails from us, please opt-out by clicking here: http://cbv.wp.kb/no-emails-please.php?u={uid}.</textarea></td> | 82 | <td><textarea name="opt_message" class="wide-input-field" rows="4" style="width:100%;color:#999" onkeydown="this.style.color = '#000000';" >If you do not wish to further receive emails from us, you can change your notification settings in your profile.</textarea></td> |
| 90 | </tr> | 83 | </tr> |
| 91 | </body> | 84 | </body> |
| 92 | </table> | 85 | </table> | ... | ... |
-
Please register or sign in to post a comment