function fullcalendar_update in FullCalendar 6
Same name and namespace in other branches
- 6.2 fullcalendar.module \fullcalendar_update()
- 7.2 fullcalendar.module \fullcalendar_update()
- 7 fullcalendar.module \fullcalendar_update()
Saves the updated fullcalendar event's datetime.
Parameters
$action: Value can be 'drop' or 'resize'.
$node: The node that will be updated.
1 string reference to 'fullcalendar_update'
- fullcalendar_menu in ./
fullcalendar.module - Implementation of hook_menu().
File
- ./
fullcalendar.module, line 114 - Provides a views style plugin for FullCalendar
Code
function fullcalendar_update($action, $node) {
// Retrieve the post vars form the ajax call.
$field = $_POST['field'];
$index = $_POST['index'];
$all_day = isset($_POST['all_day']) ? $_POST['all_day'] : '';
$day_delta = $_POST['day_delta'];
$minute_delta = $_POST['minute_delta'];
if (!empty($field) && isset($index)) {
$old_start = $node->{$field}[$index]['value'];
$old_end = $node->{$field}[$index]['value2'];
switch ($action) {
case 'drop':
$node->{$field}[$index]['value'] = date('Y-m-d H:i:s', strtotime($old_start . ' ' . $day_delta . ' days ' . $minute_delta . ' minutes'));
$node->{$field}[$index]['value2'] = date('Y-m-d H:i:s', strtotime($old_end . ' ' . $day_delta . ' days ' . $minute_delta . ' minutes'));
break;
case 'resize':
$node->{$field}[$index]['value2'] = date('Y-m-d H:i:s', strtotime($old_end . ' ' . $day_delta . ' days ' . $minute_delta . ' minutes'));
break;
}
// Save the new start/end values.
node_save($node);
drupal_json(array(
'msg' => 'The new event time has been saved. [<a href="javascript:void(0);" class="fullcalendar-status-close">close</a>]',
));
}
}