/**
  * Constructur
  *
  * @param string $a_parent_type parent object type
  * @param int $a_parent_id parent object id
  * @param bool $a_single_page_mode single page mode (page includes ml managing)
  */
 function __construct($a_parent_type, $a_parent_id, $a_single_page_mode = false)
 {
     //$this->ml = new ilPageMultiLang($a_parent_type, $a_parent_id);
     // object translation
     include_once "./Services/Object/classes/class.ilObjectTranslation.php";
     $this->ot = ilObjectTranslation::getInstance($a_parent_id);
     //		$this->single_page_mode = $a_single_page_mode;
 }
 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"];
     }
 }
 /**
  * Constructor
  */
 function __construct($a_obj_gui)
 {
     global $lng, $ilCtrl, $tpl;
     $this->lng = $lng;
     $this->ctrl = $ilCtrl;
     $this->tpl = $tpl;
     $this->obj_gui = $a_obj_gui;
     $this->obj = $a_obj_gui->object;
     include_once "./Services/Object/classes/class.ilObjectTranslation.php";
     $this->obj_trans = ilObjectTranslation::getInstance($this->obj->getId());
 }
 /**
  * Copy multilinguality settings
  *
  * @param string $a_target_parent_type parent object type
  * @param int $a_target_parent_id parent object id
  * @return ilObjectTranslation target multilang object
  */
 function copy($a_obj_id)
 {
     $target_ml = new ilObjectTranslation($a_obj_id);
     $target_ml->setMasterLanguage($this->getMasterLanguage());
     $target_ml->setLanguages($this->getLanguages());
     $target_ml->save();
     return $target_ml;
 }
示例#5
0
 /**
  * Clone course (no member data)
  *
  * @access public
  * @param int target ref_id
  * @param int copy id
  * 
  */
 public function cloneObject($a_target_id, $a_copy_id = 0)
 {
     global $ilDB, $ilUser;
     $new_obj = parent::cloneObject($a_target_id, $a_copy_id);
     /*	 done in class.ilContainer	
     	 	include_once('./Services/Container/classes/class.ilContainerSortingSettings.php');
     	 	ilContainerSortingSettings::_cloneSettings($this->getId(),$new_obj->getId());
     	 	*/
     include_once "./Services/Object/classes/class.ilObjectTranslation.php";
     $ot = ilObjectTranslation::getInstance($this->getId());
     $ot->copy($new_obj->getId());
     /*
     		$first = true;
     		$translations = $this->getTranslations();
     	 	if(is_array($translations['Fobject']))
     	 	{
     		 	foreach($translations['Fobject'] as $num => $translation)
     		 	{
     		 		$new_obj->addTranslation($translation['title'],$translation['desc'],$translation['lang'],$first);
     		 		
     		 		if($first)
     		 		{
     		 			$first = false;
     		 		}
     		 	}
     	 	}*/
     // clone icons
     $new_obj->saveIcons($this->getBigIconPath(), $this->getSmallIconPath(), $this->getTinyIconPath());
     return $new_obj;
 }
示例#6
0
 /**
  * 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;
     }
 }
示例#7
0
 /**
  * Add multi-language actions to menu
  *
  * @param
  * @return
  */
 function addMultiLangActionsAndInfo($a_list, $a_tpl)
 {
     global $lng, $ilCtrl;
     $any_items = false;
     $cfg = $this->getPageConfig();
     // general multi lang support and single page mode?
     if ($cfg->getMultiLangSupport()) {
         //include_once("./Services/COPage/classes/class.ilPageMultiLang.php");
         //$ml = new ilPageMultiLang($this->getPageObject()->getParentType(),
         //	$this->getPageObject()->getParentId());
         include_once "./Services/Object/classes/class.ilObjectTranslation.php";
         $ot = ilObjectTranslation::getInstance($this->getPageObject()->getParentId());
         if (!$ot->getContentActivated()) {
             /*				if ($cfg->getSinglePageMode())
             				{
             					$a_list->addItem($lng->txt("cont_activate_multi_lang"), "",
             						$ilCtrl->getLinkTargetByClass("ilpagemultilanggui", "activateMultilinguality"));
             	
             					$any_items = true;
             				}*/
         } else {
             $lng->loadLanguageModule("meta");
             //echo $this->getPageObject()->getLanguage();
             if ($this->getPageObject()->getLanguage() != "-") {
                 $l = $ot->getMasterLanguage();
                 $a_list->addItem($lng->txt("cont_edit_language_version") . ": " . $lng->txt("meta_l_" . $l), "", $ilCtrl->getLinkTarget($this, "editMasterLanguage"));
             }
             foreach ($ot->getLanguages() as $al => $lang) {
                 if ($this->getPageObject()->getLanguage() != $al && $al != $ot->getMasterLanguage()) {
                     $ilCtrl->setParameter($this, "totransl", $al);
                     $a_list->addItem($lng->txt("cont_edit_language_version") . ": " . $lng->txt("meta_l_" . $al), "", $ilCtrl->getLinkTarget($this, "switchToLanguage"));
                     $ilCtrl->setParameter($this, "totransl", $_GET["totransl"]);
                 }
             }
             /*				if ($cfg->getSinglePageMode())
             				{
             					$a_list->addItem($lng->txt("cont_manage_multilang"), "",
             						$ilCtrl->getLinkTargetByClass("ilpagemultilanggui", "settings"));
             				}*/
             include_once "./Services/COPage/classes/class.ilPageMultiLangGUI.php";
             $ml_gui = new ilPageMultiLangGUI($this->getPageObject()->getParentType(), $this->getPageObject()->getParentId());
             $a_tpl->setVariable("MULTI_LANG_INFO", $ml_gui->getMultiLangInfo($this->getPageObject()->getLanguage()));
             $any_items = true;
         }
     }
     return $any_items;
 }
示例#8
0
 /**
  * Get container page HTML
  */
 function getContainerPageHTML()
 {
     global $ilSetting, $ilUser;
     if (!$ilSetting->get("enable_cat_page_edit")) {
         return;
     }
     // old page editor content
     $xpage_id = ilContainer::_lookupContainerSetting($this->object->getId(), "xhtml_page");
     if ($xpage_id > 0) {
         include_once "Services/XHTMLPage/classes/class.ilXHTMLPage.php";
         $xpage = new ilXHTMLPage($xpage_id);
         return $xpage->getContent();
     }
     // page object
     // if page does not exist, return nothing
     include_once "./Services/COPage/classes/class.ilPageUtil.php";
     if (!ilPageUtil::_existsAndNotEmpty("cont", $this->object->getId())) {
         return "";
     }
     include_once "./Services/Container/classes/class.ilContainerPage.php";
     include_once "./Services/Container/classes/class.ilContainerPageGUI.php";
     include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
     $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId()));
     $this->tpl->setCurrentBlock("SyntaxStyle");
     $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
     $this->tpl->parseCurrentBlock();
     // get page object
     include_once "./Services/Object/classes/class.ilObjectTranslation.php";
     $ot = ilObjectTranslation::getInstance($this->object->getId());
     $lang = $ot->getEffectiveContentLang($ilUser->getCurrentLanguage(), "cont");
     $page_gui = new ilContainerPageGUI($this->object->getId(), 0, $lang);
     include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
     $page_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId($this->object->getStyleSheetId(), $this->object->getType()));
     $page_gui->setPresentationTitle("");
     $page_gui->setTemplateOutput(false);
     $page_gui->setHeader("");
     $ret = $page_gui->showPage();
     //$ret = "<div style='background-color: white; padding:5px; margin-bottom: 30px;'>".$ret."</div>";
     //$ret =& $page_gui->executeCommand();
     return $ret;
 }
 /**
  * Clone learning module
  *
  * @access public
  * @param int target ref_id
  * @param int copy id
  *
  */
 public function cloneObject($a_target_id, $a_copy_id = 0)
 {
     global $ilDB, $ilUser, $ilias;
     $new_obj = parent::cloneObject($a_target_id, $a_copy_id);
     $this->cloneMetaData($new_obj);
     //$new_obj->createProperties();
     //copy online status if object is not the root copy object
     $cp_options = ilCopyWizardOptions::_getInstance($a_copy_id);
     if (!$cp_options->isRootNode($this->getRefId())) {
         $new_obj->setOnline($this->getOnline());
     }
     $new_obj->setTitle($this->getTitle());
     $new_obj->setDescription($this->getDescription());
     $new_obj->setLayoutPerPage($this->getLayoutPerPage());
     $new_obj->setLayout($this->getLayout());
     $new_obj->setTOCMode($this->getTOCMode());
     $new_obj->setActiveLMMenu($this->isActiveLMMenu());
     $new_obj->setActiveTOC($this->isActiveTOC());
     $new_obj->setActiveNumbering($this->isActiveNumbering());
     $new_obj->setActivePrintView($this->isActivePrintView());
     $new_obj->setActivePreventGlossaryAppendix($this->isActivePreventGlossaryAppendix());
     $new_obj->setActiveDownloads($this->isActiveDownloads());
     $new_obj->setActiveDownloadsPublic($this->isActiveDownloadsPublic());
     $new_obj->setPublicNotes($this->publicNotes());
     $new_obj->setCleanFrames($this->cleanFrames());
     $new_obj->setHistoryUserComments($this->isActiveHistoryUserComments());
     $new_obj->setPublicAccessMode($this->getPublicAccessMode());
     $new_obj->setPageHeader($this->getPageHeader());
     $new_obj->setRating($this->hasRating());
     $new_obj->setRatingPages($this->hasRatingPages());
     $new_obj->setDisableDefaultFeedback($this->getDisableDefaultFeedback());
     $new_obj->setProgressIcons($this->getProgressIcons());
     $new_obj->update();
     $new_obj->createLMTree();
     // copy style
     include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
     $style_id = $this->getStyleSheetId();
     if ($style_id > 0 && !ilObjStyleSheet::_lookupStandard($style_id)) {
         $style_obj = $ilias->obj_factory->getInstanceByObjId($style_id);
         $new_id = $style_obj->ilClone();
         $new_obj->setStyleSheetId($new_id);
         $new_obj->update();
     }
     // copy content
     $this->copyAllPagesAndChapters($new_obj, $a_copy_id);
     // Copy learning progress settings
     include_once 'Services/Tracking/classes/class.ilLPObjSettings.php';
     $obj_settings = new ilLPObjSettings($this->getId());
     $obj_settings->cloneSettings($new_obj->getId());
     unset($obj_settings);
     // copy (page) multilang settings
     include_once "./Services/Object/classes/class.ilObjectTranslation.php";
     $ot = ilObjectTranslation::getInstance($this->getId());
     $ot->copy($new_obj->getId());
     return $new_obj;
 }
 /**
  * create html package
  */
 function exportHTML()
 {
     include_once "./Services/Object/classes/class.ilObjectTranslation.php";
     $ot = ilObjectTranslation::getInstance($this->object->getId());
     $lang = "";
     if ($ot->getContentActivated()) {
         $format = explode("_", $_POST["format"]);
         $lang = ilUtil::stripSlashes($format[1]);
     }
     require_once "./Modules/LearningModule/classes/class.ilContObjectExport.php";
     $cont_exp = new ilContObjectExport($this->object, "html", $lang);
     $cont_exp->buildExportFile();
     //echo $this->tpl->get();
     //		$this->ctrl->redirect($this, "exportList");
 }
 /**
  * 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;
 }