/**
  * constructor
  *
  * @param object $a_parent_obj
  * @param string $a_parent_cmd
  * @param ilObjLearningModule $a_lm
  */
 public function __construct($a_parent_obj, $a_parent_cmd, $a_lm)
 {
     $this->lm = $a_lm;
     include_once "./Modules/LearningModule/classes/class.ilLMTree.php";
     $tree = ilLMTree::getInstance($this->lm->getId());
     parent::__construct("lm_public_section_" . $this->lm->getId(), $a_parent_obj, $a_parent_cmd, $tree);
 }
 /**
  * Constructor
  *
  * @param object $a_parent_obj parent gui object
  * @param string $a_parent_cmd parent cmd
  * @param ilObjContentObject $a_lm learning module
  */
 public function __construct($a_parent_obj, $a_parent_cmd, ilObjContentObject $a_lm, $a_id = "")
 {
     $this->lm = $a_lm;
     include_once "./Modules/LearningModule/classes/class.ilLMTree.php";
     $tree = ilLMTree::getInstance($this->lm->getId());
     //echo "+".$tree->isCacheUsed()."+";
     //		$tree = new ilTree($this->lm->getId());
     //		$tree->setTableNames('lm_tree','lm_data');
     //		$tree->setTreeTablePK("lm_id");
     include_once "./Modules/LearningModule/classes/class.ilLMObject.php";
     $this->cnt_lmobj = ilLMObject::preloadDataByLM($this->lm->getId());
     include_once "./Services/COPage/classes/class.ilPageObject.php";
     ilPageObject::preloadActivationDataByParentId($this->lm->getId());
     if ($a_id == "") {
         $a_id = "lm_exp";
         // this does not work, since it is not set yet
         if ($this->getOfflineMode()) {
             $a_id = "lm_exp_off";
         }
     }
     parent::__construct($a_id, $a_parent_obj, $a_parent_cmd, $tree);
     $this->setSkipRootNode(false);
     $this->setAjax(false);
     $this->setPreloadChilds(true);
     if ((int) $_GET["obj_id"] > 0) {
         $this->setPathOpen((int) $_GET["obj_id"]);
     }
 }
 function ilLMPresentationGUI()
 {
     global $ilUser, $lng, $tpl, $rbacsystem, $ilCtrl, $ilAccess;
     // load language vars
     $lng->loadLanguageModule("content");
     $this->lng = $lng;
     $this->tpl = $tpl;
     $this->offline = false;
     $this->frames = array();
     $this->ctrl = $ilCtrl;
     $this->ctrl->saveParameter($this, array("ref_id", "transl", "focus_id", "focus_return"));
     $this->lm_set = new ilSetting("lm");
     include_once "./Modules/LearningModule/classes/class.ilObjLearningModuleGUI.php";
     $this->lm_gui = new ilObjLearningModuleGUI($data, $_GET["ref_id"], true, false);
     $this->lm = $this->lm_gui->object;
     // language translation
     include_once "./Services/Object/classes/class.ilObjectTranslation.php";
     $this->ot = ilObjectTranslation::getInstance($this->lm->getId());
     //include_once("./Services/COPage/classes/class.ilPageMultiLang.php");
     //$this->ml = new ilPageMultiLang("lm", $this->lm->getId());
     $this->lang = "-";
     if ($this->ot->getContentActivated()) {
         $langs = $this->ot->getLanguages();
         if (isset($langs[$_GET["transl"]]) || $_GET["transl"] == $this->ot->getMasterLanguage()) {
             $this->lang = $_GET["transl"];
         } else {
             if (isset($langs[$ilUser->getCurrentLanguage()])) {
                 $this->lang = $ilUser->getCurrentLanguage();
             }
         }
         if ($this->lang == $this->ot->getMasterLanguage()) {
             $this->lang = "-";
         }
     }
     if (IS_PAYMENT_ENABLED) {
         include_once 'Services/Payment/classes/class.ilPaymentObject.php';
         $this->needs_to_be_purchased = ilPaymentObject::_requiresPurchaseToAccess((int) $this->lm->getRefId());
     } else {
         $this->needs_to_be_purchased = false;
     }
     // check, if learning module is online
     if (!$rbacsystem->checkAccess("write", $_GET["ref_id"])) {
         if (!$this->lm->getOnline()) {
             $ilias->raiseError($lng->txt("permission_denied"), $ilias->error_obj->WARNING);
         }
     }
     include_once "./Modules/LearningModule/classes/class.ilLMTree.php";
     $this->lm_tree = ilLMTree::getInstance($this->lm->getId());
     /*$this->lm_tree = new ilTree($this->lm->getId());
     		$this->lm_tree->setTableNames('lm_tree','lm_data');
     		$this->lm_tree->setTreeTablePK("lm_id");*/
     if ((int) $_GET["focus_id"] > 0 && $this->lm_tree->isInTree((int) $_GET["focus_id"])) {
         $this->focus_id = (int) $_GET["focus_id"];
     }
 }
Example #4
0
 /**
  * Constructor
  *
  * @param ilObjLearningModule $a_lm learning module
  */
 private function __construct($a_id, $a_by_obj_id = false, $a_user_id)
 {
     $this->user_id = $a_user_id;
     if ($a_by_obj_id) {
         $this->lm_ref_id = 0;
         $this->lm_obj_id = $a_id;
     } else {
         $this->lm_ref_id = $a_id;
         $this->lm_obj_id = ilObject::_lookupObjId($a_id);
     }
     include_once "./Modules/LearningModule/classes/class.ilLMTree.php";
     $this->lm_tree = ilLMTree::getInstance($this->lm_obj_id);
 }
 /**
  * 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;
     }
 }
 /**
  * get presentation title
  *
  */
 static 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);
     }
     if ($a_lm_id == 0) {
         return "";
     }
     // this is optimized when ilLMObject::preloadDataByLM is invoked (e.g. done in ilLMExplorerGUI)
     $title = ilLMObject::_lookupTitle($a_st_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_st_id, $a_lang);
         if ($lmobjtrans->getTitle() != "") {
             $title = $lmobjtrans->getTitle();
         }
     }
     include_once "./Modules/LearningModule/classes/class.ilLMTree.php";
     $tree = ilLMTree::getInstance($a_lm_id);
     if ($a_include_numbers) {
         // this is optimized, since isInTree is cached
         if ($tree->isInTree($a_st_id)) {
             // optimization needed from here
             // get chapter tree node
             $query = "SELECT * FROM lm_tree WHERE child = " . $ilDB->quote($a_st_id, "integer") . " AND lm_id = " . $ilDB->quote($a_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($a_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 . $title;
 }