public function forwardToPageObject()
 {
     global $lng, $ilTabs;
     $ilTabs->clearTargets();
     $ilTabs->setBackTarget($lng->txt('back'), $this->ctrl->getLinkTarget($this), '_top');
     // page object
     include_once 'Services/COPage/classes/class.ilPageObject.php';
     include_once 'Services/COPage/classes/class.ilPageObjectGUI.php';
     $lng->loadLanguageModule('content');
     include_once './Services/Style/classes/class.ilObjStyleSheet.php';
     $this->tpl->setVariable('LOCATION_CONTENT_STYLESHEET', ilObjStyleSheet::getContentStylePath(0));
     if (!ilPageObject::_exists('shop', self::SHOP_PAGE_EDITOR_PAGE_ID)) {
         // doesn't exist -> create new one
         $new_page_object = new ilPageObject('shop');
         $new_page_object->setParentId(0);
         $new_page_object->setId(self::SHOP_PAGE_EDITOR_PAGE_ID);
         $new_page_object->createFromXML();
     }
     $this->ctrl->setReturnByClass('ilpageobjectgui', 'edit');
     $page_gui = new ilPageObjectGUI('shop', self::SHOP_PAGE_EDITOR_PAGE_ID);
     $page_gui->setIntLinkHelpDefault('StructureObject', self::SHOP_PAGE_EDITOR_PAGE_ID);
     $page_gui->setTemplateTargetVar('ADM_CONTENT');
     $page_gui->setLinkXML('');
     $page_gui->setFileDownloadLink($this->ctrl->getLinkTargetByClass(array('ilpageobjectgui'), 'downloadFile'));
     $page_gui->setFullscreenLink($this->ctrl->getLinkTargetByClass(array('ilpageobjectgui'), 'displayMediaFullscreen'));
     $page_gui->setSourcecodeDownloadScript($this->ctrl->getLinkTargetByClass(array('ilpageobjectgui'), 'download_paragraph'));
     $page_gui->setPresentationTitle('');
     $page_gui->setTemplateOutput(false);
     $page_gui->setHeader('');
     $page_gui->setEnabledRepositoryObjects(false);
     $page_gui->setEnabledFileLists(true);
     $page_gui->setEnabledMaps(true);
     $page_gui->setEnabledPCTabs(true);
     return $this->ctrl->forwardCommand($page_gui);
 }
 /**
  * Export all pages
  */
 function exportHTMLPages()
 {
     global $tpl, $ilBench, $ilLocator;
     $pages = ilWikiPage::getAllPages($this->wiki->getId());
     include_once "./Services/COPage/classes/class.ilPageContentUsage.php";
     include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
     foreach ($pages as $page) {
         if (ilPageObject::_exists("wpg", $page["id"])) {
             $this->exportPageHTML($page["id"]);
             $this->co_page_html_export->collectPageElements("wpg:pg", $page["id"]);
         }
     }
     $this->co_page_html_export->exportPageElements();
 }
 /**
  * Get tail dependencies
  *
  * @param		string		entity
  * @param		string		target release
  * @param		array		ids
  * @return		array		array of array with keys "component", entity", "ids"
  */
 function getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
 {
     include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
     include_once "./Services/COPage/classes/class.ilPageObject.php";
     $pg_ids = array();
     foreach ($a_ids as $id) {
         $pages = ilWikiPage::getAllPages($id);
         foreach ($pages as $p) {
             if (ilPageObject::_exists("wpg", $p["id"])) {
                 $pg_ids[] = "wpg:" . $p["id"];
             }
         }
     }
     return array(array("component" => "Services/COPage", "entity" => "pg", "ids" => $pg_ids), array("component" => "Services/Rating", "entity" => "rating_category", "ids" => $a_ids));
 }
 /**
  * Final processing
  *
  * @param	array		mapping array
  */
 function finalProcessing($a_mapping)
 {
     $pages = $a_mapping->getMappingsOfEntity("Services/COPage", "pg");
     $media_objects = $a_mapping->getMappingsOfEntity("Services/MediaObjects", "mob");
     $file_objects = $a_mapping->getMappingsOfEntity("Modules/File", "file");
     if (count($media_objects) > 0 || count($file_objects) > 0) {
         foreach ($pages as $p) {
             $id = explode(":", $p);
             if (count($id) == 2) {
                 include_once "./Services/COPage/classes/class.ilPageObject.php";
                 if (ilPageObject::_exists($id[0], $id[1])) {
                     $new_page = new ilPageObject($id[0], $id[1]);
                     $new_page->buildDom();
                     $med = $new_page->resolveMediaAliases($media_objects);
                     $fil = $new_page->resolveFileItems($file_objects);
                     if ($med || $fil) {
                         $new_page->update(false, true);
                     }
                 }
             }
         }
     }
 }
 /**
  * parse pages that contain files, mobs and/or internal links
  */
 function processPagesToParse()
 {
     /*
     		$pg_mapping = array();
     		foreach($this->pg_mapping as $key => $value)
     		{
     			$pg_mapping[$key] = "il__pg_".$value;
     		}*/
     //echo "<br><b>processIntLinks</b>"; flush();
     // outgoin internal links
     foreach ($this->pages_to_parse as $page_id) {
         $page_arr = explode(":", $page_id);
         //echo "<br>resolve:".$this->content_object->getType().":".$page_id; flush();
         switch ($page_arr[0]) {
             case "lm":
                 switch ($this->content_object->getType()) {
                     case "lm":
                         include_once "./Modules/LearningModule/classes/class.ilLMPage.php";
                         $page_obj = new ilLMPage($page_arr[1]);
                         break;
                     default:
                         die("Unknown content type " . $this->content_object->getType());
                 }
                 break;
             case "gdf":
                 include_once "./Modules/Glossary/classes/class.ilGlossaryDefPage.php";
                 $page_obj = new ilGlossaryDefPage($page_arr[1]);
                 break;
             case "qpl":
                 $page_obj = new ilAssQuestionPage($page_arr[1]);
                 break;
         }
         $page_obj->buildDom();
         $page_obj->resolveIntLinks();
         $page_obj->resolveIIMMediaAliases($this->mob_mapping);
         if (in_array($this->coType, array("lm", "dbk"))) {
             $page_obj->resolveQuestionReferences($this->qst_mapping);
         }
         $page_obj->update(false);
         if ($page_arr[0] == "gdf") {
             $def = new ilGlossaryDefinition($page_arr[1]);
             $def->updateShortText();
         }
         unset($page_obj);
     }
     //echo "<br><b>map area internal links</b>"; flush();
     // outgoins map area (mob) internal links
     foreach ($this->mobs_with_int_links as $mob_id) {
         ilMediaItem::_resolveMapAreaLinks($mob_id);
     }
     //echo "<br><b>incoming interna links</b>"; flush();
     // incoming internal links
     $done = array();
     foreach ($this->link_targets as $link_target) {
         //echo "doin link target:".$link_target.":<br>";
         $link_arr = explode("_", $link_target);
         $target_inst = $link_arr[1];
         $target_type = $link_arr[2];
         $target_id = $link_arr[3];
         //echo "<br>-".$target_type."-".$target_id."-".$target_inst."-";
         $sources = ilInternalLink::_getSourcesOfTarget($target_type, $target_id, $target_inst);
         foreach ($sources as $key => $source) {
             //echo "got source:".$key.":<br>";
             if (in_array($key, $done)) {
                 continue;
             }
             $type_arr = explode(":", $source["type"]);
             // content object pages
             if ($type_arr[1] == "pg") {
                 if (ilPageObject::_exists($type_arr[0], $source["id"])) {
                     include_once "./Services/COPage/classes/class.ilPageObjectFactory.php";
                     $page_object = ilPageObjectFactory::getInstance($type_arr[0], $source["id"]);
                     $page_object->buildDom();
                     $page_object->resolveIntLinks();
                     $page_object->update();
                     unset($page_object);
                 }
             }
             // eventually correct links in questions to learning modules
             if ($type_arr[0] == "qst") {
                 require_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
                 assQuestion::_resolveIntLinks($source["id"]);
             }
             // eventually correct links in survey questions to learning modules
             if ($type_arr[0] == "sqst") {
                 require_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
                 SurveyQuestion::_resolveIntLinks($source["id"]);
             }
             $done[$key] = $key;
         }
     }
 }
 /**
  * Export all pages
  */
 function exportHTMLPages()
 {
     global $tpl, $ilBench, $ilLocator;
     require_once "Services/Portfolio/classes/class.ilPortfolioPage.php";
     $pages = ilPortfolioPage::getAllPages($this->object->getId());
     $this->tabs = array();
     foreach ($pages as $page) {
         // substitute blog id with title
         if ($page["type"] == ilPortfolioPage::TYPE_BLOG) {
             include_once "Modules/Blog/classes/class.ilObjBlog.php";
             $page["title"] = ilObjBlog::_lookupTitle((int) $page["title"]);
         }
         $this->tabs[$page["id"]] = $page["title"];
     }
     // for sub-pages, e.g. blog postings
     $tpl_callback = array($this, "buildExportTemplate");
     include_once "./Services/COPage/classes/class.ilPageContentUsage.php";
     include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
     $has_index = false;
     foreach ($pages as $page) {
         if (ilPageObject::_exists("prtf", $page["id"])) {
             $this->active_tab = "user_page_" . $page["id"];
             if ($page["type"] == ilPortfolioPage::TYPE_BLOG) {
                 $link_template = "prtf_" . $page["id"] . "_bl{TYPE}_{ID}.html";
                 include_once "Modules/Blog/classes/class.ilObjBlogGUI.php";
                 $blog = new ilObjBlogGUI((int) $page["title"], ilObject2GUI::WORKSPACE_OBJECT_ID);
                 $blog->exportHTMLPages($this->export_dir . "/", $link_template, $tpl_callback, $this->co_page_html_export, "prtf_" . $page["id"] . ".html");
             } else {
                 $this->exportPageHTML($page["id"]);
                 $this->co_page_html_export->collectPageElements("prtf:pg", $page["id"]);
             }
             if (!$has_index) {
                 copy($this->export_dir . "/prtf_" . $page["id"] . ".html", $this->export_dir . "/index.html");
                 $has_index = true;
             }
         }
     }
     $this->co_page_html_export->exportPageElements();
 }
 /**
  * Lookup usages of media object
  *
  * @todo: This should be all in one context -> mob id table
  */
 function lookupUsages($a_id, $a_include_history = true)
 {
     global $ilDB;
     $hist_str = "";
     if ($a_include_history) {
         $hist_str = ", usage_hist_nr";
     }
     // get usages in pages
     $q = "SELECT DISTINCT usage_type, usage_id, usage_lang" . $hist_str . " FROM mob_usage WHERE id = " . $ilDB->quote($a_id, "integer");
     if (!$a_include_history) {
         $q .= " AND usage_hist_nr = " . $ilDB->quote(0, "integer");
     }
     $us_set = $ilDB->query($q);
     $ret = array();
     while ($us_rec = $ilDB->fetchAssoc($us_set)) {
         $ut = "";
         if (is_int(strpos($us_rec["usage_type"], ":"))) {
             $us_arr = explode(":", $us_rec["usage_type"]);
             $ut = $us_arr[1];
             $ct = $us_arr[0];
         }
         // check whether page exists
         $skip = false;
         if ($ut == "pg") {
             include_once "./Services/COPage/classes/class.ilPageObject.php";
             if (!ilPageObject::_exists($ct, $us_rec["usage_id"])) {
                 $skip = true;
             }
         }
         if (!$skip) {
             $ret[] = array("type" => $us_rec["usage_type"], "id" => $us_rec["usage_id"], "lang" => $us_rec["usage_lang"], "hist_nr" => $us_rec["usage_hist_nr"]);
         }
     }
     // get usages in media pools
     $q = "SELECT DISTINCT mep_id FROM mep_tree JOIN mep_item ON (child = obj_id) WHERE mep_item.foreign_id = " . $ilDB->quote($a_id, "integer") . " AND mep_item.type = " . $ilDB->quote("mob", "text");
     $us_set = $ilDB->query($q);
     while ($us_rec = $ilDB->fetchAssoc($us_set)) {
         $ret[] = array("type" => "mep", "id" => $us_rec["mep_id"]);
     }
     // get usages in news items (media casts)
     include_once "./Services/News/classes/class.ilNewsItem.php";
     $news_usages = ilNewsItem::_lookupMediaObjectUsages($a_id);
     foreach ($news_usages as $nu) {
         $ret[] = $nu;
     }
     // get usages in map areas
     $q = "SELECT DISTINCT mob_id FROM media_item it, map_area area " . " WHERE area.item_id = it.id " . " AND area.link_type = " . $ilDB->quote("int", "text") . " " . " AND area.target = " . $ilDB->quote("il__mob_" . $a_id, "text");
     $us_set = $ilDB->query($q);
     while ($us_rec = $ilDB->fetchAssoc($us_set)) {
         $ret[] = array("type" => "map", "id" => $us_rec["mob_id"]);
     }
     // get usages in personal clipboards
     $users = ilObjUser::_getUsersForClipboadObject("mob", $a_id);
     foreach ($users as $user) {
         $ret[] = array("type" => "clip", "id" => $user);
     }
     return $ret;
 }
 /**
  * Fix container item group references after a container has been cloned
  *
  * @param
  * @return
  */
 static function fixContainerItemGroupRefsAfterCloning($a_source_container, $a_copy_id)
 {
     global $ilLog;
     $ilLog->write(__METHOD__ . ': Fix item group references in ' . $a_source_container->getType());
     include_once 'Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
     $cwo = ilCopyWizardOptions::_getInstance($a_copy_id);
     $mappings = $cwo->getMappings();
     $new_container_ref_id = $mappings[$a_source_container->getRefId()];
     $ilLog->write(__METHOD__ . ': 2-' . $new_container_ref_id . '-');
     $new_container_obj_id = ilObject::_lookupObjId($new_container_ref_id);
     include_once "./Services/COPage/classes/class.ilPageObject.php";
     include_once "./Services/Container/classes/class.ilContainerPage.php";
     $ilLog->write(__METHOD__ . ': 3' . $new_container_obj_id . '-');
     if (ilPageObject::_exists("cont", $new_container_obj_id)) {
         $ilLog->write(__METHOD__ . ': 4');
         $new_page = new ilContainerPage($new_container_obj_id);
         $new_page->buildDom();
         include_once "./Services/COPage/classes/class.ilPCResources.php";
         ilPCResources::modifyItemGroupRefIdsByMapping($new_page, $mappings);
         $new_page->update();
     }
     $ilLog->write(__METHOD__ . ': 5');
 }
 /**
  * Lookup usages of media object
  *
  * @todo: This should be all in one context -> mob id table
  */
 function lookupUsages($a_id, $a_incl_hist = true)
 {
     global $ilDB;
     // get usages in pages
     $q = "SELECT * FROM page_pc_usage WHERE pc_id = " . $ilDB->quote($a_id, "integer") . " AND pc_type = " . $ilDB->quote("incl", "text");
     if (!$a_incl_hist) {
         $q .= " AND usage_hist_nr = " . $ilDB->quote(0, "integer");
     }
     $us_set = $ilDB->query($q);
     $ret = array();
     while ($us_rec = $ilDB->fetchAssoc($us_set)) {
         $ut = "";
         if (is_int(strpos($us_rec["usage_type"], ":"))) {
             $us_arr = explode(":", $us_rec["usage_type"]);
             $ut = $us_arr[1];
             $ct = $us_arr[0];
         }
         // check whether page exists
         $skip = false;
         if ($ut == "pg") {
             include_once "./Services/COPage/classes/class.ilPageObject.php";
             if (!ilPageObject::_exists($ct, $us_rec["usage_id"])) {
                 $skip = true;
             }
         }
         if (!$skip) {
             $ret[] = array("type" => $us_rec["usage_type"], "id" => $us_rec["usage_id"], "hist_nr" => $us_rec["usage_hist_nr"]);
         }
     }
     // get usages in media pools
     $q = "SELECT DISTINCT mep_id FROM mep_tree JOIN mep_item ON (child = obj_id) WHERE mep_item.obj_id = " . $ilDB->quote($a_id, "integer") . " AND mep_item.type = " . $ilDB->quote("pg", "text");
     $us_set = $ilDB->query($q);
     while ($us_rec = $ilDB->fetchAssoc($us_set)) {
         $ret[] = array("type" => "mep", "id" => $us_rec["mep_id"]);
     }
     return $ret;
 }
 /**
  * Replaces existing question content elements with
  * new copies
  */
 function newQuestionCopies(&$temp_dom)
 {
     // Get question IDs
     $path = "//Question";
     $xpc = xpath_new_context($temp_dom);
     $res =& xpath_eval($xpc, $path);
     $q_ids = array();
     include_once "./Services/COPage/classes/class.ilInternalLink.php";
     for ($i = 0; $i < count($res->nodeset); $i++) {
         $qref = $res->nodeset[$i]->get_attribute("QRef");
         $inst_id = ilInternalLink::_extractInstOfTarget($qref);
         $q_id = ilInternalLink::_extractObjIdOfTarget($qref);
         if (!($inst_id > 0)) {
             if ($q_id > 0) {
                 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
                 $question = assQuestion::_instanciateQuestion($q_id);
                 // check if page for question exists
                 // due to a bug in early 4.2.x version this is possible
                 if (!ilPageObject::_exists("qpl", $q_id)) {
                     $question->createPageObject();
                 }
                 // now copy this question and change reference to
                 // new question id
                 $duplicate_id = $question->duplicate(false);
                 $res->nodeset[$i]->set_attribute("QRef", "il__qst_" . $duplicate_id);
             }
         }
     }
 }
 /**
  * Forward to page editor
  */
 protected function forwardToPageObject()
 {
     global $lng, $tpl;
     $key = (int) $_REQUEST['key'];
     $this->ctrl->saveParameter($this, 'key', $key);
     include_once "./Services/COPage/classes/class.ilPageObject.php";
     include_once "./Services/COPage/classes/class.ilPageObjectGUI.php";
     include_once './Services/Style/classes/class.ilObjStyleSheet.php';
     $lng->loadLanguageModule("content");
     if (!ilPageObject::_exists('auth', $key)) {
         // doesn't exist -> create new one
         $new_page_object = new ilPageObject('auth');
         $new_page_object->setParentId($key);
         $new_page_object->setId($key);
         $new_page_object->createFromXML();
     }
     include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
     $tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
     $tpl->setCurrentBlock("SyntaxStyle");
     $tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
     $tpl->parseCurrentBlock();
     $this->ctrl->setReturnByClass('ilpageobjectgui', "edit");
     $page_gui = new ilPageObjectGUI('auth', $key);
     $page_gui->setIntLinkHelpDefault("RepositoryItem", $key);
     $page_gui->setTemplateTargetVar("ADM_CONTENT");
     $page_gui->setLinkXML($link_xml);
     //$page_gui->enableChangeComments($this->content_object->isActiveHistoryUserComments());
     //$page_gui->setFileDownloadLink($this->ctrl->getLinkTarget($this, "downloadFile"));
     //$page_gui->setFullscreenLink($this->ctrl->getLinkTarget($this, "showMediaFullscreen"));
     //$page_gui->setLinkParams($this->ctrl->getUrlParameterString()); // todo
     //		$page_gui->setSourcecodeDownloadScript($this->ctrl->getLinkTarget($this, ""));
     $page_gui->setPresentationTitle("");
     $page_gui->setTemplateOutput(false);
     //$page_gui->setLocator($contObjLocator);
     $page_gui->setHeader("");
     $page_gui->setEnabledRepositoryObjects(true);
     $page_gui->setEnabledLoginPage(true);
     $page_gui->setEnabledFileLists(false);
     $page_gui->setEnabledMaps(true);
     $page_gui->setEnabledPCTabs(true);
     $page_gui->setEnabledInternalLinks(true);
     // style tab
     //$page_gui->setTabHook($this, "addPageTabs");
     if ($this->ctrl->getCmd() == 'editPage') {
         $this->ctrl->setCmd('edit');
     }
     $html = $this->ctrl->forwardCommand($page_gui);
     $tpl->setContent($html);
 }
Exemple #12
0
 /**
  * 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("&", "&amp;", $a_new_name);
     if ($pg_id == 0 || $pg_id == $this->getId()) {
         include_once "./Services/Link/classes/class.ilInternalLink.php";
         $sources = ilInternalLink::_getSourcesOfTarget("wpg", $this->getId(), 0);
         foreach ($sources as $s) {
             if ($s["type"] == "wpg:pg" && ilPageObject::_exists("wpg", $s["id"])) {
                 $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 (&nbsp;) 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;
 }
 /**
  * execute command
  */
 function &executeCommand()
 {
     global $tpl, $ilCtrl, $ilTabs, $ilSetting;
     $next_class = $this->ctrl->getNextClass($this);
     $cmd = $this->ctrl->getCmd();
     //echo "<br>:cmd:".$this->ctrl->getCmd().":cmdClass:".$this->ctrl->getCmdClass().":".
     //	":nextClass:".$next_class.":"; flush();
     switch ($next_class) {
         case "illmpagegui":
             // Determine whether the view of a learning resource should
             // be shown in the frameset of ilias, or in a separate window.
             //$showViewInFrameset = $this->ilias->ini->readVariable("layout","view_target") == "frame";
             $showViewInFrameset = true;
             $lm_set = new ilSetting("lm");
             $this->ctrl->setReturn($this, "edit");
             if (!ilPageObject::_exists("lm", $this->obj->getId(), $_GET["transl"]) && ilPageObject::_exists("lm", $this->obj->getId(), "-")) {
                 if ($_GET["totransl"] == "") {
                     $_GET["totransl"] = $_GET["transl"];
                     $ilCtrl->setCmd("switchToLanguage");
                 }
                 $ilCtrl->setCmdClass("illmpagegui");
                 $page_gui = new ilLMPageGUI($this->obj->getId(), 0, false, "-");
             } else {
                 $page_gui = new ilLMPageGUI($this->obj->getId());
             }
             $page_gui->setEditPreview(true);
             $page_gui->activateMetaDataEditor($this->content_object->getID(), $this->obj->getId(), $this->obj->getType(), $this->obj, "MDUpdateListener");
             if ($ilSetting->get("block_activated_news")) {
                 $page_gui->setEnabledNews(true, $this->obj->content_object->getId(), $this->obj->content_object->getType());
             }
             // set page view link
             if ($showViewInFrameset) {
                 $view_frame = ilFrameTargetInfo::_getFrame("MainContent");
             } else {
                 $view_frame = "ilContObj" . $this->content_object->getID();
             }
             $page_gui->setViewPageLink(ILIAS_HTTP_PATH . "/goto.php?target=pg_" . $this->obj->getId() . "_" . $_GET["ref_id"], $view_frame);
             include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
             $page_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId($this->content_object->getStyleSheetId(), "lm"));
             $page_gui->setTemplateTargetVar("ADM_CONTENT");
             $page_gui->getPageObject()->buildDom();
             $int_links = $page_gui->getPageObject()->getInternalLinks();
             $link_xml = $this->getLinkXML($int_links);
             $page_gui->setLinkXML($link_xml);
             $page_gui->enableChangeComments($this->content_object->isActiveHistoryUserComments());
             $page_gui->setFileDownloadLink("ilias.php?cmd=downloadFile&ref_id=" . $_GET["ref_id"] . "&baseClass=ilLMPresentationGUI");
             $page_gui->setFullscreenLink("ilias.php?cmd=fullscreen&ref_id=" . $_GET["ref_id"] . "&baseClass=ilLMPresentationGUI");
             $page_gui->setLinkParams("ref_id=" . $this->content_object->getRefId());
             $page_gui->setSourcecodeDownloadScript("ilias.php?ref_id=" . $_GET["ref_id"] . "&baseClass=ilLMPresentationGUI");
             $page_gui->setPresentationTitle(ilLMPageObject::_getPresentationTitle($this->obj->getId(), $this->content_object->getPageHeader(), $this->content_object->isActiveNumbering()));
             $page_gui->setLocator($contObjLocator);
             $page_gui->setHeader($this->lng->txt("page") . ": " . $this->obj->getTitle());
             $page_gui->setActivationListener($this, "activatePage");
             $up_gui = $this->content_object->getType() == "dbk" ? "ilobjdlbookgui" : "ilobjlearningmodulegui";
             $ilCtrl->setParameterByClass($up_gui, "active_node", $this->obj->getId());
             $page_gui->setExplorerUpdater("tree", "tree_div", $ilCtrl->getLinkTargetByClass($up_gui, "explorer", "", true));
             $tpl->setTitleIcon(ilUtil::getImagePath("icon_pg_b.png"));
             $tpl->setTitle($this->lng->txt("page") . ": " . $this->obj->getTitle());
             if ($this->content_object->getLayoutPerPage()) {
                 $page_gui->setTabHook($this, "addPageTabs");
             }
             $ret = $this->ctrl->forwardCommand($page_gui);
             $tpl->setContent($ret);
             break;
         default:
             $ret =& $this->{$cmd}();
             break;
     }
 }
Exemple #14
0
 /**
  * Copy page
  *
  * @param int $a_id target page id
  * @param string $a_parent_type target parent type
  * @param int $a_parent_id target parent id
  */
 function copy($a_id, $a_parent_type = "", $a_parent_id = 0, $a_clone_mobs = false)
 {
     if ($a_parent_type == "") {
         $a_parent_type = $this->getParentType();
         if ($a_parent_id == 0) {
             $a_parent_id = $this->getParentId();
         }
     }
     include_once "./Services/COPage/classes/class.ilPageObjectFactory.php";
     foreach (self::lookupTranslations($this->getParentType(), $this->getId()) as $l) {
         $existed = false;
         $orig_page = ilPageObjectFactory::getInstance($this->getParentType(), $this->getId(), 0, $l);
         if (ilPageObject::_exists($a_parent_type, $a_id, $l)) {
             $new_page_object = ilPageObjectFactory::getInstance($a_parent_type, $a_id, 0, $l);
             $existed = true;
         } else {
             $new_page_object = ilPageObjectFactory::getInstance($a_parent_type, 0, 0, $l);
             $new_page_object->setParentId($a_parent_id);
             $new_page_object->setId($a_id);
         }
         $new_page_object->setXMLContent($orig_page->copyXMLContent($a_clone_mobs));
         $new_page_object->setActive($orig_page->getActive());
         $new_page_object->setActivationStart($orig_page->getActivationStart());
         $new_page_object->setActivationEnd($orig_page->getActivationEnd());
         if ($existed) {
             $new_page_object->buildDom();
             $new_page_object->update();
         } else {
             $new_page_object->create();
         }
     }
 }
 /**
  * Validate all pages
  */
 function validatePages()
 {
     include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
     include_once "./Services/COPage/classes/class.ilPageObject.php";
     $mess = "";
     $pages = ilLMPageObject::getPageList($this->getId());
     foreach ($pages as $page) {
         if (ilPageObject::_exists($this->getType(), $page["obj_id"])) {
             $cpage = new ilPageObject($this->getType(), $page["obj_id"]);
             $cpage->buildDom();
             $error = @$cpage->validateDom();
             if ($error != "") {
                 $this->lng->loadLanguageModule("content");
                 ilUtil::sendInfo($this->lng->txt("cont_import_validation_errors"));
                 $title = ilLMObject::_lookupTitle($page["obj_id"]);
                 $page_obj = new ilLMPageObject($this, $page["obj_id"]);
                 $mess .= $this->lng->txt("obj_pg") . ": " . $title;
                 $mess .= '<div class="small">';
                 foreach ($error as $e) {
                     $err_mess = implode($e, " - ");
                     if (!is_int(strpos($err_mess, ":0:"))) {
                         $mess .= htmlentities($err_mess) . "<br />";
                     }
                 }
                 $mess .= '</div>';
                 $mess .= "<br />";
             }
         }
     }
     return $mess;
 }
 private function __getAbstractHTML($a_payment_object_id)
 {
     // page object
     include_once 'Services/COPage/classes/class.ilPageObject.php';
     include_once 'Services/COPage/classes/class.ilPageObjectGUI.php';
     // if page does not exist, return nothing
     if (!ilPageObject::_exists('shop', $a_payment_object_id)) {
         return '';
     }
     include_once 'Services/Style/classes/class.ilObjStyleSheet.php';
     // get page object
     $page_gui = new ilPageObjectGUI('shop', $a_payment_object_id);
     $page_gui->setIntLinkHelpDefault('StructureObject', $a_payment_object_id);
     $page_gui->setLinkXML('');
     $page_gui->setFileDownloadLink($this->ctrl->getLinkTargetByClass('ilPageObjectGUI', 'downloadFile'));
     $page_gui->setFullscreenLink($this->ctrl->getLinkTargetByClass('ilPageObjectGUI', 'displayMediaFullscreen'));
     $page_gui->setSourcecodeDownloadScript($this->ctrl->getLinkTargetByClass('ilPageObjectGUI', 'download_paragraph'));
     $page_gui->setPresentationTitle('');
     $page_gui->setTemplateOutput(false);
     $page_gui->setHeader('');
     $page_gui->setEnabledRepositoryObjects(false);
     $page_gui->setEnabledFileLists(false);
     $page_gui->setEnabledPCTabs(true);
     $page_gui->setEnabledMaps(true);
     return $page_gui->showPage();
 }
 /**
  * Clone container settings
  *
  * @access public
  * @param int target ref_id
  * @param int copy id
  * @return object new object 
  */
 public function cloneObject($a_target_id, $a_copy_id = 0)
 {
     $new_obj = parent::cloneObject($a_target_id, $a_copy_id);
     include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
     $sorting = new ilContainerSortingSettings($new_obj->getId());
     $sorting->setSortMode($this->getOrderType());
     $sorting->update();
     // copy content page
     include_once "./Services/COPage/classes/class.ilPageObject.php";
     if (ilPageObject::_exists($this->getType(), $this->getId())) {
         $orig_page = new ilPageObject($this->getType(), $this->getId());
         $new_page_object = new ilPageObject($this->getType());
         $new_page_object->setParentId($new_obj->getId());
         $new_page_object->setId($new_obj->getId());
         $new_page_object->createFromXML();
         $new_page_object->setXMLContent($orig_page->getXMLContent());
         $new_page_object->buildDom();
         $new_page_object->update();
     }
     return $new_obj;
 }
 /**
  * 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 (ilPageObject::_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();
 }
 /**
  * Get lm page object
  *
  * @param
  * @return
  */
 function getLMPage($a_id)
 {
     include_once "./Modules/LearningModule/classes/class.ilLMPage.php";
     if ($this->lang != "-" && ilPageObject::_exists("lm", $a_id, $this->lang)) {
         return new ilLMPage($a_id, 0, $this->lang);
     }
     return new ilLMPage($a_id);
 }
 /**
  * Switch to language
  */
 function switchToLanguage()
 {
     global $ilCtrl;
     $l = ilUtil::stripSlashes($_GET["totransl"]);
     $p = $this->getPageObject();
     if (!ilPageObject::_exists($p->getParentType(), $p->getId(), $l)) {
         $this->confirmPageTranslationCreation();
         return;
     }
     $ilCtrl->setParameter($this, "transl", $_GET["totransl"]);
     $ilCtrl->redirect($this, "edit");
 }
 public function forwardToPageObject()
 {
     /**
      * @var $ilTabs ilTabsGUI
      */
     global $ilTabs;
     if (!(int) $_GET['pobject_id']) {
         ilUtil::sendInfo($this->lng->txt('paya_no_object_selected'));
         return $this->showObjects();
     }
     $this->ctrl->setParameter($this, 'pobject_id', (int) $_GET['pobject_id']);
     $this->__initPaymentObject((int) $_GET['pobject_id']);
     $this->lng->loadLanguageModule('content');
     $ilTabs->clearTargets();
     $ilTabs->clearSubTabs();
     $ilTabs->setBackTarget($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'editDetails'), '_top');
     // page objec
     include_once 'Services/COPage/classes/class.ilPageObject.php';
     include_once 'Services/COPage/classes/class.ilPageObjectGUI.php';
     include_once './Services/Style/classes/class.ilObjStyleSheet.php';
     $this->tpl->setVariable('LOCATION_CONTENT_STYLESHEET', ilObjStyleSheet::getContentStylePath(0));
     if (!ilPageObject::_exists('shop', $this->pobject->getPobjectId())) {
         // doesn't exist -> create new one
         $new_page_object = new ilPageObject('shop');
         $new_page_object->setParentId(0);
         $new_page_object->setId($this->pobject->getPobjectId());
         $new_page_object->createFromXML();
     }
     $this->ctrl->setReturnByClass('ilpageobjectgui', 'edit');
     $page_gui = new ilPageObjectGUI('shop', $this->pobject->getPobjectId());
     $this->ctrl->setParameter($page_gui, 'pobject_id', (int) $_GET['pobject_id']);
     $page_gui->setIntLinkHelpDefault('StructureObject', $this->pobject->getPobjectId());
     $page_gui->setTemplateTargetVar('ADM_CONTENT');
     $page_gui->setLinkXML('');
     $page_gui->setFileDownloadLink($this->ctrl->getLinkTargetByClass(array('ilpageobjectgui'), 'downloadFile'));
     $page_gui->setFullscreenLink($this->ctrl->getLinkTargetByClass(array('ilpageobjectgui'), 'displayMediaFullscreen'));
     $page_gui->setSourcecodeDownloadScript($this->ctrl->getLinkTargetByClass(array('ilpageobjectgui'), 'download_paragraph'));
     $page_gui->setPresentationTitle('');
     $page_gui->setTemplateOutput(false);
     $page_gui->setHeader('');
     $page_gui->setEnabledRepositoryObjects(false);
     $page_gui->setEnabledFileLists(true);
     $page_gui->setEnabledMaps(true);
     $page_gui->setEnabledPCTabs(true);
     return $this->ctrl->forwardCommand($page_gui);
 }
 /**
  * Get effective language for given language. This checks if
  * - multilinguality is activated and
  * - the given language is part of the available translations
  * If not a "-" is returned (master language).
  *
  * @param string $a_lang language
  * @param string $a_parent_type page parent type
  * @return string effective language ("-" for master)
  */
 function getEffectiveContentLang($a_lang, $a_parent_type)
 {
     $langs = $this->getLanguages();
     if ($this->getContentActivated() && isset($langs[$a_lang]) && ilPageObject::_exists($a_parent_type, $this->getObjId(), $a_lang)) {
         return $a_lang;
     }
     return "-";
 }
 /**
  * Get effective language
  *
  * @param
  * @return
  */
 function getEffectiveLang($a_lang)
 {
     if ($this->getActivated() && in_array($a_lang, $this->getLanguages()) && ilPageObject::_exists($this->getParentType(), $this->getParentId(), $a_lang)) {
         return $a_lang;
     }
     return "-";
 }