/** * show objectives * * @access public * @param object $tpl template object * @return */ public function showObjectives($a_tpl, $a_is_order = false) { global $lng, $ilSetting; $this->clearAdminCommandsDetermination(); // get embedded blocks $has_container_page = false; if (!$a_is_order) { $output_html = $this->getContainerGUI()->getContainerPageHTML(); if ($output_html != "") { $has_container_page = true; $this->output_html .= $this->insertPageEmbeddedBlocks($output_html); } unset($output_html); } // All objectives include_once './Modules/Course/classes/class.ilCourseObjective.php'; if (!count($objective_ids = ilCourseObjective::_getObjectiveIds($this->getContainerObject()->getId(), true))) { return false; } include_once './Modules/Course/classes/class.ilCourseObjectiveListGUI.php'; $this->objective_list_gui = new ilCourseObjectiveListGUI(); $this->objective_list_gui->setContainerObject($this->getContainerGUI()); if ($ilSetting->get("icon_position_in_lists") == "item_rows") { $this->objective_list_gui->enableIcon(true); } $acc = null; if (!$a_is_order) { include_once "Services/Accordion/classes/class.ilAccordionGUI.php"; $acc = new ilAccordionGUI(); $acc->setUseSessionStorage(true); $acc->setAllowMultiOpened(true); $acc->setBehaviour(ilAccordionGUI::FIRST_OPEN); $acc->setId("crsobjtv_" . $this->container_obj->getId()); } else { $this->renderer->addCustomBlock('lobj', $lng->txt('crs_objectives')); } $lur_data = $this->parseLOUserResults(); $has_initial = ilLOSettings::getInstanceByObjId($this->container_obj->getId())->worksWithInitialTest(); $has_lo_page = false; $obj_cnt = 0; foreach ($objective_ids as $objective_id) { include_once './Modules/Course/classes/Objectives/class.ilLOUtils.php'; if ($has_initial && (!isset($lur_data[$objective_id]) or ilLOUtils::hasActiveRun($this->container_obj->getId(), ilLOSettings::getInstanceByObjId($this->container_obj->getId())->getInitialTest(), $objective_id))) { $lur_data[$objective_id] = array("type" => ilLOSettings::TYPE_TEST_INITIAL); } if ($html = $this->renderObjective($objective_id, $has_lo_page, $acc, $lur_data[$objective_id])) { $this->renderer->addItemToBlock('lobj', 'lobj', $objective_id, $html); } $obj_cnt++; } // buttons for showing/hiding all objectives if (!$a_is_order && $obj_cnt > 1) { $this->showButton("", $lng->txt("crs_show_all_obj"), "", "crs_show_all_obj_btn"); $this->showButton("", $lng->txt("crs_hide_all_obj"), "", "crs_hide_all_obj_btn"); $acc->setShowAllElement("crs_show_all_obj_btn"); $acc->setHideAllElement("crs_hide_all_obj_btn"); } if (!$has_container_page && $has_lo_page) { // add core co page css include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $GLOBALS["tpl"]->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0)); $GLOBALS["tpl"]->setCurrentBlock("SyntaxStyle"); $GLOBALS["tpl"]->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath()); $GLOBALS["tpl"]->parseCurrentBlock(); } // order/block if ($a_is_order) { $this->addFooterRow(); $this->output_html .= $output_html . $this->renderer->getHTML(); $this->renderer->resetDetails(); } else { $this->output_html .= "<div class='ilCrsObjAcc'>" . $acc->getHTML() . "</div>"; } }