Пример #1
0
<?php

/* For licensing terms, see /license.txt */
/**
 * @package chamilo.calendar
 */
require_once '../inc/global.inc.php';
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . "calendar/agenda_js.php", 'name' => get_lang('Agenda'));
$currentCourseId = api_get_course_int_id();
$agenda = new Agenda();
$type = isset($_REQUEST['type']) ? $_REQUEST['type'] : null;
$agenda->setType($type);
$events = $agenda->getEvents(null, null, $currentCourseId, api_get_group_id(), null, 'array');
$this_section = SECTION_MYAGENDA;
if (!empty($currentCourseId) && $currentCourseId != -1) {
    // Agenda is inside a course tool
    $url = api_get_self() . '?' . api_get_cidreq();
    $this_section = SECTION_COURSES;
} else {
    // Agenda is out of the course tool (e.g personal agenda)
    $url = false;
    foreach ($events as &$event) {
        $courseId = isset($event['course_id']) ? $event['course_id'] : '';
        $event['url'] = api_get_self() . '?cid=' . $courseId . '&type=' . $event['type'];
    }
}
$actions = $agenda->displayActions('list');
$tpl = new Template(get_lang('Events'));
$tpl->assign('agenda_events', $events);
$tpl->assign('url', $url);
$tpl->assign('actions', $actions);
Пример #2
0
<?php

/* For licensing terms, see /license.txt */
/**
 * @package chamilo.calendar
 */
require_once '../inc/global.inc.php';
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . "calendar/agenda_js.php", 'name' => get_lang('Agenda'));
$agenda = new Agenda();
$type = isset($_REQUEST['type']) ? $_REQUEST['type'] : null;
$agenda->setType($type);
$events = $agenda->getEvents(null, null, api_get_course_int_id(), api_get_group_id(), null, 'array');
$this_section = SECTION_MYAGENDA;
if (!empty($GLOBALS['_cid']) && $GLOBALS['_cid'] != -1) {
    // Agenda is inside a course tool
    $url = api_get_self() . '?' . api_get_cidreq();
    $this_section = SECTION_COURSES;
} else {
    // Agenda is out of the course tool (e.g personal agenda)
    $url = false;
    foreach ($events as &$event) {
        $courseId = isset($event['course_id']) ? $event['course_id'] : '';
        $event['url'] = api_get_self() . '?cid=' . $courseId . '&type=' . $event['type'];
    }
}
$tpl = new Template(get_lang('Events'));
$tpl->assign('agenda_events', $events);
$actions = $agenda->displayActions('list');
$tpl->assign('url', $url);
$tpl->assign('actions', $actions);
$tpl->assign('is_allowed_to_edit', api_is_allowed_to_edit());
Пример #3
0
     $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
         $DaysShort = api_get_week_days_short();
         $MonthsLong = api_get_months_long();
         $user_id = intval($_REQUEST['user_id']);
         $my_course_list = CourseManager::get_courses_list_by_user_id($user_id, true);
         if (!is_array($my_course_list)) {
             // this is for the special case if the user has no courses (otherwise you get an error)
             $my_course_list = array();
         }