$tpl->addGlobal('type_label', $type_label); $tpl->addGlobal('type_event_class', $type_event_class); // Current user can add event? $tpl->addGlobal('can_add_events', $can_add_events); //Setting AJAX caller if (!empty($userId)) { $agenda_ajax_url = api_get_path(WEB_AJAX_PATH) . 'agenda.ajax.php?user_id=' . $userId . '&type=' . $type; } else { $agenda_ajax_url = api_get_path(WEB_AJAX_PATH) . 'agenda.ajax.php?type=' . $type; } $tpl->addGlobal('web_agenda_ajax_url', $agenda_ajax_url); $course_code = api_get_course_id(); //This will fill the select called #users_to_send_id $form = new FormValidator('form', 'get', null, null, array('id' => 'add_event_form')); $form->addElement('html', '<div id="visible_to_input">'); $sendTo = $agenda->parseAgendaFilter($userId); $addOnlyItemsInSendTo = true; if ($sendTo['everyone']) { $addOnlyItemsInSendTo = false; } $agenda->showToForm($form, $sendTo, array(), $addOnlyItemsInSendTo); $form->addElement('html', '</div>'); $form->addElement('html', '<div id="visible_to_read_only" style="display: none">'); $form->addElement('label', get_lang('To'), '<div id="visible_to_read_only_users"></div>'); $form->addElement('html', '</div>'); $form->addElement('label', get_lang('Agenda'), '<div id="color_calendar"></div>'); $form->addElement('label', get_lang('Date'), '<span id="start_date"></span><span id="end_date"></span>'); $form->addElement('text', 'title', get_lang('Title'), array('id' => 'title')); $form->addElement('textarea', 'content', get_lang('Description'), array('id' => 'content')); if ($agenda->type == 'course') { $form->addElement('html', '<div id="add_as_announcement_div" style="display: none">');
$agenda->resizeEvent($id, $day_delta, $minute_delta); break; case 'move_event': if (!api_is_allowed_to_edit(null, true) && $type == 'course') { break; } $day_delta = $_REQUEST['day_delta']; $minute_delta = $_REQUEST['minute_delta']; $id = explode('_', $_REQUEST['id']); $id = $id[1]; $agenda->move_event($id, $day_delta, $minute_delta); break; case 'get_events': $filter = isset($_REQUEST['user_id']) ? $_REQUEST['user_id'] : null; $sessionId = isset($_REQUEST['session_id']) ? $_REQUEST['session_id'] : null; $result = $agenda->parseAgendaFilter($filter); $groupId = current($result['groups']); $userId = current($result['users']); $start = isset($_REQUEST['start']) ? api_strtotime($_REQUEST['start']) : null; $end = isset($_REQUEST['end']) ? api_strtotime($_REQUEST['end']) : null; if ($type == 'personal' && !empty($sessionId)) { $agenda->setSessionId($sessionId); } $events = $agenda->getEvents($start, $end, api_get_course_int_id(), $groupId, $userId); echo $events; break; case 'get_user_agenda': //Used in the admin user list api_protect_admin_script(); if (api_is_allowed_to_edit(null, true)) { //@todo move this in the agenda class