updates to notifications admin
Showing
1 changed file
with
13 additions
and
24 deletions
| ... | @@ -39,15 +39,10 @@ function display_page() { | ... | @@ -39,15 +39,10 @@ function display_page() { |
| 39 | $details = get_post_meta($id,'details',true); | 39 | $details = get_post_meta($id,'details',true); |
| 40 | $email = get_post_meta($id,'email',true); | 40 | $email = get_post_meta($id,'email',true); |
| 41 | $system = get_post_meta($id,'system',true); | 41 | $system = get_post_meta($id,'system',true); |
| 42 | $sms = get_post_meta($id,'sms',true); | ||
| 43 | 42 | ||
| 44 | $entry->details = $details; | 43 | $entry->details = $details; |
| 45 | $entry->email = $email; | 44 | $entry->email = $email; |
| 46 | $entry->system = $system; | 45 | $entry->system = $system; |
| 47 | $entry->sms = $sms; | ||
| 48 | |||
| 49 | |||
| 50 | |||
| 51 | 46 | ||
| 52 | // here | 47 | // here |
| 53 | $validation = new Notifications\Validation; | 48 | $validation = new Notifications\Validation; |
| ... | @@ -69,7 +64,7 @@ function display_page() { | ... | @@ -69,7 +64,7 @@ function display_page() { |
| 69 | 64 | ||
| 70 | $validation->set_rules('system_message_type','System Message Type','trim'); | 65 | $validation->set_rules('system_message_type','System Message Type','trim'); |
| 71 | $validation->set_rules('system','System Message','trim|min_length[16]'); | 66 | $validation->set_rules('system','System Message','trim|min_length[16]'); |
| 72 | $validation->set_rules('sms','SMS Message','trim|min_length[16]'); | 67 | |
| 73 | 68 | ||
| 74 | //details | 69 | //details |
| 75 | if ($validation->run() == TRUE) { | 70 | if ($validation->run() == TRUE) { |
| ... | @@ -102,11 +97,11 @@ function display_page() { | ... | @@ -102,11 +97,11 @@ function display_page() { |
| 102 | $system_message_type = $_POST['system_message_type']; | 97 | $system_message_type = $_POST['system_message_type']; |
| 103 | $system = $_POST['system']; | 98 | $system = $_POST['system']; |
| 104 | 99 | ||
| 105 | // SMS | 100 | |
| 106 | $sms =""; | ||
| 107 | 101 | ||
| 108 | update_post_meta($id, 'notif_type', $type); | 102 | update_post_meta($id, 'notif_type', $type); |
| 109 | update_post_meta($id, 'execute_date', mysqldatetime_to_timestamp($execute_date)); | 103 | update_post_meta($id, 'execute_date', mysqldatetime_to_timestamp($execute_date)); |
| 104 | update_post_meta($id, 'trigger', $trigger); | ||
| 110 | 105 | ||
| 111 | update_post_meta($id, "details", array( | 106 | update_post_meta($id, "details", array( |
| 112 | 'type' => $type | 107 | 'type' => $type |
| ... | @@ -132,9 +127,7 @@ function display_page() { | ... | @@ -132,9 +127,7 @@ function display_page() { |
| 132 | 'system_message_type' => $system_message_type | 127 | 'system_message_type' => $system_message_type |
| 133 | , 'message' => $system | 128 | , 'message' => $system |
| 134 | )); | 129 | )); |
| 135 | update_post_meta($id, "sms", array( | 130 | |
| 136 | 'message' => $sms | ||
| 137 | )); | ||
| 138 | 131 | ||
| 139 | $update = array(); | 132 | $update = array(); |
| 140 | $update['ID'] = $id; | 133 | $update['ID'] = $id; |
| ... | @@ -146,12 +139,12 @@ function display_page() { | ... | @@ -146,12 +139,12 @@ function display_page() { |
| 146 | $details = get_post_meta($id,'details',true); | 139 | $details = get_post_meta($id,'details',true); |
| 147 | $email = get_post_meta($id,'email',true); | 140 | $email = get_post_meta($id,'email',true); |
| 148 | $system = get_post_meta($id,'system',true); | 141 | $system = get_post_meta($id,'system',true); |
| 149 | $sms = get_post_meta($id,'sms',true); | 142 | |
| 150 | 143 | ||
| 151 | $entry->details = $details; | 144 | $entry->details = $details; |
| 152 | $entry->email = $email; | 145 | $entry->email = $email; |
| 153 | $entry->system = $system; | 146 | $entry->system = $system; |
| 154 | $entry->sms = $sms; | 147 | |
| 155 | 148 | ||
| 156 | 149 | ||
| 157 | $flash = "<strong>Notification Saved Successfully!</strong><br /><a href='/wp-admin/admin.php?page=notifications'>Click here</a> to view all notifications.</a>"; | 150 | $flash = "<strong>Notification Saved Successfully!</strong><br /><a href='/wp-admin/admin.php?page=notifications'>Click here</a> to view all notifications.</a>"; |
| ... | @@ -204,7 +197,7 @@ function display_page() { | ... | @@ -204,7 +197,7 @@ function display_page() { |
| 204 | $details = get_post_meta($id,'details',true); | 197 | $details = get_post_meta($id,'details',true); |
| 205 | $email = get_post_meta($id,'email',true); | 198 | $email = get_post_meta($id,'email',true); |
| 206 | $system = get_post_meta($id,'system',true); | 199 | $system = get_post_meta($id,'system',true); |
| 207 | $sms = get_post_meta($id,'sms',true); | 200 | |
| 208 | 201 | ||
| 209 | $entry->trigger = $details['trigger']; | 202 | $entry->trigger = $details['trigger']; |
| 210 | $entry->status = isset($details['status']) ? $details['status'] : "active"; | 203 | $entry->status = isset($details['status']) ? $details['status'] : "active"; |
| ... | @@ -213,7 +206,7 @@ function display_page() { | ... | @@ -213,7 +206,7 @@ function display_page() { |
| 213 | 206 | ||
| 214 | $entry->is_email = (($email['text'] != "" || $email['html'] != "")) ? true : false; | 207 | $entry->is_email = (($email['text'] != "" || $email['html'] != "")) ? true : false; |
| 215 | $entry->is_system = (isset($system['message']) && $system['message'] != "") ? true : false; | 208 | $entry->is_system = (isset($system['message']) && $system['message'] != "") ? true : false; |
| 216 | $entry->is_sms = (isset($sms['message']) && $sms['message'] != "") ? true : false; | 209 | |
| 217 | 210 | ||
| 218 | $entry->execute_date = $details['execute_date']; | 211 | $entry->execute_date = $details['execute_date']; |
| 219 | 212 | ||
| ... | @@ -309,9 +302,9 @@ function create_notification() { | ... | @@ -309,9 +302,9 @@ function create_notification() { |
| 309 | $validation->set_rules('html','HTML Version','trim|min_length[16]'); | 302 | $validation->set_rules('html','HTML Version','trim|min_length[16]'); |
| 310 | 303 | ||
| 311 | $validation->set_rules('system','System Message','trim|min_length[16]'); | 304 | $validation->set_rules('system','System Message','trim|min_length[16]'); |
| 312 | $validation->set_rules('sms','SMS Message','trim|min_length[16]'); | 305 | |
| 313 | 306 | ||
| 314 | if ($_POST && ($_POST['subject']=="" && $_POST['sms']=="" && $_POST['system']=="")) { | 307 | if ($_POST && ($_POST['subject']=="" && $_POST['system']=="")) { |
| 315 | $form_error = true; | 308 | $form_error = true; |
| 316 | require_once(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'create.php'); | 309 | require_once(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'create.php'); |
| 317 | } else { | 310 | } else { |
| ... | @@ -352,8 +345,7 @@ function create_notification() { | ... | @@ -352,8 +345,7 @@ function create_notification() { |
| 352 | $system_message_type = $_POST['system_message_type']; | 345 | $system_message_type = $_POST['system_message_type']; |
| 353 | $system = $_POST['system']; | 346 | $system = $_POST['system']; |
| 354 | 347 | ||
| 355 | // SMS | 348 | |
| 356 | $sms = $_POST['sms']; | ||
| 357 | 349 | ||
| 358 | 350 | ||
| 359 | // make post... | 351 | // make post... |
| ... | @@ -367,6 +359,7 @@ function create_notification() { | ... | @@ -367,6 +359,7 @@ function create_notification() { |
| 367 | 359 | ||
| 368 | update_post_meta($id, 'notif_type', $type); | 360 | update_post_meta($id, 'notif_type', $type); |
| 369 | update_post_meta($id, 'execute_date', mysqldatetime_to_timestamp($execute_date)); | 361 | update_post_meta($id, 'execute_date', mysqldatetime_to_timestamp($execute_date)); |
| 362 | update_post_meta($id, 'trigger', $trigger); | ||
| 370 | 363 | ||
| 371 | add_post_meta($id, "details", array( | 364 | add_post_meta($id, "details", array( |
| 372 | 'type' => $type | 365 | 'type' => $type |
| ... | @@ -387,11 +380,7 @@ function create_notification() { | ... | @@ -387,11 +380,7 @@ function create_notification() { |
| 387 | update_post_meta($id, "system", array( | 380 | update_post_meta($id, "system", array( |
| 388 | 'system_message_type' => $system_message_type | 381 | 'system_message_type' => $system_message_type |
| 389 | , 'message' => $system | 382 | , 'message' => $system |
| 390 | )); | 383 | )); |
| 391 | update_post_meta($id, "sms", array( | ||
| 392 | 'message' => $sms | ||
| 393 | )); | ||
| 394 | |||
| 395 | 384 | ||
| 396 | $flash = "<strong>Notification Saved Successfully!</strong><br /><a href='/wp-admin/admin.php?page=notifications'>Click here</a> to view all notifications.</a>"; | 385 | $flash = "<strong>Notification Saved Successfully!</strong><br /><a href='/wp-admin/admin.php?page=notifications'>Click here</a> to view all notifications.</a>"; |
| 397 | require_once(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'create.php'); | 386 | require_once(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'create.php'); | ... | ... |
-
Please register or sign in to post a comment