/**
  * Standard Version of Fill Row. Most likely to
  * be overwritten by derived class.
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl;
     include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
     $title = ilWikiPage::lookupTitle($a_set);
     $this->tpl->setVariable("TXT_PAGE_TITLE", $title);
     $ilCtrl->setParameterByClass("ilwikipagegui", "page", ilWikiUtil::makeUrlTitle($title));
     $this->tpl->setVariable("HREF_PAGE", $ilCtrl->getLinkTargetByClass("ilwikipagegui", "preview"));
 }
 /**
  * Standard Version of Fill Row. Most likely to
  * be overwritten by derived class.
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl;
     include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
     $title = ilWikiPage::lookupTitle($a_set["id"]);
     $this->tpl->setVariable("TXT_PAGE_TITLE", $title);
     $this->tpl->setVariable("DATE", ilDatePresentation::formatDate(new ilDateTime($a_set["date"], IL_CAL_DATETIME)));
     $ilCtrl->setParameterByClass("ilwikipagegui", "page", rawurlencode($title));
     $ilCtrl->setParameterByClass("ilwikipagegui", "old_nr", $a_set["nr"]);
     $this->tpl->setVariable("HREF_PAGE", $ilCtrl->getLinkTargetByClass("ilwikipagegui", "preview"));
     // user name
     include_once "./Services/User/classes/class.ilUserUtil.php";
     $this->tpl->setVariable("TXT_USER", ilUserUtil::getNamePresentation($a_set["user"], true, true, $ilCtrl->getLinkTarget($this->getParentObject(), $this->getParentCmd())));
 }
 /**
  * Fill table row
  */
 protected function fillRow($a_set)
 {
     global $lng;
     if ($a_set["page_id"] > 0) {
         $this->tpl->setCurrentBlock("cb");
         $this->tpl->setVariable("PAGE_ID", $a_set["page_id"]);
         $this->tpl->parseCurrentBlock();
         $this->tpl->setCurrentBlock("ord");
         $this->tpl->setVariable("PAGE_ID_ORD", $a_set["page_id"]);
         $this->tpl->setVariable("VAL_ORD", $a_set["ord"]);
         $this->tpl->parseCurrentBlock();
         $this->tpl->setVariable("PAGE_TITLE", ilWikiPage::lookupTitle($a_set["page_id"]));
         $this->tpl->setVariable("SEL_INDENT", ilUtil::formSelect($a_set["indent"], "indent[" . $a_set["page_id"] . "]", array(0 => "0", 1 => "1", 2 => "2"), false, true));
     } else {
         $this->tpl->setVariable("PAGE_TITLE", $lng->txt("wiki_start_page"));
     }
 }
 function ilWikiPagesTableGUI($a_parent_obj, $a_parent_cmd = "", $a_wiki_id, $a_mode = IL_WIKI_ALL_PAGES, $a_page_id = 0)
 {
     global $ilCtrl, $lng;
     parent::__construct($a_parent_obj, $a_parent_cmd);
     $this->pg_list_mode = $a_mode;
     $this->wiki_id = $a_wiki_id;
     $this->page_id = $a_page_id;
     switch ($this->pg_list_mode) {
         case IL_WIKI_NEW_PAGES:
             $this->addColumn($lng->txt("created"), "created", "33%");
             $this->addColumn($lng->txt("wiki_page"), "title", "33%");
             $this->addColumn($lng->txt("wiki_created_by"), "user_sort", "34%");
             $this->setRowTemplate("tpl.table_row_wiki_new_page.html", "Modules/Wiki");
             break;
         case IL_WIKI_POPULAR_PAGES:
             $this->addColumn($lng->txt("wiki_page"), "title", "50%");
             $this->addColumn($lng->txt("wiki_page_hits"), "cnt", "50%");
             $this->setRowTemplate("tpl.table_row_wiki_popular_page.html", "Modules/Wiki");
             break;
         case IL_WIKI_ORPHANED_PAGES:
             $this->addColumn($lng->txt("wiki_page"), "title", "100%");
             $this->setRowTemplate("tpl.table_row_wiki_orphaned_page.html", "Modules/Wiki");
             break;
         default:
             $this->addColumn($lng->txt("wiki_page"), "title", "33%");
             $this->addColumn($lng->txt("wiki_last_changed"), "date", "33%");
             $this->addColumn($lng->txt("wiki_last_changed_by"), "user_sort", "34%");
             $this->setRowTemplate("tpl.table_row_wiki_page.html", "Modules/Wiki");
             break;
     }
     $this->setEnableHeader(true);
     $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
     $this->getPages();
     $this->setShowRowsSelector(true);
     switch ($this->pg_list_mode) {
         case IL_WIKI_WHAT_LINKS_HERE:
             $this->setTitle(sprintf($lng->txt("wiki_what_links_to_page"), ilWikiPage::lookupTitle($this->page_id)));
             break;
         default:
             $this->setTitle($lng->txt("wiki_" . $a_mode . "_pages"));
             break;
     }
 }
 /**
  * execute command
  */
 function &executeCommand()
 {
     global $lng, $ilAccess, $tpl, $ilNavigationHistory;
     $cmd = $this->ctrl->getCmd();
     $next_class = $this->ctrl->getNextClass($this);
     if ($next_class == "") {
         $this->ctrl->setCmdClass("ilobjwikigui");
         $next_class = $this->ctrl->getNextClass($this);
     }
     // add entry to navigation history
     if ($ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
         $obj_id = ilObject::_lookupObjId($_GET["ref_id"]);
         $title = ilObject::_lookupTitle($obj_id);
         if ($_GET["page"] != "") {
             $page = $_GET["page"];
         } else {
             include_once "./Modules/Wiki/classes/class.ilObjWiki.php";
             $page = ilObjWiki::_lookupStartPage($obj_id);
         }
         include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
         if (ilWikiPage::exists($obj_id, $page)) {
             include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
             $add = "_" . rawurlencode($page);
             $page_id = ilWikiPage::getPageIdForTitle($obj_id, $page);
             $ptitle = ilWikiPage::lookupTitle($page_id);
             $title .= ": " . $ptitle;
             $append = $_GET["page"] != "" ? "_" . ilWikiUtil::makeUrlTitle($page) : "";
             include_once './Services/Link/classes/class.ilLink.php';
             $goto = ilLink::_getStaticLink($_GET["ref_id"], "wiki", true, $append);
             //var_dump($goto);
             $ilNavigationHistory->addItem($_GET["ref_id"], "./goto.php?target=wiki_" . $_GET["ref_id"] . $add, "wiki", $title, $page_id, $goto);
         }
     }
     switch ($next_class) {
         case 'ilobjwikigui':
             require_once "./Modules/Wiki/classes/class.ilObjWikiGUI.php";
             $mc_gui =& new ilObjWikiGUI("", (int) $_GET["ref_id"], true, false);
             $this->ctrl->forwardCommand($mc_gui);
             break;
     }
     $tpl->show();
 }
 /**
  * get html 
  * @return
  */
 public function getHTML()
 {
     global $lng, $ilUser;
     $lng->loadLanguageModule('content');
     foreach ($this->getSubItemIds(true) as $sub_item) {
         if (is_object($this->getHighlighter()) and strlen($this->getHighlighter()->getContent($this->getObjId(), $sub_item))) {
             $this->tpl->setCurrentBlock('sea_fragment');
             $this->tpl->setVariable('TXT_FRAGMENT', $this->getHighlighter()->getContent($this->getObjId(), $sub_item));
             $this->tpl->parseCurrentBlock();
         }
         $this->tpl->setCurrentBlock('subitem');
         // TODO: subitem type must returned from lucene
         if (($title = ilWikiPage::lookupTitle($sub_item)) !== false) {
             // Page
             $this->tpl->setVariable('SUBITEM_TYPE', $lng->txt('obj_pg'));
             $this->tpl->setVariable('SEPERATOR', ':');
             include_once './Services/Search/classes/class.ilUserSearchCache.php';
             $link = '&srcstring=1';
             $link = ilObjWikiGUI::getGotoLink($this->getRefId(), $title) . $link;
             $this->tpl->setVariable('LINK', $link);
             $this->tpl->setVariable('TARGET', $this->getItemListGUI()->getCommandFrame(''));
             $this->tpl->setVariable('TITLE', $title);
             $this->tpl->parseCurrentBlock();
         } else {
             $this->tpl->setVariable('SUBITEM_TYPE', $lng->txt('obj_file'));
             $this->tpl->setVariable('SEPERATOR', ':');
             // File
             $this->getItemListGUI()->setChildId('il__file_' . $sub_item);
             $link = $this->getItemListGUI()->getCommandLink('downloadFile');
             $this->tpl->setVariable('LINK', $link);
             $this->tpl->setVariable('TITLE', ilObject::_lookupTitle($sub_item));
             $this->tpl->parseCurrentBlock();
         }
         if (count($this->getSubItemIds(true)) > 1) {
             $this->parseRelevance($sub_item);
         }
         $this->tpl->parseCurrentBlock();
     }
     $this->showDetailsLink();
     return $this->tpl->get();
 }
 function ilObjectFeedWriter($a_ref_id, $a_userid = false, $a_purpose = false)
 {
     global $ilSetting, $lng;
     parent::ilFeedWriter();
     if ($a_ref_id <= 0) {
         return;
     }
     include_once "./Services/Block/classes/class.ilBlockSetting.php";
     $news_set = new ilSetting("news");
     if (!$news_set->get("enable_rss_for_internal")) {
         return;
     }
     $obj_id = ilObject::_lookupObjId($a_ref_id);
     $obj_type = ilObject::_lookupType($obj_id);
     $obj_title = ilObject::_lookupTitle($obj_id);
     if (!ilBlockSetting::_lookup("news", "public_feed", 0, $obj_id)) {
         return;
     }
     if ($ilSetting->get('short_inst_name') != "") {
         $this->setChannelTitle($ilSetting->get('short_inst_name') . " - " . $this->prepareStr($loc . $obj_title));
     } else {
         $this->setChannelTitle("ILIAS" . " - " . $this->prepareStr($loc . $obj_title . ($a_purpose ? " - " . $a_purpose : "")));
     }
     $this->setChannelAbout(ILIAS_HTTP_PATH);
     $this->setChannelLink(ILIAS_HTTP_PATH);
     // not nice, to do: general solution
     if ($obj_type == "mcst") {
         include_once "./Modules/MediaCast/classes/class.ilObjMediaCastAccess.php";
         if (!ilObjMediaCastAccess::_lookupOnline($obj_id)) {
             $lng->loadLanguageModule("mcst");
             $feed_item = new ilFeedItem();
             $feed_item->setTitle($lng->txt("mcst_media_cast_not_online"));
             $feed_item->setDescription($lng->txt("mcst_media_cast_not_online_text"));
             $feed_item->setLink(ILIAS_HTTP_PATH . "/goto.php?client_id=" . CLIENT_ID . "&amp;target=" . $item["context_obj_type"]);
             $this->addItem($feed_item);
             return;
         }
     }
     include_once "./Services/Locator/classes/class.ilLocatorGUI.php";
     $cont_loc = new ilLocatorGUI();
     $cont_loc->addContextItems($a_ref_id, true);
     $cont_loc->setTextOnly(true);
     $loc = $cont_loc->getTextVersion();
     if (trim($loc) != "") {
         $loc = " [" . $loc . "] ";
     }
     $rss_period = ilNewsItem::_lookupRSSPeriod();
     ilNewsItem::setPrivateFeedId($a_userid);
     $news_item = new ilNewsItem();
     $news_item->setContextObjId($obj_id);
     $news_item->setContextObjType($obj_type);
     $items = $news_item->getNewsForRefId($a_ref_id, true, false, $rss_period, true);
     if ($a_purpose) {
         include_once "./Services/MediaObjects/classes/class.ilMediaItem.php";
     }
     $i = 0;
     foreach ($items as $item) {
         $i++;
         if ($a_purpose != false && $obj_type == "mcst") {
             $mob = ilMediaItem::_getMediaItemsOfMObId($item[mob_id], $a_purpose);
             if ($mob == false) {
                 continue;
             }
         }
         $obj_title = ilObject::_lookupTitle($item["context_obj_id"]);
         $feed_item = new ilFeedItem();
         $title = ilNewsItem::determineNewsTitle($item["context_obj_type"], $item["title"], $item["content_is_lang_var"], $item["agg_ref_id"], $item["aggregation"]);
         // path
         $cont_loc = new ilLocatorGUI();
         $cont_loc->addContextItems($item["ref_id"], true, $a_ref_id);
         $cont_loc->setTextOnly(true);
         $loc = $cont_loc->getHTML();
         if (trim($loc) != "") {
             $loc = "[" . $loc . "]";
         }
         if ($news_set->get("rss_title_format") == "news_obj") {
             $sep = trim($this->prepareStr($loc)) == "" ? "" : " ";
             $feed_item->setTitle($this->prepareStr($title) . " (" . $this->prepareStr($loc) . $sep . $this->prepareStr($obj_title) . ")");
         } else {
             $feed_item->setTitle($this->prepareStr($loc) . " " . $this->prepareStr($obj_title) . ": " . $this->prepareStr($title));
         }
         $feed_item->setDescription($this->prepareStr(nl2br(ilNewsItem::determineNewsContent($item["context_obj_type"], $item["content"], $item["content_text_is_lang_var"]))));
         // lm hack, not nice
         if (in_array($item["context_obj_type"], array("dbk", "lm")) && $item["context_sub_obj_type"] == "pg" && $item["context_sub_obj_id"] > 0) {
             $feed_item->setLink(ILIAS_HTTP_PATH . "/goto.php?client_id=" . CLIENT_ID . "&amp;target=pg_" . $item["context_sub_obj_id"] . "_" . $item["ref_id"]);
         } else {
             if ($item["context_obj_type"] == "wiki" && $item["context_sub_obj_type"] == "wpg" && $item["context_sub_obj_id"] > 0) {
                 include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
                 $wptitle = ilWikiPage::lookupTitle($item["context_sub_obj_id"]);
                 $feed_item->setLink(ILIAS_HTTP_PATH . "/goto.php?client_id=" . CLIENT_ID . "&amp;target=" . $item["context_obj_type"] . "_" . $item["ref_id"] . "_" . $wptitle);
             } else {
                 if (in_array($item["context_obj_type"], array("frm")) && $item["context_sub_obj_type"] == "pos" && $item["context_sub_obj_id"] > 0) {
                     // frm hack, not nice
                     include_once "./Modules/Forum/classes/class.ilObjForumAccess.php";
                     $thread_id = ilObjForumAccess::_getThreadForPosting($item["context_sub_obj_id"]);
                     if ($thread_id > 0) {
                         $feed_item->setLink(ILIAS_HTTP_PATH . "/goto.php?client_id=" . CLIENT_ID . "&amp;target=" . $item["context_obj_type"] . "_" . $item["ref_id"] . "_" . $thread_id . "_" . $item["context_sub_obj_id"]);
                     } else {
                         $feed_item->setLink(ILIAS_HTTP_PATH . "/goto.php?client_id=" . CLIENT_ID . "&amp;target=" . $item["context_obj_type"] . "_" . $item["ref_id"]);
                     }
                 } else {
                     $feed_item->setLink(ILIAS_HTTP_PATH . "/goto.php?client_id=" . CLIENT_ID . "&amp;target=" . $item["context_obj_type"] . "_" . $item["ref_id"]);
                     //echo "<br>".ILIAS_HTTP_PATH."/goto.php?client_id=".CLIENT_ID.
                     //					"&amp;target=".$item["context_obj_type"]."_".$item["ref_id"];
                 }
             }
         }
         $feed_item->setAbout($feed_item->getLink() . "&amp;il_about_feed=" . $item["id"]);
         $feed_item->setDate($item["creation_date"]);
         // Enclosure
         if ($item["content_type"] == NEWS_AUDIO && $item["mob_id"] > 0 && ilObject::_exists($item["mob_id"])) {
             $go_on = true;
             if ($obj_type == "mcst") {
                 include_once "./Modules/MediaCast/classes/class.ilObjMediaCastAccess.php";
                 if (!ilObjMediaCastAccess::_lookupPublicFiles($obj_id)) {
                     $go_on = false;
                 }
             }
             if ($go_on) {
                 include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
                 $url = ilObjMediaObject::_lookupItemPath($item["mob_id"], true, true, $mob["purpose"]);
                 $file = ilObjMediaObject::_lookupItemPath($item["mob_id"], false, false, $mob["purpose"]);
                 if (is_file($file)) {
                     $size = filesize($file);
                 }
                 $feed_item->setEnclosureUrl($url);
                 $feed_item->setEnclosureType(isset($mob["format"]) ? $mob["format"] : "audio/mpeg");
                 $feed_item->setEnclosureLength($size);
             }
         }
         $this->addItem($feed_item);
     }
 }
 protected function export()
 {
     global $ilCtrl;
     $params = $this->viewToolbar();
     if ($params) {
         // data
         $tfr = explode("-", (string) $params["month"]);
         $day_from = date("Y-m-d", mktime(0, 0, 1, $tfr[1] - ($params["scope"] - 1), 1, $tfr[0]));
         $day_to = date("Y-m-d", mktime(0, 0, 1, $tfr[1] + 1, 0, $tfr[0]));
         unset($tfr);
         $chart_data = $this->getChartData($params["figure"], $params["scope"], $day_from, $day_to);
         // excel
         $period = ilDatePresentation::formatPeriod(new ilDate($day_from, IL_CAL_DATE), new ilDate($day_to, IL_CAL_DATE));
         $filename = ilObject::_lookupTitle($this->wiki_id);
         if ($this->page_id) {
             $filename .= " - " . ilWikiPage::lookupTitle($this->page_id);
         }
         $filename .= " - " . ilWikiStat::getFigureTitle($params["figure"]) . " - " . $period . ".xls";
         include_once "./Services/Excel/classes/class.ilExcelUtils.php";
         include_once "./Services/Excel/classes/class.ilExcelWriterAdapter.php";
         $adapter = new ilExcelWriterAdapter($filename, true);
         $workbook = $adapter->getWorkbook();
         $worksheet = $workbook->addWorksheet();
         // $worksheet->setLandscape();
         /*
         $worksheet->setColumn(0, 0, 20);
         $worksheet->setColumn(1, 1, 40);
         */
         $row = 0;
         foreach ($chart_data as $day => $value) {
             $row++;
             $worksheet->writeString($row, 0, $day);
             $worksheet->writeNumber($row, 1, $value);
         }
         $workbook->close();
         exit;
     }
     $ilCtrl->redirect($this, "view");
 }
 /**
  * Used for rating export
  * 
  * @param int $a_id
  * @param string $a_type
  * @return string
  */
 function getSubObjectTitle($a_id, $a_type)
 {
     include_once "Modules/Wiki/classes/class.ilWikiPage.php";
     return ilWikiPage::lookupTitle($a_id);
 }
 function ilUserFeedWriter($a_user_id, $a_hash, $privFeed = false)
 {
     global $ilSetting, $lng;
     parent::ilFeedWriter();
     //$lng->loadLanguageModule("news");
     if ($a_user_id == "" || $a_hash == "") {
         return;
     }
     $news_set = new ilSetting("news");
     if (!$news_set->get("enable_rss_for_internal")) {
         return;
     }
     include_once "Services/User/classes/class.ilObjUser.php";
     $hash = ilObjUser::_lookupFeedHash($a_user_id);
     include_once "./Services/News/classes/class.ilNewsItem.php";
     $rss_period = ilNewsItem::_lookupRSSPeriod();
     if ($a_hash == $hash) {
         if ($privFeed) {
             //ilNewsItem::setPrivateFeedId($a_user_id);
             $items = ilNewsItem::_getNewsItemsOfUser($a_user_id, false, true, $rss_period);
         } else {
             $items = ilNewsItem::_getNewsItemsOfUser($a_user_id, true, true, $rss_period);
         }
         if ($ilSetting->get('short_inst_name') != "") {
             $this->setChannelTitle($ilSetting->get('short_inst_name'));
         } else {
             $this->setChannelTitle("ILIAS");
         }
         $this->setChannelAbout(ILIAS_HTTP_PATH);
         $this->setChannelLink(ILIAS_HTTP_PATH);
         //$this->setChannelDescription("ILIAS Channel Description");
         $i = 0;
         foreach ($items as $item) {
             $obj_id = ilObject::_lookupObjId($item["ref_id"]);
             $obj_type = ilObject::_lookupType($obj_id);
             $obj_title = ilObject::_lookupTitle($obj_id);
             // not nice, to do: general solution
             if ($obj_type == "mcst") {
                 include_once "./Modules/MediaCast/classes/class.ilObjMediaCastAccess.php";
                 if (!ilObjMediaCastAccess::_lookupOnline($obj_id)) {
                     continue;
                 }
             }
             $i++;
             $feed_item = new ilFeedItem();
             $title = ilNewsItem::determineNewsTitle($item["context_obj_type"], $item["title"], $item["content_is_lang_var"], $item["agg_ref_id"], $item["aggregation"]);
             // path
             $loc = $this->getContextPath($item["ref_id"]);
             // title
             if ($news_set->get("rss_title_format") == "news_obj") {
                 $feed_item->setTitle($this->prepareStr(str_replace("<br />", " ", $title)) . " (" . $this->prepareStr($loc) . " " . $this->prepareStr($obj_title) . ")");
             } else {
                 $feed_item->setTitle($this->prepareStr($loc) . " " . $this->prepareStr($obj_title) . ": " . $this->prepareStr(str_replace("<br />", " ", $title)));
             }
             // description
             $content = $this->prepareStr(nl2br(ilNewsItem::determineNewsContent($item["context_obj_type"], $item["content"], $item["content_text_is_lang_var"])));
             $feed_item->setDescription($content);
             // lm page hack, not nice
             if (in_array($item["context_obj_type"], array("dbk", "lm")) && $item["context_sub_obj_type"] == "pg" && $item["context_sub_obj_id"] > 0) {
                 $feed_item->setLink(ILIAS_HTTP_PATH . "/goto.php?client_id=" . CLIENT_ID . "&amp;target=pg_" . $item["context_sub_obj_id"] . "_" . $item["ref_id"]);
             } else {
                 if ($item["context_obj_type"] == "wiki" && $item["context_sub_obj_type"] == "wpg" && $item["context_sub_obj_id"] > 0) {
                     include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
                     $wptitle = ilWikiPage::lookupTitle($item["context_sub_obj_id"]);
                     $feed_item->setLink(ILIAS_HTTP_PATH . "/goto.php?client_id=" . CLIENT_ID . "&amp;target=" . $item["context_obj_type"] . "_" . $item["ref_id"] . "_" . urlencode($wptitle));
                     // #14629
                 } else {
                     if (in_array($item["context_obj_type"], array("frm")) && $item["context_sub_obj_type"] == "pos" && $item["context_sub_obj_id"] > 0) {
                         // frm hack, not nice
                         include_once "./Modules/Forum/classes/class.ilObjForumAccess.php";
                         $thread_id = ilObjForumAccess::_getThreadForPosting($item["context_sub_obj_id"]);
                         if ($thread_id > 0) {
                             $feed_item->setLink(ILIAS_HTTP_PATH . "/goto.php?client_id=" . CLIENT_ID . "&amp;target=" . $item["context_obj_type"] . "_" . $item["ref_id"] . "_" . $thread_id . "_" . $item["context_sub_obj_id"]);
                         } else {
                             $feed_item->setLink(ILIAS_HTTP_PATH . "/goto.php?client_id=" . CLIENT_ID . "&amp;target=" . $item["context_obj_type"] . "_" . $item["ref_id"]);
                         }
                     } else {
                         $feed_item->setLink(ILIAS_HTTP_PATH . "/goto.php?client_id=" . CLIENT_ID . "&amp;target=" . $item["context_obj_type"] . "_" . $item["ref_id"]);
                     }
                 }
             }
             $feed_item->setAbout($feed_item->getLink() . "&amp;il_about_feed=" . $item["id"]);
             $feed_item->setDate($item["creation_date"]);
             $this->addItem($feed_item);
         }
     }
 }
 /**
  * Standard Version of Fill Row. Most likely to
  * be overwritten by derived class.
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl, $ilAccess;
     $usage = $a_set;
     if (is_int(strpos($usage["type"], ":"))) {
         $us_arr = explode(":", $usage["type"]);
         $usage["type"] = $us_arr[1];
         $cont_type = $us_arr[0];
     }
     include_once './Services/Link/classes/class.ilLink.php';
     switch ($usage["type"]) {
         case "pg":
             $item = array();
             //$this->tpl->setVariable("TXT_OBJECT", $usage["type"].":".$usage["id"]);
             switch ($cont_type) {
                 case "sahs":
                     require_once "./Modules/Scorm2004/classes/class.ilSCORM2004Page.php";
                     $page_obj = new ilSCORM2004Page($usage["id"]);
                     require_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
                     require_once "./Modules/Scorm2004/classes/class.ilSCORM2004PageNode.php";
                     $lm_obj = new ilObjSAHSLearningModule($page_obj->getParentId(), false);
                     $item["obj_type_txt"] = $this->lng->txt("obj_" . $cont_type);
                     $item["obj_title"] = $lm_obj->getTitle();
                     $item["sub_txt"] = $this->lng->txt("pg");
                     $item["sub_title"] = ilSCORM2004PageNode::_lookupTitle($page_obj->getId());
                     $ref_id = $this->getFirstWritableRefId($lm_obj->getId());
                     if ($ref_id > 0) {
                         $item["obj_link"] = ilLink::_getStaticLink($ref_id, "sahs");
                     }
                     break;
                 case "lm":
                     require_once "./Modules/LearningModule/classes/class.ilLMPage.php";
                     $page_obj = new ilLMPage($usage["id"]);
                     require_once "./Modules/LearningModule/classes/class.ilObjContentObject.php";
                     require_once "./Modules/LearningModule/classes/class.ilObjLearningModule.php";
                     require_once "./Modules/LearningModule/classes/class.ilLMObject.php";
                     $lm_obj =& new ilObjLearningModule($page_obj->getParentId(), false);
                     $item["obj_type_txt"] = $this->lng->txt("obj_" . $cont_type);
                     $item["obj_title"] = $lm_obj->getTitle();
                     $item["sub_txt"] = $this->lng->txt("pg");
                     $item["sub_title"] = ilLMObject::_lookupTitle($page_obj->getId());
                     $ref_id = $this->getFirstWritableRefId($lm_obj->getId());
                     if ($ref_id > 0) {
                         $item["obj_link"] = ilLink::_getStaticLink($ref_id, "lm");
                     }
                     break;
                 case "wpg":
                     require_once "./Modules/Wiki/classes/class.ilWikiPage.php";
                     $page_obj = new ilWikiPage($usage["id"]);
                     $item["obj_type_txt"] = $this->lng->txt("obj_wiki");
                     $item["obj_title"] = ilObject::_lookupTitle($page_obj->getParentId());
                     $item["sub_txt"] = $this->lng->txt("pg");
                     $item["sub_title"] = ilWikiPage::lookupTitle($page_obj->getId());
                     $ref_id = $this->getFirstWritableRefId($page_obj->getParentId());
                     if ($ref_id > 0) {
                         $item["obj_link"] = ilLink::_getStaticLink($ref_id, "wiki");
                     }
                     break;
                 case "gdf":
                     require_once "./Modules/Glossary/classes/class.ilGlossaryDefPage.php";
                     $page_obj = new ilGlossaryDefPage($usage["id"]);
                     require_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php";
                     require_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php";
                     $term_id = ilGlossaryDefinition::_lookupTermId($page_obj->getId());
                     $glo_id = ilGlossaryTerm::_lookGlossaryId($term_id);
                     $item["obj_type_txt"] = $this->lng->txt("obj_glo");
                     $item["obj_title"] = ilObject::_lookupTitle($glo_id);
                     $item["sub_txt"] = $this->lng->txt("cont_term");
                     $item["sub_title"] = ilGlossaryTerm::_lookGlossaryTerm($term_id);
                     $ref_id = $this->getFirstWritableRefId($page_obj->getParentId());
                     if ($ref_id > 0) {
                         $item["obj_link"] = ilLink::_getStaticLink($ref_id, "glo");
                     }
                     break;
                 case "fold":
                 case "root":
                 case "crs":
                 case "grp":
                 case "cat":
                 case "cont":
                     $item["obj_type_txt"] = $this->lng->txt("obj_" . $cont_type);
                     $item["obj_title"] = ilObject::_lookupTitle($usage["id"]);
                     $ref_id = $this->getFirstWritableRefId($usage["id"]);
                     if ($ref_id > 0) {
                         $item["obj_link"] = ilLink::_getStaticLink($ref_id, $cont_type);
                     }
                     break;
                 default:
                     $item["obj_title"] = "Page " . $cont_type . ", " . $usage["id"];
                     break;
             }
             break;
         case "mep":
             $item["obj_type_txt"] = $this->lng->txt("obj_mep");
             $item["obj_title"] = ilObject::_lookupTitle($usage["id"]);
             $ref_id = $this->getFirstWritableRefId($usage["id"]);
             if ($ref_id > 0) {
                 $item["obj_link"] = ilLink::_getStaticLink($ref_id, "mep");
             }
             break;
         case "map":
             $item["obj_type_txt"] = $this->lng->txt("obj_mob");
             $item["obj_title"] = ilObject::_lookupTitle($usage["id"]);
             $item["sub_txt"] = $this->lng->txt("cont_link_area");
             break;
         case "sqst":
             $item["obj_type_txt"] = $this->lng->txt("cont_sqst");
             include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
             $obj_id = SurveyQuestion::lookupObjFi($usage["id"]);
             $item["obj_title"] = ilObject::_lookupTitle($obj_id);
             $item["sub_txt"] = $this->lng->txt("question");
             $item["sub_title"] = SurveyQuestion::_getTitle($usage["id"]);
             $ref_id = $this->getFirstWritableRefId($obj_id);
             if ($ref_id > 0) {
                 $item["obj_link"] = ilLink::_getStaticLink($ref_id);
             }
             break;
         default:
             $item["obj_title"] = "Type " . $usage["type"] . ", " . $usage["id"];
             break;
     }
     // show versions
     if (is_array($usage["hist_nr"]) && (count($usage["hist_nr"]) > 1 || $usage["hist_nr"][0] > 0)) {
         asort($usage["hist_nr"]);
         $ver = $sep = "";
         if ($usage["hist_nr"][0] == 0) {
             array_shift($usage["hist_nr"]);
             $usage["hist_nr"][] = 0;
         }
         foreach ($usage["hist_nr"] as $nr) {
             if ($nr > 0) {
                 $ver .= $sep . $nr;
             } else {
                 $ver .= $sep . $this->lng->txt("cont_current_version");
             }
             $sep = ", ";
         }
         $this->tpl->setCurrentBlock("versions");
         $this->tpl->setVariable("TXT_VERSIONS", $this->lng->txt("cont_versions"));
         $this->tpl->setVariable("VAL_VERSIONS", $ver);
         $this->tpl->parseCurrentBlock();
     }
     if ($item["obj_type_txt"] != "") {
         $this->tpl->setCurrentBlock("type");
         $this->tpl->setVariable("TXT_TYPE", $this->lng->txt("type"));
         $this->tpl->setVariable("VAL_TYPE", $item["obj_type_txt"]);
         $this->tpl->parseCurrentBlock();
     }
     if ($usage["type"] != "clip") {
         if ($item["obj_link"]) {
             $this->tpl->setCurrentBlock("linked_item");
             $this->tpl->setVariable("TXT_OBJECT", $item["obj_title"]);
             $this->tpl->setVariable("HREF_LINK", $item["obj_link"]);
             $this->tpl->parseCurrentBlock();
         } else {
             $this->tpl->setVariable("TXT_OBJECT_NO_LINK", $item["obj_title"]);
         }
         if ($item["sub_txt"] != "") {
             $this->tpl->setVariable("SEP", ", ");
             $this->tpl->setVariable("SUB_TXT", $item["sub_txt"]);
             if ($item["sub_title"] != "") {
                 $this->tpl->setVariable("SEP2", ": ");
                 $this->tpl->setVariable("SUB_TITLE", $item["sub_title"]);
             }
         }
     } else {
         $this->tpl->setVariable("TXT_OBJECT_NO_LINK", $this->lng->txt("cont_users_have_mob_in_clip1") . " " . $usage["cnt"] . " " . $this->lng->txt("cont_users_have_mob_in_clip2"));
     }
 }
 /**
  * Search wiki link list
  */
 function searchWikiLinkAC()
 {
     global $lng;
     $lng->loadLanguageModule("wiki");
     $tpl = new ilTemplate("tpl.wiki_ac_search_result.html", true, true, "Modules/Wiki");
     $term = trim($_GET["term"]);
     $pages = ilObjWiki::_performSearch($this->getPageObject()->getParentId(), $term);
     $found = array();
     foreach ($pages as $page) {
         $found[] = array("page_id" => $page["page_id"], "title" => ilWikiPage::lookupTitle($page["page_id"]));
     }
     // sort if all pages are listed
     if ($term == "") {
         $found = ilUtil::sortArray($found, "title", "asc");
     }
     foreach ($found as $f) {
         $tpl->setCurrentBlock("item");
         $tpl->setVariable("WIKI_TITLE", $f["title"]);
         $tpl->parseCurrentBlock();
     }
     if (count($pages) == 0) {
         $tpl->setVariable("INFOTEXT", str_replace("\$1", $term, $lng->txt("wiki_no_page_found")));
     } else {
         if ($term == '') {
             $tpl->setVariable("INFOTEXT", $lng->txt("wiki_no_search_term"), $term);
         } else {
             $tpl->setVariable("INFOTEXT", str_replace("\$1", $term, $lng->txt("wiki_pages_found")));
         }
     }
     $tpl->setVariable("TXT_BACK", $lng->txt("back"));
     echo $tpl->get();
     exit;
 }
Beispiel #13
0
 public static function getAdvMDSubItemTitle($a_obj_id, $a_sub_type, $a_sub_id)
 {
     global $lng;
     if ($a_sub_type == "wpg") {
         $lng->loadLanguageModule("wiki");
         include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
         return $lng->txt("wiki_wpg") . ' "' . ilWikiPage::lookupTitle($a_sub_id) . '"';
     }
 }
 /**
  * Fill data section
  */
 function fillDataSection()
 {
     global $ilCtrl, $lng, $ilAccess;
     $tpl = new ilTemplate("tpl.wiki_imp_pages_block.html", true, true, "Modules/Wiki");
     $cpar[0] = $cpar[1] = 0;
     include_once "./Services/UIComponent/NestedList/classes/class.ilNestedList.php";
     $list = new ilNestedList();
     $list->setItemClass("ilWikiBlockItem");
     $list->setListClass("ilWikiBlockList");
     $list->setListClass("ilWikiBlockListNoIndent", 1);
     $cnt = 1;
     if (!$this->export) {
         $list->addListNode("<p class='small'><a href='" . $ilCtrl->getLinkTargetByClass("ilobjwikigui", "gotoStartPage") . "'>" . $lng->txt("wiki_start_page") . "</a></p>", 1, 0);
     } else {
         $list->addListNode("<p class='small'><a href='" . "index.html" . "'>" . $lng->txt("wiki_start_page") . "</a></p>", 1, 0);
     }
     $cpar[0] = 1;
     $ipages = ilObjWiki::_lookupImportantPagesList(ilObject::_lookupObjId($_GET["ref_id"]));
     foreach ($ipages as $p) {
         $cnt++;
         $title = ilWikiPage::lookupTitle($p["page_id"]);
         if (!$this->export) {
             $list->addListNode("<p class='small'><a href='" . ilObjWikiGUI::getGotoLink($_GET["ref_id"], $title) . "'>" . $title . "</a></p>", $cnt, (int) $cpar[$p["indent"] - 1]);
         } else {
             $list->addListNode("<p class='small'><a href='" . "wpg_" . $p["page_id"] . ".html" . "'>" . $title . "</a></p>", $cnt, (int) $cpar[$p["indent"] - 1]);
         }
         $cpar[$p["indent"]] = $cnt;
     }
     $this->setDataSection($list->getHTML());
     return;
     // old style
     // the start page
     $tpl->setCurrentBlock("item");
     $title = ilWikiPage::lookupTitle($p["page_id"]);
     $tpl->setVariable("ITEM_TITLE", $lng->txt("wiki_start_page"));
     $tpl->setVariable("PAD", (int) 5 + 0 * 20);
     $tpl->setVariable("ITEM_HREF", $ilCtrl->getLinkTargetByClass("ilobjwikigui", "gotoStartPage"));
     $tpl->parseCurrentBlock();
     $ipages = ilObjWiki::_lookupImportantPagesList(ilObject::_lookupObjId($_GET["ref_id"]));
     foreach ($ipages as $p) {
         $tpl->setCurrentBlock("item");
         $title = ilWikiPage::lookupTitle($p["page_id"]);
         $tpl->setVariable("ITEM_TITLE", $title);
         $tpl->setVariable("PAD", (int) 5 + $p["indent"] * 20);
         $tpl->setVariable("ITEM_HREF", ilObjWikiGUI::getGotoLink($_GET["ref_id"], $title));
         $tpl->parseCurrentBlock();
     }
     $this->setDataSection($tpl->get());
 }
 /**
  * Get all pages of wiki	
  *
  * @access	public
  */
 static function getNewPages($a_wiki_id)
 {
     global $ilDB;
     $pages = parent::getNewPages("wpg", $a_wiki_id);
     foreach ($pages as $k => $page) {
         $pages[$k]["title"] = ilWikiPage::lookupTitle($page["id"]);
     }
     return $pages;
 }
 /**
  * show news
  */
 function showNews()
 {
     global $lng, $ilCtrl, $ilUser;
     // workaround for dynamic mode (if cache is disabled, showNews has no data)
     if (empty(self::$st_data)) {
         $this->setData($this->getNewsData());
     }
     $news_set = new ilSetting("news");
     $enable_internal_rss = $news_set->get("enable_rss_for_internal");
     include_once "./Services/News/classes/class.ilNewsItem.php";
     $news = new ilNewsItem($_GET["news_id"]);
     $tpl = new ilTemplate("tpl.show_news.html", true, true, "Services/News");
     // get current item in data set
     $previous = $next = "";
     reset($this->data);
     $c = current($this->data);
     $curr_cnt = 1;
     while ($c["id"] > 0 && $c["id"] != $_GET["news_id"]) {
         $previous = $c;
         $c = next($this->data);
         $curr_cnt++;
     }
     // collect news items to show
     $news_list = array();
     if (is_array($c["aggregation"])) {
         //$agg_obj_id = ilObject::_lookupObjId($c["agg_ref_id"]);
         //$agg_obj_type = ilObject::_lookupType($agg_obj_id);
         //$agg_obj_title = ilObject::_lookupObjId($agg_obj_id);
         $news_list[] = array("ref_id" => $c["agg_ref_id"], "agg_ref_id" => $c["agg_ref_id"], "aggregation" => $c["aggregation"], "user_id" => "", "content_type" => "text", "mob_id" => 0, "visibility" => "", "content" => "", "content_long" => "", "update_date" => $news->getUpdateDate(), "creation_date" => "", "content_is_lang_var" => false, "loc_context" => $_GET["news_context"], "context_obj_type" => $news->getContextObjType(), "title" => "");
         foreach ($c["aggregation"] as $c_item) {
             ilNewsItem::_setRead($ilUser->getId(), $c_item["id"]);
             $c_item["loc_context"] = $c_item["ref_id"];
             $c_item["loc_stop"] = $_GET["news_context"];
             $news_list[] = $c_item;
         }
     } else {
         $news_list[] = array("ref_id" => $_GET["news_context"], "user_id" => $news->getUserId(), "content_type" => $news->getContentType(), "mob_id" => $news->getMobId(), "visibility" => $news->getVisibility(), "priority" => $news->getPriority(), "content" => $news->getContent(), "content_long" => $news->getContentLong(), "update_date" => $news->getUpdateDate(), "creation_date" => $news->getCreationDate(), "context_sub_obj_type" => $news->getContextSubObjType(), "context_obj_type" => $news->getContextObjType(), "context_sub_obj_id" => $news->getContextSubObjId(), "content_is_lang_var" => $news->getContentIsLangVar(), "content_text_is_lang_var" => $news->getContentTextIsLangVar(), "loc_context" => $_GET["news_context"], "title" => $news->getTitle());
         ilNewsItem::_setRead($ilUser->getId(), $_GET["news_id"]);
     }
     foreach ($news_list as $item) {
         // user
         if ($item["user_id"] > 0 && ilObject::_exists($item["user_id"])) {
             // get login
             if (ilObjUser::_exists($item["user_id"])) {
                 $user = new ilObjUser($item["user_id"]);
                 $displayname = $user->getLogin();
             } else {
                 // this should actually not happen, since news entries
                 // should be deleted when the user is going to be removed
                 $displayname = "&lt;" . strtolower($lng->txt("deleted")) . "&gt;";
             }
             $tpl->setCurrentBlock("user_info");
             $tpl->setVariable("VAL_AUTHOR", $displayname);
             $tpl->setVariable("TXT_AUTHOR", $lng->txt("author"));
             $tpl->parseCurrentBlock();
         }
         // media player
         if ($item["content_type"] == NEWS_AUDIO && $item["mob_id"] > 0 && ilObject::_exists($item["mob_id"])) {
             include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
             include_once "./Services/MediaObjects/classes/class.ilMediaPlayerGUI.php";
             $mob = new ilObjMediaObject($item["mob_id"]);
             $med = $mob->getMediaItem("Standard");
             $mpl = new ilMediaPlayerGUI();
             if (strcasecmp("Reference", $med->getLocationType()) == 0) {
                 $mpl->setFile($med->getLocation());
             } else {
                 $mpl->setFile(ilObjMediaObject::_getURL($mob->getId()) . "/" . $med->getLocation());
             }
             $mpl->setDisplayHeight($med->getHeight());
             $tpl->setCurrentBlock("player");
             $tpl->setVariable("PLAYER", $mpl->getMp3PlayerHtml());
             $tpl->parseCurrentBlock();
         }
         // access
         if ($enable_internal_rss && $item["visibility"] != "") {
             $obj_id = ilObject::_lookupObjId($item["ref_id"]);
             $tpl->setCurrentBlock("access");
             $tpl->setVariable("TXT_ACCESS", $lng->txt("news_news_item_visibility"));
             if ($item["visibility"] == NEWS_PUBLIC || $item["priority"] == 0 && ilBlockSetting::_lookup("news", "public_notifications", 0, $obj_id)) {
                 $tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_public"));
             } else {
                 $tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_users"));
             }
             $tpl->parseCurrentBlock();
         }
         // content
         if (trim($item["content"]) != "") {
             $tpl->setCurrentBlock("content");
             $tpl->setVariable("VAL_CONTENT", nl2br($this->makeClickable(ilNewsItem::determineNewsContent($item["context_obj_type"], $item["content"], $item["content_text_is_lang_var"]))));
             //$tpl->setVariable("VAL_CONTENT", nl2br($item["content"]));
             $tpl->parseCurrentBlock();
         }
         if (trim($item["content_long"]) != "") {
             $tpl->setCurrentBlock("long");
             $tpl->setVariable("VAL_LONG_CONTENT", $this->makeClickable($item["content_long"]));
             $tpl->parseCurrentBlock();
         }
         if ($item["update_date"] != $item["creation_date"]) {
             $tpl->setCurrentBlock("ni_update");
             $tpl->setVariable("TXT_LAST_UPDATE", $lng->txt("last_update"));
             $tpl->setVariable("VAL_LAST_UPDATE", ilDatePresentation::formatDate(new ilDateTime($item["update_date"], IL_CAL_DATETIME)));
             $tpl->parseCurrentBlock();
         }
         // creation date
         if ($item["creation_date"] != "") {
             $tpl->setCurrentBlock("ni_update");
             $tpl->setVariable("VAL_CREATION_DATE", ilDatePresentation::formatDate(new ilDateTime($item["creation_date"], IL_CAL_DATETIME)));
             $tpl->setVariable("TXT_CREATED", $lng->txt("created"));
             $tpl->parseCurrentBlock();
         }
         // context / title
         if ($_GET["news_context"] > 0) {
             //$obj_id = ilObject::_lookupObjId($_GET["news_context"]);
             $obj_id = ilObject::_lookupObjId($item["ref_id"]);
             $obj_type = ilObject::_lookupType($obj_id);
             $obj_title = ilObject::_lookupTitle($obj_id);
             // file hack, not nice
             if ($obj_type == "file") {
                 $tpl->setCurrentBlock("download");
                 $tpl->setVariable("TXT_DOWNLOAD", $lng->txt("download"));
                 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $item["ref_id"]);
                 $tpl->setVariable("HREF_DOWNLOAD", $ilCtrl->getLinkTargetByClass("ilrepositorygui", "sendfile"));
                 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
                 $tpl->parseCurrentBlock();
             }
             // forum hack, not nice
             $add = "";
             if ($obj_type == "frm" && $item["context_sub_obj_type"] == "pos" && $item["context_sub_obj_id"] > 0) {
                 include_once "./Modules/Forum/classes/class.ilObjForumAccess.php";
                 $pos = $item["context_sub_obj_id"];
                 $thread = ilObjForumAccess::_getThreadForPosting($pos);
                 if ($thread > 0) {
                     $add = "_" . $thread . "_" . $pos;
                 }
             }
             // wiki hack, not nice
             if ($obj_type == "wiki" && $item["context_sub_obj_type"] == "wpg" && $item["context_sub_obj_id"] > 0) {
                 include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
                 $wptitle = ilWikiPage::lookupTitle($item["context_sub_obj_id"]);
                 if ($wptitle != "") {
                     $add = "_" . ilWikiUtil::makeUrlTitle($wptitle);
                 }
             }
             $url_target = "./goto.php?client_id=" . rawurlencode(CLIENT_ID) . "&target=" . $obj_type . "_" . $item["ref_id"] . $add;
             // lm page hack, not nice
             if (in_array($obj_type, array("dbk", "lm")) && $item["context_sub_obj_type"] == "pg" && $item["context_sub_obj_id"] > 0) {
                 $url_target = "./goto.php?client_id=" . rawurlencode(CLIENT_ID) . "&target=" . "pg_" . $item["context_sub_obj_id"] . "_" . $item["ref_id"];
             }
             $context_opened = false;
             if ($item["loc_context"] != null && $item["loc_context"] != $item["loc_stop"]) {
                 $tpl->setCurrentBlock("context");
                 $context_opened = true;
                 $cont_loc = new ilLocatorGUI();
                 $cont_loc->addContextItems($item["loc_context"], true, $item["loc_stop"]);
                 $tpl->setVariable("CONTEXT_LOCATOR", $cont_loc->getHTML());
             }
             //var_dump($item);
             if ($item["no_context_title"] !== true) {
                 if (!$context_opened) {
                     $tpl->setCurrentBlock("context");
                 }
                 $tpl->setVariable("HREF_CONTEXT_TITLE", $url_target);
                 $tpl->setVariable("CONTEXT_TITLE", $obj_title);
                 $tpl->setVariable("IMG_CONTEXT_TITLE", ilObject::_getIcon($obj_id, "big", $obj_type));
             }
             if ($context_opened) {
                 $tpl->parseCurrentBlock();
             }
             $tpl->setVariable("HREF_TITLE", $url_target);
         }
         // title
         $tpl->setVariable("VAL_TITLE", ilNewsItem::determineNewsTitle($item["context_obj_type"], $item["title"], $item["content_is_lang_var"], $item["agg_ref_id"], $item["aggregation"]));
         $row_css = $row_css != "tblrow1" ? "tblrow1" : "tblrow2";
         $tpl->setCurrentBlock("item");
         $tpl->setVariable("ITEM_ROW_CSS", $row_css);
         $tpl->parseCurrentBlock();
     }
     include_once "./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php";
     $content_block = new ilPDContentBlockGUI();
     $content_block->setContent($tpl->get());
     if ($this->getProperty("title") != "") {
         $content_block->setTitle($this->getProperty("title"));
     } else {
         $content_block->setTitle($lng->txt("news_internal_news"));
     }
     //$content_block->setColSpan(2);
     $content_block->setImage(ilUtil::getImagePath("icon_news.png"));
     $this->addCloseCommand($content_block);
     // previous
     if ($previous != "") {
         if ($previous["ref_id"] > 0) {
             $ilCtrl->setParameter($this, "news_context", $previous["ref_id"]);
         }
         $ilCtrl->setParameter($this, "news_id", $previous["id"]);
         $content_block->addFooterLink($lng->txt("previous"), $ilCtrl->getLinkTarget($this, "showNews"), "", "", true);
         $ilCtrl->setParameter($this, "news_context", "");
     }
     // next
     if ($c = next($this->data)) {
         if ($c["ref_id"] > 0) {
             $ilCtrl->setParameter($this, "news_context", $c["ref_id"]);
         }
         $ilCtrl->setParameter($this, "news_id", $c["id"]);
         $content_block->addFooterLink($lng->txt("next"), $ilCtrl->getLinkTarget($this, "showNews"), "", "", true);
     }
     $ilCtrl->setParameter($this, "news_context", "");
     $ilCtrl->setParameter($this, "news_id", "");
     $content_block->setCurrentItemNumber($curr_cnt);
     $content_block->setEnableNumInfo(true);
     $content_block->setData($this->getData());
     return $content_block->getHTML();
 }
 /**
  * Standard Version of Fill Row. Most likely to
  * be overwritten by derived class.
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl, $lng;
     include_once "./Services/Tracking/classes/class.ilLPMarks.php";
     include_once "./Modules/Wiki/classes/class.ilWikiContributor.php";
     if (ilObject::_exists($a_set["user_id"])) {
         arsort($a_set["pages"]);
         // pages
         foreach ($a_set["pages"] as $page_id => $cnt) {
             if ($page_id > 0) {
                 include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
                 $title = ilWikiPage::lookupTitle($page_id);
                 $this->tpl->setCurrentBlock("page");
                 $this->tpl->setVariable("PAGE", $title);
                 $this->tpl->setVariable("CNT", $cnt);
                 $this->tpl->parseCurrentBlock();
             }
         }
         $this->tpl->setVariable("TXT_LINKED_USER", $user["lastname"] . ", " . $user["firstname"] . " [" . $login . "]");
         // profile link
         //$ilCtrl->setParameterByClass("ilpublicuserprofilegui", "user", $a_set["user"]);
         //$ilCtrl->setParameterByClass("ilpublicuserprofilegui", "back_url",
         //	rawurlencode($ilCtrl->getLinkTarget($this->getParentObject(), $this->getParentCmd())));
         //$this->tpl->setVariable("USER_LINK",
         //	$ilCtrl->getLinkTargetByClass("ilpublicuserprofilegui", "getHTML"));
         $img = ilObjUser::_getPersonalPicturePath($a_set["user_id"], "xsmall");
         $this->tpl->setVariable("IMG_USER", $img);
         $this->tpl->setVariable("TXT_NAME", $a_set["lastname"] . ", " . $a_set["firstname"]);
         $this->tpl->setVariable("USER_ID", $a_set["user_id"]);
         // comment for learner
         $this->tpl->setVariable("TXT_LCOMMENT", $lng->txt("wiki_comment_for_learner"));
         $this->tpl->setVariable("NAME_LCOMMENT", "lcomment[" . $a_set["user_id"] . "]");
         $lpcomment = ilLPMarks::_lookupComment($a_set["user_id"], $this->parent_obj->object->getId());
         $this->tpl->setVariable("VAL_LCOMMENT", ilUtil::prepareFormOutput($lpcomment));
         // status
         //$status = ilExerciseMembers::_lookupStatus($this->object->getId(), $member_id);
         $status = ilWikiContributor::_lookupStatus($this->parent_obj->object->getId(), $a_set["user_id"]);
         $this->tpl->setVariable("SEL_" . $status, ' selected="selected" ');
         $this->tpl->setVariable("TXT_NOTGRADED", $lng->txt("wiki_notgraded"));
         $this->tpl->setVariable("TXT_PASSED", $lng->txt("wiki_passed"));
         $this->tpl->setVariable("TXT_FAILED", $lng->txt("wiki_failed"));
         $this->tpl->setVariable("VAL_NOTGRADED", ilWikiContributor::STATUS_NOT_GRADED);
         $this->tpl->setVariable("VAL_PASSED", ilWikiContributor::STATUS_PASSED);
         $this->tpl->setVariable("VAL_FAILED", ilWikiContributor::STATUS_FAILED);
         if (($sd = ilWikiContributor::_lookupStatusTime($this->parent_obj->object->getId(), $a_set["user_id"])) > 0) {
             $this->tpl->setCurrentBlock("status_date");
             $this->tpl->setVariable("TXT_LAST_CHANGE", $lng->txt("last_change"));
             $this->tpl->setVariable("VAL_STATUS_DATE", ilDatePresentation::formatDate(new ilDateTime($sd, IL_CAL_DATETIME)));
             $this->tpl->parseCurrentBlock();
         }
         switch ($status) {
             case ilWikiContributor::STATUS_PASSED:
                 $pic = "scorm/passed.png";
                 break;
             case ilWikiContributor::STATUS_FAILED:
                 $pic = "scorm/failed.png";
                 break;
             default:
                 $pic = "scorm/not_attempted.png";
                 break;
         }
         $this->tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic));
         $this->tpl->setVariable("ALT_STATUS", $lng->txt("wiki_" . $status));
         // mark
         $this->tpl->setVariable("TXT_MARK", $lng->txt("wiki_mark"));
         $this->tpl->setVariable("NAME_MARK", "mark[" . $a_set["user_id"] . "]");
         $mark = ilLPMarks::_lookupMark($a_set["user_id"], $this->parent_obj->object->getId());
         $this->tpl->setVariable("VAL_MARK", ilUtil::prepareFormOutput($mark));
     }
 }
 /**
  * Standard Version of Fill Row. Most likely to
  * be overwritten by derived class.
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl, $ilAccess;
     $usage = $a_set;
     //var_dump($usage);
     if (is_int(strpos($usage["type"], ":"))) {
         $us_arr = explode(":", $usage["type"]);
         $usage["type"] = $us_arr[1];
         $cont_type = $us_arr[0];
     }
     //var_dump($usage);
     include_once './Services/Link/classes/class.ilLink.php';
     switch ($usage["type"]) {
         case "pg":
             include_once "./Services/COPage/classes/class.ilPageObjectFactory.php";
             $page_obj = ilPageObjectFactory::getInstance($cont_type, $usage["id"]);
             $item = array();
             //$this->tpl->setVariable("TXT_OBJECT", $usage["type"].":".$usage["id"]);
             switch ($cont_type) {
                 case "lm":
                     require_once "./Modules/LearningModule/classes/class.ilObjContentObject.php";
                     require_once "./Modules/LearningModule/classes/class.ilObjLearningModule.php";
                     require_once "./Modules/LearningModule/classes/class.ilLMObject.php";
                     $lm_obj = new ilObjLearningModule($page_obj->getParentId(), false);
                     $item["obj_type_txt"] = $this->lng->txt("obj_" . $cont_type);
                     $item["obj_title"] = $lm_obj->getTitle();
                     $item["sub_txt"] = $this->lng->txt("pg");
                     $item["sub_title"] = ilLMObject::_lookupTitle($page_obj->getId());
                     $ref_id = $this->getFirstWritableRefId($lm_obj->getId());
                     if ($ref_id > 0) {
                         $item["obj_link"] = ilLink::_getStaticLink($page_obj->getId() . "_" . $ref_id, "pg");
                     }
                     break;
                 case "wpg":
                     require_once "./Modules/Wiki/classes/class.ilWikiPage.php";
                     $item["obj_type_txt"] = $this->lng->txt("obj_wiki");
                     $item["obj_title"] = ilObject::_lookupTitle($page_obj->getParentId());
                     $item["sub_txt"] = $this->lng->txt("pg");
                     $item["sub_title"] = ilWikiPage::lookupTitle($page_obj->getId());
                     $ref_id = $this->getFirstWritableRefId($page_obj->getParentId());
                     if ($ref_id > 0) {
                         $item["obj_link"] = ilLink::_getStaticLink($ref_id, "wiki");
                     }
                     break;
                 case "gdf":
                     require_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php";
                     require_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php";
                     $term_id = ilGlossaryDefinition::_lookupTermId($page_obj->getId());
                     $glo_id = ilGlossaryTerm::_lookGlossaryId($term_id);
                     $item["obj_type_txt"] = $this->lng->txt("obj_glo");
                     $item["obj_title"] = ilObject::_lookupTitle($glo_id);
                     $item["sub_txt"] = $this->lng->txt("cont_term");
                     $item["sub_title"] = ilGlossaryTerm::_lookGlossaryTerm($term_id);
                     $ref_id = $this->getFirstWritableRefId($page_obj->getParentId());
                     if ($ref_id > 0) {
                         $item["obj_link"] = ilLink::_getStaticLink($ref_id, "glo");
                     }
                     break;
                 case "cont":
                     $item["obj_type_txt"] = $this->lng->txt("obj_" . $cont_type);
                     $item["obj_title"] = ilObject::_lookupTitle($page_obj->getId());
                     $ref_id = $this->getFirstWritableRefId($page_obj->getId());
                     if ($ref_id > 0) {
                         $item["obj_link"] = ilLink::_getStaticLink($ref_id, $cont_type);
                     }
                     break;
             }
             break;
         case "mep":
             $item["obj_type_txt"] = $this->lng->txt("obj_mep");
             $item["obj_title"] = ilObject::_lookupTitle($usage["id"]);
             $ref_id = $this->getFirstWritableRefId($usage["id"]);
             if ($ref_id > 0) {
                 $item["obj_link"] = ilLink::_getStaticLink($ref_id, "mep");
             }
             break;
         case "map":
             $item["obj_type_txt"] = $this->lng->txt("obj_mob");
             $item["obj_title"] = ilObject::_lookupTitle($usage["id"]);
             $item["sub_txt"] = $this->lng->txt("cont_link_area");
             break;
     }
     // show versions
     if (is_array($usage["hist_nr"]) && (count($usage["hist_nr"]) > 1 || $usage["hist_nr"][0] > 0)) {
         asort($usage["hist_nr"]);
         $ver = $sep = "";
         if ($usage["hist_nr"][0] == 0) {
             array_shift($usage["hist_nr"]);
             $usage["hist_nr"][] = 0;
         }
         if (count($usage["hist_nr"]) > 5) {
             $ver .= "..., ";
             $cnt = count($usage["hist_nr"]) - 5;
             for ($i = 0; $i < $cnt; $i++) {
                 unset($usage["hist_nr"][$i]);
             }
         }
         foreach ($usage["hist_nr"] as $nr) {
             if ($nr > 0) {
                 $ver .= $sep . $nr;
             } else {
                 $ver .= $sep . $this->lng->txt("cont_current_version");
             }
             $sep = ", ";
         }
         $this->tpl->setCurrentBlock("versions");
         $this->tpl->setVariable("TXT_VERSIONS", $this->lng->txt("cont_versions"));
         $this->tpl->setVariable("VAL_VERSIONS", $ver);
         $this->tpl->parseCurrentBlock();
     }
     if ($item["obj_type_txt"] != "") {
         $this->tpl->setCurrentBlock("type");
         $this->tpl->setVariable("TXT_TYPE", $this->lng->txt("type"));
         $this->tpl->setVariable("VAL_TYPE", $item["obj_type_txt"]);
         $this->tpl->parseCurrentBlock();
     }
     if ($usage["type"] != "clip") {
         if ($item["obj_link"]) {
             $this->tpl->setCurrentBlock("linked_item");
             $this->tpl->setVariable("TXT_OBJECT", $item["obj_title"]);
             $this->tpl->setVariable("HREF_LINK", $item["obj_link"]);
             $this->tpl->parseCurrentBlock();
         } else {
             $this->tpl->setVariable("TXT_OBJECT_NO_LINK", $item["obj_title"]);
         }
         if ($item["sub_txt"] != "") {
             $this->tpl->setVariable("SEP", ", ");
             $this->tpl->setVariable("SUB_TXT", $item["sub_txt"]);
             if ($item["sub_title"] != "") {
                 $this->tpl->setVariable("SEP2", ": ");
                 $this->tpl->setVariable("SUB_TITLE", $item["sub_title"]);
             }
         }
     } else {
         $this->tpl->setVariable("TXT_OBJECT_NO_LINK", $this->lng->txt("cont_users_have_mob_in_clip1") . " " . $usage["cnt"] . " " . $this->lng->txt("cont_users_have_mob_in_clip2"));
     }
 }
 public function __appendChildLinks($html, $item, &$item_list_gui)
 {
     if (!count($item['child'])) {
         return $html;
     }
     $tpl = new ilTemplate('tpl.detail_links.html', true, true, 'Services/Search');
     switch ($item['type']) {
         case 'lm':
             $tpl->setVariable("HITS", $this->lng->txt('search_hits'));
             include_once 'Modules/LearningModule/classes/class.ilLMObject.php';
             foreach ($item['child'] as $child) {
                 $tpl->setCurrentBlock("link_row");
                 switch (ilLMObject::_lookupType($child)) {
                     case 'pg':
                         $tpl->setVariable("CHAPTER_PAGE", $this->lng->txt('obj_pg'));
                         break;
                     case 'st':
                         $tpl->setVariable("CHAPTER_PAGE", $this->lng->txt('obj_st'));
                         break;
                 }
                 $item_list_gui->setChildId($child);
                 $tpl->setVariable("SEPERATOR", ' -> ');
                 $tpl->setVariable("LINK", $item_list_gui->getCommandLink('page'));
                 $tpl->setVariable("TARGET", $item_list_gui->getCommandFrame('page'));
                 $tpl->setVariable("TITLE", ilLMObject::_lookupTitle($child));
                 $tpl->parseCurrentBlock();
             }
             break;
         case 'frm':
             $tpl->setVariable("HITS", $this->lng->txt('search_hits'));
             include_once './Modules/Forum/classes/class.ilObjForum.php';
             foreach ($item['child'] as $child) {
                 $thread_post = explode('_', $child);
                 $tpl->setCurrentBlock("link_row");
                 $tpl->setVariable("CHAPTER_PAGE", $this->lng->txt('thread'));
                 $item_list_gui->setChildId($thread_post);
                 $tpl->setVariable("SEPERATOR", ': ');
                 $tpl->setVariable("LINK", $item_list_gui->getCommandLink('posting'));
                 $tpl->setVariable("TARGET", $item_list_gui->getCommandFrame(''));
                 $tpl->setVariable("TITLE", ilObjForum::_lookupThreadSubject($thread_post[0]));
                 $tpl->parseCurrentBlock();
             }
             break;
         case 'glo':
             $tpl->setVariable("HITS", $this->lng->txt('search_hits'));
             include_once './Modules/Glossary/classes/class.ilGlossaryTerm.php';
             $this->lng->loadLanguageModule('content');
             foreach ($item['child'] as $child) {
                 $tpl->setCurrentBlock("link_row");
                 $tpl->setVariable("CHAPTER_PAGE", $this->lng->txt('cont_term'));
                 $tpl->setVariable("SEPERATOR", ': ');
                 $tpl->setVariable("LINK", ilLink::_getLink($item['ref_id'], 'git', array('target' => 'git_' . $child . '_' . $item['ref_id'])));
                 $tpl->setVariable("TITLE", ilGlossaryTerm::_lookGlossaryTerm($child));
                 $tpl->parseCurrentBlock();
             }
             break;
         case 'wiki':
             $tpl->setVariable("HITS", $this->lng->txt('search_hits'));
             include_once './Modules/Wiki/classes/class.ilWikiPage.php';
             include_once './Modules/Wiki/classes/class.ilWikiUtil.php';
             $this->lng->loadLanguageModule('wiki');
             foreach ($item['child'] as $child) {
                 $page_title = ilWikiPage::lookupTitle($child);
                 $tpl->setCurrentBlock("link_row");
                 $tpl->setVariable("CHAPTER_PAGE", $this->lng->txt('wiki_page'));
                 $tpl->setVariable("SEPERATOR", ': ');
                 $tpl->setVariable("LINK", ilLink::_getLink($item['ref_id'], 'wiki', array(), "_" . ilWikiUtil::makeUrlTitle($page_title)));
                 $tpl->setVariable("TITLE", $page_title);
                 $tpl->parseCurrentBlock();
             }
             break;
         case 'mcst':
             $tpl->setVariable("HITS", $this->lng->txt('search_hits'));
             include_once "./Services/News/classes/class.ilNewsItem.php";
             foreach ($item['child'] as $child) {
                 $tpl->setCurrentBlock("link_row");
                 //$tpl->setVariable("CHAPTER_PAGE",$this->lng->txt('item'));
                 $item_list_gui->setChildId($child);
                 //$tpl->setVariable("SEPERATOR",': ');
                 $tpl->setVariable("LINK", $item_list_gui->getCommandLink('listItems'));
                 $tpl->setVariable("TARGET", $item_list_gui->getCommandFrame(''));
                 $tpl->setVariable("TITLE", ilNewsItem::_lookupTitle($child));
                 $tpl->parseCurrentBlock();
             }
             break;
         default:
     }
     return $html . $tpl->get();
 }