919ef20b by Insu Mun

Add language selection for new notification page.

1 parent 7cc54a60
...@@ -132,7 +132,8 @@ function display_page() ...@@ -132,7 +132,8 @@ function display_page()
132 ); 132 );
133 update_post_meta($id, 'send_status', $entry->details['status']); 133 update_post_meta($id, 'send_status', $entry->details['status']);
134 update_post_meta($id, 'notif_type', $type); 134 update_post_meta($id, 'notif_type', $type);
135 update_post_meta($id, 'execute_date', mysqldatetime_to_timestamp($executeDate)); 135 // update_post_meta($id, 'execute_date', mysqldatetime_to_timestamp($executeDate));
136 update_post_meta($id, 'execute_date', strtotime($executeDate));
136 update_post_meta($id, 'trigger', $trigger); 137 update_post_meta($id, 'trigger', $trigger);
137 138
138 update_post_meta($id, 'email', $emailData); 139 update_post_meta($id, 'email', $emailData);
...@@ -288,15 +289,17 @@ function create_notification() ...@@ -288,15 +289,17 @@ function create_notification()
288 289
289 foreach (['en', 'fr'] as $lang) { 290 foreach (['en', 'fr'] as $lang) {
290 $validation->set_rules($lang.'_subject', 'Subject', 'trim'); 291 $validation->set_rules($lang.'_subject', 'Subject', 'trim');
291 $validation->set_rules($lang.'_text', 'Text Version', 'trim|min_length[16]'); 292 // $validation->set_rules($lang.'_text', 'Text Version', 'trim|min_length[16]');
292 $validation->set_rules($lang.'_html', 'HTML Version', 'trim|min_length[16]'); 293 // $validation->set_rules($lang.'_html', 'HTML Version', 'trim|min_length[16]');
294 $validation->set_rules($lang.'_text', 'Text Version', 'trim');
295 $validation->set_rules($lang.'_html', 'HTML Version', 'trim');
293 $validation->set_rules($lang.'_system', 'System Message', 'trim|min_length[16]'); 296 $validation->set_rules($lang.'_system', 'System Message', 'trim|min_length[16]');
294 } 297 }
295 298
296 if ($_POST && ($_POST['subject'] == '' && $_POST['system'] == '')) { 299 // if ($_POST && ($_POST['subject'] == '' && $_POST['system'] == '')) {
297 $form_error = true; 300 // $form_error = true;
298 require_once(__DIR__.'/views/create.php'); 301 // require_once(__DIR__.'/views/create.php');
299 } else { 302 // } else {
300 if ($validation->run() == true) { 303 if ($validation->run() == true) {
301 304
302 // Clean up the data before saving 305 // Clean up the data before saving
...@@ -385,7 +388,9 @@ function create_notification() ...@@ -385,7 +388,9 @@ function create_notification()
385 ); 388 );
386 update_post_meta($id, 'send_status', 'pending'); 389 update_post_meta($id, 'send_status', 'pending');
387 update_post_meta($id, 'notif_type', $type); 390 update_post_meta($id, 'notif_type', $type);
388 update_post_meta($id, 'execute_date', mysqldatetime_to_timestamp($executeDate)); 391 // update_post_meta($id, 'execute_date', mysqldatetime_to_timestamp($executeDate));
392 update_post_meta($id, 'execute_date', strtotime($executeDate));
393
389 update_post_meta($id, 'trigger', $trigger); 394 update_post_meta($id, 'trigger', $trigger);
390 395
391 update_post_meta($id, 'email', $emailData); 396 update_post_meta($id, 'email', $emailData);
...@@ -396,5 +401,5 @@ function create_notification() ...@@ -396,5 +401,5 @@ function create_notification()
396 } else { 401 } else {
397 require_once(__DIR__.DIRECTORY_SEPARATOR.'views'.DIRECTORY_SEPARATOR.'create.php'); 402 require_once(__DIR__.DIRECTORY_SEPARATOR.'views'.DIRECTORY_SEPARATOR.'create.php');
398 } 403 }
399 } 404 // }
400 } 405 }
......
...@@ -309,7 +309,6 @@ class Validation ...@@ -309,7 +309,6 @@ class Validation
309 309
310 // Did we end up with any errors? 310 // Did we end up with any errors?
311 $total_errors = count($this->_error_array); 311 $total_errors = count($this->_error_array);
312
313 if ($total_errors > 0) { 312 if ($total_errors > 0) {
314 $this->_safe_form_data = true; 313 $this->_safe_form_data = true;
315 } 314 }
......