![]() |
|---|
| [ Index ] |
Source Code Reference for V1.00 |
[Summary view] [Print] [Text view]
1 <?php /* $Id: do_event_aed.php 137 2008-04-04 16:12:02Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/calendar/do_event_aed.php $ */ 2 if (!defined('W2P_BASE_DIR')) { 3 die('You should not access this file directly.'); 4 } 5 6 $obj = new CEvent(); 7 $msg = ''; 8 9 $del = w2PgetParam($_POST, 'del', 0); 10 11 $isNotNew = $_POST['event_id']; 12 $event_id = intval(w2PgetParam($_POST, 'event_id', 0)); 13 $perms = &$AppUI->acl(); 14 if ($del) { 15 if (!$perms->checkModuleItem('calendar', 'delete', $event_id)) { 16 $AppUI->redirect('m=public&a=access_denied'); 17 } 18 } elseif ($isNotNew) { 19 if (!$perms->checkModuleItem('calendar', 'edit', $event_id)) { 20 $AppUI->redirect('m=public&a=access_denied'); 21 } 22 } else { 23 if (!$perms->checkModule('calendar', 'add')) { 24 $AppUI->redirect('m=public&a=access_denied'); 25 } 26 } 27 28 // bind the POST parameter to the object record 29 if (!$obj->bind($_POST)) { 30 $AppUI->setMsg($obj->getError(), UI_MSG_ERROR); 31 $AppUI->redirect(); 32 } 33 // configure the date and times to insert into the db table 34 if ($obj->event_start_date) { 35 $start_date = new CDate($obj->event_start_date . $_POST['start_time']); 36 $obj->event_start_date = $start_date->format(FMT_DATETIME_MYSQL); 37 } 38 if ($obj->event_end_date) { 39 $end_date = new CDate($obj->event_end_date . $_POST['end_time']); 40 $obj->event_end_date = $end_date->format(FMT_DATETIME_MYSQL); 41 } 42 43 if (!$del && $start_date->compare($start_date, $end_date) >= 0) { 44 $AppUI->setMsg('Start-Date >= End-Date, please correct', UI_MSG_ERROR); 45 $AppUI->redirect(); 46 exit; 47 } 48 49 if (!$obj->event_recurs) { 50 $obj->event_times_recuring = 0; 51 } 52 53 // prepare (and translate) the module name ready for the suffix 54 $AppUI->setMsg('Event'); 55 $do_redirect = true; 56 require_once $AppUI->getSystemClass('CustomFields'); 57 58 if ($del) { 59 if (!$obj->canDelete($msg)) { 60 $AppUI->setMsg($msg, UI_MSG_ERROR); 61 $AppUI->redirect(); 62 } 63 if (($msg = $obj->delete())) { 64 $AppUI->setMsg($msg, UI_MSG_ERROR); 65 } else { 66 $AppUI->setMsg('deleted', UI_MSG_OK, true); 67 } 68 $AppUI->redirect('m=calendar'); 69 } else { 70 if (!$isNotNew) { 71 $obj->event_owner = $AppUI->user_id; 72 } 73 // Check for existence of clashes. 74 if ($_POST['event_assigned'] > '' && ($clash = $obj->checkClash($_POST['event_assigned']))) { 75 $last_a = $a; 76 $GLOBALS['a'] = "clash"; 77 $do_redirect = false; 78 } else { 79 if (($msg = $obj->store())) { 80 $AppUI->setMsg($msg, UI_MSG_ERROR); 81 } else { 82 $custom_fields = new CustomFields('calendar', 'addedit', $obj->event_id, 'edit'); 83 $custom_fields->bind($_POST); 84 $sql = $custom_fields->store($obj->event_id); // Store Custom Fields 85 86 $AppUI->setMsg($isNotNew ? 'updated' : 'added', UI_MSG_OK, true); 87 if (isset($_POST['event_assigned'])) 88 $obj->updateAssigned(explode(',', $_POST['event_assigned'])); 89 if (isset($_POST['mail_invited'])) { 90 $obj->notify($_POST['event_assigned'], $isNotNew); 91 } 92 } 93 } 94 } 95 if ($do_redirect) { 96 $AppUI->redirect(); 97 } 98 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Jan 7 03:00:01 2009 | Cross-referenced by PHPXref 0.7 |