/** * render objective * * @access protected * @param int objective id * @param bool co page status * @param ilAccordionGUI $a_accordion * @param array $a_lo_result * @return string html */ protected function renderObjective($a_objective_id, &$a_has_lo_page, ilAccordionGUI $a_accordion = null, array $a_lo_result = null) { global $ilUser, $lng; include_once './Modules/Course/classes/class.ilCourseObjective.php'; $objective = new ilCourseObjective($this->getContainerObject(), $a_objective_id); include_once './Services/Container/classes/class.ilContainerSorting.php'; include_once './Services/Object/classes/class.ilObjectActivation.php'; $items = ilObjectActivation::getItemsByObjective($a_objective_id); // sorting is handled by ilCourseObjectiveMaterials // $items = ilContainerSorting::_getInstance($this->getContainerObject()->getId())->sortSubItems('lobj',$a_objective_id,$items); include_once './Modules/Course/classes/class.ilCourseObjectiveMaterials.php'; $objectives_lm_obj = new ilCourseObjectiveMaterials($a_objective_id); // #13381 - map material assignment to position $sort_map = array(); foreach ($objectives_lm_obj->getMaterials() as $item) { $sort_map[$item["lm_ass_id"]] = $item["position"]; } $is_manage = $this->getContainerGUI()->isActiveAdministrationPanel(); $is_order = $this->getContainerGUI()->isActiveOrdering(); $sort_content = array(); foreach ($items as $item) { if ($this->getDetailsLevel($a_objective_id) < self::DETAILS_ALL) { continue; } $item_list_gui2 = $this->getItemGUI($item); $item_list_gui2->enableIcon(true); if ($is_order || $a_accordion) { $item_list_gui2->enableCommands(true, true); $item_list_gui2->enableProperties(false); } $chapters = $objectives_lm_obj->getChapters(); if (count($chapters)) { $has_sections = false; foreach ($chapters as $chapter) { if ($chapter['ref_id'] != $item['child']) { continue; } $has_sections = true; include_once './Modules/LearningModule/classes/class.ilLMObject.php'; $title = $item['title'] . " › " . ilLMObject::_lookupTitle($chapter['obj_id']) . " (" . $lng->txt('obj_' . $chapter['type']) . ")"; $item_list_gui2->setDefaultCommandParameters(array("obj_id" => $chapter['obj_id'], "focus_id" => $chapter['obj_id'], "focus_return" => $this->container_obj->getRefId())); if ($is_order) { $item_list_gui2->setPositionInputField("[lobj][" . $a_objective_id . "][" . $chapter['lm_ass_id'] . "]", sprintf('%d', $chapter['position'] * 10)); } $sub_item_html = $item_list_gui2->getListItemHTML($item['ref_id'], $item['obj_id'], $title, $item['description']); // #13381 - use materials order $sort_key = str_pad($chapter['position'], 5, 0, STR_PAD_LEFT) . "_" . strtolower($title) . "_" . $chapter['lm_ass_id']; $sort_content[$sort_key] = $sub_item_html; } } $this->rendered_items[$item['child']] = true; if ($lm_ass_id = $objectives_lm_obj->isAssigned($item['ref_id'], true)) { if ($is_order) { $item_list_gui2->setPositionInputField("[lobj][" . $a_objective_id . "][" . $lm_ass_id . "]", sprintf('%d', $sort_map[$lm_ass_id] * 10)); } $sub_item_html = $item_list_gui2->getListItemHTML($item['ref_id'], $item['obj_id'], $item['title'], $item['description']); // #13381 - use materials order $sort_key = str_pad($sort_map[$lm_ass_id], 5, 0, STR_PAD_LEFT) . "_" . strtolower($item['title']) . "_" . $lm_ass_id; $sort_content[$sort_key] = $sub_item_html; } } if ($this->getDetailsLevel($a_objective_id) == self::DETAILS_ALL) { $this->objective_list_gui->enableCommands(false); } else { $this->objective_list_gui->enableCommands(true); } if ($is_order) { $this->objective_list_gui->setPositionInputField("[lobj][" . $a_objective_id . "][0]", $objective->__getPosition() * 10); } ksort($sort_content); if (!$a_accordion) { foreach ($sort_content as $sub_item_html) { $this->objective_list_gui->addSubItemHTML($sub_item_html); } return $this->objective_list_gui->getListItemHTML(0, $a_objective_id, $objective->getTitle(), $objective->getDescription(), $is_manage || $is_order); } else { $acc_content = $sort_content; $initial_shown = false; if ($this->getSettings()->hasSeparateInitialTests() and !$a_lo_result['initial_status']) { $acc_content[] = $this->renderTest($this->getTestAssignments()->getTestByObjective($a_objective_id, ilLOSettings::TYPE_TEST_INITIAL), $a_objective_id, true, false, $a_lo_result); $initial_shown = TRUE; } elseif ($this->getSettings()->hasSeparateQualifiedTests()) { $acc_content[] = $this->renderTest($this->getTestAssignments()->getTestByObjective($a_objective_id, ilLOSettings::TYPE_TEST_QUALIFIED), $a_objective_id, false, false, $a_lo_result); } /* if($this->loc_settings->getInitialTest() && $this->loc_settings->getType() == ilLOSettings::LOC_INITIAL_SEL && !$a_lo_result["initial_status"]) { $acc_content[] = $this->renderTest($this->loc_settings->getInitialTest(), $a_objective_id, true, false, $a_lo_result); $initial_shown = true; } if(!$initial_shown && $this->loc_settings->getQualifiedTest() && $this->loc_settings->isQualifiedTestPerObjectiveVisible()) { $acc_content[] = $this->renderTest($this->loc_settings->getQualifiedTest(), $a_objective_id, false, false, $a_lo_result); } */ $co_page = null; include_once "./Services/COPage/classes/class.ilPageUtil.php"; if (ilPageUtil::_existsAndNotEmpty("lobj", $objective->getObjectiveId())) { $a_has_lo_page = true; include_once 'Modules/Course/classes/Objectives/class.ilLOPageGUI.php'; $page_gui = new ilLOPageGUI($objective->getObjectiveId()); include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $page_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(0)); $page_gui->setPresentationTitle(""); $page_gui->setTemplateOutput(false); $page_gui->setHeader(""); $co_page = "<div class='ilContObjectiveIntro'>" . $page_gui->showPage() . "</div>"; } // patch optes start $a_accordion->addItem($this->buildAccordionTitle($objective, $a_lo_result), $co_page . $this->buildAccordionContent($acc_content), isset($_GET["oobj"]) && (int) $_GET["oobj"] == $objective->getObjectiveId()); // patch optes end } }
/** * Execute command * @return <type> */ public function executeCommand() { global $ilCtrl; $next_class = $ilCtrl->getNextClass($this); $cmd = $ilCtrl->getCmd(); $this->setTabs(); switch ($next_class) { case 'ilcourseobjectivesgui': $this->ctrl->setReturn($this, 'listObjectives'); $GLOBALS['ilTabs']->clearTargets(); $GLOBALS['ilTabs']->setBackTarget($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'listObjectives')); include_once './Modules/Course/classes/class.ilCourseObjectivesGUI.php'; $reg_gui =& new ilCourseObjectivesGUI($this->getParentObject()->getRefId()); $this->ctrl->forwardCommand($reg_gui); break; case 'ilcontainerstartobjectsgui': include_once './Services/Container/classes/class.ilContainerStartObjectsGUI.php'; $stgui = new ilContainerStartObjectsGUI($this->getParentObject()); $ret = $this->ctrl->forwardCommand($stgui); $GLOBALS['ilTabs']->activateSubTab('start'); $GLOBALS['ilTabs']->removeSubTab('manage'); #$GLOBALS['tpl']->setContent($this->ctrl->getHTML($stgui)); break; case 'ilconditionhandlergui': $this->ctrl->saveParameterByClass('ilconditionhandlergui', 'objective_id'); $GLOBALS['ilTabs']->clearTargets(); $GLOBALS['ilTabs']->setBackTarget($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'listObjectives')); include_once './Services/AccessControl/classes/class.ilConditionHandlerInterface.php'; $cond = new ilConditionHandlerGUI($this); $cond->setBackButtons(array()); $cond->setAutomaticValidation(false); $cond->setTargetType("lobj"); $cond->setTargetRefId($this->getParentObject()->getRefId()); $cond->setTargetId((int) $_REQUEST['objective_id']); // objecitve include_once './Modules/Course/classes/class.ilCourseObjective.php'; $obj = new ilCourseObjective($this->getParentObject(), (int) $_REQUEST['objective_id']); $cond->setTargetTitle($obj->getTitle()); $this->ctrl->forwardCommand($cond); break; case 'illopagegui': $this->ctrl->saveParameterByClass('illopagegui', 'objective_id'); $GLOBALS['ilTabs']->clearTargets(); $GLOBALS['ilTabs']->setBackTarget($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'listObjectives')); $objtv_id = (int) $_REQUEST['objective_id']; include_once 'Modules/Course/classes/Objectives/class.ilLOPage.php'; if (!ilLOPage::_exists('lobj', $objtv_id)) { // doesn't exist -> create new one $new_page_object = new ilLOPage(); $new_page_object->setParentId($objtv_id); $new_page_object->setId($objtv_id); $new_page_object->createFromXML(); unset($new_page_object); } $this->ctrl->setReturn($this, 'listObjectives'); include_once 'Modules/Course/classes/Objectives/class.ilLOPageGUI.php'; $pgui = new ilLOPageGUI($objtv_id); $pgui->setPresentationTitle(ilCourseObjective::lookupObjectiveTitle($objtv_id)); // needed for editor? include_once './Services/Style/classes/class.ilObjStyleSheet.php'; $pgui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(0)); // #14895 $GLOBALS['tpl']->setCurrentBlock("ContentStyle"); $GLOBALS['tpl']->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0)); $GLOBALS['tpl']->parseCurrentBlock(); $ret = $this->ctrl->forwardCommand($pgui); if ($ret) { $GLOBALS['tpl']->setContent($ret); } break; default: if (!$cmd) { // get first unaccomplished step include_once './Modules/Course/classes/Objectives/class.ilLOEditorStatus.php'; $cmd = ilLOEditorStatus::getInstance($this->getParentObject())->getFirstFailedStep(); } $this->{$cmd}(); break; } return true; }