Пример #1
0
                        'button-class' => 'btn-success',
                        'level' => 'primary-label'),
                    array('title' => $langiCalExport,
                        'url' => "icalendar.php",
                        'icon' => 'fa-calendar',
                        'level' => 'primary'),
                ));

    if (isset($_GET['id'])) {
        require_once 'modules/agenda/course_calendar.inc.php';
        $id = intval($_GET['id']);
        if (isset($_GET['admin'])) {
            $personal_event = array('0' => Calendar_Events::get_admin_event($id));
            $tool_content .= event_list($personal_event, 'ASC', 'admin');
        } else {
            $personal_event = array('0' => Calendar_Events::get_event($id));
            $tool_content .= event_list($personal_event, 'ASC', 'personal');
        }
        
    } else {
        /* display events */
        $day = (isset($_GET['day'])) ? intval($_GET['day']) : null;
        $month = (isset($_GET['month'])) ? intval($_GET['month']) : null;
        $year = (isset($_GET['year'])) ? intval($_GET['year']) : null;
        $tool_content .= '<div id="calendar_wrapper" class="row">
                    <div class="col-md-12">
                        <div class="row calendar-header">
                        <div class="col-md-12">
                        <div id="calendar-header">
                            <div class="pull-right form-inline">
                                <div class="btn-group">
 /**
  * A function to generate event block in day calendar
  * @param object $event event to format
  * @param string $color event color
  * @return html formatted item
  */
 public static function day_calendar_item($event, $class)
 {
     global $urlServer, $is_admin, $langVisible, $dateFormatLong, $langDuration, $langAgendaNoTitle, $langModify, $langDelete, $langHour, $langConfirmDelete, $langReferencedObject;
     $formatted_calendar_item = "";
     $formatted_calendar_item .= "<tr {$class}>";
     $formatted_calendar_item .= "<td valign='top'><div class=\"legend_color\" style=\"float:left;margin:3px;height:16px;width:16px;background-color:" . Calendar_Events::$calsettings->{$event->event_group . "_color"} . "\"></div></td>";
     $formatted_calendar_item .= "<td valign='top'>";
     $eventdate = strtotime($event->start);
     $formatted_calendar_item .= $langHour . ": " . ucfirst(date('H:i', $eventdate));
     if ($event->duration != '') {
         $msg = "({$langDuration}: " . q($event->duration) . ")";
     } else {
         $msg = '';
     }
     $formatted_calendar_item .= "<br><b><div class='event'>";
     $link = str_replace('thisid', $event->id, $urlServer . Calendar_Events::$event_type_url[$event->event_type]);
     if ($event->event_type != 'personal' && $event->event_type != 'admin') {
         $link = str_replace('thiscourse', $event->course, $link);
     }
     if ($event->title == '') {
         $formatted_calendar_item .= $langAgendaNoTitle;
     } else {
         if (!$is_admin && $event->event_type == 'admin') {
             $formatted_calendar_item .= q($event->title);
         } else {
             $formatted_calendar_item .= "<a href=\"" . $link . "\">" . q($event->title) . "</a>";
         }
     }
     if ($event->event_type == "personal") {
         $fullevent = Calendar_Events::get_event($event->id);
         if ($reflink = References::item_link($fullevent->reference_obj_module, $fullevent->reference_obj_type, $fullevent->reference_obj_id, $fullevent->reference_obj_course)) {
             $formatted_calendar_item .= "</b> {$msg} " . standard_text_escape($event->content) . "{$langReferencedObject}: " . $reflink . "</div></td>";
         }
     } else {
         $formatted_calendar_item .= "</b> {$msg} " . standard_text_escape($event->content) . "</div></td>";
     }
     $formatted_calendar_item .= "<td class='right' width='70'>";
     if ($event->event_type == "personal" || $event->event_type == "admin" && $is_admin) {
         $formatted_calendar_item .= icon('fa-edit', $langModify, str_replace('thisid', $event->id, Calendar_Events::$event_type_url[$event->event_type])) . "&nbsp;\r\n                        " . icon('fa-times', $langDelete, "?delete={$event->id}&et={$event->event_type}", "onClick=\"return confirmation('{$langConfirmDelete}');\"") . "&nbsp;";
     }
     $formatted_calendar_item .= "</td>";
     $formatted_calendar_item .= "</tr>";
     return $formatted_calendar_item;
 }
Пример #3
0
 $displayForm = false;
 if (isset($_GET['admin']) && $_GET['admin'] == 1) {
     $event = Calendar_Events::get_admin_event($modify);
     if ($event) {
         $eventToModify = $event->id;
         $contentToModify = $event->content;
         $titleToModify = q($event->title);
         $startDate_obj = DateTime::createFromFormat('Y-m-d H:i:s', $event->start);
         $startdate = $startDate_obj->format('d-m-Y H:i');
         $datetimeToModify = q($startdate);
         $durationToModify = q($event->duration);
         $visibility_level = $event->visibility_level;
         $displayForm = true;
     }
 } else {
     $event = Calendar_Events::get_event($modify);
     if ($event) {
         $eventToModify = $event->id;
         $contentToModify = $event->content;
         $titleToModify = q($event->title);
         $startDate_obj = DateTime::createFromFormat('Y-m-d H:i:s', $event->start);
         $startdate = $startDate_obj->format('d-m-Y H:i');
         $datetimeToModify = q($startdate);
         $durationToModify = q($event->duration);
         $gen_type_selected = $event->reference_obj_module;
         $course_selected = $event->reference_obj_course;
         $type_selected = $event->reference_obj_type;
         $object_selected = $event->reference_obj_id;
         $displayForm = true;
     }
 }