/** * 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")); }
/** * 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(); }
/** * Secure and split - main initialisation function for this object * * Assumes that mDbkeyform has been set, and is urldecoded * and uses underscores, but not otherwise munged. This function * removes illegal characters, splits off the interwiki and * namespace prefixes, sets the other forms, and canonicalizes * everything. * @return bool true on success */ private function secureAndSplit() { global $wgContLang, $wgLocalInterwiki, $wgCapitalLinks; # Initialisation static $rxTc = false; if (!$rxTc) { # % is needed as well $rxTc = '/[^' . Title::legalChars() . ']|%[0-9A-Fa-f]{2}/S'; } $this->mInterwiki = $this->mFragment = ''; $this->mNamespace = $this->mDefaultNamespace; # Usually NS_MAIN $dbkey = $this->mDbkeyform; # Strip Unicode bidi override characters. # Sometimes they slip into cut-n-pasted page titles, where the # override chars get included in list displays. $dbkey = str_replace("", '', $dbkey); // 200E LEFT-TO-RIGHT MARK $dbkey = str_replace("", '', $dbkey); // 200F RIGHT-TO-LEFT MARK # Clean up whitespace # $dbkey = preg_replace('/[ _]+/', '_', $dbkey); $dbkey = trim($dbkey, '_'); if ('' == $dbkey) { return false; } if (false !== strpos($dbkey, UTF8_REPLACEMENT)) { # Contained illegal UTF-8 sequences or forbidden Unicode chars. return false; } $this->mDbkeyform = $dbkey; # Initial colon indicates main namespace rather than specified default # but should not create invalid {ns,title} pairs such as {0,Project:Foo} if (':' == $dbkey[0]) { $this->mNamespace = NS_MAIN; $dbkey = substr($dbkey, 1); # remove the colon but continue processing $dbkey = trim($dbkey, '_'); # remove any subsequent whitespace } # Namespace or interwiki prefix $firstPass = true; do { $m = array(); if (preg_match("/^(.+?)_*:_*(.*)\$/S", $dbkey, $m)) { $p = $m[1]; if ($ns = $wgContLang->getNsIndex($p)) { # Ordinary namespace $dbkey = $m[2]; $this->mNamespace = $ns; } elseif ($this->getInterwikiLink($p)) { if (!$firstPass) { # Can't make a local interwiki link to an interwiki link. # That's just crazy! return false; } # Interwiki link $dbkey = $m[2]; $this->mInterwiki = $wgContLang->lc($p); # Redundant interwiki prefix to the local wiki if (0 == strcasecmp($this->mInterwiki, $wgLocalInterwiki)) { if ($dbkey == '') { # Can't have an empty self-link return false; } $this->mInterwiki = ''; $firstPass = false; # Do another namespace split... continue; } # If there's an initial colon after the interwiki, that also # resets the default namespace if ($dbkey !== '' && $dbkey[0] == ':') { $this->mNamespace = NS_MAIN; $dbkey = substr($dbkey, 1); } } # If there's no recognized interwiki or namespace, # then let the colon expression be part of the title. } break; } while (true); # We already know that some pages won't be in the database! # if ('' != $this->mInterwiki || NS_SPECIAL == $this->mNamespace) { $this->mArticleID = 0; } $fragment = strstr($dbkey, '#'); if (false !== $fragment) { $this->setFragment($fragment); $dbkey = substr($dbkey, 0, strlen($dbkey) - strlen($fragment)); # remove whitespace again: prevents "Foo_bar_#" # becoming "Foo_bar_" $dbkey = preg_replace('/_*$/', '', $dbkey); } # Reject illegal characters. # if (preg_match($rxTc, $dbkey)) { return false; } /** * Pages with "/./" or "/../" appearing in the URLs will * often be unreachable due to the way web browsers deal * with 'relative' URLs. Forbid them explicitly. */ if (strpos($dbkey, '.') !== false && ($dbkey === '.' || $dbkey === '..' || strpos($dbkey, './') === 0 || strpos($dbkey, '../') === 0 || strpos($dbkey, '/./') !== false || strpos($dbkey, '/../') !== false)) { return false; } /** * Magic tilde sequences? Nu-uh! */ if (strpos($dbkey, '~~~') !== false) { return false; } /** * Limit the size of titles to 255 bytes. * This is typically the size of the underlying database field. * We make an exception for special pages, which don't need to be stored * in the database, and may edge over 255 bytes due to subpage syntax * for long titles, e.g. [[Special:Block/Long name]] */ if ($this->mNamespace != NS_SPECIAL && strlen($dbkey) > 255 || strlen($dbkey) > 512) { return false; } /** * Normally, all wiki links are forced to have * an initial capital letter so [[foo]] and [[Foo]] * point to the same place. * * Don't force it for interwikis, since the other * site might be case-sensitive. */ if ($wgCapitalLinks && $this->mInterwiki == '') { $dbkey = $wgContLang->ucfirst($dbkey); } /** * Can't make a link to a namespace alone... * "empty" local links can only be self-links * with a fragment identifier. */ if ($dbkey == '' && $this->mInterwiki == '' && $this->mNamespace != NS_MAIN) { return false; } // Any remaining initial :s are illegal. if ($dbkey !== '' && ':' == $dbkey[0]) { return false; } # Fill fields $this->mDbkeyform = $dbkey; $this->mUrlform = ilWikiUtil::wfUrlencode($dbkey); $this->mTextform = str_replace('_', ' ', $dbkey); return true; }
/** * Set page parameter for Url Embedding */ static function makeUrlTitle($a_par) { $a_par = ilWikiUtil::removeUnsafeCharacters($a_par); $a_par = str_replace(" ", "_", $a_par); return ilWikiUtil::wfUrlencode($a_par); }
function observeNoteAction($a_wiki_id, $a_page_id, $a_type, $a_action, $a_note_id) { // #10040 - get note text include_once "Services/Notes/classes/class.ilNote.php"; $note = new ilNote($a_note_id); $note = $note->getText(); include_once "./Services/Notification/classes/class.ilNotification.php"; ilWikiUtil::sendNotification("comment", ilNotification::TYPE_WIKI_PAGE, $this->getWikiRefId(), $a_page_id, $note); }
/** * 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 = "<" . strtolower($lng->txt("deleted")) . ">"; } $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(); }
/** * Rename page */ function rename($a_new_name) { global $ilDB; // replace unallowed characters $a_new_name = str_replace(array("<", ">"), '', $a_new_name); // replace multiple whitespace characters by one single space $a_new_name = trim(preg_replace('!\\s+!', ' ', $a_new_name)); $page_title = ilWikiUtil::makeDbTitle($a_new_name); $pg_id = ilWikiPage::_getPageIdForWikiTitle($this->getWikiId(), $page_title); $xml_new_name = str_replace("&", "&", $a_new_name); if ($pg_id == 0 || $pg_id == $this->getId()) { include_once "./Services/COPage/classes/class.ilInternalLink.php"; $sources = ilInternalLink::_getSourcesOfTarget("wpg", $this->getId(), 0); foreach ($sources as $s) { if ($s["type"] == "wpg:pg") { $wpage = new ilWikiPage($s["id"]); $col = ilWikiUtil::processInternalLinks($wpage->getXmlContent(), 0, IL_WIKI_MODE_EXT_COLLECT); $new_content = $wpage->getXmlContent(); foreach ($col as $c) { // this complicated procedure is needed due to the fact // that depending on the collation e = é is true // in the (mysql) database // see bug http://www.ilias.de/mantis/view.php?id=11227 $t1 = ilWikiUtil::makeDbTitle($c["nt"]->mTextform); $t2 = ilWikiUtil::makeDbTitle($this->getTitle()); // this one replaces C2A0 ( ) by a usual space // otherwise the comparision will fail, since you // get these characters from tiny if more than one // space is repeated in a string. This may not be // 100% but we do not store $t1 anywhere and only // modify it for the comparison $t1 = preg_replace('/\\xC2\\xA0/', ' ', $t1); $t2 = preg_replace('/\\xC2\\xA0/', ' ', $t2); $set = $ilDB->query($q = "SELECT " . $ilDB->quote($t1, "text") . " = " . $ilDB->quote($t2, "text") . " isequal"); $rec = $ilDB->fetchAssoc($set); if ($rec["isequal"]) { $new_content = str_replace("[[" . $c["nt"]->mTextform . "]]", "[[" . $xml_new_name . "]]", $new_content); if ($c["text"] != "") { $new_content = str_replace("[[" . $c["text"] . "]]", "[[" . $xml_new_name . "]]", $new_content); } $add = $c["text"] != "" ? "|" . $c["text"] : ""; $new_content = str_replace("[[" . $c["nt"]->mTextform . $add . "]]", "[[" . $xml_new_name . $add . "]]", $new_content); } } $wpage->setXmlContent($new_content); //echo htmlentities($new_content); $wpage->update(); } } include_once "./Modules/Wiki/classes/class.ilObjWiki.php"; if (ilObjWiki::_lookupStartPage($this->getWikiId()) == $this->getTitle()) { ilObjWiki::writeStartPage($this->getWikiId(), $a_new_name); } $this->setTitle($a_new_name); $this->update(); } return $a_new_name; }
/** * Cancel page creation using a template */ function cancelCreationPageUsingTemplateObject() { global $ilCtrl; // redirect to newly created page $ilCtrl->setParameterByClass("ilwikipagegui", "page", ilWikiUtil::makeUrlTitle($_GET["from_page"])); $ilCtrl->redirectByClass("ilwikipagegui", "preview"); }
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(); }
function modifyPageContentPostXsl($a_html, $a_mode) { global $lng; if ($this->getPage()->getParentType() != "wpg") { return $a_html; } include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php'; include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php'; include_once 'Modules/Wiki/classes/class.ilWikiUtil.php'; $wiki_id = $this->getPage()->getWikiId(); $c_pos = 0; $start = strpos($a_html, "[[[[[AMDPageList;"); if (is_int($start)) { $end = strpos($a_html, "]]]]]", $start); } $i = 1; while ($end > 0) { $list_id = (int) substr($a_html, $start + 17, $end - $start - 17); $ltpl = new ilTemplate("tpl.wiki_amd_page_list.html", true, true, "Modules/Wiki"); $pages = $this->findPages($list_id); if (sizeof($pages)) { $ltpl->setCurrentBlock("page_bl"); foreach ($pages as $page_id => $page_title) { // see ilWikiUtil::makeLink() $frag = new stdClass(); $frag->mFragment = null; $frag->mTextform = $page_title; $ltpl->setVariable("PAGE", ilWikiUtil::makeLink($frag, $wiki_id, $page_title)); $ltpl->parseCurrentBlock(); } } else { $ltpl->setVariable("NO_HITS", $lng->txt("wiki_amd_page_list_no_hits")); } $a_html = substr($a_html, 0, $start) . $ltpl->get() . substr($a_html, $end + 5); $start = strpos($a_html, "[[[[[AMDPageList;", $start + 5); $end = 0; if (is_int($start)) { $end = strpos($a_html, "]]]]]", $start); } } return $a_html; }
/** * Create new wiki page * * @param string $a_page_title page title * @param int $a_template_page template page id * @return ilWikiPage new wiki page */ function createWikiPage($a_page_title, $a_template_page = 0) { // check if template has to be used if ($a_template_page == 0) { if (!$this->getEmptyPageTemplate()) { include_once "./Modules/Wiki/classes/class.ilWikiPageTemplate.php"; $wt = new ilWikiPageTemplate($this->getId()); $ts = $wt->getAllInfo(ilWikiPageTemplate::TYPE_NEW_PAGES); if (count($ts) == 1) { $t = current($ts); $a_template_page = $t["wpage_id"]; } } } // create the page $page = new ilWikiPage(); $page->setWikiId($this->getId()); $page->setTitle(ilWikiUtil::makeDbTitle($a_page_title)); if ($this->getRating() && $this->getRatingForNewPages()) { $page->setRating(true); } // needed for notification $page->setWikiRefId($this->getRefId()); $page->create(); // copy template into new page if ($a_template_page > 0) { $orig = new ilWikiPage($a_template_page); $orig->copy($page->getId()); } return $page; }
/** * Go to specific page * * @param string $a_page page title */ function gotoPageObject($a_page = "") { global $ilCtrl; if ($a_page == "") { $a_page = $_GET["page"]; } include_once "./Modules/Wiki/classes/class.ilWikiPage.php"; if (ilWikiPage::_wikiPageExists($this->object->getId(), ilWikiUtil::makeDbTitle($a_page))) { // to do: get rid of this redirect ilUtil::redirect(ilObjWikiGUI::getGotoLink($this->object->getRefId(), $a_page)); } else { // create the page $page = new ilWikiPage(); $page->setWikiId($this->object->getId()); $page->setTitle(ilWikiUtil::makeDbTitle($_GET["page"])); if ($this->object->getRating() && $this->object->getRatingForNewPages()) { $page->setRating(true); } $page->create(); // redirect to newly created page $ilCtrl->setParameterByClass("ilwikipagegui", "page", ilWikiUtil::makeUrlTitle($a_page)); $ilCtrl->redirectByClass("ilwikipagegui", "edit"); } }
/** * Write start page */ static function writeStartPage($a_id, $a_name) { global $ilDB; include_once "./Modules/Wiki/classes/class.ilWikiUtil.php"; $ilDB->manipulate("UPDATE il_wiki_data SET " . " startpage = " . $ilDB->quote(ilWikiUtil::makeDbTitle($a_name), "text") . " WHERE id = " . $ilDB->quote($a_id, "integer")); }
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; } // path $loc = $this->getContextPath($a_ref_id); 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 . "&target=" . $item["context_obj_type"]); $this->addItem($feed_item); return; } } $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"]); $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 . "&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"; include_once "./Modules/Wiki/classes/class.ilWikiUtil.php"; $wptitle = ilWikiUtil::makeUrlTitle(ilWikiPage::lookupTitle($item["context_sub_obj_id"])); $feed_item->setLink(ILIAS_HTTP_PATH . "/goto.php?client_id=" . CLIENT_ID . "&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 . "&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 . "&target=" . $item["context_obj_type"] . "_" . $item["ref_id"]); } } else { $feed_item->setLink(ILIAS_HTTP_PATH . "/goto.php?client_id=" . CLIENT_ID . "&target=" . $item["context_obj_type"] . "_" . $item["ref_id"]); //echo "<br>".ILIAS_HTTP_PATH."/goto.php?client_id=".CLIENT_ID. // "&target=".$item["context_obj_type"]."_".$item["ref_id"]; } } } $feed_item->setAbout($feed_item->getLink() . "&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); } }