/** */ protected function initUserInstance() { if ($this->authorEntity instanceof ilObjUser && $this->authorEntity->getId()) { $this->author = $this->authorEntity; } else { if (is_numeric($this->authorEntity) && $this->authorEntity) { // Try to read user instance from preloaded cache array $this->author = ilForumAuthorInformationCache::getUserObjectById($this->authorEntity); if (!$this->author) { // Get a user instance from forum module's cache method $this->author = ilObjForumAccess::getCachedUserInstance($this->authorEntity); } } } if (!$this->author) { $this->author = new ilObjUser(); $this->author->setId(0); $this->author->setPref('public_profile', 'n'); $this->author->setGender(''); } }
private function getUserData() { global $lng; if ($this->id && $this->user_id) { require_once "Modules/Forum/classes/class.ilObjForumAccess.php"; if ($tmp_user = ilObjForumAccess::getCachedUserInstance($this->user_id)) { $this->fullname = $tmp_user->getFullname(); $this->loginname = $tmp_user->getLogin(); unset($tmp_user); } $this->fullname = $this->fullname ? $this->fullname : ($this->import_name ? $this->import_name : $lng->txt('unknown')); return true; } return false; }
/** * 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(); }
/** * @return array */ public function getProperties() { /** * @var $lng ilLanguage * @var $ilUser ilObjUser * @var $ilAccess ilAccessHandler */ global $lng, $ilUser, $ilAccess; if (!$ilAccess->checkAccess('read', '', $this->ref_id)) { return array(); } $lng->loadLanguageModule('forum'); $props = array(); include_once 'Modules/Forum/classes/class.ilObjForumAccess.php'; $properties = ilObjForumAccess::getStatisticsByRefId($this->ref_id); $num_posts_total = $properties['num_posts']; $num_unread_total = $properties['num_unread_posts']; $num_new_total = $properties['num_new_posts']; $last_post = ilObjForumAccess::getLastPostByRefId($this->ref_id); if (!$ilUser->isAnonymous()) { if ($this->getDetailsLevel() == ilObjectListGUI::DETAILS_ALL) { $alert = $num_unread_total > 0 ? true : false; $props[] = array('alert' => $alert, 'property' => $lng->txt('forums_articles') . ' (' . $lng->txt('unread') . ')', 'value' => $num_posts_total . ' (' . $num_unread_total . ')'); // New $alert = $num_new_total > 0 ? true : false; $props[] = array('alert' => $alert, 'property' => $lng->txt('forums_new_articles'), 'value' => $num_new_total); } } else { $props[] = array('alert' => false, 'property' => $lng->txt('forums_articles'), 'value' => $num_posts_total); } include_once 'Modules/Forum/classes/class.ilForumProperties.php'; if ($this->getDetailsLevel() == ilObjectListGUI::DETAILS_ALL) { if (ilForumProperties::getInstance($this->obj_id)->isAnonymized()) { $props[] = array('alert' => false, 'newline' => false, 'property' => $lng->txt('forums_anonymized'), 'value' => $lng->txt('yes')); } } // Last Post if ((int) $last_post['pos_pk']) { $lpCont = "<a class=\"il_ItemProperty\" target=\"" . ilFrameTargetInfo::_getFrame('MainContent') . "\" href=\"ilias.php?baseClass=ilRepositoryGUI&cmd=viewThread&cmdClass=ilobjforumgui&target=true&pos_pk=" . $last_post['pos_pk'] . "&thr_pk=" . $last_post['pos_thr_fk'] . "&ref_id=" . $this->ref_id . "#" . $last_post["pos_pk"] . "\">" . ilObjForumAccess::prepareMessageForLists($last_post['pos_message']) . "</a> " . strtolower($lng->txt('from')) . " "; require_once 'Modules/Forum/classes/class.ilForumAuthorInformation.php'; $authorinfo = new ilForumAuthorInformation($last_post['pos_usr_id'], $last_post['pos_usr_alias'], $last_post['import_name'], array('class' => 'il_ItemProperty', 'href' => 'ilias.php?baseClass=ilRepositoryGUI&cmd=showUser&cmdClass=ilobjforumgui&ref_id=' . $this->ref_id . '&user='******'pos_usr_id'] . '&offset=0&backurl=' . urlencode('ilias.php?baseClass=ilRepositoryGUI&ref_id=' . $_GET['ref_id']))); $lpCont .= $authorinfo->getLinkedAuthorName(); $lpCont .= ', ' . ilDatePresentation::formatDate(new ilDateTime($last_post['pos_date'], IL_CAL_DATETIME)); $props[] = array('alert' => false, 'newline' => true, 'property' => $lng->txt('forums_last_post'), 'value' => $lpCont); } return $props; }
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 . "&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 . "&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 . "&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); } }
/** * Gets the disk usage of the object in bytes. * @access public * @return integer the disk usage in bytes */ function getDiskUsage() { require_once "./Modules/File/classes/class.ilObjFileAccess.php"; return ilObjForumAccess::_lookupDiskUsage($this->id); }
/** * Standard Version of Fill Row. Most likely to * be overwritten by derived class. */ protected function fillRow($a_set) { global $lng, $ilCtrl; $news_set = new ilSetting("news"); $enable_internal_rss = $news_set->get("enable_rss_for_internal"); // context $obj_id = ilObject::_lookupObjId($a_set["ref_id"]); $obj_type = ilObject::_lookupType($obj_id); $obj_title = ilObject::_lookupTitle($obj_id); // user if ($a_set["user_id"] > 0) { $this->tpl->setCurrentBlock("user_info"); if ($obj_type == "frm") { include_once "./Modules/Forum/classes/class.ilForumProperties.php"; if (ilForumProperties::_isAnonymized($a_set["context_obj_id"])) { if ($a_set["context_sub_obj_type"] == "pos" && $a_set["context_sub_obj_id"] > 0) { include_once "./Modules/Forum/classes/class.ilForumPost.php"; $post = new ilForumPost($a_set["context_sub_obj_id"]); if ($post->getUserAlias() != "") { $this->tpl->setVariable("VAL_AUTHOR", ilUtil::stripSlashes($post->getUserAlias())); } else { $this->tpl->setVariable("VAL_AUTHOR", $lng->txt("forums_anonymous")); } } else { $this->tpl->setVariable("VAL_AUTHOR", $lng->txt("forums_anonymous")); } } else { if (ilObject::_exists($a_set["user_id"])) { $user_obj = new ilObjUser($a_set["user_id"]); $this->tpl->setVariable("VAL_AUTHOR", $user_obj->getLogin()); } } } else { if (ilObject::_exists($a_set["user_id"])) { $user_obj = new ilObjUser($a_set["user_id"]); $this->tpl->setVariable("VAL_AUTHOR", $user_obj->getLogin()); } } $this->tpl->setVariable("TXT_AUTHOR", $lng->txt("author")); $this->tpl->parseCurrentBlock(); } // media player if ($a_set["content_type"] == NEWS_AUDIO && $a_set["mob_id"] > 0 && ilObject::_exists($a_set["mob_id"])) { include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php"; include_once "./Services/MediaObjects/classes/class.ilMediaPlayerGUI.php"; $mob = new ilObjMediaObject($a_set["mob_id"]); $med = $mob->getMediaItem("Standard"); $mpl = new ilMediaPlayerGUI(); $mpl->setFile(ilObjMediaObject::_getDirectory($a_set["mob_id"]) . "/" . $med->getLocation()); $this->tpl->setCurrentBlock("player"); $this->tpl->setVariable("PLAYER", $mpl->getMp3PlayerHtml()); $this->tpl->parseCurrentBlock(); } // access if ($enable_internal_rss) { $this->tpl->setCurrentBlock("access"); include_once "./Services/Block/classes/class.ilBlockSetting.php"; $this->tpl->setVariable("TXT_ACCESS", $lng->txt("news_news_item_visibility")); if ($a_set["visibility"] == NEWS_PUBLIC || $a_set["priority"] == 0 && ilBlockSetting::_lookup("news", "public_notifications", 0, $obj_id)) { $this->tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_public")); } else { $this->tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_users")); } $this->tpl->parseCurrentBlock(); } // content if ($a_set["content"] != "") { $this->tpl->setCurrentBlock("content"); $this->tpl->setVariable("VAL_CONTENT", ilUtil::makeClickable($a_set["content"], true)); $this->tpl->parseCurrentBlock(); } if ($a_set["content_long"] != "") { $this->tpl->setCurrentBlock("long"); $this->tpl->setVariable("VAL_LONG_CONTENT", ilUtil::makeClickable($a_set["content_long"], true)); $this->tpl->parseCurrentBlock(); } if ($a_set["update_date"] != $a_set["creation_date"]) { $this->tpl->setCurrentBlock("ni_update"); $this->tpl->setVariable("TXT_LAST_UPDATE", $lng->txt("last_update")); $this->tpl->setVariable("VAL_LAST_UPDATE", ilDatePresentation::formatDate(new ilDateTime($a_set["update_date"], IL_CAL_DATETIME))); $this->tpl->parseCurrentBlock(); } // forum hack, not nice $add = ""; if ($obj_type == "frm" && $a_set["context_sub_obj_type"] == "pos" && $a_set["context_sub_obj_id"] > 0) { include_once "./Modules/Forum/classes/class.ilObjForumAccess.php"; $pos = $a_set["context_sub_obj_id"]; $thread = ilObjForumAccess::_getThreadForPosting($pos); if ($thread > 0) { $add = "_" . $thread . "_" . $pos; } } $url_target = "./goto.php?client_id=" . rawurlencode(CLIENT_ID) . "&target=" . $obj_type . "_" . $a_set["ref_id"] . $add; $this->tpl->setCurrentBlock("context"); $cont_loc = new ilLocatorGUI(); $cont_loc->addContextItems($a_set["ref_id"], true); $this->tpl->setVariable("CONTEXT_LOCATOR", $cont_loc->getHTML()); $this->tpl->setVariable("HREF_CONTEXT_TITLE", $url_target); $this->tpl->setVariable("CONTEXT_TITLE", $obj_title); $this->tpl->setVariable("ALT_CONTEXT_TITLE", $lng->txt("icon") . " " . $lng->txt("obj_" . $obj_type)); $this->tpl->setVariable("IMG_CONTEXT_TITLE", ilUtil::getImagePath("icon_" . $obj_type . "_b.png")); $this->tpl->parseCurrentBlock(); $this->tpl->setVariable("HREF_TITLE", $url_target); // title if ($a_set["content_is_lang_var"]) { $this->tpl->setVariable("VAL_TITLE", $lng->txt($a_set["title"])); } else { $this->tpl->setVariable("VAL_TITLE", ilUtil::stripSlashes($a_set["title"])); // title } // creation date $this->tpl->setVariable("VAL_CREATION_DATE", ilDatePresentation::formatDate(new ilDateTime($a_set["creation_date"], IL_CAL_DATETIME))); $this->tpl->setVariable("TXT_CREATED", $lng->txt("created")); $this->tpl->parseCurrentBlock(); }
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 . "&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 . "&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 . "&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"]); } } } $feed_item->setAbout($feed_item->getLink() . "&il_about_feed=" . $item["id"]); $feed_item->setDate($item["creation_date"]); $this->addItem($feed_item); } } }