当前位置: 首页>>代码示例>>PHP>>正文


PHP ilLMObject::_lookupContObjID方法代码示例

本文整理汇总了PHP中ilLMObject::_lookupContObjID方法的典型用法代码示例。如果您正苦于以下问题:PHP ilLMObject::_lookupContObjID方法的具体用法?PHP ilLMObject::_lookupContObjID怎么用?PHP ilLMObject::_lookupContObjID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ilLMObject的用法示例。


在下文中一共展示了ilLMObject::_lookupContObjID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getParentObjectIdForUsage


//.........这里部分代码省略.........
                     // temporary items (per user)
                 // temporary items (per user)
                 case "frm~":
                 case "exca~":
                     $obj_id = $a_usage['id'];
                     break;
                     // "old" category pages
                 // "old" category pages
                 case "cat":
                     // InfoScreen Text
                 // InfoScreen Text
                 case "tst":
                 case "svy":
                     // data collection
                 // data collection
                 case "dcl":
                     $obj_id = $id;
                     break;
             }
             break;
             // page editor
         // page editor
         case "pg":
             switch ($cont_type) {
                 case "qpl":
                     // Question Pool Question Pages
                     include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
                     $qinfo = assQuestion::_getQuestionInfo($id);
                     if ($qinfo["original_id"] > 0) {
                         include_once "./Modules/Test/classes/class.ilObjTest.php";
                         $obj_id = ilObjTest::_lookupTestObjIdForQuestionId($id);
                         // usage in test
                     } else {
                         $obj_id = $qinfo["obj_fi"];
                         // usage in pool
                     }
                     break;
                 case "lm":
                 case "dbk":
                     // learning modules
                     include_once "./Modules/LearningModule/classes/class.ilLMObject.php";
                     $obj_id = ilLMObject::_lookupContObjID($id);
                     break;
                 case "gdf":
                     // glossary definition
                     include_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php";
                     include_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php";
                     $term_id = ilGlossaryDefinition::_lookupTermId($id);
                     $obj_id = ilGlossaryTerm::_lookGlossaryID($term_id);
                     break;
                 case "wpg":
                     // wiki page
                     include_once 'Modules/Wiki/classes/class.ilWikiPage.php';
                     $obj_id = ilWikiPage::lookupObjIdByPage($id);
                     break;
                 case "sahs":
                     // sahs page
                     // can this implementation be used for other content types, too?
                     include_once './Services/COPage/classes/class.ilPageObject.php';
                     $obj_id = ilPageObject::lookupParentId($id, 'sahs');
                     break;
                 case "prtf":
                     // portfolio
                     include_once "Modules/Portfolio/classes/class.ilPortfolioPage.php";
                     $obj_id = ilPortfolioPage::findPortfolioForPage($id);
                     break;
                 case "prtt":
                     // portfolio template
                     include_once "Modules/Portfolio/classes/class.ilPortfolioTemplatePage.php";
                     $obj_id = ilPortfolioTemplatePage::findPortfolioForPage($id);
                     break;
                 case "blp":
                     // blog
                     include_once './Services/COPage/classes/class.ilPageObject.php';
                     $obj_id = ilPageObject::lookupParentId($id, 'blp');
                     break;
                 case "crs":
                 case "grp":
                 case "cat":
                 case "fold":
                 case "root":
                     // repository pages
                     $obj_id = $id;
                     break;
             }
             break;
             // Media Pool
         // Media Pool
         case "mep":
             $obj_id = $id;
             break;
             // News Context Object (e.g. MediaCast)
         // News Context Object (e.g. MediaCast)
         case "news":
             include_once "./Services/News/classes/class.ilNewsItem.php";
             $obj_id = ilNewsItem::_lookupContextObjId($id);
             break;
     }
     return $obj_id;
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:101,代码来源:class.ilObjMediaObject.php

示例2: _goto

 /**
  * redirect script
  *
  * @param	string		$a_target
  */
 function _goto($a_target, $a_target_ref_id = "")
 {
     global $rbacsystem, $ilErr, $lng, $ilAccess;
     // determine learning object
     $lm_id = ilLMObject::_lookupContObjID($a_target);
     // get all references
     $ref_ids = ilObject::_getAllReferences($lm_id);
     // always try passed ref id first
     if (in_array($a_target_ref_id, $ref_ids)) {
         $ref_ids = array_merge(array($a_target_ref_id), $ref_ids);
     }
     // check read permissions
     foreach ($ref_ids as $ref_id) {
         // Permission check
         if ($ilAccess->checkAccess("read", "", $ref_id)) {
             // don't redirect anymore, just set parameters
             // (goto.php includes  "ilias.php")
             $_GET["baseClass"] = "ilLMPresentationGUI";
             $_GET["obj_id"] = $a_target;
             $_GET["ref_id"] = $ref_id;
             include_once "ilias.php";
             exit;
         }
     }
     if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
         ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"), ilObject::_lookupTitle($lm_id)), true);
         include_once "./Services/Object/classes/class.ilObjectGUI.php";
         ilObjectGUI::_gotoRepositoryRoot();
     }
     $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:36,代码来源:class.ilStructureObjectGUI.php

示例3: _getPresentationTitle

 /**
  * presentation title doesn't have to be page title, it may be
  * chapter title + page title or chapter title only, depending on settings
  *
  * @param	string	$a_mode		IL_CHAPTER_TITLE | IL_PAGE_TITLE | IL_NO_HEADER
  */
 static function _getPresentationTitle($a_pg_id, $a_mode = IL_CHAPTER_TITLE, $a_include_numbers = false, $a_time_scheduled_activation = false, $a_force_content = false, $a_lm_id = 0, $a_lang = "-")
 {
     if ($a_mode == IL_NO_HEADER && !$a_force_content) {
         return "";
     }
     if ($a_lm_id == 0) {
         $a_lm_id = ilLMObject::_lookupContObjID($a_pg_id);
     }
     if ($a_lm_id == 0) {
         return "";
     }
     // this is optimized when ilLMObject::preloadDataByLM is invoked (e.g. done in ilLMExplorerGUI)
     $title = ilLMObject::_lookupTitle($a_pg_id);
     // this is also optimized since ilObjectTranslation re-uses instances for one lm
     include_once "./Services/Object/classes/class.ilObjectTranslation.php";
     $ot = ilObjectTranslation::getInstance($a_lm_id);
     $languages = $ot->getLanguages();
     if ($a_lang != "-" && $ot->getContentActivated() && isset($languages[$a_lang])) {
         include_once "./Modules/LearningModule/classes/class.ilLMObjTranslation.php";
         $lmobjtrans = new ilLMObjTranslation($a_pg_id, $a_lang);
         if ($lmobjtrans->getTitle() != "") {
             $title = $lmobjtrans->getTitle();
         }
     }
     if ($a_mode == IL_PAGE_TITLE) {
         return $title;
     }
     include_once "./Modules/LearningModule/classes/class.ilLMTree.php";
     $tree = ilLMTree::getInstance($a_lm_id);
     if ($tree->isInTree($a_pg_id)) {
         $pred_node = $tree->fetchPredecessorNode($a_pg_id, "st");
         $childs = $tree->getChildsByType($pred_node["obj_id"], "pg");
         $cnt_str = "";
         if (count($childs) > 1) {
             $cnt = 0;
             foreach ($childs as $child) {
                 include_once "./Modules/LearningModule/classes/class.ilLMPage.php";
                 $active = ilLMPage::_lookupActive($child["obj_id"], ilObject::_lookupType($a_lm_id), $a_time_scheduled_activation);
                 if (!$active) {
                     $act_data = ilLMPage::_lookupActivationData((int) $child["obj_id"], ilObject::_lookupType($a_lm_id));
                     if ($act_data["show_activation_info"] && ilUtil::now() < $act_data["activation_start"]) {
                         $active = true;
                     }
                 }
                 if ($child["type"] != "pg" || $active) {
                     $cnt++;
                 }
                 if ($child["obj_id"] == $a_pg_id) {
                     $cur_cnt = $cnt;
                 }
             }
             if ($cnt > 1) {
                 $cnt_str = " (" . $cur_cnt . "/" . $cnt . ")";
             }
         }
         require_once "./Modules/LearningModule/classes/class.ilStructureObject.php";
         //$struct_obj =& new ilStructureObject($pred_node["obj_id"]);
         //return $struct_obj->getTitle();
         return ilStructureObject::_getPresentationTitle($pred_node["obj_id"], $a_include_numbers, false, 0, $a_lang) . $cnt_str;
         //return $pred_node["title"].$cnt_str;
     } else {
         return $title;
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:70,代码来源:class.ilLMPageObject.php

示例4: _getPresentationTitle

 /**
  * get presentation title
  *
  */
 function _getPresentationTitle($a_st_id, $a_include_numbers = false, $a_time_scheduled_activation = false, $a_lm_id = 0, $a_lang = "-")
 {
     global $ilDB;
     if ($a_lm_id == 0) {
         $a_lm_id = ilLMObject::_lookupContObjID($a_st_id);
     }
     // @todo: optimize
     include_once "./Services/COPage/classes/class.ilPageMultiLang.php";
     $ml = new ilPageMultiLang("lm", $a_lm_id);
     // get chapter data
     $query = "SELECT * FROM lm_data WHERE obj_id = " . $ilDB->quote($a_st_id, "integer");
     $st_set = $ilDB->query($query);
     $st_rec = $ilDB->fetchAssoc($st_set);
     if ($a_lang != "-" && $ml->getActivated() && in_array($a_lang, $ml->getLanguages())) {
         include_once "./Modules/LearningModule/classes/class.ilLMObjTranslation.php";
         $lmobjtrans = new ilLMObjTranslation($a_st_id, $a_lang);
         if ($lmobjtrans->getTitle() != "") {
             $st_rec["title"] = $lmobjtrans->getTitle();
         }
     }
     $tree = new ilTree($st_rec["lm_id"]);
     $tree->setTableNames('lm_tree', 'lm_data');
     $tree->setTreeTablePK("lm_id");
     if ($a_include_numbers) {
         if ($tree->isInTree($st_rec["obj_id"])) {
             // get chapter tree node
             $query = "SELECT * FROM lm_tree WHERE child = " . $ilDB->quote($a_st_id, "integer") . " AND lm_id = " . $ilDB->quote($st_rec["lm_id"], "integer");
             $tree_set = $ilDB->query($query);
             $tree_node = $tree_set->fetchRow(DB_FETCHMODE_ASSOC);
             $depth = $tree_node["depth"];
             $nr = $tree->getChildSequenceNumber($tree_node, "st") . " ";
             for ($i = $depth - 1; $i > 1; $i--) {
                 // get next parent tree node
                 $query = "SELECT * FROM lm_tree WHERE child = " . $ilDB->quote($tree_node["parent"], "integer") . " AND lm_id = " . $ilDB->quote($st_rec["lm_id"], "integer");
                 $tree_set = $ilDB->query($query);
                 $tree_node = $tree_set->fetchRow(DB_FETCHMODE_ASSOC);
                 $seq = $tree->getChildSequenceNumber($tree_node, "st");
                 $nr = $seq . "." . $nr;
             }
         }
     }
     return $nr . $st_rec["title"];
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:47,代码来源:class.ilStructureObject.php

示例5: fillRow

 /**
  * Standard Version of Fill Row. Most likely to
  * be overwritten by derived class.
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl;
     $this->tpl->setVariable("TXT_PAGE_TITLE", $a_set["title"]);
     $ilCtrl->setParameterByClass("illmpageobjectgui", "obj_id", $a_set["obj_id"]);
     $this->tpl->setVariable("HREF_PAGE", $ilCtrl->getLinkTargetByClass("illmpageobjectgui", "edit"));
     include_once "./Modules/LearningModule/classes/class.ilLMPage.php";
     $page_object = new ilLMPage($a_set["obj_id"]);
     $page_object->buildDom();
     $int_links = $page_object->getInternalLinks();
     foreach ($int_links as $link) {
         $target = $link["Target"];
         if (substr($target, 0, 4) == "il__") {
             $target_arr = explode("_", $target);
             $target_id = $target_arr[count($target_arr) - 1];
             $type = $link["Type"];
             switch ($type) {
                 case "PageObject":
                     $this->tpl->setCurrentBlock("link");
                     $this->tpl->setVariable("TXT_LINK_TYPE", $lng->txt("pg"));
                     if (ilLMObject::_exists($target_id)) {
                         $lm_id = ilLMObject::_lookupContObjID($target_id);
                         $add_str = $lm_id != $this->lm_id ? " (" . ilObject::_lookupTitle($lm_id) . ")" : "";
                         $this->tpl->setVariable("TXT_LINK_TITLE", ilLMObject::_lookupTitle($target_id) . $add_str);
                     } else {
                         $this->tpl->setVariable("TXT_MISSING", "<b>" . $lng->txt("cont_target_missing") . " [" . $target_id . "]" . "</b>");
                     }
                     $this->tpl->parseCurrentBlock();
                     break;
                 case "StructureObject":
                     $this->tpl->setCurrentBlock("link");
                     $this->tpl->setVariable("TXT_LINK_TYPE", $lng->txt("st"));
                     if (ilLMObject::_exists($target_id)) {
                         $lm_id = ilLMObject::_lookupContObjID($target_id);
                         $add_str = $lm_id != $this->lm_id ? " (" . ilObject::_lookupTitle($lm_id) . ")" : "";
                         $this->tpl->setVariable("TXT_LINK_TITLE", ilLMObject::_lookupTitle($target_id) . $add_str);
                     } else {
                         $this->tpl->setVariable("TXT_MISSING", "<b>" . $lng->txt("cont_target_missing") . " [" . $target_id . "]" . "</b>");
                     }
                     $this->tpl->parseCurrentBlock();
                     break;
                 case "GlossaryItem":
                     $this->tpl->setCurrentBlock("link");
                     $this->tpl->setVariable("TXT_LINK_TYPE", $lng->txt("cont_term"));
                     include_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php";
                     if (ilGlossaryTerm::_exists($target_id)) {
                         $this->tpl->setVariable("TXT_LINK_TITLE", ilGlossaryTerm::_lookGlossaryTerm($target_id));
                     } else {
                         $this->tpl->setVariable("TXT_MISSING", "<b>" . $lng->txt("cont_target_missing") . " [" . $target_id . "]" . "</b>");
                     }
                     $this->tpl->parseCurrentBlock();
                     break;
                 case "MediaObject":
                     $this->tpl->setCurrentBlock("link");
                     $this->tpl->setVariable("TXT_LINK_TYPE", $lng->txt("mob"));
                     if (ilObject::_exists($target_id)) {
                         $this->tpl->setVariable("TXT_LINK_TITLE", ilObject::_lookupTitle($target_id));
                     } else {
                         $this->tpl->setVariable("TXT_MISSING", "<b>" . $lng->txt("cont_target_missing") . " [" . $target_id . "]" . "</b>");
                     }
                     $this->tpl->parseCurrentBlock();
                     break;
                 case "RepositoryItem":
                     $this->tpl->setCurrentBlock("link");
                     $this->tpl->setVariable("TXT_LINK_TYPE", $lng->txt("cont_repository_item"));
                     $obj_type = ilObject::_lookupType($target_id, true);
                     $obj_id = ilObject::_lookupObjId($target_id);
                     if (ilObject::_exists($obj_id)) {
                         $this->tpl->setVariable("TXT_LINK_TITLE", ilObject::_lookupTitle($obj_id) . " (" . $lng->txt("obj_" . $obj_type) . ")");
                     } else {
                         $this->tpl->setVariable("TXT_MISSING", "<b>" . $lng->txt("cont_target_missing") . " [" . $target_id . "]" . "</b>");
                     }
                     $this->tpl->parseCurrentBlock();
                     break;
             }
         } else {
             $type = $link["Type"];
             switch ($type) {
                 case "PageObject":
                     $this->tpl->setVariable("TXT_LINK_TYPE", $lng->txt("pg"));
                     break;
                 case "StructureObject":
                     $this->tpl->setVariable("TXT_LINK_TYPE", $lng->txt("st"));
                     break;
                 case "GlossaryItem":
                     $this->tpl->setVariable("TXT_LINK_TYPE", $lng->txt("cont_term"));
                     break;
                 case "MediaObject":
                     $this->tpl->setVariable("TXT_LINK_TYPE", $lng->txt("mob"));
                     break;
                 case "RepositoryItem":
                     $this->tpl->setVariable("TXT_LINK_TYPE", $lng->txt("cont_repository_item"));
                     break;
             }
             $this->tpl->setCurrentBlock("link");
             $this->tpl->setVariable("TXT_MISSING", "<b>" . $lng->txt("cont_target_missing") . " [" . $target . "]" . "</b>");
//.........这里部分代码省略.........
开发者ID:arlendotcn,项目名称:ilias,代码行数:101,代码来源:class.ilLinksTableGUI.php

示例6: _splitPageNext

 /**
  * split page to next page at hierarchical id
  *
  * the main reason for this method being static is that a lm page
  * object is not available within ilPageContentGUI where this method
  * is called
  */
 function _splitPageNext($a_page_id, $a_pg_parent_type, $a_hier_id)
 {
     // get content object (learning module / digilib book)
     $lm_id = ilLMObject::_lookupContObjID($a_page_id);
     $type = ilObject::_lookupType($lm_id, false);
     switch ($type) {
         case "lm":
             include_once "./Modules/LearningModule/classes/class.ilObjLearningModule.php";
             $cont_obj = new ilObjLearningModule($lm_id, false);
             break;
         case "dbk":
             include_once "./Modules/LearningModule/classes/class.ilObjDlBook.php";
             $cont_obj = new ilObjDlBook($lm_id, false);
             break;
     }
     $tree = new ilTree($cont_obj->getId());
     $tree->setTableNames('lm_tree', 'lm_data');
     $tree->setTreeTablePK("lm_id");
     $source_lm_page =& new ilLMPageObject($cont_obj, $a_page_id);
     $source_page =& $source_lm_page->getPageObject();
     // get next page
     $succ = $tree->fetchSuccessorNode($a_page_id, "pg");
     if ($succ["child"] > 0) {
         $target_lm_page =& new ilLMPageObject($cont_obj, $succ["child"]);
         $target_page =& $target_lm_page->getPageObject();
         $target_page->buildDom();
         $target_page->addHierIds();
         // move nodes to target page
         $source_page->buildDom();
         $source_page->addHierIds();
         ilPageObject::_moveContentAfterHierId($source_page, $target_page, $a_hier_id);
         //$source_page->deleteContentFromHierId($a_hier_id);
         return $succ["child"];
     }
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:42,代码来源:class.ilLMPageObject.php

示例7: setDefaultLinkXml

 /**
  * Set standard link xml
  */
 function setDefaultLinkXml()
 {
     global $ilCtrl;
     $int_links = $this->getPageObject()->getInternalLinks();
     //var_dump($int_links);
     $link_info = "<IntLinkInfos>";
     $targetframe = "None";
     foreach ($int_links as $int_link) {
         $target = $int_link["Target"];
         if (substr($target, 0, 4) == "il__") {
             $target_arr = explode("_", $target);
             $target_id = $target_arr[count($target_arr) - 1];
             $type = $int_link["Type"];
             $targetframe = $int_link["TargetFrame"] != "" ? $int_link["TargetFrame"] : "None";
             $ltarget = "_top";
             if ($targetframe != "None") {
                 $ltarget = "_blank";
             }
             // anchor
             $anc = $anc_add = "";
             if ($int_link["Anchor"] != "") {
                 $anc = $int_link["Anchor"];
                 $anc_add = "_" . rawurlencode($int_link["Anchor"]);
             }
             $href = "";
             switch ($type) {
                 case "PageObject":
                 case "StructureObject":
                     $lm_id = ilLMObject::_lookupContObjID($target_id);
                     if ($type == "PageObject") {
                         $href = "./goto.php?target=pg_" . $target_id . $anc_add;
                     } else {
                         $href = "./goto.php?target=st_" . $target_id;
                     }
                     break;
                 case "GlossaryItem":
                     if ($targetframe == "None") {
                         $targetframe = "Glossary";
                     }
                     $href = "./goto.php?target=git_" . $target_id;
                     break;
                 case "MediaObject":
                     $ilCtrl->setParameter($this, "mob_id", $target_id);
                     //$ilCtrl->setParameter($this, "pg_id", $this->obj->getId());
                     $href = $ilCtrl->getLinkTarget($this, "displayMedia");
                     $ilCtrl->setParameter($this, "mob_id", "");
                     break;
                 case "WikiPage":
                     include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
                     $href = ilWikiPage::getGotoForWikiPageTarget($target_id);
                     break;
                 case "RepositoryItem":
                     $obj_type = ilObject::_lookupType($target_id, true);
                     $obj_id = ilObject::_lookupObjId($target_id);
                     $href = "./goto.php?target=" . $obj_type . "_" . $target_id;
                     break;
             }
             $anc_par = 'Anchor="' . $anc . '"';
             $link_info .= "<IntLinkInfo Target=\"{$target}\" Type=\"{$type}\" " . $anc_par . " " . "TargetFrame=\"{$targetframe}\" LinkHref=\"{$href}\" LinkTarget=\"{$ltarget}\" />";
         }
     }
     $link_info .= "</IntLinkInfos>";
     $this->setLinkXML($link_info);
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:67,代码来源:class.ilPageObjectGUI.php

示例8: pastePage

 /**
  * paste page
  */
 function pastePage()
 {
     if (ilEditClipboard::getContentObjectType() != "pg") {
         $this->ilias->raiseError($this->lng->txt("no_page_in_clipboard"), $this->ilias->error_obj->MESSAGE);
     }
     // paste selected object
     $id = ilEditClipboard::getContentObjectId();
     // copy page, if action is copy
     if (ilEditClipboard::getAction() == "copy") {
         // check wether page belongs to lm
         if (ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId()) == $this->object->getID()) {
             $lm_page = new ilLMPageObject($this->object, $id);
             $new_page =& $lm_page->copy();
             $id = $new_page->getId();
         } else {
             // get page from other content object into current content object
             $lm_id = ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId());
             $lm_obj =& $this->ilias->obj_factory->getInstanceByObjId($lm_id);
             $lm_page = new ilLMPageObject($lm_obj, $id);
             $copied_nodes = array();
             $new_page =& $lm_page->copyToOtherContObject($this->object, $copied_nodes);
             $id = $new_page->getId();
             ilLMObject::updateInternalLinks($copied_nodes);
         }
     }
     // cut is not be possible in "all pages" form yet
     if (ilEditClipboard::getAction() == "cut") {
         // check wether page belongs not to lm
         if (ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId()) != $this->object->getID()) {
             $lm_id = ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId());
             $lm_obj =& $this->ilias->obj_factory->getInstanceByObjId($lm_id);
             $lm_page = new ilLMPageObject($lm_obj, $id);
             $lm_page->setLMId($this->object->getID());
             $lm_page->update();
             $page =& $lm_page->getPageObject();
             $page->buildDom();
             $page->setParentId($this->object->getID());
             $page->update();
         }
     }
     ilEditClipboard::clear();
     $this->ctrl->redirect($this, "pages");
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:46,代码来源:class.ilObjContentObjectGUI.php

示例9: _goto

 /**
  * redirect script
  *
  * @param	string		$a_target
  */
 function _goto($a_target)
 {
     global $rbacsystem, $ilErr, $lng, $ilAccess;
     $first = strpos($a_target, "_");
     $second = strpos($a_target, "_", $first + 1);
     $page_id = substr($a_target, 0, $first);
     if ($first > 0) {
         $page_id = substr($a_target, 0, $first);
         if ($second > 0) {
             $ref_id = substr($a_target, $first + 1, $second - ($first + 1));
             $anchor = substr($a_target, $second + 1);
         } else {
             $ref_id = substr($a_target, $first + 1);
         }
     } else {
         $page_id = $a_target;
     }
     // determine learning object
     $lm_id = ilLMObject::_lookupContObjID($page_id);
     // get all references
     $ref_ids = ilObject::_getAllReferences($lm_id);
     // always try passed ref id first
     if (in_array($ref_id, $ref_ids)) {
         $ref_ids = array_merge(array($ref_id), $ref_ids);
     }
     // check read permissions
     foreach ($ref_ids as $ref_id) {
         // check read permissions
         if ($ilAccess->checkAccess("read", "", $ref_id)) {
             // don't redirect anymore, just set parameters
             // (goto.php includes  "ilias.php")
             $_GET["baseClass"] = "ilLMPresentationGUI";
             $_GET["obj_id"] = $page_id;
             $_GET["ref_id"] = $ref_id;
             $_GET["anchor"] = $anchor;
             include_once "ilias.php";
             exit;
         }
     }
     if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
         if ($lm_id > 0) {
             ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"), ilObject::_lookupTitle($lm_id)), true);
         } else {
             $lng->loadLanguageModule("content");
             ilUtil::sendFailure($lng->txt("page_does_not_exist"), true);
         }
         include_once "./Services/Object/classes/class.ilObjectGUI.php";
         ilObjectGUI::_gotoRepositoryRoot();
     }
     $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:56,代码来源:class.ilLMPageObjectGUI.php

示例10: _checkGoto

 function _checkGoto($a_target)
 {
     global $objDefinition, $ilPluginAdmin, $ilUser;
     if (is_object($ilPluginAdmin)) {
         // get user interface plugins
         $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
         // search
         foreach ($pl_names as $pl) {
             $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
             $gui_class = $ui_plugin->getUIClassInstance();
             $resp = $gui_class->checkGotoHook($a_target);
             if ($resp["target"] !== false) {
                 $a_target = $resp["target"];
                 break;
             }
         }
     }
     if ($a_target == "") {
         return false;
     }
     $t_arr = explode("_", $a_target);
     $type = $t_arr[0];
     if ($type == "git") {
         $type = "glo";
     }
     if ($type == "pg" | $type == "st") {
         $type = "lm";
     }
     $class = $objDefinition->getClassName($type);
     if ($class == "") {
         return false;
     }
     $location = $objDefinition->getLocation($type);
     $full_class = "ilObj" . $class . "Access";
     include_once $location . "/class." . $full_class . ".php";
     $ret = call_user_func(array($full_class, "_checkGoto"), $a_target);
     // if no access and repository object => check for parent course/group
     if (!$ret && !stristr($a_target, "_wsp") && $ilUser->getId() != ANONYMOUS_USER_ID && !$objDefinition->isAdministrationObject($type) && $objDefinition->isRBACObject($type) && $t_arr[1]) {
         global $tree, $rbacsystem, $ilAccess;
         // original type "pg" => pg_<page_id>[_<ref_id>]
         if ($t_arr[0] == "pg") {
             if (isset($t_arr[2])) {
                 $ref_id = $t_arr[2];
             } else {
                 $lm_id = ilLMObject::_lookupContObjID($t_arr[1]);
                 $ref_id = ilObject::_getAllReferences($lm_id);
                 if ($ref_id) {
                     $ref_id = array_shift($ref_id);
                 }
             }
         } else {
             $ref_id = $t_arr[1];
         }
         include_once "Services/Membership/classes/class.ilParticipants.php";
         $block_obj = array();
         // walk path to find parent container
         $path = $tree->getPathId($ref_id);
         array_pop($path);
         foreach ($path as $path_ref_id) {
             $redirect_infopage = false;
             $add_member_role = false;
             $ptype = ilObject::_lookupType($path_ref_id, true);
             $pobj_id = ilObject::_lookupObjId($path_ref_id);
             // core checks: timings/object-specific
             if (!$ilAccess->doActivationCheck("read", "", $path_ref_id, $ilUser->getId(), $pobj_id, $ptype) || !$ilAccess->doStatusCheck("read", "", $path_ref_id, $ilUser->getId(), $pobj_id, $ptype)) {
                 // object in path is inaccessible - aborting
                 return false;
             } else {
                 if ($ptype == "crs") {
                     // check if already participant
                     include_once "Modules/Course/classes/class.ilCourseParticipant.php";
                     $participants = new ilCourseParticipant($pobj_id, $ilUser->getId());
                     if (!$participants->isAssigned()) {
                         // subscription currently possible?
                         include_once "Modules/Course/classes/class.ilObjCourse.php";
                         if (ilObjCourse::_isActivated($pobj_id) && ilObjCourse::_registrationEnabled($pobj_id)) {
                             $block_obj[] = $path_ref_id;
                             $add_member_role = true;
                         } else {
                             $redirect_infopage = true;
                         }
                     }
                 } else {
                     if ($ptype == "grp") {
                         // check if already participant
                         include_once "Modules/Group/classes/class.ilGroupParticipants.php";
                         if (!ilGroupParticipants::_isParticipant($path_ref_id, $ilUser->getId())) {
                             // subscription currently possible?
                             include_once "Modules/Group/classes/class.ilObjGroup.php";
                             $group_obj = new ilObjGroup($path_ref_id);
                             if ($group_obj->isRegistrationEnabled()) {
                                 $block_obj[] = $path_ref_id;
                                 $add_member_role = true;
                             } else {
                                 $redirect_infopage = true;
                             }
                         }
                     }
                 }
             }
//.........这里部分代码省略.........
开发者ID:arlendotcn,项目名称:ilias,代码行数:101,代码来源:class.ilStartUpGUI.php

示例11: getParentObjectIdForUsage

 /**
  * Get's the repository object ID of a parent object, if possible
  */
 function getParentObjectIdForUsage($a_usage, $a_include_all_access_obj_ids = false)
 {
     if (is_int(strpos($a_usage["type"], ":"))) {
         $us_arr = explode(":", $a_usage["type"]);
         $type = $us_arr[1];
         $cont_type = $us_arr[0];
     } else {
         $type = $a_usage["type"];
     }
     $id = $a_usage["id"];
     $obj_id = false;
     switch ($type) {
         case "html":
             // "old" category pages
             if ($cont_type == "cat") {
                 $obj_id = $id;
             }
             // Test InfoScreen Text
             if ($cont_type == "tst" || $cont_type == "svy") {
                 $obj_id = $id;
                 //var_dump($qinfo);
             }
             // Question Pool *Question* Text (Test)
             if ($cont_type == "qpl") {
                 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
                 $qinfo = assQuestion::_getQuestionInfo($id);
                 if ($qinfo["original_id"] > 0) {
                     include_once "./Modules/Test/classes/class.ilObjTest.php";
                     $obj_id = ilObjTest::_lookupTestObjIdForQuestionId($id);
                     // usage in test
                 } else {
                     $obj_id = $qinfo["obj_fi"];
                     // usage in pool
                 }
             }
             // Question Pool *Question* Text (Survey)
             if ($cont_type == "spl") {
                 include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
                 $quest = SurveyQuestion::_instanciateQuestion($id);
                 if ($quest) {
                     if ($quest->getOriginalId() > 0) {
                         $obj_id = $quest->getSurveyId();
                     } else {
                         $obj_id = $quest->getObjId();
                         // usage in pool
                     }
                     unset($quest);
                 }
             }
             // Forum
             if ($cont_type == "frm") {
                 $post_pk = $a_usage['id'];
                 include_once 'Modules/Forum/classes/class.ilForumPost.php';
                 include_once 'Modules/Forum/classes/class.ilForum.php';
                 $oPost = new ilForumPost($post_pk);
                 $frm_pk = $oPost->getForumId();
                 $obj_id = ilForum::_lookupObjIdForForumId($frm_pk);
             }
             if ($cont_type == 'frm~') {
                 $obj_id = $a_usage['id'];
             }
             if ($cont_type == "dcl") {
                 $obj_id = $id;
             }
             break;
         case "pg":
             // Question Pool Question Pages
             if ($cont_type == "qpl") {
                 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
                 $qinfo = assQuestion::_getQuestionInfo($id);
                 if ($qinfo["original_id"] > 0) {
                     include_once "./Modules/Test/classes/class.ilObjTest.php";
                     $obj_id = ilObjTest::_lookupTestObjIdForQuestionId($id);
                     // usage in test
                 } else {
                     $obj_id = $qinfo["obj_fi"];
                     // usage in pool
                 }
             }
             // learning modules
             if ($cont_type == "lm" || $cont_type == "dbk") {
                 include_once "./Modules/LearningModule/classes/class.ilLMObject.php";
                 $obj_id = ilLMObject::_lookupContObjID($id);
             }
             // glossary definition
             if ($cont_type == "gdf") {
                 include_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php";
                 include_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php";
                 $term_id = ilGlossaryDefinition::_lookupTermId($id);
                 $obj_id = ilGlossaryTerm::_lookGlossaryID($term_id);
             }
             // wiki page
             if ($cont_type == 'wpg') {
                 include_once 'Modules/Wiki/classes/class.ilWikiPage.php';
                 $obj_id = ilWikiPage::lookupObjIdByPage($id);
             }
             // sahs page
//.........这里部分代码省略.........
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:101,代码来源:class.ilObjMediaObject.php

示例12: setMaterial

 /**
 * Sets a material link for the question
 *
 * @param string $material_id An internal link pointing to the material
 * @param boolean $is_import A boolean indication that the internal link was imported from another ILIAS installation
 * @access public
 */
 function setMaterial($material_id = "", $is_import = false, $material_title = "")
 {
     if (strcmp($material_id, "") != 0) {
         $import_id = "";
         if ($is_import) {
             $import_id = $material_id;
             $material_id = $this->_resolveInternalLink($import_id);
         }
         if (strcmp($material_title, "") == 0) {
             if (preg_match("/il__(\\w+)_(\\d+)/", $material_id, $matches)) {
                 $type = $matches[1];
                 $target_id = $matches[2];
                 $material_title = $this->lng->txt("obj_{$type}") . ": ";
                 switch ($type) {
                     case "lm":
                         include_once "./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php";
                         $cont_obj_gui =& new ilObjContentObjectGUI("", $target_id, true);
                         $cont_obj = $cont_obj_gui->object;
                         $material_title .= $cont_obj->getTitle();
                         break;
                     case "pg":
                         include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
                         include_once "./Modules/LearningModule/classes/class.ilLMObject.php";
                         $lm_id = ilLMObject::_lookupContObjID($target_id);
                         include_once "./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php";
                         $cont_obj_gui =& new ilObjContentObjectGUI("", $lm_id, FALSE);
                         $cont_obj = $cont_obj_gui->object;
                         $pg_obj =& new ilLMPageObject($cont_obj, $target_id);
                         $material_title .= $pg_obj->getTitle();
                         break;
                     case "st":
                         include_once "./Modules/LearningModule/classes/class.ilStructureObject.php";
                         include_once "./Modules/LearningModule/classes/class.ilLMObject.php";
                         $lm_id = ilLMObject::_lookupContObjID($target_id);
                         include_once "./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php";
                         $cont_obj_gui =& new ilObjContentObjectGUI("", $lm_id, FALSE);
                         $cont_obj = $cont_obj_gui->object;
                         $st_obj =& new ilStructureObject($cont_obj, $target_id);
                         $material_title .= $st_obj->getTitle();
                         break;
                     case "git":
                         include_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php";
                         $material_title = $this->lng->txt("glossary_term") . ": " . ilGlossaryTerm::_lookGlossaryTerm($target_id);
                         break;
                     case "mob":
                         break;
                 }
             }
         }
         $this->material = array("internal_link" => $material_id, "import_id" => $import_id, "title" => $material_title);
     }
     $this->saveMaterial();
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:60,代码来源:class.SurveyQuestion.php

示例13: checkAccessGlossaryTerm

 /**
  * Check access rights for glossary terms
  * This checks also learning modules linking the term
  *
  * @param    int     	object id (glossary)
  * @param    int         page id (definition)
  * @return   boolean     access given (true/false)
  */
 private function checkAccessGlossaryTerm($obj_id, $page_id)
 {
     // give access if glossary is readable
     if ($this->checkAccessObject($obj_id)) {
         return true;
     }
     include_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php";
     include_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php";
     $term_id = ilGlossaryDefinition::_lookupTermId($page_id);
     include_once './Services/COPage/classes/class.ilInternalLink.php';
     $sources = ilInternalLink::_getSourcesOfTarget('git', $term_id, 0);
     if ($sources) {
         foreach ($sources as $src) {
             switch ($src['type']) {
                 // Give access if term is linked by a learning module with read access.
                 // The term including media is shown by the learning module presentation!
                 case 'lm:pg':
                     include_once "./Modules/LearningModule/classes/class.ilLMObject.php";
                     $src_obj_id = ilLMObject::_lookupContObjID($src['id']);
                     if ($this->checkAccessObject($src_obj_id, 'lm')) {
                         return true;
                     }
                     break;
                     // Don't yet give access if the term is linked by another glossary
                     // The link will lead to the origin glossary which is already checked
                     /*
                     case 'gdf:pg':
                     	$src_term_id = ilGlossaryDefinition::_lookupTermId($src['id']);
                     	$src_obj_id = ilGlossaryTerm::_lookGlossaryID($src_term_id);
                      						if ($this->checkAccessObject($src_obj_id, 'glo'))
                     	{
                     		return true;
                     	}
                     	break;
                     */
             }
         }
     }
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:47,代码来源:class.ilWebAccessChecker.php

示例14: getLinkXML

 /**
  * get link targets
  */
 function getLinkXML($a_int_links)
 {
     if ($a_layoutframes == "") {
         $a_layoutframes = array();
     }
     $link_info = "<IntLinkInfos>";
     foreach ($a_int_links as $int_link) {
         //echo "<br>+".$int_link["Type"]."+".$int_link["TargetFrame"]."+".$int_link["Target"]."+";
         $target = $int_link["Target"];
         if (substr($target, 0, 4) == "il__") {
             $target_arr = explode("_", $target);
             $target_id = $target_arr[count($target_arr) - 1];
             $type = $int_link["Type"];
             $targetframe = $int_link["TargetFrame"] != "" ? $int_link["TargetFrame"] : "None";
             // anchor
             $anc = $anc_add = "";
             if ($int_link["Anchor"] != "") {
                 $anc = $int_link["Anchor"];
                 $anc_add = "_" . rawurlencode($int_link["Anchor"]);
             }
             if ($targetframe == "New") {
                 $ltarget = "_blank";
             } else {
                 $ltarget = "";
             }
             switch ($type) {
                 case "PageObject":
                 case "StructureObject":
                     $lm_id = ilLMObject::_lookupContObjID($target_id);
                     $cont_obj =& $this->content_object;
                     if ($type == "PageObject") {
                         $href = "./goto.php?target=pg_" . $target_id . $anc_add;
                     } else {
                         $href = "./goto.php?target=st_" . $target_id;
                     }
                     //$ltarget = "ilContObj".$lm_id;
                     break;
                 case "GlossaryItem":
                     if (ilGlossaryTerm::_lookGlossaryID($target_id) == $this->glossary->getId()) {
                         if ($this->offlineMode()) {
                             $href = "term_" . $target_id . ".html";
                         } else {
                             $this->ctrl->setParameter($this, "term_id", $target_id);
                             $href = $this->ctrl->getLinkTarget($this, "listDefinitions");
                             $href = str_replace("&", "&amp;", $href);
                         }
                     } else {
                         $href = "./goto.php?target=git_" . $target_id;
                     }
                     break;
                 case "MediaObject":
                     if ($this->offlineMode()) {
                         $href = "media_" . $target_id . ".html";
                     } else {
                         $this->ctrl->setParameter($this, "obj_type", $type);
                         $this->ctrl->setParameter($this, "mob_id", $target_id);
                         $href = $this->ctrl->getLinkTarget($this, "media");
                         $href = str_replace("&", "&amp;", $href);
                     }
                     break;
                 case "RepositoryItem":
                     $obj_type = ilObject::_lookupType($target_id, true);
                     $obj_id = ilObject::_lookupObjId($target_id);
                     $href = "./goto.php?target=" . $obj_type . "_" . $target_id;
                     $t_frame = ilFrameTargetInfo::_getFrame("MainContent", $obj_type);
                     $ltarget = $t_frame;
                     break;
             }
             $anc_par = 'Anchor="' . $anc . '"';
             $link_info .= "<IntLinkInfo Target=\"{$target}\" Type=\"{$type}\" " . "TargetFrame=\"{$targetframe}\" LinkHref=\"{$href}\" LinkTarget=\"{$ltarget}\" {$anc_par}/>";
             $this->ctrl->clearParameters($this);
         }
     }
     $link_info .= "</IntLinkInfos>";
     return $link_info;
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:79,代码来源:class.ilGlossaryPresentationGUI.php

示例15: _getPresentationTitle

 /**
  * presentation title doesn't have to be page title, it may be
  * chapter title + page title or chapter title only, depending on settings
  *
  * @param	string	$a_mode		IL_CHAPTER_TITLE | IL_PAGE_TITLE | IL_NO_HEADER
  */
 function _getPresentationTitle($a_pg_id, $a_mode = IL_CHAPTER_TITLE, $a_include_numbers = false, $a_time_scheduled_activation = false, $a_force_content = false, $a_lm_id = 0, $a_lang = "-")
 {
     global $ilDB, $ilUser;
     if ($a_lm_id == 0) {
         $a_lm_id = ilLMObject::_lookupContObjID($a_pg_id);
     }
     // @todo: optimize
     include_once "./Services/COPage/classes/class.ilPageMultiLang.php";
     $ml = new ilPageMultiLang("lm", $a_lm_id);
     // select
     $query = "SELECT * FROM lm_data WHERE obj_id = " . $ilDB->quote($a_pg_id, "integer");
     $pg_set = $ilDB->query($query);
     $pg_rec = $ilDB->fetchAssoc($pg_set);
     if ($a_lang != "-" && $ml->getActivated() && in_array($a_lang, $ml->getLanguages())) {
         include_once "./Modules/LearningModule/classes/class.ilLMObjTranslation.php";
         $lmobjtrans = new ilLMObjTranslation($a_pg_id, $a_lang);
         if ($lmobjtrans->getTitle() != "") {
             $pg_rec["title"] = $lmobjtrans->getTitle();
         }
     }
     if ($a_mode == IL_NO_HEADER && !$a_force_content) {
         return "";
     }
     $tree = new ilTree($pg_rec["lm_id"]);
     $tree->setTableNames('lm_tree', 'lm_data');
     $tree->setTreeTablePK("lm_id");
     if ($a_mode == IL_PAGE_TITLE) {
         $nr = "";
         return $nr . $pg_rec["title"];
     }
     if ($tree->isInTree($pg_rec["obj_id"])) {
         $pred_node = $tree->fetchPredecessorNode($pg_rec["obj_id"], "st");
         $childs = $tree->getChildsByType($pred_node["obj_id"], "pg");
         $cnt_str = "";
         if (count($childs) > 1) {
             $cnt = 0;
             foreach ($childs as $child) {
                 include_once "./Modules/LearningModule/classes/class.ilLMPage.php";
                 $active = ilLMPage::_lookupActive($child["obj_id"], ilObject::_lookupType($pg_rec["lm_id"]), $a_time_scheduled_activation);
                 if (!$active) {
                     $act_data = ilLMPage::_lookupActivationData((int) $child["obj_id"], ilObject::_lookupType($pg_rec["lm_id"]));
                     if ($act_data["show_activation_info"] && ilUtil::now() < $act_data["activation_start"]) {
                         $active = true;
                     }
                 }
                 if ($child["type"] != "pg" || $active) {
                     $cnt++;
                 }
                 if ($child["obj_id"] == $pg_rec["obj_id"]) {
                     $cur_cnt = $cnt;
                 }
             }
             if ($cnt > 1) {
                 $cnt_str = " (" . $cur_cnt . "/" . $cnt . ")";
             }
         }
         require_once "./Modules/LearningModule/classes/class.ilStructureObject.php";
         //$struct_obj =& new ilStructureObject($pred_node["obj_id"]);
         //return $struct_obj->getTitle();
         return ilStructureObject::_getPresentationTitle($pred_node["obj_id"], $a_include_numbers) . $cnt_str;
         //return $pred_node["title"].$cnt_str;
     } else {
         return $pg_rec["title"];
     }
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:71,代码来源:class.ilLMPageObject.php


注:本文中的ilLMObject::_lookupContObjID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。