protected function viewToolbar($a_is_initial = false) { global $ilToolbar, $lng, $ilCtrl; $current_figure = (int) $_POST["fig"]; $current_time_frame = (string) $_POST["tfr"]; $current_scope = (int) $_POST["scp"]; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $view = new ilSelectInputGUI($lng->txt("wiki_stat_figure"), "fig"); $view->setOptions($this->page_id ? ilWikiStat::getFigureOptionsPage() : ilWikiStat::getFigureOptions()); if ($current_figure) { $view->setValue($current_figure); } else { if ($a_is_initial) { // default $current_figure = $this->page_id ? ilWikiStat::KEY_FIGURE_WIKI_PAGE_CHANGES : ilWikiStat::KEY_FIGURE_WIKI_NUM_PAGES; } } $ilToolbar->addInputItem($view, true); $options = array(); include_once "Services/Calendar/classes/class.ilCalendarUtil.php"; $lng->loadLanguageModule("dateplaner"); foreach (ilWikiStat::getAvailableMonths($this->wiki_id) as $month) { $parts = explode("-", $month); $options[$month] = ilCalendarUtil::_numericMonthToString((int) $parts[1]) . " " . $parts[0]; } krsort($options); $tframe = new ilSelectInputGUI($lng->txt("month"), "tfr"); $tframe->setOptions($options); if ($current_time_frame) { $tframe->setValue($current_time_frame); } else { if ($a_is_initial) { $current_time_frame = array_shift(array_keys($options)); // default } } $ilToolbar->addInputItem($tframe, true); $scope = new ilSelectInputGUI($lng->txt("wiki_stat_scope"), "scp"); $scope->setOptions(array(1 => "1 " . $lng->txt("month"), 2 => "2 " . $lng->txt("months"), 3 => "3 " . $lng->txt("months"), 4 => "4 " . $lng->txt("months"), 5 => "5 " . $lng->txt("months"), 6 => "6 " . $lng->txt("months"))); if ($current_scope) { $scope->setValue($current_scope); } else { if ($a_is_initial) { $current_scope = 1; // default } } $ilToolbar->addInputItem($scope, true); $ilToolbar->setFormAction($ilCtrl->getFormAction($this, "view")); $ilToolbar->addFormButton($lng->txt("show"), "view"); if ($current_figure && $current_time_frame && $current_scope) { $ilToolbar->addSeparator(); $ilToolbar->addFormButton($lng->txt("export"), "export"); return array("figure" => $current_figure, "month" => $current_time_frame, "scope" => $current_scope); } }
/** * Build navigation block * * @param array $items * @param string $a_list_cmd * @param string $a_posting_cmd * @param bool $a_link_template * @param bool $a_show_inactive * @return string */ function renderNavigation(array $items, $a_list_cmd = "render", $a_posting_cmd = "preview", $a_link_template = null, $a_show_inactive = false) { global $ilCtrl, $ilSetting; $max_detail_postings = 10; $wtpl = new ilTemplate("tpl.blog_list_navigation.html", true, true, "Modules/Blog"); $wtpl->setVariable("NAVIGATION_TITLE", $this->lng->txt("blog_navigation")); $ilCtrl->setParameter($this, "blpg", ""); include_once "Services/Calendar/classes/class.ilCalendarUtil.php"; $counter = 0; foreach ($items as $month => $postings) { $month_name = ilCalendarUtil::_numericMonthToString((int) substr($month, 5)) . " " . substr($month, 0, 4); if (!$a_link_template) { $ilCtrl->setParameter($this, "bmn", $month); $month_url = $ilCtrl->getLinkTarget($this, $a_list_cmd); } else { $month_url = $this->buildExportLink($a_link_template, "list", $month); } // list postings for month if ($counter < $max_detail_postings) { foreach ($postings as $id => $posting) { $is_active = ilBlogPosting::_lookupActive($id, "blp"); if (!$is_active && !$a_show_inactive) { continue; } $counter++; $caption = $posting["title"]; if (!$a_link_template) { $ilCtrl->setParameterByClass("ilblogpostinggui", "bmn", $month); $ilCtrl->setParameterByClass("ilblogpostinggui", "blpg", $id); $url = $ilCtrl->getLinkTargetByClass("ilblogpostinggui", $a_posting_cmd); } else { $url = $this->buildExportLink($a_link_template, "posting", $id); } if (!$is_active) { $wtpl->setVariable("NAV_ITEM_DRAFT", $this->lng->txt("blog_draft")); } else { if ($this->object->hasApproval() && !$posting["approved"]) { $wtpl->setVariable("NAV_ITEM_APPROVAL", $this->lng->txt("blog_needs_approval")); } } $wtpl->setCurrentBlock("navigation_item"); $wtpl->setVariable("NAV_ITEM_URL", $url); $wtpl->setVariable("NAV_ITEM_CAPTION", $caption); $wtpl->parseCurrentBlock(); } $wtpl->setCurrentBlock("navigation_month_details"); $wtpl->setVariable("NAV_MONTH", $month_name); $wtpl->setVariable("URL_MONTH", $month_url); $wtpl->parseCurrentBlock(); } else { $wtpl->setCurrentBlock("navigation_month"); $wtpl->setVariable("MONTH_NAME", $month_name); $wtpl->setVariable("URL_MONTH", $month_url); $wtpl->setVariable("MONTH_COUNT", sizeof($postings)); $wtpl->parseCurrentBlock(); } } $ilCtrl->setParameter($this, "bmn", $this->month); $ilCtrl->setParameterByClass("ilblogpostinggui", "bmn", ""); // authors if ($this->id_type == self::REPOSITORY_NODE_ID) { $authors = array(); foreach ($this->items as $month => $items) { foreach ($items as $item) { if (($a_show_inactive || ilBlogPosting::_lookupActive($item["id"], "blp")) && $item["author"]) { $authors[] = $item["author"]; } } } $authors = array_unique($authors); if (sizeof($authors) > 1) { include_once "Services/User/classes/class.ilUserUtil.php"; $list = array(); foreach ($authors as $user_id) { if ($user_id) { $ilCtrl->setParameter($this, "ath", $user_id); $url = $ilCtrl->getLinkTarget($this, $a_list_cmd); $ilCtrl->setParameter($this, "ath", ""); $name = ilUserUtil::getNamePresentation($user_id, true); $idx = trim(strip_tags($name)) . "///" . $user_id; // #10934 $list[$idx] = array($name, $url); } } ksort($list); $wtpl->setVariable("AUTHORS_TITLE", $this->lng->txt("blog_authors")); $wtpl->setCurrentBlock("author"); foreach ($list as $author) { $wtpl->setVariable("TXT_AUTHOR", $author[0]); $wtpl->setVariable("URL_AUTHOR", $author[1]); $wtpl->parseCurrentBlock(); } } } if (!$a_link_template) { // keywords $may_edit_keywords = $_GET["blpg"] && $this->mayContribute($_GET["blpg"]) && !$a_link_template && $a_list_cmd != "preview" && $a_list_cmd != "gethtml"; $keywords = $this->getKeywords($a_show_inactive, $_GET["blpg"]); if ($keywords || $may_edit_keywords) { $wtpl->setVariable("KEYWORDS_TITLE", $this->lng->txt("blog_keywords")); if ($keywords) { $max = max($keywords); include_once "Services/Tagging/classes/class.ilTagging.php"; $wtpl->setCurrentBlock("keyword"); foreach ($keywords as $keyword => $counter) { $ilCtrl->setParameter($this, "kwd", $keyword); $url = $ilCtrl->getLinkTarget($this, $a_list_cmd); $ilCtrl->setParameter($this, "kwd", ""); $wtpl->setVariable("TXT_KEYWORD", $keyword); $wtpl->setVariable("SIZE_KEYWORD", ilTagging::calculateFontSize($counter, $max)); $wtpl->setVariable("URL_KEYWORD", $url); $wtpl->parseCurrentBlock(); } } else { $wtpl->setVariable("TXT_NO_KEYWORDS", $this->lng->txt("blog_no_keywords")); } if ($may_edit_keywords) { $ilCtrl->setParameterByClass("ilblogpostinggui", "blpg", $_GET["blpg"]); $wtpl->setVariable("URL_EDIT_KEYWORDS", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "editKeywords")); $ilCtrl->setParameterByClass("ilblogpostinggui", "blpg", ""); $wtpl->setVariable("TXT_EDIT_KEYWORDS", $this->lng->txt("blog_edit_keywords")); } } // rss if ($this->object->hasRSS() && $ilSetting->get('enable_global_profiles') && $a_list_cmd == "preview") { // #10827 $blog_id = $this->node_id; if ($this->id_type != self::WORKSPACE_NODE_ID) { $blog_id .= "_cll"; } $url = ILIAS_HTTP_PATH . "/feed.php?blog_id=" . $blog_id . "&client_id=" . rawurlencode(CLIENT_ID); $wtpl->setCurrentBlock("rss"); $wtpl->setVariable("URL_RSS", $url); $wtpl->setVariable("IMG_RSS", ilUtil::getImagePath("rss.png")); $wtpl->parseCurrentBlock(); } } return $wtpl->get(); }
/** * fill data section * * @access protected * */ protected function show() { global $lng, $ilUser; // config $raster = 15; if ($this->user_settings->getDayStart()) { // push starting point to last "slot" of hour BEFORE morning aggregation $morning_aggr = ($this->user_settings->getDayStart() - 1) * 60 + (60 - $raster); } else { $morning_aggr = 0; } $evening_aggr = $this->user_settings->getDayEnd() * 60; $this->tpl = new ilTemplate('tpl.day_view.html', true, true, 'Services/Calendar'); include_once './Services/YUI/classes/class.ilYuiUtil.php'; ilYuiUtil::initDragDrop(); ilYuiUtil::initPanel(); if (isset($_GET["bkid"])) { $user_id = $_GET["bkid"]; $no_add = true; } elseif ($ilUser->getId() == ANONYMOUS_USER_ID) { $user_id = $ilUser->getId(); $no_add = true; } else { $user_id = $ilUser->getId(); $no_add = false; } include_once 'Services/Calendar/classes/class.ilCalendarSchedule.php'; $this->scheduler = new ilCalendarSchedule($this->seed, ilCalendarSchedule::TYPE_DAY, $user_id); $this->scheduler->addSubitemCalendars(true); $this->scheduler->calculate(); $daily_apps = $this->scheduler->getByDay($this->seed, $this->timezone); $hours = $this->parseInfoIntoRaster($daily_apps, $morning_aggr, $evening_aggr, $raster); $colspan = $this->calculateColspan($hours); $navigation = new ilCalendarHeaderNavigationGUI($this, $this->seed, ilDateTime::DAY); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->seed->get(IL_CAL_DATE)); // add milestone link include_once 'Services/Calendar/classes/class.ilCalendarSettings.php'; $settings = ilCalendarSettings::_getInstance(); include_once "Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; if (!$no_add) { $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->seed->get(IL_CAL_DATE)); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'idate', $this->seed->get(IL_CAL_DATE)); $new_app_url = $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'add'); if ($settings->getEnableGroupMilestones()) { $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->seed->get(IL_CAL_DATE)); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'idate', $this->seed->get(IL_CAL_DATE)); $new_ms_url = $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'addMilestone'); $this->tpl->setCurrentBlock("new_ms"); $this->tpl->setVariable('DD_ID', $this->seed->get(IL_CAL_UNIX)); $this->tpl->setVariable('DD_TRIGGER', ilGlyphGUI::get(ilGlyphGUI::ADD)); $this->tpl->setVariable('URL_DD_NEW_APP', $new_app_url); $this->tpl->setVariable('TXT_DD_NEW_APP', $this->lng->txt('cal_new_app')); $this->tpl->setVariable('URL_DD_NEW_MS', $new_ms_url); $this->tpl->setVariable('TXT_DD_NEW_MS', $this->lng->txt('cal_new_ms')); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setCurrentBlock("new_app1"); $this->tpl->setVariable('H_NEW_APP_SRC', ilGlyphGUI::get(ilGlyphGUI::ADD, $this->lng->txt('cal_new_app'))); $this->tpl->setVariable('NEW_APP_LINK', $new_app_url); $this->tpl->parseCurrentBlock(); } $this->ctrl->clearParametersByClass('ilcalendarappointmentgui'); } $this->tpl->setVariable('NAVIGATION', $navigation->getHTML()); $this->tpl->setVariable('HEADER_DATE', $this->seed_info['mday'] . ' ' . ilCalendarUtil::_numericMonthToString($this->seed_info['mon'], false)); $this->tpl->setVariable('HEADER_DAY', ilCalendarUtil::_numericDayToString($this->seed_info['wday'], true)); $this->tpl->setVariable('HCOLSPAN', $colspan - 1); $this->tpl->setVariable('TXT_TIME', $lng->txt("time")); // show fullday events foreach ($daily_apps as $event) { if ($event['fullday']) { $this->showFulldayAppointment($event); } } $this->tpl->setCurrentBlock('fullday_apps'); $this->tpl->setVariable('TXT_F_DAY', $lng->txt("cal_all_day")); $this->tpl->setVariable('COLSPAN', $colspan - 1); $this->tpl->parseCurrentBlock(); // parse the hour rows foreach ($hours as $numeric => $hour) { if (!($numeric % 60) || $numeric == $morning_aggr && $morning_aggr || $numeric == $evening_aggr && $evening_aggr) { if (!$no_add) { $this->tpl->setCurrentBlock("new_app2"); $this->ctrl->clearParametersByClass('ilcalendarappointmentgui'); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->seed->get(IL_CAL_DATE)); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'idate', $this->seed->get(IL_CAL_DATE)); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'hour', floor($numeric / 60)); $this->tpl->setVariable('NEW_APP_HOUR_LINK', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'add')); $this->tpl->setVariable('NEW_APP_SRC', ilGlyphGUI::get(ilGlyphGUI::ADD, $this->lng->txt('cal_new_app'))); $this->tpl->parseCurrentBlock(); } // aggregation rows if ($numeric == $morning_aggr && $morning_aggr || $numeric == $evening_aggr && $evening_aggr) { $this->tpl->setVariable('TIME_ROWSPAN', 1); } else { $this->tpl->setVariable('TIME_ROWSPAN', 60 / $raster); } $this->tpl->setCurrentBlock('time_txt'); $this->tpl->setVariable('TIME', $hour['txt']); $this->tpl->parseCurrentBlock(); } foreach ($hour['apps_start'] as $app) { $this->showAppointment($app); } if ($ilUser->prefs["screen_reader_optimization"]) { $this->tpl->touchBlock('scrd_app_cell'); } for ($i = $colspan - 1; $i > $hour['apps_num']; $i--) { $this->tpl->setCurrentBlock('empty_cell'); $this->tpl->setVariable('EMPTY_WIDTH', 100 / (int) ($colspan - 1) . '%'); // last "slot" of hour needs border if ($numeric % 60 == 60 - $raster || $numeric == $morning_aggr && $morning_aggr || $numeric == $evening_aggr && $evening_aggr) { $this->tpl->setVariable('EMPTY_STYLE', ' calempty_border'); } $this->tpl->parseCurrentBlock(); } $this->tpl->touchBlock('time_row'); } }
/** * Format a date * @access public * @param object $date ilDate or ilDateTime * @return string date presentation in user specific timezone and language * @static */ public static function formatDate(ilDateTime $date) { global $lng, $ilUser; if ($date->isNull()) { return self::getLanguage()->txt('no_date'); } $has_time = !is_a($date, 'ilDate'); // Converting pure dates to user timezone might return wrong dates if ($has_time) { $date_info = $date->get(IL_CAL_FKT_GETDATE, '', $ilUser->getTimeZone()); } else { $date_info = $date->get(IL_CAL_FKT_GETDATE, '', 'UTC'); } if (self::isToday($date) and self::useRelativeDates()) { $date_str = self::getLanguage()->txt('today'); } elseif (self::isTomorrow($date) and self::useRelativeDates()) { $date_str = self::getLanguage()->txt('tomorrow'); } elseif (self::isYesterday($date) and self::useRelativeDates()) { $date_str = self::getLanguage()->txt('yesterday'); } else { include_once './Services/Calendar/classes/class.ilCalendarUtil.php'; $date_str = $date->get(IL_CAL_FKT_DATE, 'd') . '. ' . ilCalendarUtil::_numericMonthToString($date_info['mon'], false) . ' ' . $date_info['year']; } if (!$has_time) { return $date_str; } switch ($ilUser->getTimeFormat()) { case ilCalendarSettings::TIME_FORMAT_24: return $date_str . ', ' . $date->get(IL_CAL_FKT_DATE, 'H:i', $ilUser->getTimeZone()); case ilCalendarSettings::TIME_FORMAT_12: return $date_str . ', ' . $date->get(IL_CAL_FKT_DATE, 'g:ia', $ilUser->getTimeZone()); } }
/** * fill data section * * @access public * */ public function show() { global $ilUser, $lng; // config $raster = 15; if ($this->user_settings->getDayStart()) { // push starting point to last "slot" of hour BEFORE morning aggregation $morning_aggr = ($this->user_settings->getDayStart() - 1) * 60 + (60 - $raster); } else { $morning_aggr = 0; } $evening_aggr = $this->user_settings->getDayEnd() * 60; $this->tpl = new ilTemplate('tpl.week_view.html', true, true, 'Services/Calendar'); include_once './Services/YUI/classes/class.ilYuiUtil.php'; ilYuiUtil::initDragDrop(); ilYuiUtil::initPanel(); $navigation = new ilCalendarHeaderNavigationGUI($this, $this->seed, ilDateTime::WEEK); $this->tpl->setVariable('NAVIGATION', $navigation->getHTML()); if (isset($_GET["bkid"])) { $user_id = $_GET["bkid"]; $disable_empty = true; $no_add = true; } elseif ($ilUser->getId() == ANONYMOUS_USER_ID) { $user_id = $ilUser->getId(); $disable_empty = false; $no_add = true; } else { $user_id = $ilUser->getId(); $disable_empty = false; $no_add = false; } include_once 'Services/Calendar/classes/class.ilCalendarSchedule.php'; $this->scheduler = new ilCalendarSchedule($this->seed, ilCalendarSchedule::TYPE_WEEK, $user_id, $disable_empty); $this->scheduler->addSubitemCalendars(true); $this->scheduler->calculate(); $counter = 0; $hours = null; $all_fullday = array(); foreach (ilCalendarUtil::_buildWeekDayList($this->seed, $this->user_settings->getWeekStart())->get() as $date) { $daily_apps = $this->scheduler->getByDay($date, $this->timezone); $hours = $this->parseHourInfo($daily_apps, $date, $counter, $hours, $morning_aggr, $evening_aggr, $raster); $this->weekdays[] = $date; $num_apps[$date->get(IL_CAL_DATE)] = count($daily_apps); $all_fullday[] = $daily_apps; $counter++; } $colspans = $this->calculateColspans($hours); include_once 'Services/Calendar/classes/class.ilCalendarSettings.php'; $settings = ilCalendarSettings::_getInstance(); include_once "Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; // Table header $counter = 0; foreach (ilCalendarUtil::_buildWeekDayList($this->seed, $this->user_settings->getWeekStart())->get() as $date) { $date_info = $date->get(IL_CAL_FKT_GETDATE, '', 'UTC'); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $date->get(IL_CAL_DATE)); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'idate', $date->get(IL_CAL_DATE)); $this->ctrl->setParameterByClass('ilcalendardaygui', 'seed', $date->get(IL_CAL_DATE)); if (!$no_add) { $new_app_url = $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'add'); if ($settings->getEnableGroupMilestones()) { $new_ms_url = $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'addMilestone'); $this->tpl->setCurrentBlock("new_ms"); $this->tpl->setVariable('DD_ID', $date->get(IL_CAL_UNIX)); $this->tpl->setVariable('DD_TRIGGER', ilGlyphGUI::get(ilGlyphGUI::ADD)); $this->tpl->setVariable('URL_DD_NEW_APP', $new_app_url); $this->tpl->setVariable('TXT_DD_NEW_APP', $this->lng->txt('cal_new_app')); $this->tpl->setVariable('URL_DD_NEW_MS', $new_ms_url); $this->tpl->setVariable('TXT_DD_NEW_MS', $this->lng->txt('cal_new_ms')); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setCurrentBlock("new_app"); $this->tpl->setVariable('NEW_APP_LINK', $new_app_url); $this->tpl->setVariable('NEW_APP_SRC', ilGlyphGUI::get(ilGlyphGUI::ADD, $this->lng->txt('cal_new_app'))); // $this->tpl->setVariable('NEW_APP_ALT',$this->lng->txt('cal_new_app')); $this->tpl->parseCurrentBlock(); } $this->ctrl->clearParametersByClass('ilcalendarappointmentgui'); } $dayname = ilCalendarUtil::_numericDayToString($date->get(IL_CAL_FKT_DATE, 'w'), true); $daydate = $date_info['mday'] . ' ' . ilCalendarUtil::_numericMonthToString($date_info['mon'], false); if (!$disable_empty || $num_apps[$date->get(IL_CAL_DATE)] > 0) { $link = $this->ctrl->getLinkTargetByClass('ilcalendardaygui', ''); $this->ctrl->clearParametersByClass('ilcalendardaygui'); $this->tpl->setCurrentBlock("day_view1_link"); $this->tpl->setVariable('HEADER_DATE', $daydate); $this->tpl->setVariable('DAY_VIEW_LINK', $link); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("day_view2_link"); $this->tpl->setVariable('DAYNAME', $dayname); $this->tpl->setVariable('DAY_VIEW_LINK', $link); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setCurrentBlock("day_view1_no_link"); $this->tpl->setVariable('HEADER_DATE', $daydate); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("day_view2_no_link"); $this->tpl->setVariable('DAYNAME', $dayname); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock('day_header_row'); $this->tpl->setVariable('DAY_COLSPAN', max($colspans[$counter], 1)); $this->tpl->parseCurrentBlock(); $counter++; } // show fullday events $counter = 0; foreach ($all_fullday as $daily_apps) { foreach ($daily_apps as $event) { if ($event['fullday']) { $this->showFulldayAppointment($event); } } $this->tpl->setCurrentBlock('f_day_row'); $this->tpl->setVariable('COLSPAN', max($colspans[$counter], 1)); $this->tpl->parseCurrentBlock(); $counter++; } $this->tpl->setCurrentBlock('fullday_apps'); $this->tpl->setVariable('TXT_F_DAY', $lng->txt("cal_all_day")); $this->tpl->parseCurrentBlock(); $new_link_counter = 0; foreach ($hours as $num_hour => $hours_per_day) { $first = true; foreach ($hours_per_day as $num_day => $hour) { if ($first) { if (!($num_hour % 60) || $num_hour == $morning_aggr && $morning_aggr || $num_hour == $evening_aggr && $evening_aggr) { $first = false; // aggregation rows if ($num_hour == $morning_aggr && $morning_aggr || $num_hour == $evening_aggr && $evening_aggr) { $this->tpl->setVariable('TIME_ROWSPAN', 1); } else { $this->tpl->setVariable('TIME_ROWSPAN', 60 / $raster); } $this->tpl->setCurrentBlock('time_txt'); $this->tpl->setVariable('TIME', $hour['txt']); $this->tpl->parseCurrentBlock(); } } foreach ($hour['apps_start'] as $app) { $this->showAppointment($app); } // screen reader: appointments are divs, now output cell if ($ilUser->prefs["screen_reader_optimization"]) { $this->tpl->setCurrentBlock('scrd_day_cell'); $this->tpl->setVariable('TD_CLASS', 'calstd'); $this->tpl->parseCurrentBlock(); } #echo "NUMDAY: ".$num_day; #echo "COLAPANS: ".max($colspans[$num_day],1).'<br />'; $num_apps = $hour['apps_num']; $colspan = max($colspans[$num_day], 1); // Show new apointment link if (!$hour['apps_num'] && !$ilUser->prefs["screen_reader_optimization"] && !$no_add) { $this->tpl->setCurrentBlock('new_app_link'); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'idate', $this->weekdays[$num_day]->get(IL_CAL_DATE)); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->seed->get(IL_CAL_DATE)); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'hour', floor($num_hour / 60)); $this->tpl->setVariable('DAY_NEW_APP_LINK', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'add')); $this->ctrl->clearParametersByClass('ilcalendarappointmentgui'); $this->tpl->setVariable('DAY_NEW_APP_SRC', ilGlyphGUI::get(ilGlyphGUI::ADD, $this->lng->txt('cal_new_app'))); $this->tpl->setVariable('DAY_NEW_APP_ALT', $this->lng->txt('cal_new_app')); $this->tpl->setVariable('DAY_NEW_ID', ++$new_link_counter); $this->tpl->parseCurrentBlock(); } for ($i = $colspan; $i > $hour['apps_num']; $i--) { if ($ilUser->prefs["screen_reader_optimization"]) { continue; } $this->tpl->setCurrentBlock('day_cell'); // last "slot" of hour needs border $empty_border = ''; if ($num_hour % 60 == 60 - $raster || $num_hour == $morning_aggr && $morning_aggr || $num_hour == $evening_aggr && $evening_aggr) { $empty_border = ' calempty_border'; } if ($i == $hour['apps_num'] + 1) { $this->tpl->setVariable('TD_CLASS', 'calempty calrightborder' . $empty_border); #$this->tpl->setVariable('TD_STYLE',$add_style); } else { $this->tpl->setVariable('TD_CLASS', 'calempty' . $empty_border); #$this->tpl->setVariable('TD_STYLE',$add_style); } if (!$hour['apps_num']) { $this->tpl->setVariable('DAY_ID', $new_link_counter); } $this->tpl->setVariable('TD_ROWSPAN', 1); $this->tpl->parseCurrentBlock(); } } $this->tpl->touchBlock('time_row'); } $this->tpl->setVariable("TXT_TIME", $lng->txt("time")); }
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(); }
/** * Fills the table with data for whole week. */ public function show($export = false) { if ($export && isset($_SESSION['weeklySeed'])) { $this->seed = $_SESSION['weeklySeed']; } else { $_SESSION['weeklySeed'] = $this->seed; } if (!$this->permission->checkPrivilege(PRIVC::SEE_BOOKINGS_OF_ROOMS)) { ilUtil::sendFailure($this->lng->txt("rep_robj_xrs_no_permission_for_action")); $this->ctrl->redirectByClass('ilinfoscreengui', 'showSummary', 'showSummary'); return false; } global $ilUser; $this->setSubTabs('weekview'); //intervalsize $raster = 15; if ($this->user_settings->getDayStart()) { // push starting point to last "slot" of hour BEFORE morning aggregation $morning_aggr = ($this->user_settings->getDayStart() - 1) * 60 + (60 - $raster); } else { $morning_aggr = 0; } $evening_aggr = $this->user_settings->getDayEnd() * 60; $this->tpl = new ilTemplate('tpl.room_week_view.html', true, true, 'Customizing/global/plugins/Services/Repository/RepositoryObject/RoomSharing'); ilYuiUtil::initDragDrop(); ilYuiUtil::initPanel(); $navigation = new ilCalendarHeaderNavigationGUI($this, $this->seed, ilDateTime::WEEK); $this->tpl->setVariable('NAVIGATION', $navigation->getHTML()); if (isset($_GET["bkid"])) { $user_id = $_GET["bkid"]; $disable_empty = true; $no_add = true; } elseif ($ilUser->getId() == ANONYMOUS_USER_ID) { $user_id = $ilUser->getId(); $disable_empty = false; $no_add = true; } else { $user_id = $ilUser->getId(); $disable_empty = false; $no_add = false; } $room = new ilRoomSharingRoom($this->pool_id, $this->room_id); $this->tpl->setVariable('ROOM', $this->lng->txt('rep_robj_xrs_room_occupation_title') . " " . $room->getName()); $this->scheduler = new ilRoomSharingCalendarSchedule($this->seed, ilCalendarSchedule::TYPE_WEEK, $user_id, $room); $this->scheduler->addSubitemCalendars(true); $this->scheduler->calculate(); $counter = 0; $hours = NULL; foreach (ilCalendarUtil::_buildWeekDayList($this->seed, $this->user_settings->getWeekStart())->get() as $date) { $daily_apps = $this->scheduler->getByDay($date, $this->timezone); $hours = $this->parseHourInfo($daily_apps, $date, $counter, $hours, $morning_aggr, $evening_aggr, $raster); $this->weekdays[] = $date; $num_apps[$date->get(IL_CAL_DATE)] = count($daily_apps); $counter++; } $colspans = $this->calculateColspans($hours); $settings = ilCalendarSettings::_getInstance(); $exportLink = $this->ctrl->getLinkTargetByClass("ilroomsharingcalendarweekgui", "export"); $this->tpl->setCurrentBlock("export_block"); $this->tpl->setVariable('EXPORT_LINK', $exportLink); $this->tpl->parseCurrentBlock(); // Table header $counter = 0; foreach (ilCalendarUtil::_buildWeekDayList($this->seed, $this->user_settings->getWeekStart())->get() as $date) { $date_info = $date->get(IL_CAL_FKT_GETDATE, '', 'UTC'); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $date->get(IL_CAL_DATE)); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'idate', $date->get(IL_CAL_DATE)); $this->ctrl->setParameterByClass('ilcalendardaygui', 'seed', $date->get(IL_CAL_DATE)); $dayname = ilCalendarUtil::_numericDayToString($date->get(IL_CAL_FKT_DATE, 'w'), true); $this->days[$counter] = $date; $daydate = $date_info['mday'] . ' ' . ilCalendarUtil::_numericMonthToString($date_info['mon'], false); if (!$disable_empty || $num_apps[$date->get(IL_CAL_DATE)] > 0) { $link = $this->ctrl->getLinkTargetByClass('ilcalendardaygui', ''); $this->ctrl->clearParametersByClass('ilcalendardaygui'); $this->tpl->setCurrentBlock("day_view1_link"); $this->tpl->setVariable('HEADER_DATE', $daydate); $this->tpl->setVariable('DAY_VIEW_LINK', $link); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("day_view2_link"); $this->tpl->setVariable('DAYNAME', $dayname); $this->tpl->setVariable('DAY_VIEW_LINK', $link); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setCurrentBlock("day_view1_no_link"); $this->tpl->setVariable('HEADER_DATE', $daydate); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("day_view2_no_link"); $this->tpl->setVariable('DAYNAME', $dayname); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock('day_header_row'); $this->tpl->setVariable('DAY_COLSPAN', max($colspans[$counter], 1)); $this->tpl->parseCurrentBlock(); $counter++; } $new_link_counter = 0; foreach ($hours as $num_hour => $hours_per_day) { $first = true; foreach ($hours_per_day as $num_day => $hour) { if ($first) { if (!($num_hour % 60) || $num_hour == $morning_aggr && $morning_aggr || $num_hour == $evening_aggr && $evening_aggr) { $first = false; $this->timeIntervals[] = $hours_per_day[2]; // aggregation rows if ($num_hour == $morning_aggr && $morning_aggr || $num_hour == $evening_aggr && $evening_aggr) { $this->tpl->setVariable('TIME_ROWSPAN', 1); } else { $this->tpl->setVariable('TIME_ROWSPAN', 60 / $raster); } $this->tpl->setCurrentBlock('time_txt'); $this->tpl->setVariable('TIME', $hour['txt']); $this->tpl->parseCurrentBlock(); } } foreach ($hour['apps_start'] as $app) { $this->showAppointment($app); } // screen reader: appointments are divs, now output cell if ($ilUser->prefs["screen_reader_optimization"]) { $this->tpl->setCurrentBlock('scrd_day_cell'); $this->tpl->setVariable('TD_CLASS', 'calstd'); $this->tpl->parseCurrentBlock(); } #echo "NUMDAY: ".$num_day; #echo "COLAPANS: ".max($colspans[$num_day],1).'<br />'; $num_apps = $hour['apps_num']; $colspan = max($colspans[$num_day], 1); // Show new apointment link $userCanAddBooking = $this->permission->checkPrivilege(PRIVC::ADD_OWN_BOOKINGS); $calStuffAllowed = !$hour['apps_num'] && !$ilUser->prefs["screen_reader_optimization"] && !$no_add; if ($userCanAddBooking && $calStuffAllowed) { $this->tpl->setCurrentBlock('new_app_link'); $this->tpl->setVariable('DAY_NEW_APP_LINK', $this->lng->txt('rep_robj_xrs_room_book')); $this->ctrl->setParameterByClass('ilobjroomsharinggui', 'room', $room->getName()); $this->ctrl->setParameterByClass('ilobjroomsharinggui', 'room_id', $room->getId()); $_SESSION['last_cmd'] = 'showroom'; $date = $this->weekdays[$num_day]->get(IL_CAL_DATE); //convert time into suitable format (HH:ii:ss) $hr = floor($num_hour / 60); $hr = $hr < 10 ? "0" . $hr : $hr; $hr_end = floor(($num_hour + 60) / 60); $hr_end = $hr_end < 10 ? "0" . $hr_end : $hr_end; $min = floor($num_hour % 60); $min = $min < 10 ? "0" . $min : $min; $min_end = floor(($num_hour + 60) % 60); $min_end = $min_end < 10 ? "0" . $min_end : $min_end; $time_from = $hr . ":" . $min . ":00"; $time_to = $hr_end . ":" . $min_end . ":00"; $this->ctrl->setParameterByClass('ilobjroomsharinggui', 'date', $date); $this->ctrl->setParameterByClass('ilobjroomsharinggui', 'time_from', $time_from); $this->ctrl->setParameterByClass('ilobjroomsharinggui', 'time_to', $time_to); $this->tpl->setVariable('DAY_NEW_APP_LINK', $this->ctrl->getLinkTargetByClass('ilobjroomsharinggui', 'book')); // free the parameters $this->ctrl->clearParametersByClass('ilobjroomsharinggui'); $this->tpl->setVariable('DAY_NEW_APP_SRC', ilUtil::getImagePath('date_add.png')); $this->tpl->setVariable('DAY_NEW_APP_ALT', $this->lng->txt('cal_new_app')); $this->tpl->setVariable('DAY_NEW_ID', ++$new_link_counter); $this->tpl->parseCurrentBlock(); } for ($i = $colspan; $i > $hour['apps_num']; $i--) { if ($ilUser->prefs["screen_reader_optimization"]) { continue; } $this->tpl->setCurrentBlock('day_cell'); // last "slot" of hour needs border $empty_border = ''; if ($num_hour % 60 == 60 - $raster || $num_hour == $morning_aggr && $morning_aggr || $num_hour == $evening_aggr && $evening_aggr) { $empty_border = ' calempty_border'; } if ($i == $hour['apps_num'] + 1) { $this->tpl->setVariable('TD_CLASS', 'calempty calrightborder' . $empty_border); #$this->tpl->setVariable('TD_STYLE',$add_style); } else { $this->tpl->setVariable('TD_CLASS', 'calempty' . $empty_border); #$this->tpl->setVariable('TD_STYLE',$add_style); } if (!$hour['apps_num']) { $this->tpl->setVariable('DAY_ID', $new_link_counter); } $this->tpl->setVariable('TD_ROWSPAN', 1); $this->tpl->parseCurrentBlock(); } } $this->tpl->touchBlock('time_row'); } $this->tpl->setVariable("TXT_TIME", $this->lng->txt("time")); if ($export) { $this->export(); } }
/** * Build navigation by date block * * @param array $a_items * @param string $a_list_cmd * @param string $a_posting_cmd * @param bool $a_link_template * @param bool $a_show_inactive * @return string */ protected function renderNavigationByDate(array $a_items, $a_list_cmd = "render", $a_posting_cmd = "preview", $a_link_template = null, $a_show_inactive = false) { global $ilCtrl; // gather page active status foreach ($a_items as $month => $postings) { foreach (array_keys($postings) as $id) { $active = ilBlogPosting::_lookupActive($id, "blp"); if (!$a_show_inactive && !$active) { unset($a_items[$month][$id]); } else { $a_items[$month][$id]["active"] = $active; } } if (!sizeof($a_items[$month])) { unset($a_items[$month]); } } // list month (incl. postings) if ($this->object->getNavMode() == ilObjBlog::NAV_MODE_LIST || $a_link_template) { $max_detail_postings = $this->object->getNavModeListPostings(); $max_months = $this->object->getNavModeListMonths(); $wtpl = new ilTemplate("tpl.blog_list_navigation_by_date.html", true, true, "Modules/Blog"); $ilCtrl->setParameter($this, "blpg", ""); include_once "Services/Calendar/classes/class.ilCalendarUtil.php"; $counter = $mon_counter = $last_year = 0; foreach ($a_items as $month => $postings) { if (!$a_link_template && $max_months && $mon_counter >= $max_months) { break; } $add_year = false; $year = substr($month, 0, 4); if (!$last_year || $year != $last_year) { // #13562 $add_year = true; $last_year = $year; } $mon_counter++; $month_name = ilCalendarUtil::_numericMonthToString((int) substr($month, 5)); if (!$a_link_template) { $ilCtrl->setParameter($this, "bmn", $month); $month_url = $ilCtrl->getLinkTarget($this, $a_list_cmd); } else { $month_url = $this->buildExportLink($a_link_template, "list", $month); } // list postings for month if ($counter < $max_detail_postings) { if ($add_year) { $wtpl->setCurrentBlock("navigation_year_details"); $wtpl->setVariable("YEAR", $year); $wtpl->parseCurrentBlock(); } foreach ($postings as $id => $posting) { if ($max_detail_postings && $counter >= $max_detail_postings) { break; } $counter++; $caption = $posting["title"]; if (!$a_link_template) { $ilCtrl->setParameterByClass("ilblogpostinggui", "bmn", $month); $ilCtrl->setParameterByClass("ilblogpostinggui", "blpg", $id); $url = $ilCtrl->getLinkTargetByClass("ilblogpostinggui", $a_posting_cmd); } else { $url = $this->buildExportLink($a_link_template, "posting", $id); } if (!$posting["active"]) { $wtpl->setVariable("NAV_ITEM_DRAFT", $this->lng->txt("blog_draft")); } else { if ($this->object->hasApproval() && !$posting["approved"]) { $wtpl->setVariable("NAV_ITEM_APPROVAL", $this->lng->txt("blog_needs_approval")); } } $wtpl->setCurrentBlock("navigation_item"); $wtpl->setVariable("NAV_ITEM_URL", $url); $wtpl->setVariable("NAV_ITEM_CAPTION", $caption); $wtpl->parseCurrentBlock(); } $wtpl->setCurrentBlock("navigation_month_details"); $wtpl->setVariable("NAV_MONTH", $month_name); $wtpl->setVariable("URL_MONTH", $month_url); $wtpl->parseCurrentBlock(); } else { if ($add_year) { $wtpl->setCurrentBlock("navigation_year"); $wtpl->setVariable("YEAR", $year); $wtpl->parseCurrentBlock(); } $wtpl->setCurrentBlock("navigation_month"); $wtpl->setVariable("MONTH_NAME", $month_name); $wtpl->setVariable("URL_MONTH", $month_url); $wtpl->setVariable("MONTH_COUNT", sizeof($postings)); $wtpl->parseCurrentBlock(); } } $ilCtrl->setParameter($this, "bmn", $this->month); $ilCtrl->setParameterByClass("ilblogpostinggui", "bmn", ""); return $wtpl->get(); } else { $wtpl = new ilTemplate("tpl.blog_list_navigation_month.html", true, true, "Modules/Blog"); $ilCtrl->setParameter($this, "blpg", ""); include_once "Services/Calendar/classes/class.ilCalendarUtil.php"; $month_options = array(); foreach ($a_items as $month => $postings) { $month_name = ilCalendarUtil::_numericMonthToString((int) substr($month, 5)) . " " . substr($month, 0, 4); $month_options[$month] = $month_name; if ($month == $this->month) { if (!$a_link_template) { $ilCtrl->setParameter($this, "bmn", $month); $month_url = $ilCtrl->getLinkTarget($this, $a_list_cmd); } else { $month_url = $this->buildExportLink($a_link_template, "list", $month); } foreach ($postings as $id => $posting) { $caption = $posting["title"]; if (!$a_link_template) { $ilCtrl->setParameterByClass("ilblogpostinggui", "bmn", $month); $ilCtrl->setParameterByClass("ilblogpostinggui", "blpg", $id); $url = $ilCtrl->getLinkTargetByClass("ilblogpostinggui", $a_posting_cmd); } else { $url = $this->buildExportLink($a_link_template, "posting", $id); } if (!$posting["active"]) { $wtpl->setVariable("NAV_ITEM_DRAFT", $this->lng->txt("blog_draft")); } else { if ($this->object->hasApproval() && !$posting["approved"]) { $wtpl->setVariable("NAV_ITEM_APPROVAL", $this->lng->txt("blog_needs_approval")); } } $wtpl->setCurrentBlock("navigation_item"); $wtpl->setVariable("NAV_ITEM_URL", $url); $wtpl->setVariable("NAV_ITEM_CAPTION", $caption); $wtpl->parseCurrentBlock(); } $wtpl->setCurrentBlock("navigation_month_details"); if ($_GET["blpg"]) { $wtpl->setVariable("NAV_MONTH", $month_name); $wtpl->setVariable("URL_MONTH", $month_url); } $wtpl->parseCurrentBlock(); } } if (!$_GET["blpg"]) { $wtpl->setCurrentBlock("option_bl"); foreach ($month_options as $value => $caption) { $wtpl->setVariable("OPTION_VALUE", $value); $wtpl->setVariable("OPTION_CAPTION", $caption); if ($value == $this->month) { $wtpl->setVariable("OPTION_SEL", ' selected="selected"'); } $wtpl->parseCurrentBlock(); } $wtpl->setVariable("FORM_ACTION", $ilCtrl->getFormAction($this, $a_list_cmd)); } $ilCtrl->setParameter($this, "bmn", $this->month); $ilCtrl->setParameterByClass("ilblogpostinggui", "bmn", ""); return $wtpl->get(); } }
/** * fill data section * * @access public * */ public function show() { global $tpl, $ilUser; $this->tpl = new ilTemplate('tpl.month_view.html', true, true, 'Services/Calendar'); include_once './Services/YUI/classes/class.ilYuiUtil.php'; ilYuiUtil::initDragDrop(); ilYuiUtil::initPanel(); $navigation = new ilCalendarHeaderNavigationGUI($this, $this->seed, ilDateTime::MONTH); $this->tpl->setVariable('NAVIGATION', $navigation->getHTML()); for ($i = (int) $this->user_settings->getWeekStart(); $i < 7 + (int) $this->user_settings->getWeekStart(); $i++) { $this->tpl->setCurrentBlock('month_header_col'); $this->tpl->setVariable('TXT_WEEKDAY', ilCalendarUtil::_numericDayToString($i, true)); $this->tpl->parseCurrentBlock(); } if (isset($_GET["bkid"])) { $user_id = $_GET["bkid"]; $disable_empty = true; $no_add = true; } else { if ($ilUser->getId() == ANONYMOUS_USER_ID) { $user_id = $ilUser->getId(); $disable_empty = false; $no_add = true; } else { $user_id = $ilUser->getId(); $disable_empty = false; $no_add = false; } } $is_portfolio_embedded = false; if (ilCalendarCategories::_getInstance()->getMode() == ilCalendarCategories::MODE_PORTFOLIO_CONSULTATION) { $no_add = true; $is_portfolio_embedded = true; } include_once 'Services/Calendar/classes/class.ilCalendarSchedule.php'; $this->scheduler = new ilCalendarSchedule($this->seed, ilCalendarSchedule::TYPE_MONTH, $user_id); $this->scheduler->addSubitemCalendars(true); if (sizeof($this->schedule_filters)) { foreach ($this->schedule_filters as $filter) { $this->scheduler->addFilter($filter); } } $this->scheduler->calculate(); include_once 'Services/Calendar/classes/class.ilCalendarSettings.php'; $settings = ilCalendarSettings::_getInstance(); $counter = 0; foreach (ilCalendarUtil::_buildMonthDayList($this->seed->get(IL_CAL_FKT_DATE, 'm'), $this->seed->get(IL_CAL_FKT_DATE, 'Y'), $this->user_settings->getWeekStart())->get() as $date) { $counter++; $has_events = (bool) $this->showEvents($date); if (!$no_add) { include_once "Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; $this->ctrl->clearParametersByClass('ilcalendarappointmentgui'); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'idate', $date->get(IL_CAL_DATE)); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->seed->get(IL_CAL_DATE)); $new_app_url = $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'add'); if ($settings->getEnableGroupMilestones()) { $this->ctrl->clearParametersByClass('ilcalendarappointmentgui'); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->seed->get(IL_CAL_DATE)); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'idate', $date->get(IL_CAL_DATE)); $new_ms_url = $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'addMilestone'); $this->tpl->setCurrentBlock("new_ms"); $this->tpl->setVariable('DD_ID', $date->get(IL_CAL_UNIX)); $this->tpl->setVariable('DD_TRIGGER', ilGlyphGUI::get(ilGlyphGUI::ADD)); $this->tpl->setVariable('URL_DD_NEW_APP', $new_app_url); $this->tpl->setVariable('TXT_DD_NEW_APP', $this->lng->txt('cal_new_app')); $this->tpl->setVariable('URL_DD_NEW_MS', $new_ms_url); $this->tpl->setVariable('TXT_DD_NEW_MS', $this->lng->txt('cal_new_ms')); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setCurrentBlock("new_app"); $this->tpl->setVariable('ADD_LINK', $new_app_url); $this->tpl->setVariable('NEW_SRC', ilGlyphGUI::get(ilGlyphGUI::ADD, $this->lng->txt('cal_new_app'))); $this->tpl->parseCurrentBlock(); } } $day = $date->get(IL_CAL_FKT_DATE, 'j'); $month = $date->get(IL_CAL_FKT_DATE, 'n'); if ($day == 1) { $month_day = '1 ' . ilCalendarUtil::_numericMonthToString($month, false); } else { $month_day = $day; } if (!$is_portfolio_embedded && (!$disable_empty || $has_events)) { $this->tpl->setCurrentBlock('month_day_link'); $this->ctrl->clearParametersByClass('ilcalendardaygui'); $this->ctrl->setParameterByClass('ilcalendardaygui', 'seed', $date->get(IL_CAL_DATE)); $this->tpl->setVariable('OPEN_DAY_VIEW', $this->ctrl->getLinkTargetByClass('ilcalendardaygui', '')); $this->ctrl->clearParametersByClass('ilcalendardaygui'); } else { $this->tpl->setCurrentBlock('month_day_no_link'); } $this->tpl->setVariable('MONTH_DAY', $month_day); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock('month_col'); include_once './Services/Calendar/classes/class.ilCalendarUtil.php'; if (ilCalendarUtil::_isToday($date)) { $this->tpl->setVariable('TD_CLASS', 'caltoday'); } elseif (ilDateTime::_equals($date, $this->seed, IL_CAL_MONTH)) { $this->tpl->setVariable('TD_CLASS', 'calstd'); } elseif (ilDateTime::_before($date, $this->seed, IL_CAL_MONTH)) { $this->tpl->setVariable('TD_CLASS', 'calprev'); } else { $this->tpl->setVariable('TD_CLASS', 'calnext'); } $this->tpl->parseCurrentBlock(); if ($counter and !($counter % 7)) { $this->tpl->setCurrentBlock('month_row'); $this->tpl->parseCurrentBlock(); } } }
/** * * * @access protected * @param * @return */ protected function buildYearlyByDaySelection($tpl) { $tpl->setVariable('TXT_ON_THE', $this->lng->txt('cal_on_the')); $chosen_num_day = 1; $chosen_day = 'MO'; $chosen = false; foreach ($this->recurrence->getBYDAYList() as $byday) { if (preg_match('/^(-?\\d)([A-Z][A-Z])/', $byday, $parsed) === 1) { $chosen = true; $chosen_num_day = $parsed[1]; $chosen_day = $parsed[2]; } } $num_options = array(1 => $this->lng->txt('cal_first'), 2 => $this->lng->txt('cal_second'), 3 => $this->lng->txt('cal_third'), 4 => $this->lng->txt('cal_fourth'), 5 => $this->lng->txt('cal_fifth'), -1 => $this->lng->txt('cal_last')); $tpl->setVariable('SELECT_BYDAY_NUM_YEARLY', ilUtil::formSelect($chosen_num_day, 'yearly_byday_num', $num_options, false, true, '', '', array('onchange' => "ilUpdateSubTypeSelection('sub_yearly_radio_1');"))); $days = array(0 => 'SU', 1 => 'MO', 2 => 'TU', 3 => 'WE', 4 => 'TH', 5 => 'FR', 6 => 'SA', 7 => 'SU'); for ($i = (int) $this->user_settings->getWeekStart(); $i < 7 + (int) $this->user_settings->getWeekStart(); $i++) { $days_select[$days[$i]] = ilCalendarUtil::_numericDayToString($i); } $tpl->setVariable('SELECT_BYDAY_DAY_YEARLY', ilUtil::formSelect($chosen_day, 'yearly_byday', $days_select, false, true, '', '', array('onchange' => "ilUpdateSubTypeSelection('sub_yearly_radio_1');"))); $chosen = false; $chosen_month = 1; foreach ($this->recurrence->getBYMONTHList() as $month) { if ($this->recurrence->getBYMONTHDAYList()) { $chosen_month = $month; $chosen = true; break; } } $options = array(); for ($m = 1; $m < 13; $m++) { $options[$m] = ilCalendarUtil::_numericMonthToString($m); } $tpl->setVariable('SELECT_BYMONTH_BYDAY', ilUtil::formSelect($chosen_month, 'yearly_bymonth_byday', $options, false, true, '', '', array('onchange' => "ilUpdateSubTypeSelection('sub_yearly_radio_1');"))); }