/** * Read data * * @param * @return */ function readData($a_entity, $a_version, $a_ids, $a_field = "") { global $ilDB; if (!is_array($a_ids)) { $a_ids = array($a_ids); } if ($a_entity == "mcst") { switch ($a_version) { case "4.1.0": $this->getDirectDataFromQuery("SELECT id, title, description, " . " public_files, downloadable, def_access default_access" . " FROM il_media_cast_data JOIN object_data ON (il_media_cast_data.id = object_data.obj_id) " . "WHERE " . $ilDB->in("id", $a_ids, false, "integer")); break; case "5.0.0": $this->getDirectDataFromQuery("SELECT id, title, description, " . " public_files, downloadable, def_access default_access, sortmode, viewmode" . " FROM il_media_cast_data JOIN object_data ON (il_media_cast_data.id = object_data.obj_id) " . "WHERE " . $ilDB->in("id", $a_ids, false, "integer")); // #17174 - manual order? $order = array(); $set = $ilDB->query("SELECT * FROM il_media_cast_data_ord" . " WHERE " . $ilDB->in("obj_id", $a_ids, false, "integer") . " ORDER BY pos"); while ($row = $ilDB->fetchAssoc($set)) { $order[$row["obj_id"]][] = $row["item_id"]; } include_once "./Services/Block/classes/class.ilBlockSetting.php"; foreach ($this->data as $k => $v) { $this->data[$k]["PublicFeed"] = ilBlockSetting::_lookup("news", "public_feed", 0, $v["Id"]); $this->data[$k]["KeepRssMin"] = (int) ilBlockSetting::_lookup("news", "keep_rss_min", 0, $v["Id"]); // manual order? if ($this->data[$k]["Sortmode"] == 4 && array_key_exists($v["Id"], $order)) { $this->data[$k]["Order"] = implode(";", $order[$v["Id"]]); } } break; } } }
/** * Standard Version of Fill Row. Most likely to * be overwritten by derived class. */ protected function fillRow($a_set) { global $lng, $ilCtrl, $ilAccess; $news_set = new ilSetting("news"); $enable_internal_rss = $news_set->get("enable_rss_for_internal"); // user if ($a_set["user_id"] > 0) { $this->tpl->setCurrentBlock("user_info"); $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(); } // access if ($enable_internal_rss) { $this->tpl->setCurrentBlock("access"); $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, $a_set["context_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(); } // last update if ($a_set["creation_date"] != $a_set["update_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(); } // 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")); // title $this->tpl->setVariable("VAL_TITLE", $a_set["title"]); // content if ($a_set["content"] != "") { $this->tpl->setCurrentBlock("content"); $this->tpl->setVariable("VAL_CONTENT", ilUtil::shortenText($a_set["content"], 80, true, true), true); $this->tpl->parseCurrentBlock(); } $perm_ref_id = $this->perm_ref_id > 0 ? $this->perm_ref_id : $a_set["ref_id"]; if ($ilAccess->checkAccess("write", "", $perm_ref_id)) { $this->tpl->setCurrentBlock("edit"); $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit")); $ilCtrl->setParameterByClass("ilnewsitemgui", "news_item_id", $a_set["id"]); $this->tpl->setVariable("CMD_EDIT", $ilCtrl->getLinkTargetByClass("ilnewsitemgui", "editNewsItem")); $this->tpl->parseCurrentBlock(); } // context $this->tpl->setVariable("CONTEXT", $lng->txt("obj_" . $a_set["context_obj_type"]) . ":<br />" . ilObject::_lookupTitle($a_set["context_obj_id"])); $this->tpl->setVariable("VAL_ID", $a_set["id"]); }
/** * Init setting form */ function initSettingsForm() { global $ilUser, $lng, $ilCtrl, $ilSetting, $ilTabs; $ilTabs->clearTargets(); $news_set = new ilSetting("news"); $enable_internal_rss = $news_set->get("enable_rss_for_internal"); $public = ilBlockSetting::_lookup($this->getBlockType(), "public_notifications", 0, $this->block_id); $public_feed = ilBlockSetting::_lookup($this->getBlockType(), "public_feed", 0, $this->block_id); $hide_block = ilBlockSetting::_lookup($this->getBlockType(), "hide_news_block", 0, $this->block_id); $hide_news_per_date = ilBlockSetting::_lookup($this->getBlockType(), "hide_news_per_date", 0, $this->block_id); $hide_news_date = ilBlockSetting::_lookup($this->getBlockType(), "hide_news_date", 0, $this->block_id); if ($hide_news_date != "") { $hide_news_date = explode(" ", $hide_news_date); } include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $this->settings_form = new ilPropertyFormGUI(); $this->settings_form->setTitle($lng->txt("news_settings")); $this->settings_form->setTitleIcon(ilUtil::getImagePath("icon_news.png")); // hide news block for learners if ($this->getProperty("hide_news_block_option")) { $ch = new ilCheckboxInputGUI($lng->txt("news_hide_news_block"), "hide_news_block"); $ch->setInfo($lng->txt("news_hide_news_block_info")); $ch->setChecked($hide_block); $this->settings_form->addItem($ch); $hnpd = new ilCheckboxInputGUI($lng->txt("news_hide_news_per_date"), "hide_news_per_date"); $hnpd->setInfo($lng->txt("news_hide_news_per_date_info")); $hnpd->setChecked($hide_news_per_date); $dt_prop = new ilDateTimeInputGUI($lng->txt("news_hide_news_date"), "hide_news_date"); if ($hide_news_date != "") { $dt_prop->setDate(new ilDateTime($hide_news_date[0] . ' ' . $hide_news_date[1], IL_CAL_DATETIME)); } #$dt_prop->setDate($hide_news_date[0]); #$dt_prop->setTime($hide_news_date[1]); $dt_prop->setShowTime(true); //$dt_prop->setInfo($lng->txt("news_hide_news_date_info")); $hnpd->addSubItem($dt_prop); $this->settings_form->addItem($hnpd); } // default visibility if ($this->getProperty("default_visibility_option") && $enable_internal_rss) { $default_visibility = ilBlockSetting::_lookup($this->getBlockType(), "default_visibility", 0, $this->block_id); if ($default_visibility == "") { $default_visibility = ilNewsItem::_getDefaultVisibilityForRefId($_GET["ref_id"]); } // Default Visibility $radio_group = new ilRadioGroupInputGUI($lng->txt("news_default_visibility"), "default_visibility"); $radio_option = new ilRadioOption($lng->txt("news_visibility_users"), "users"); $radio_group->addOption($radio_option); $radio_option = new ilRadioOption($lng->txt("news_visibility_public"), "public"); $radio_group->addOption($radio_option); $radio_group->setInfo($lng->txt("news_news_item_visibility_info")); $radio_group->setRequired(false); $radio_group->setValue($default_visibility); $this->settings_form->addItem($radio_group); } // public notifications if ($this->getProperty("public_notifications_option") && $enable_internal_rss) { $ch = new ilCheckboxInputGUI($lng->txt("news_notifications_public"), "notifications_public"); $ch->setInfo($lng->txt("news_notifications_public_info")); $ch->setChecked($public); $this->settings_form->addItem($ch); } // extra rss feed if ($enable_internal_rss) { $ch = new ilCheckboxInputGUI($lng->txt("news_public_feed"), "notifications_public_feed"); $ch->setInfo($lng->txt("news_public_feed_info")); $ch->setChecked($public_feed); $this->settings_form->addItem($ch); } //$this->settings_form->addCheckboxProperty($lng->txt("news_public_feed"), "notifications_public_feed", // "1", $public_feed, $lng->txt("news_public_feed_info")); //if ($this->getProperty("public_notifications_option")) //{ // $this->settings_form->addCheckboxProperty($lng->txt("news_notifications_public"), "notifications_public", // "1", $public, $lng->txt("news_notifications_public_info")); //} $this->settings_form->addCommandButton("saveSettings", $lng->txt("save")); $this->settings_form->addCommandButton("cancelSettings", $lng->txt("cancel")); $this->settings_form->setFormAction($ilCtrl->getFormaction($this)); }
function _lookupUserPDPeriod($a_user_id) { global $ilSetting; $news_set = new ilSetting("news"); $allow_shorter_periods = $news_set->get("allow_shorter_periods"); $allow_longer_periods = $news_set->get("allow_longer_periods"); $default_per = ilNewsItem::_lookupDefaultPDPeriod(); include_once "./Services/Block/classes/class.ilBlockSetting.php"; $per = ilBlockSetting::_lookup("pdnews", "news_pd_period", $a_user_id, 0); // news period information if ($per <= 0 || !$allow_shorter_periods && $per < $default_per || !$allow_longer_periods && $per > $default_per) { $per = $default_per; } return $per; }
/** * Init Settings Form */ function initSettingsForm() { global $tpl, $lng, $ilCtrl; $lng->loadLanguageModule("mcst"); include "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form_gui = new ilPropertyFormGUI(); $this->form_gui->setTitle($lng->txt("mcst_settings")); // Title $tit = new ilTextInputGUI($lng->txt("title"), "title"); $tit->setValue($this->object->getTitle()); $tit->setRequired(true); $this->form_gui->addItem($tit); // description $des = new ilTextAreaInputGUI($lng->txt("description"), "description"); $des->setValue($this->object->getLongDescription()); $this->form_gui->addItem($des); // Online $online = new ilCheckboxInputGUI($lng->txt("online"), "online"); $online->setChecked($this->object->getOnline()); $this->form_gui->addItem($online); // Sorting $sort = new ilRadioGroupInputGUI($lng->txt("mcst_ordering"), "order"); $sort->addOption(new ilRadioOption($lng->txt("mcst_ordering_title"), ilObjMediaCast::ORDER_TITLE)); $sort->addOption(new ilRadioOption($lng->txt("mcst_ordering_creation_date_asc"), ilObjMediaCast::ORDER_CREATION_DATE_ASC)); $sort->addOption(new ilRadioOption($lng->txt("mcst_ordering_creation_date_desc"), ilObjMediaCast::ORDER_CREATION_DATE_DESC)); $sort->addOption(new ilRadioOption($lng->txt("mcst_ordering_manual"), ilObjMediaCast::ORDER_MANUAL)); $sort->setValue($this->object->getOrder()); $this->form_gui->addItem($sort); // view mode $options = array(ilObjMediaCast::VIEW_LIST => $lng->txt("mcst_list"), ilObjMediaCast::VIEW_GALLERY => $lng->txt("mcst_gallery")); $si = new ilSelectInputGUI($this->lng->txt("mcst_viewmode"), "viewmode"); $si->setOptions($options); $si->setValue($this->object->getViewMode()); $this->form_gui->addItem($si); // Downloadable $downloadable = new ilCheckboxInputGUI($lng->txt("mcst_downloadable"), "downloadable"); $downloadable->setChecked($this->object->getDownloadable()); $downloadable->setInfo($lng->txt("mcst_downloadable_info")); $this->form_gui->addItem($downloadable); $news_set = new ilSetting("news"); $enable_internal_rss = $news_set->get("enable_rss_for_internal"); //Default Visibility if ($enable_internal_rss) { $radio_group = new ilRadioGroupInputGUI($lng->txt("news_default_visibility"), "defaultaccess"); $radio_option = new ilRadioOption($lng->txt("news_visibility_users"), "0"); $radio_group->addOption($radio_option); $radio_option = new ilRadioOption($lng->txt("news_visibility_public"), "1"); $radio_group->addOption($radio_option); $radio_group->setInfo($lng->txt("news_news_item_visibility_info")); $radio_group->setRequired(false); $radio_group->setValue($this->object->getDefaultAccess()); #$ch->addSubItem($radio_group); $this->form_gui->addItem($radio_group); //Extra Feed include_once "./Services/Block/classes/class.ilBlockSetting.php"; $public_feed = ilBlockSetting::_lookup("news", "public_feed", 0, $this->object->getId()); $ch = new ilCheckboxInputGUI($lng->txt("news_public_feed"), "extra_feed"); $ch->setInfo($lng->txt("news_public_feed_info")); $ch->setChecked($public_feed); $this->form_gui->addItem($ch); // keep minimal x number of items $ni = new ilNumberInputGUI($this->lng->txt("news_keep_minimal_x_items"), "keep_rss_min"); $ni->setMaxValue(100); $ni->setMinValue(0); $ni->setMaxLength(3); $ni->setSize(3); $ni->setInfo($this->lng->txt("news_keep_minimal_x_items_info") . " (" . ilNewsItem::_lookupRSSPeriod() . " " . (ilNewsItem::_lookupRSSPeriod() == 1 ? $lng->txt("day") : $lng->txt("days")) . ")"); $ni->setValue((int) ilBlockSetting::_lookup("news", "keep_rss_min", 0, $this->object->getId())); $ch->addSubItem($ni); // Include Files in Pubic Items $incl_files = new ilCheckboxInputGUI($lng->txt("mcst_incl_files_in_rss"), "public_files"); $incl_files->setChecked($this->object->getPublicFiles()); $incl_files->setInfo($lng->txt("mcst_incl_files_in_rss_info")); #$ch->addSubItem($incl_files); $this->form_gui->addItem($incl_files); } // Form action and save button $this->form_gui->addCommandButton("saveSettings", $lng->txt("save")); $this->form_gui->setFormAction($ilCtrl->getFormAction($this, "saveSettings")); }
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); } }
/** * 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(); }
/** * Lookup side. * */ public static function _lookupSide($a_type, $a_user = 0, $a_block_id = 0) { $side = ilBlockSetting::_lookup($a_type, "side", $a_user, $a_block_id); return $side; }
/** * Clone media cast * * @param int target ref_id * @param int copy id */ public function cloneObject($a_target_id, $a_copy_id = 0) { global $ilDB, $ilUser, $ilias; $new_obj = parent::cloneObject($a_target_id, $a_copy_id); //copy online status if object is not the root copy object $cp_options = ilCopyWizardOptions::_getInstance($a_copy_id); if (!$cp_options->isRootNode($this->getRefId())) { $new_obj->setOnline($this->getOnline()); } //$new_obj->setTitle($this->getTitle()); $new_obj->setPublicFiles($this->getPublicFiles()); $new_obj->setDownloadable($this->getDownloadable()); $new_obj->setDefaultAccess($this->getDefaultAccess()); $new_obj->setOrder($this->getOrder()); $new_obj->setViewMode($this->getViewMode()); $new_obj->update(); include_once "./Services/Block/classes/class.ilBlockSetting.php"; $pf = ilBlockSetting::_lookup("news", "public_feed", 0, $this->getId()); $keeprss = (int) ilBlockSetting::_lookup("news", "keep_rss_min", 0, $this->getId()); ilBlockSetting::_write("news", "public_feed", $pf, 0, $new_obj->getId()); ilBlockSetting::_write("news", "keep_rss_min", $keeprss, 0, $new_obj->getId()); // copy items $this->copyItems($new_obj); // copy order!? return $new_obj; }