public function getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
 {
     $res = array();
     // postings
     include_once "./Modules/Blog/classes/class.ilBlogPosting.php";
     $pg_ids = array();
     foreach ($a_ids as $id) {
         $pages = ilBlogPosting::getAllPostings($id);
         foreach (array_keys($pages) as $p) {
             $pg_ids[] = "blp:" . $p;
         }
     }
     if (sizeof($pg_ids)) {
         $res[] = array("component" => "Services/COPage", "entity" => "pg", "ids" => $pg_ids);
     }
     // style
     $style_ids = array();
     foreach ($a_ids as $id) {
         include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
         $style_id = ilObjStyleSheet::lookupObjectStyle($id);
         if ($style_id > 0) {
             $style_ids[] = $style_id;
         }
     }
     if (sizeof($style_ids)) {
         $res[] = array("component" => "Services/Style", "entity" => "sty", "ids" => $style_ids);
     }
     return $res;
 }
 public function getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
 {
     include_once "./Modules/Blog/classes/class.ilBlogPosting.php";
     $pg_ids = array();
     foreach ($a_ids as $id) {
         $pages = ilBlogPosting::getAllPostings($id);
         foreach (array_keys($pages) as $p) {
             $pg_ids[] = "blp:" . $p;
         }
     }
     return array(array("component" => "Services/COPage", "entity" => "pg", "ids" => $pg_ids));
 }
 /**
  * Export all pages
  * 
  * @param string $a_target_directory
  * @param string $a_link_template (embedded)
  * @param array $a_tpl_callback (embedded)
  * @param object $a_co_page_html_export (embedded)
  * @param string $a_index_name (embedded)
  */
 function exportHTMLPages($a_target_directory, $a_link_template = null, $a_tpl_callback = null, $a_co_page_html_export = null, $a_index_name = "index.html")
 {
     if (!$a_link_template) {
         $a_link_template = "bl{TYPE}_{ID}.html";
     }
     if ($a_co_page_html_export) {
         $this->co_page_html_export = $a_co_page_html_export;
     }
     $nav = $this->renderNavigation($this->items, "", "", $a_link_template);
     // month list
     $has_index = false;
     foreach (array_keys($this->items) as $month) {
         $file = $this->buildExportLink($a_link_template, "list", $month);
         $list = $this->renderList($this->items[$month], $month, "render", $a_link_template);
         if (!$a_tpl_callback) {
             $tpl = $this->buildExportTemplate();
         } else {
             $tpl = call_user_func($a_tpl_callback);
         }
         $file = $this->writeExportFile($a_target_directory, $file, $tpl, $list, $nav);
         if (!$has_index) {
             copy($file, $a_target_directory . "/" . $a_index_name);
             $has_index = true;
         }
     }
     // single postings
     include_once "./Services/COPage/classes/class.ilPageContentUsage.php";
     include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
     $pages = ilBlogPosting::getAllPostings($this->object->getId(), 0);
     foreach ($pages as $page) {
         if (ilBlogPosting::_exists("blp", $page["id"])) {
             include_once "./Modules/Blog/classes/class.ilBlogPostingGUI.php";
             $blp_gui = new ilBlogPostingGUI(0, null, $page["id"]);
             $blp_gui->setOutputMode("offline");
             $blp_gui->add_date = true;
             $page_content = $blp_gui->showPage();
             $back = $this->buildExportLink($a_link_template, "list", substr($page["created"]->get(IL_CAL_DATE), 0, 7));
             $file = $this->buildExportLink($a_link_template, "posting", $page["id"]);
             if (!$a_tpl_callback) {
                 $tpl = $this->buildExportTemplate();
             } else {
                 $tpl = call_user_func($a_tpl_callback);
             }
             $this->writeExportFile($a_target_directory, $file, $tpl, $page_content, $nav, $back);
             $this->co_page_html_export->collectPageElements("blp:pg", $page["id"]);
         }
     }
     $this->co_page_html_export->exportPageElements();
 }
Beispiel #4
0
 /**
  * Init blog posting form
  *
  * @param int $a_blog_id
  * @param bool $a_insert
  * @return ilPropertyFormGUI
  */
 protected function initPostingForm($a_blog_id, $a_insert = false)
 {
     global $ilCtrl, $ilUser;
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($ilCtrl->getFormAction($this));
     if ($a_insert) {
         $form->setTitle($this->lng->txt("cont_insert_blog"));
     } else {
         $form->setTitle($this->lng->txt("cont_update_blog"));
     }
     $options = array();
     include_once "Modules/Blog/classes/class.ilBlogPosting.php";
     $postings = ilBlogPosting::getAllPostings($a_blog_id);
     if ($postings) {
         foreach ($postings as $post) {
             // could be posting from someone else
             if ($post["author"] == $ilUser->getId()) {
                 $date = new ilDateTime($post["date"], IL_CAL_DATETIME);
                 $title = $post["title"] . " - " . ilDatePresentation::formatDate($date);
                 $cbox = new ilCheckboxInputGUI($title, "posting");
                 $cbox->setValue($post["id"]);
                 $options[] = $cbox;
             }
         }
     }
     asort($options);
     $obj = new ilCheckboxGroupInputGUI($this->lng->txt("cont_pc_blog_posting"), "posting");
     $obj->setRequired(true);
     $obj->setOptions($options);
     $form->addItem($obj);
     $blog_id = new ilHiddenInputGUI("blog_id");
     $blog_id->setValue($a_blog_id);
     $form->addItem($blog_id);
     if ($a_insert) {
         $form->addCommandButton("create_blog", $this->lng->txt("save"));
         $form->addCommandButton("cancelCreate", $this->lng->txt("cancel"));
     } else {
         $obj->setValue($this->content_obj->getPostings());
         $form->addCommandButton("update", $this->lng->txt("save"));
         $form->addCommandButton("cancelUpdate", $this->lng->txt("cancel"));
     }
     return $form;
 }
 /**
  * Deliver blog as rss feed
  * 
  * @param int $a_wsp_id
  */
 static function deliverRSS($a_wsp_id)
 {
     global $tpl, $ilSetting;
     if (!$ilSetting->get('enable_global_profiles')) {
         return;
     }
     // #10827
     if (substr($a_wsp_id, -4) != "_cll") {
         include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
         $wsp_id = new ilWorkspaceTree(0);
         $obj_id = $wsp_id->lookupObjectId($a_wsp_id);
         $is_wsp = "_wsp";
     } else {
         $a_wsp_id = substr($a_wsp_id, 0, -4);
         $obj_id = ilObject::_lookupObjId($a_wsp_id);
         $is_wsp = null;
     }
     if (!$obj_id) {
         return;
     }
     $blog = new self($obj_id, false);
     if (!$blog->hasRSS()) {
         return;
     }
     include_once "Services/Feeds/classes/class.ilFeedWriter.php";
     $feed = new ilFeedWriter();
     include_once "Services/Link/classes/class.ilLink.php";
     $url = ilLink::_getStaticLink($a_wsp_id, "blog", true, $is_wsp);
     $url = str_replace("&", "&", $url);
     $feed->setChannelTitle($blog->getTitle());
     $feed->setChannelDescription($blog->getDescription());
     $feed->setChannelLink($url);
     // needed for blogpostinggui / pagegui
     $tpl = new ilTemplate("tpl.main.html", true, true);
     include_once "./Modules/Blog/classes/class.ilBlogPosting.php";
     include_once "./Modules/Blog/classes/class.ilBlogPostingGUI.php";
     foreach (ilBlogPosting::getAllPostings($obj_id) as $item) {
         $id = $item["id"];
         // only published items
         $is_active = ilBlogPosting::_lookupActive($id, "blp");
         if (!$is_active) {
             continue;
         }
         $snippet = strip_tags(ilBlogPostingGUI::getSnippet($id));
         $snippet = str_replace("&", "&", $snippet);
         $url = ilLink::_getStaticLink($a_wsp_id, "blog", true, "_" . $id . $is_wsp);
         $url = str_replace("&", "&", $url);
         $feed_item = new ilFeedItem();
         $feed_item->setTitle($item["title"]);
         $feed_item->setDate($item["created"]->get(IL_CAL_DATETIME));
         $feed_item->setDescription($snippet);
         $feed_item->setLink($url);
         $feed_item->setAbout($url);
         $feed->addItem($feed_item);
     }
     $feed->showFeed();
     exit;
 }
 protected function initKeywordsForm()
 {
     global $ilUser;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this, "saveKeywordsForm"));
     $form->setTitle($this->lng->txt("blog_edit_keywords"));
     $txt = new ilTextInputGUI($this->lng->txt("blog_keywords"), "keywords");
     // $txt->setRequired(true); #10504
     $txt->setMulti(true);
     $txt->setDataSource($this->ctrl->getLinkTarget($this, "keywordAutocomplete", "", true));
     $txt->setMaxLength(200);
     $txt->setSize(50);
     $txt->setInfo($this->lng->txt("blog_keywords_info"));
     $form->addItem($txt);
     $md_section = $this->getBlogPosting()->getMDSection();
     $keywords = array();
     foreach ($ids = $md_section->getKeywordIds() as $id) {
         $md_key = $md_section->getKeyword($id);
         if (trim($md_key->getKeyword()) != "") {
             $keywords[$md_key->getKeywordLanguageCode()][] = $md_key->getKeyword();
         }
     }
     // language is not "used" anywhere
     $ulang = $ilUser->getLanguage();
     if ($keywords[$ulang]) {
         asort($keywords[$ulang]);
         $txt->setValue($keywords[$ulang]);
     }
     // other keywords in blog
     $other = array();
     foreach (array_keys(ilBlogPosting::getAllPostings($this->getBlogPosting()->getBlogId())) as $posting_id) {
         if ($posting_id != $this->getBlogPosting()->getId()) {
             $other = array_merge($other, ilBlogPosting::getKeywords($this->getBlogPosting()->getBlogId(), $posting_id));
         }
     }
     if (is_array($keywords[$ulang])) {
         $other = array_diff($other, $keywords[$ulang]);
     }
     if (sizeof($other)) {
         $html = "";
         foreach ($other as $item) {
             $html .= '<span class="ilTag">' . $item . '</span>';
         }
         $info = new ilNonEditableValueGUI($this->lng->txt("blog_keywords_other"), "", true);
         $info->setInfo($this->lng->txt("blog_keywords_other_info"));
         $info->setValue($html);
         $form->addItem($info);
     }
     $form->addCommandButton("saveKeywordsForm", $this->lng->txt("save"));
     $form->addCommandButton("preview", $this->lng->txt("cancel"));
     return $form;
 }