/** * Get feed icons HTML * * @param * @return */ function getFeedIconsHTML() { global $lng; $html = ""; include_once "./Services/Block/classes/class.ilBlockSetting.php"; $public_feed = ilBlockSetting::_lookup("news", "public_feed", 0, $this->object->getId()); // rss icon/link if ($public_feed) { $news_set = new ilSetting("news"); $enable_internal_rss = $news_set->get("enable_rss_for_internal"); if ($enable_internal_rss) { // create dummy object in db (we need an id) $items = $this->object->getItemsArray(); include_once "./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php"; $html = ""; foreach (ilObjMediaCast::$purposes as $purpose) { foreach ($items as $id => $item) { $mob = new ilObjMediaObject($item["mob_id"]); $mob->read(); if ($mob->hasPurposeItem($purpose)) { if ($html == "") { $html = " "; } $url = ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&" . "ref_id=" . $_GET["ref_id"] . "&purpose={$purpose}"; $title = $lng->txt("news_feed_url"); include_once "./Services/News/classes/class.ilRSSButtonGUI.php"; switch (strtolower($purpose)) { case "audioportable": $type1 = ilRSSButtonGUI::ICON_RSS_AUDIO; $type2 = ilRSSButtonGUI::ICON_ITUNES_AUDIO; break; case "videoportable": $type1 = ilRSSButtonGUI::ICON_RSS_VIDEO; $type2 = ilRSSButtonGUI::ICON_ITUNES_VIDEO; break; default: $type1 = ilRSSButtonGUI::ICON_RSS; $type2 = ilRSSButtonGUI::ICON_ITUNES; break; } $row1 .= " " . ilRSSButtonGUI::get($type1, $url); if ($this->object->getPublicFiles()) { $url = preg_replace("/https?/i", "itpc", $url); $title = $lng->txt("news_feed_url"); include_once "./Services/News/classes/class.ilRSSButtonGUI.php"; $row2 .= " " . ilRSSButtonGUI::get($type2, $url); } break; } } } if ($html != "") { $html .= $row1; if ($row2 != "") { $html .= $row2; } } } } return $html; }
/** * Get bloch HTML code. */ function getHTML() { global $ilCtrl, $lng, $ilUser, $ilAccess; if ($this->getCurrentDetailLevel() == 0) { return ""; } // add edit commands #if ($this->getEnableEdit()) if ($this->mode == ilCalendarCategories::MODE_PERSONAL_DESKTOP_ITEMS or $this->mode == ilCalendarCategories::MODE_PERSONAL_DESKTOP_MEMBERSHIP) { include_once "./Services/News/classes/class.ilRSSButtonGUI.php"; $this->addBlockCommand($this->ctrl->getLinkTarget($this, 'showCalendarSubscription'), $lng->txt('ical_export'), "", "", true, false, ilRSSButtonGUI::get(ilRSSButtonGUI::ICON_ICAL)); } if ($this->mode == ilCalendarCategories::MODE_REPOSITORY) { if (!isset($_GET["bkid"])) { if ($ilAccess->checkAccess('edit_event', '', (int) $_GET['ref_id'])) { $ilCtrl->setParameter($this, "add_mode", "block"); $this->addBlockCommand($ilCtrl->getLinkTargetByClass("ilCalendarAppointmentGUI", "add"), $lng->txt("add_appointment")); $ilCtrl->setParameter($this, "add_mode", ""); } global $ilObjDataCache; include_once "Modules/Course/classes/class.ilCourseParticipants.php"; $obj_id = $ilObjDataCache->lookupObjId((int) $_GET['ref_id']); $participants = ilCourseParticipants::_getInstanceByObjId($obj_id); $users = array_unique(array_merge($participants->getTutors(), $participants->getAdmins())); //$users = $participants->getParticipants(); include_once 'Services/Booking/classes/class.ilBookingEntry.php'; //$users = ilBookingEntry::isBookable($users, $obj_id); $users = ilBookingEntry::lookupBookableUsersForObject($obj_id, $users); if ($users) { foreach ($users as $user_id) { if (!isset($_GET["bkid"])) { $ilCtrl->setParameter($this, "bkid", $user_id); $this->addBlockCommand($ilCtrl->getLinkTargetByClass("ilCalendarMonthGUI", ""), $lng->txt("cal_consultation_hours_for") . ' ' . ilObjUser::_lookupFullname($user_id)); $this->cal_footer[] = array('link' => $ilCtrl->getLinkTargetByClass('ilCalendarMonthGUI', ''), 'txt' => $lng->txt("cal_consultation_hours_for") . ' ' . ilObjUser::_lookupFullname($user_id)); } } $ilCtrl->setParameter($this, "bkid", ""); } } else { $ilCtrl->setParameter($this, "bkid", ""); $this->addBlockCommand($ilCtrl->getLinkTarget($this), $lng->txt("back")); $ilCtrl->setParameter($this, "bkid", (int) $_GET["bkid"]); } } if ($this->getProperty("settings") == true) { $this->addBlockCommand($ilCtrl->getLinkTarget($this, "editSettings"), $lng->txt("settings")); } $ilCtrl->setParameterByClass("ilcolumngui", "seed", isset($_GET["seed"]) ? $_GET["seed"] : ""); $ret = parent::getHTML(); $ilCtrl->setParameterByClass("ilcolumngui", "seed", ""); return $ret; }
/** * show calendar details * * @access protected * @return */ protected function details() { global $tpl; if (!$_GET['category_id']) { ilUtil::sendFailure($this->lng->txt('select_one'), true); $this->ctrl->returnToParent($this); } $this->readPermissions(); $this->checkVisible(); $category = new ilCalendarCategory((int) $_GET['category_id']); if (!in_array($category->getType(), array(ilCalendarCategory::TYPE_CH, ilCalendarCategory::TYPE_BOOK))) { include_once "./Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php"; $toolbar = new ilToolbarGui(); $toolbar->addButton($this->lng->txt("cal_add_appointment"), $this->ctrl->getLinkTargetByClass("ilcalendarappointmentgui", "add")); if (!in_array($category->getType(), array(ilCalendarCategory::TYPE_CH, ilCalendarCategory::TYPE_BOOK))) { $toolbar->addButton($this->lng->txt("cal_import_appointments"), $this->ctrl->getLinkTarget($this, "importAppointments")); } $toolbar = $toolbar->getHTML(); } // Non editable category include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php"; $info = new ilInfoScreenGUI($this); $info->setFormAction($this->ctrl->getFormAction($this)); $info->addSection($this->lng->txt('cal_cal_details')); // Calendar Name $info->addProperty($this->lng->txt('cal_calendar_name'), $category->getTitle()); switch ($category->getType()) { case ilCalendarCategory::TYPE_USR: $info->addProperty($this->lng->txt('cal_cal_type'), $this->lng->txt('cal_type_personal')); break; case ilCalendarCategory::TYPE_GLOBAL: $info->addProperty($this->lng->txt('cal_cal_type'), $this->lng->txt('cal_type_system')); break; case ilCalendarCategory::TYPE_OBJ: $info->addProperty($this->lng->txt('cal_cal_type'), $this->lng->txt('cal_type_' . $category->getObjType())); $info->addSection($this->lng->txt('additional_info')); $info->addProperty($this->lng->txt('perma_link'), $this->addReferenceLinks($category->getObjId())); break; case ilCalendarCategory::TYPE_CH: case ilCalendarCategory::TYPE_BOOK: // nothing to do break; } // Ical link include_once "./Services/News/classes/class.ilRSSButtonGUI.php"; $this->ctrl->setParameterByClass('ilcalendarsubscriptiongui', 'cal_id', (int) $_GET['category_id']); $info->addProperty($this->lng->txt('cal_ical_infoscreen'), ilRSSButtonGUI::get(ilRSSButtonGUI::ICON_ICAL), $this->ctrl->getLinkTargetByClass(array('ilcalendarpresentationgui', 'ilcalendarsubscriptiongui'))); $tpl->setContent($toolbar . $info->getHTML() . $this->showAssignedAppointments()); }
/** * Get bloch HTML code. */ function getHTML() { global $ilCtrl, $lng, $ilUser; $news_set = new ilSetting("news"); $enable_internal_rss = $news_set->get("enable_rss_for_internal"); $hide_block = ilBlockSetting::_lookup($this->getBlockType(), "hide_news_block", 0, $this->block_id); if ($hide_block) { $this->setFooterInfo($lng->txt("news_hidden_news_block")); } if ($this->getProperty("title") != "") { $this->setTitle($this->getProperty("title")); } $public_feed = ilBlockSetting::_lookup($this->getBlockType(), "public_feed", 0, $this->block_id); if ($public_feed) { if ($enable_internal_rss) { include_once "./Services/News/classes/class.ilRSSButtonGUI.php"; $this->addBlockCommand(ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&" . "ref_id=" . $_GET["ref_id"], $lng->txt("news_feed_url"), "", "", true, false, ilRSSButtonGUI::get(ilRSSButtonGUI::ICON_RSS)); } } /* Subscription Concept is abandonded for now (Alex) // subscribe/unsibscribe link include_once("./Services/News/classes/class.ilNewsSubscription.php"); if (ilNewsSubscription::_hasSubscribed($_GET["ref_id"], $ilUser->getId())) { $this->addBlockCommand( $ilCtrl->getLinkTarget($this, "unsubscribeNews"), $lng->txt("news_unsubscribe")); } else { $this->addBlockCommand( $ilCtrl->getLinkTarget($this, "subscribeNews"), $lng->txt("news_subscribe")); } */ // add edit commands if ($this->getEnableEdit()) { $this->addBlockCommand($ilCtrl->getLinkTargetByClass("ilnewsitemgui", "editNews"), $lng->txt("edit")); $ilCtrl->setParameter($this, "add_mode", "block"); $this->addBlockCommand($ilCtrl->getLinkTargetByClass("ilnewsitemgui", "createNewsItem"), $lng->txt("add")); $ilCtrl->setParameter($this, "add_mode", ""); } if ($this->getProperty("settings") == true) { $this->addBlockCommand($ilCtrl->getLinkTarget($this, "editSettings"), $lng->txt("settings")); } // do not display hidden repository news blocks for users // who do not have write permission if (!$this->getEnableEdit() && $this->getRepositoryMode() && ilBlockSetting::_lookup($this->getBlockType(), "hide_news_block", 0, $this->block_id)) { return ""; } // do not display empty news blocks for users // who do not have write permission if (count($this->getData()) == 0 && !$this->getEnableEdit() && $this->getRepositoryMode() && !$this->dynamic && (!$news_set->get("enable_rss_for_internal") || !ilBlockSetting::_lookup($this->getBlockType(), "public_feed", 0, $this->block_id))) { return ""; } $en = ""; if ($ilUser->getPref("il_feed_js") == "n") { // $en = getJSEnabler(); } return parent::getHTML() . $en; }
/** * Get bloch HTML code. */ function getHTML() { global $ilCtrl, $lng, $ilUser; // set footer info $this->setFooterInfo($lng->txt("news_block_information"), true); $news_set = new ilSetting("news"); $enable_internal_rss = $news_set->get("enable_rss_for_internal"); $allow_shorter_periods = $news_set->get("allow_shorter_periods"); $allow_longer_periods = $news_set->get("allow_longer_periods"); $enable_private_feed = $news_set->get("enable_private_feed"); // subscribe/unsibscribe link include_once "./Services/News/classes/class.ilNewsSubscription.php"; // show feed url if ($enable_internal_rss) { include_once "./Services/News/classes/class.ilRSSButtonGUI.php"; $this->addBlockCommand($ilCtrl->getLinkTarget($this, "showFeedUrl"), $lng->txt("news_get_feed_url"), "", "", true, false, ilRSSButtonGUI::get(ilRSSButtonGUI::ICON_RSS)); } if ($allow_shorter_periods || $allow_longer_periods || $enable_private_feed) { $this->addBlockCommand($ilCtrl->getLinkTarget($this, "editSettings"), $lng->txt("settings")); } $per = ilNewsItem::_lookupUserPDPeriod($ilUser->getId()); if ($per > 0) { switch ($per) { case 2: case 3: case 5: $per_str = sprintf($lng->txt("news_period_x_days"), $per); break; case 7: $per_str = $lng->txt("news_period_1_week"); break; case 14: $per_str = sprintf($lng->txt("news_period_x_weeks"), 2); break; case 30: $per_str = $lng->txt("news_period_1_month"); break; case 60: $per_str = sprintf($lng->txt("news_period_x_months"), 2); break; case 120: $per_str = sprintf($lng->txt("news_period_x_months"), 4); break; case 180: $per_str = sprintf($lng->txt("news_period_x_months"), 6); break; case 366: $per_str = $lng->txt("news_period_1_year"); break; } if ($per_str != "") { $this->setTitle($this->getTitle() . ' <span style="font-weight:normal;">- ' . $per_str . "</span>"); } } if ($this->getCurrentDetailLevel() == 0) { return ""; } $en = ""; if ($ilUser->getPref("il_feed_js") == "n") { $en = $this->getJSEnabler(); } return ilBlockGUI::getHTML() . $en; }
/** * Build navigation blocks * * @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 */ function renderNavigation(array $a_items, $a_list_cmd = "render", $a_posting_cmd = "preview", $a_link_template = null, $a_show_inactive = false) { global $ilCtrl, $ilSetting; if ($this->object->getOrder()) { $order = array_flip($this->object->getOrder()); } else { $order = array("navigation" => 0, "keywords" => 2, "authors" => 1); } $wtpl = new ilTemplate("tpl.blog_list_navigation.html", true, true, "Modules/Blog"); $blocks = array(); // by date if (sizeof($a_items)) { $blocks[$order["navigation"]] = array($this->lng->txt("blog_navigation"), $this->renderNavigationByDate($a_items, $a_list_cmd, $a_posting_cmd, $a_link_template, $a_show_inactive)); } // authors if ($this->id_type == self::REPOSITORY_NODE_ID && $this->object->hasAuthors()) { $authors = $this->renderNavigationByAuthors($a_items, $a_list_cmd, $a_show_inactive); if ($authors) { $blocks[$order["authors"]] = array($this->lng->txt("blog_authors"), $authors); } } // is not part of (html) export if (!$a_link_template) { if ($this->object->hasKeywords()) { // keywords $may_edit_keywords = $_GET["blpg"] && $this->mayContribute($_GET["blpg"]) && $a_list_cmd != "preview" && $a_list_cmd != "gethtml"; $keywords = $this->renderNavigationByKeywords($a_list_cmd, $a_show_inactive); if ($keywords || $may_edit_keywords) { if (!$keywords) { $keywords = $this->lng->txt("blog_no_keywords"); } $cmd = null; if ($may_edit_keywords) { $ilCtrl->setParameterByClass("ilblogpostinggui", "blpg", $_GET["blpg"]); $cmd = $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "editKeywords"); $ilCtrl->setParameterByClass("ilblogpostinggui", "blpg", ""); } $blocks[$order["keywords"]] = array($this->lng->txt("blog_keywords"), $keywords, $cmd ? array($cmd, $this->lng->txt("blog_edit_keywords")) : null); } } // 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); include_once "./Services/News/classes/class.ilRSSButtonGUI.php"; $wtpl->setVariable("RSS_BUTTON", ilRSSButtonGUI::get(ilRSSButtonGUI::ICON_RSS, $url)); } } if (sizeof($blocks)) { include_once "Services/UIComponent/Panel/classes/class.ilPanelGUI.php"; ksort($blocks); foreach ($blocks as $block) { $panel = ilPanelGUI::getInstance(); $panel->setPanelStyle(ilPanelGUI::PANEL_STYLE_SECONDARY); $panel->setHeadingStyle(ilPanelGUI::HEADING_STYLE_BLOCK); $panel->setHeading($block[0]); $panel->setBody($block[1]); if (isset($block[2]) && is_array($block[2])) { $panel->setFooter('<a href="' . $block[2][0] . '">' . $block[2][1] . '</a>'); } $wtpl->setCurrentBlock("block_bl"); $wtpl->setVariable("BLOCK", $panel->getHTML()); $wtpl->parseCurrentBlock(); } } return $wtpl->get(); }
/** * fill row * * @access protected * @param * @return */ protected function fillRow($a_set) { $this->tpl->setVariable('VAL_ID', $a_set['id']); if (!$a_set['hidden']) { $this->tpl->setVariable('VAL_CHECKED', 'checked="checked"'); } $this->tpl->setVariable('VAL_TITLE', $a_set['title']); $this->tpl->setVariable('BGCOLOR', $a_set['color']); $this->ctrl->setParameter($this->getParentObject(), 'category_id', $a_set['id']); $this->tpl->setVariable('EDIT_LINK', $this->ctrl->getLinkTarget($this->getParentObject(), 'details')); $this->tpl->setVariable('TXT_EDIT', $this->lng->txt('edit')); switch ($a_set['type']) { case ilCalendarCategory::TYPE_GLOBAL: $this->tpl->setVariable('IMG_SRC', ilUtil::getImagePath('icon_calg.svg')); $this->tpl->setVariable('IMG_ALT', $this->lng->txt('cal_type_system')); break; case ilCalendarCategory::TYPE_USR: $this->tpl->setVariable('IMG_SRC', ilUtil::getImagePath('icon_usr.svg')); $this->tpl->setVariable('IMG_ALT', $this->lng->txt('cal_type_personal')); break; case ilCalendarCategory::TYPE_OBJ: $type = ilObject::_lookupType($a_set['obj_id']); $this->tpl->setVariable('IMG_SRC', ilUtil::getImagePath('icon_' . $type . '.svg')); $this->tpl->setVariable('IMG_ALT', $this->lng->txt('cal_type_' . $type)); break; } if (strlen($a_set['path'])) { $this->tpl->setCurrentBlock('calendar_path'); $this->tpl->setVariable('ADD_PATH_INFO', $a_set['path']); $this->tpl->parseCurrentBlock(); } // Subscription link $this->tpl->setVariable('SUB_SRC', ilRSSButtonGUI::get(ilRSSButtonGUI::ICON_ICAL)); $this->ctrl->setParameterByClass('ilcalendarsubscriptiongui', 'seed', $this->seed->get(IL_CAL_DATE)); $this->ctrl->setParameterByClass('ilcalendarsubscriptiongui', 'cal_id', $a_set['id']); $this->tpl->setVariable('SUB_LINK', $this->ctrl->getLinkTargetByClass(array('ilcalendarpresentationgui', 'ilcalendarsubscriptiongui'))); $this->tpl->setVariable('SUB_ALT', $this->lng->txt('ical_export')); }