本文整理汇总了PHP中Events::updateEvent方法的典型用法代码示例。如果您正苦于以下问题:PHP Events::updateEvent方法的具体用法?PHP Events::updateEvent怎么用?PHP Events::updateEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Events
的用法示例。
在下文中一共展示了Events::updateEvent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateEvent
function updateEvent()
{
global $error;
$arr_submit = array(array('color', 'string', false, ''), array('date_end', 'int', true, ''), array('date_start', 'int', true, ''), array('str_date_end', 'string', false, ''), array('str_date_start', 'string', false, ''), array('title', 'string', false, ''), array('location', 'string', false, ''), array('description', 'string', false, ''), array('phone', 'phone', false, ''), array('myurl', 'string', false, ''), array('cal_type', 'textonly', false, ''), array('allDay', 'bool', false, ''), array('repair_pattern', 'bool', false, ''), array('event_id', 'int', true, ''), array('rep_event_id', 'int', false, ''), array('cal_id', 'int', false, ''), array('calendar_id', 'int', false, -1), array('interval', 'string', false, ''), array('weekdays', 'string', false, ''), array('monthday', 'textonly', false, ''), array('yearmonthday', 'int', false, ''), array('yearmonth', 'int', false, ''));
$frm_submitted = validate_var($arr_submit);
if (empty($error)) {
$frm_submitted['title'] = stripslashes($frm_submitted['title']);
$frm_submitted['location'] = stripslashes($frm_submitted['location']);
$frm_submitted['description'] = stripslashes($frm_submitted['description']);
if (!empty($frm_submitted['time_end'])) {
$frm_submitted['date_end'] = strtotime(date('Y-m-d', $frm_submitted['date_end']) . ' ' . $frm_submitted['time_end']);
} else {
if (!IGNORE_TIMEZONE) {
$frm_submitted['date_end'] -= TIME_OFFSET;
}
}
if (!empty($frm_submitted['time_start'])) {
$frm_submitted['date_start'] = strtotime(date('Y-m-d', $frm_submitted['date_start']) . ' ' . $frm_submitted['time_start']);
} else {
if (!IGNORE_TIMEZONE) {
$frm_submitted['date_start'] -= TIME_OFFSET;
}
}
// check if repeating event
// existing repeating event
if ($frm_submitted['date_start'] !== $frm_submitted['date_end'] && isset($frm_submitted['interval']) && ($frm_submitted['interval'] == 'W' || $frm_submitted['interval'] == '2W' || $frm_submitted['interval'] == 'M' || $frm_submitted['interval'] == 'Y')) {
if ($frm_submitted['rep_event_id'] > 0) {
$arr_days = Utils::getDaysInPattern($frm_submitted);
$arr_event = Events::updateRepeatingEvent($arr_days, $frm_submitted);
echo json_encode(array('success' => true));
exit;
} else {
// normal event changed to repeating pattern
$arr_days = Utils::getDaysInPattern($frm_submitted);
$arr_event = Events::insertRepeatingEvent($arr_days, $frm_submitted);
if ($frm_submitted['event_id'] > 0) {
// delete old normal event
$bln_deleted = Events::deleteEvent(array('event_id' => $frm_submitted['event_id'], 'rep_event_id' => 0));
}
echo json_encode(array('success' => true));
exit;
}
} else {
if ($frm_submitted['rep_event_id'] > 0) {
// this event changed from repeating event to an normal day event
$bln_deleted = Events::deleteEvent(array('event_id' => $frm_submitted['event_id'], 'rep_event_id' => $frm_submitted['rep_event_id'], 'delete_all' => true));
// // delete repeating_event
// Events::deleteRepeatingEvent($frm_submitted['rep_event_id']);
//
// // delete events with this rep_event_id
//
//
// insert new daily event
$frm_submitted['repeating_event_id'] = 0;
$frm_submitted['rep_event_id'] = 0;
$arr_event = Events::insertEvent($frm_submitted);
$arr_event['remove_old_event'] = true;
echo json_encode(array('success' => true, 'event' => $arr_event));
exit;
//
// //Events::setEventToNotRepeating($frm_submitted['rep_event_id']);
} else {
$arr_event = Events::updateEvent($frm_submitted);
echo json_encode(array('success' => true, 'event' => $arr_event));
exit;
}
}
//
// if($frm_submitted['interval'] == 'W') {
// // weekday
//
// $arr_days = Utils::getDaysInPattern($frm_submitted);
// $arr_event = Events::updateRepeatingEvent($arr_days, $frm_submitted);
//
// echo json_encode(array('success'=>true));exit;
// }
// else {
// $arr_days = Utils::getDaysInPattern($frm_submitted);
// $arr_event = Events::insertRepeatingEvent($arr_days, $frm_submitted);
// //$arr_event = Events::updateEvent($frm_submitted);
// echo json_encode(array('success'=>true, 'event'=>$arr_event ));exit;
// }
} else {
echo json_encode(array('success' => false, 'error' => $error));
exit;
}
echo json_encode(array('success' => false));
exit;
}
示例2: updateEvent
function updateEvent()
{
global $error;
$arr_submit = array(array('date_end', 'int', false, ''), array('date_start', 'int', false, ''), array('title', 'string', false, ''), array('video_url', 'string', false, ''), array('category', 'string', false, ''), array('genre', 'string', false, ''), array('instructor_link', 'string', false, ''), array('spots', 'string', false, ''), array('size', 'string', false, ''), array('img_url', 'string', false, ''), array('class_time', 'string', false, ''), array('rank', 'string', false, ''), array('instructor', 'string', false, ''), array('description', 'string', false, ''), array('interval', 'string', false, ''), array('weekdays', 'string', false, ''));
$frm_submitted = validate_var($arr_submit);
//print_r($frm_submitted);
if (empty($error)) {
if (!empty($frm_submitted['time_end'])) {
$frm_submitted['date_end'] = strtotime(date('Y-m-d', $frm_submitted['date_end']) . ' ' . $frm_submitted['time_end']);
} else {
$frm_submitted['date_end'] -= TIME_OFFSET;
}
if (!empty($frm_submitted['time_start'])) {
$frm_submitted['date_start'] = strtotime(date('Y-m-d', $frm_submitted['date_start']) . ' ' . $frm_submitted['time_start']);
} else {
$frm_submitted['date_start'] -= TIME_OFFSET;
}
// check if repeating event
// existing repeating event
if ($frm_submitted['date_start'] !== $frm_submitted['date_end'] && isset($frm_submitted['interval']) && ($frm_submitted['interval'] == 'W' || $frm_submitted['interval'] == '2W' || $frm_submitted['interval'] == 'M' || $frm_submitted['interval'] == 'Y')) {
if ($frm_submitted['rep_event_id'] > 0) {
$arr_days = Utils::getDaysInPattern($frm_submitted);
return $arr_days;
exit;
$arr_event = Events::updateRepeatingEvent($arr_days, $frm_submitted);
echo json_encode(array('success' => true));
exit;
} else {
// normal event changed to repeating pattern
$arr_days = Utils::getDaysInPattern($frm_submitted);
$arr_event = Events::insertRepeatingEvent($arr_days, $frm_submitted);
if ($frm_submitted['event_id'] > 0) {
// delete old normal event
$bln_deleted = Events::deleteEvent(array('event_id' => $frm_submitted['event_id'], 'rep_event_id' => 0));
}
echo json_encode(array('success' => true));
exit;
}
} else {
if ($frm_submitted['rep_event_id'] > 0) {
// this event changed from repeating event to an normal day event
$bln_deleted = Events::deleteEvent(array('event_id' => $frm_submitted['event_id'], 'rep_event_id' => $frm_submitted['rep_event_id'], 'delete_all' => true));
// // delete repeating_event
// Events::deleteRepeatingEvent($frm_submitted['rep_event_id']);
//
// // delete events with this rep_event_id
//
//
// insert new daily event
$frm_submitted['repeating_event_id'] = 0;
$frm_submitted['rep_event_id'] = 0;
$arr_event = Events::insertEvent($frm_submitted);
$arr_event['remove_old_event'] = true;
echo json_encode(array('success' => true, 'event' => $arr_event));
exit;
//
// //Events::setEventToNotRepeating($frm_submitted['rep_event_id']);
} else {
$arr_event = Events::updateEvent($frm_submitted);
echo json_encode(array('success' => true, 'event' => $arr_event));
exit;
}
}
//
// if($frm_submitted['interval'] == 'W') {
// // weekday
//
// $arr_days = Utils::getDaysInPattern($frm_submitted);
// $arr_event = Events::updateRepeatingEvent($arr_days, $frm_submitted);
//
// echo json_encode(array('success'=>true));exit;
// }
// else {
// $arr_days = Utils::getDaysInPattern($frm_submitted);
// $arr_event = Events::insertRepeatingEvent($arr_days, $frm_submitted);
// //$arr_event = Events::updateEvent($frm_submitted);
// echo json_encode(array('success'=>true, 'event'=>$arr_event ));exit;
// }
} else {
echo json_encode(array('success' => false, 'error' => $error));
exit;
}
echo json_encode(array('success' => false));
exit;
}
示例3: elseif
$l10n->localizeArray($event, 'name');
$l10n->localizeArray($event, 'location');
$viewFile = 'views/events.php';
} elseif ($_GET['page'] === "create-event") {
$eventID = $model->saveEvent(array_splice($_POST, 1, 12));
$loggers['audit']->info("Event created");
foreach ($_POST as $key => $value) {
$service = explode('_', $key);
if ($value !== '' && intval($value) !== 0 && $service[0] === 'service') {
$model->saveEventService($eventID, $service[1], $value, $_POST['service-price_' . $service[1]]);
$loggers['audit']->info("Service {$service[1]} added to event {$eventID}");
}
}
echo $eventID;
} elseif ($_GET['page'] === "update-event") {
$model->updateEvent(array_splice($_POST, 1, 12), $_POST['id']);
$loggers['audit']->info("Event {$_POST['id']} updated");
foreach ($_POST as $key => $value) {
$service = explode('_', $key);
if ($value !== '' && $service[0] === 'service') {
$data = array('event_id' => $_POST['id'], 'service_id' => $service[1], 'capacity' => $value, 'price' => $_POST['service-price_' . $service[1]]);
if (isset($_POST['event_service_registration_for_' . $service[1]])) {
$model->updateEventService($data, $_POST['event_service_registration_for_' . $service[1]]);
$loggers['audit']->info("Service {$data['service_id']} updated for event {$_POST['id']}");
} else {
$model->saveEventService($_POST['id'], $service[1], $value, $_POST['service-price_' . $service[1]]);
$loggers['audit']->info("Service {$service[1]} added to event {$_POST['id']}");
}
}
}
echo $_POST['id'];
示例4: Events
$event_id = $_POST['event_id'];
$update = new Events();
if ($update->rescheduleEvent($event_id, $action, $_POST['value'])) {
echo $_POST['value'];
} else {
echo 'There was an error, please refresh the page.';
}
break;
case 'archive':
// ------------------------------------------------------------ //
// Archive Event
// ------------------------------------------------------------ //
$action = $_POST['event_action'];
$event_id = $_POST['event_id'];
$update = new Events();
if ($update->updateEvent($event_id, $action, $_POST['value'])) {
//echo 'Updated: '.$_POST['event_id'];
} else {
echo 'There was an error, please refresh the page.';
}
break;
default:
echo 'Not Detected!';
print_r($_POST['event_action']);
exit;
break;
}
//echo 'Updating Event Description for '.$event_id;
}
include ROOT . 'inc/connection.php';
// APPROVE SUBMISSION