$wd = getcwd(); global $ilLog; include_once 'Services/Calendar/classes/class.ilCalendarAppointmentColors.php'; // Create missing crs calendars $query = "SELECT obd.obj_id,obd.title,obd.type FROM object_data AS obd " . "LEFT JOIN cal_categories AS cc on obd.obj_id = cc.obj_id AND cc.type = 2 " . "WHERE cc.obj_id IS NULL and obd.type = 'crs' "; $res = $ilDB->query($query); while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $color = ilCalendarAppointmentColors::_getRandomColorByType('crs'); $query = "INSERT INTO cal_categories SET " . "obj_id = " . $ilDB->quote($row->obj_id) . ", " . "title = " . $ilDB->quote($row->title) . ", " . "color = '" . $color . "', " . "type = 2"; $ilDB->query($query); } // Create missing grp calendars $query = "SELECT obd.obj_id,obd.title,obd.type FROM object_data AS obd " . "LEFT JOIN cal_categories AS cc on obd.obj_id = cc.obj_id AND cc.type = 2 " . "WHERE cc.obj_id IS NULL and obd.type = 'grp' "; $res = $ilDB->query($query); while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $color = ilCalendarAppointmentColors::_getRandomColorByType('grp'); $query = "INSERT INTO cal_categories SET " . "obj_id = " . $ilDB->quote($row->obj_id) . ", " . "title = " . $ilDB->quote($row->title) . ", " . "color = '" . $color . "', " . "type = 2"; $ilDB->query($query); } ?> <#1257> ALTER TABLE il_wiki_data ADD COLUMN introduction TEXT; <#1258> ALTER TABLE mail_saved CHANGE rcp_to rcp_to TEXT NULL DEFAULT NULL , CHANGE rcp_cc rcp_cc TEXT NULL DEFAULT NULL , CHANGE rcp_bcc rcp_bcc TEXT NULL DEFAULT NULL , CHANGE m_type m_type VARCHAR(255) NULL DEFAULT NULL; <#1259> <?php
/** * Create a category for a new object (crs,grp, ...) * * @access public * @param object ilias object ('crs','grp',...) * @static */ public static function createCategory($a_obj) { global $lng; include_once './Services/Calendar/classes/class.ilCalendarCategory.php'; include_once './Services/Calendar/classes/class.ilCalendarAppointmentColors.php'; $cat = new ilCalendarCategory(); $cat->setTitle($a_obj->getTitle() ? $a_obj->getTitle() : $lng->txt('obj_' . $a_obj->getType())); $cat->setType(ilCalendarCategory::TYPE_OBJ); $cat->setColor(ilCalendarAppointmentColors::_getRandomColorByType($a_obj->getType())); $cat->setObjId($a_obj->getId()); return $cat->add(); }
protected function renderSlots(ilBookingSchedule $schedule, array $object_ids, $title) { global $ilUser; // fix if (!$schedule->getRaster()) { $mytpl = new ilTemplate('tpl.booking_reservation_fix.html', true, true, 'Modules/BookingManager'); $mytpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this)); $mytpl->setVariable('TXT_TITLE', $this->lng->txt('book_reservation_title')); $mytpl->setVariable('TXT_INFO', $this->lng->txt('book_reservation_fix_info')); $mytpl->setVariable('TXT_OBJECT', $title); $mytpl->setVariable('TXT_CMD_BOOK', $this->lng->txt('book_confirm_booking')); $mytpl->setVariable('TXT_CMD_CANCEL', $this->lng->txt('cancel')); include_once 'Services/Calendar/classes/class.ilCalendarUserSettings.php'; $user_settings = ilCalendarUserSettings::_getInstanceByUserId($ilUser->getId()); $morning_aggr = $user_settings->getDayStart(); $evening_aggr = $user_settings->getDayEnd(); $hours = array(); for ($i = $morning_aggr; $i <= $evening_aggr; $i++) { switch ($user_settings->getTimeFormat()) { case ilCalendarSettings::TIME_FORMAT_24: if ($morning_aggr > 0 && $i == $morning_aggr) { $hours[$i] = sprintf('%02d:00', 0) . "-"; } $hours[$i] .= sprintf('%02d:00', $i); if ($evening_aggr < 23 && $i == $evening_aggr) { $hours[$i] .= "-" . sprintf('%02d:00', 23); } break; case ilCalendarSettings::TIME_FORMAT_12: if ($morning_aggr > 0 && $i == $morning_aggr) { $hours[$i] = date('h a', mktime(0, 0, 0, 1, 1, 2000)) . "-"; } $hours[$i] .= date('h a', mktime($i, 0, 0, 1, 1, 2000)); if ($evening_aggr < 23 && $i == $evening_aggr) { $hours[$i] .= "-" . date('h a', mktime(23, 0, 0, 1, 1, 2000)); } break; } } if (isset($_GET['seed'])) { $find_first_open = false; $seed = new ilDate($_GET['seed'], IL_CAL_DATE); } else { $find_first_open = true; $seed = new ilDate(time(), IL_CAL_UNIX); } include_once 'Services/Calendar/classes/class.ilCalendarUtil.php'; include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php'; $week_start = $user_settings->getWeekStart(); if (!$find_first_open) { $dates = array(); $this->buildDatesBySchedule($week_start, $hours, $schedule, $object_ids, $seed, $dates); } else { $dates = array(); $has_open_slot = $this->buildDatesBySchedule($week_start, $hours, $schedule, $object_ids, $seed, $dates); // find first open slot if (!$has_open_slot) { // 1 year is limit for search $limit = clone $seed; $limit->increment(ilDate::YEAR, 1); $limit = $limit->get(IL_CAL_UNIX); while (!$has_open_slot && $seed->get(IL_CAL_UNIX) < $limit) { $seed->increment(ilDate::WEEK, 1); $dates = array(); $has_open_slot = $this->buildDatesBySchedule($week_start, $hours, $schedule, $object_ids, $seed, $dates); } } } include_once 'Services/Calendar/classes/class.ilCalendarHeaderNavigationGUI.php'; $navigation = new ilCalendarHeaderNavigationGUI($this, $seed, ilDateTime::WEEK, 'book'); $mytpl->setVariable('NAVIGATION', $navigation->getHTML()); foreach (ilCalendarUtil::_buildWeekDayList($seed, $week_start)->get() as $date) { $date_info = $date->get(IL_CAL_FKT_GETDATE, '', 'UTC'); $mytpl->setCurrentBlock('weekdays'); $mytpl->setVariable('TXT_WEEKDAY', ilCalendarUtil::_numericDayToString($date_info['wday'])); $mytpl->setVariable('TXT_DATE', $date_info['mday'] . ' ' . ilCalendarUtil::_numericMonthToString($date_info['mon'])); $mytpl->parseCurrentBlock(); } include_once 'Services/Calendar/classes/class.ilCalendarAppointmentColors.php'; include_once 'Services/Calendar/classes/class.ilCalendarUtil.php'; $color = array(); $all = ilCalendarAppointmentColors::_getColorsByType('crs'); for ($loop = 0; $loop < 7; $loop++) { $col = $all[$loop]; $fnt = ilCalendarUtil::calculateFontColor($col); $color[$loop + 1] = 'border-bottom: 1px solid ' . $col . '; background-color: ' . $col . '; color: ' . $fnt; } $counter = 0; foreach ($dates as $hour => $days) { $caption = $days; $caption = array_shift($caption); for ($loop = 1; $loop < 8; $loop++) { if (!isset($days[$loop])) { $mytpl->setCurrentBlock('dates'); $mytpl->setVariable('DUMMY', ' '); $mytpl->parseCurrentBlock(); } else { if (isset($days[$loop]['captions'])) { foreach ($days[$loop]['captions'] as $slot_id => $slot_caption) { $mytpl->setCurrentBlock('choice'); $mytpl->setVariable('TXT_DATE', $slot_caption); $mytpl->setVariable('VALUE_DATE', $slot_id); $mytpl->setVariable('DATE_COLOR', $color[$loop]); $mytpl->parseCurrentBlock(); } $mytpl->setCurrentBlock('dates'); $mytpl->setVariable('DUMMY', ''); $mytpl->parseCurrentBlock(); } else { if (isset($days[$loop]['in_slot'])) { $mytpl->setCurrentBlock('dates'); $mytpl->setVariable('DATE_COLOR', $color[$loop]); $mytpl->parseCurrentBlock(); } else { $mytpl->setCurrentBlock('dates'); $mytpl->setVariable('DUMMY', ' '); $mytpl->parseCurrentBlock(); } } } } $mytpl->setCurrentBlock('slots'); $mytpl->setVariable('TXT_HOUR', $caption); if ($counter % 2) { $mytpl->setVariable('CSS_ROW', 'tblrow1'); } else { $mytpl->setVariable('CSS_ROW', 'tblrow2'); } $mytpl->parseCurrentBlock(); $counter++; } } else { // :TODO: inactive for now } return $mytpl->get(); }
/** * Create a category for a new object (crs,grp, ...) * * @access public * @param object ilias object ('crs','grp',...) * @static */ public static function createCategory($a_obj, $a_check_existing = false) { global $lng; include_once './Services/Calendar/classes/class.ilCalendarCategory.php'; include_once './Services/Calendar/classes/class.ilCalendarAppointmentColors.php'; // already existing? do update instead if ($a_check_existing && ilCalendarCategory::_getInstanceByObjId($a_obj->getId())) { return self::updateCategory($a_obj); } $cat = new ilCalendarCategory(); $cat->setTitle($a_obj->getTitle() ? $a_obj->getTitle() : $lng->txt('obj_' . $a_obj->getType())); $cat->setType(ilCalendarCategory::TYPE_OBJ); $cat->setColor(ilCalendarAppointmentColors::_getRandomColorByType($a_obj->getType())); $cat->setObjId($a_obj->getId()); return $cat->add(); }