/** * parse * * @access public * @param array array of objective id's */ public function parse($a_objective_ids) { $position = 1; foreach ($a_objective_ids as $objective_id) { $objective = new ilCourseObjective($this->course_obj, $objective_id); $objective_data['id'] = $objective_id; $objective_data['position'] = sprintf("%.1f", $position++); $objective_data['title'] = $objective->getTitle(); $objective_data['description'] = $objective->getDescription(); // assigned materials $materials = array(); $ass_materials = new ilCourseObjectiveMaterials($objective_id); foreach ($ass_materials->getMaterials() as $material) { $materials[$material['ref_id']]['obj_id'] = $obj_id = ilObject::_lookupObjId($material['ref_id']); $materials[$material['ref_id']]['type'] = ilObject::_lookupType($obj_id); switch ($material['type']) { case 'pg': case 'st': $materials[$material['ref_id']]['items'][] = $material; break; default: } } $objective_data['materials'] = $materials; $question_obj = new ilCourseObjectiveQuestion($objective_id); // self assessment questions $tests = array(); foreach ($question_obj->getSelfAssessmentTests() as $test) { $questions = array(); foreach ($question_obj->getQuestionsOfTest($test['obj_id']) as $qst) { $questions[] = $qst; } $tmp_test = $test; $tmp_test['questions'] = $questions; $tests[] = $tmp_test; } $objective_data['self'] = $tests; // final test questions $tests = array(); foreach ($question_obj->getFinalTests() as $test) { $questions = array(); foreach ($question_obj->getQuestionsOfTest($test['obj_id']) as $qst) { $questions[] = $qst; } $tmp_test = $test; $tmp_test['questions'] = $questions; $tests[] = $tmp_test; } $objective_data['final'] = $tests; $objectives[] = $objective_data; } $this->setData($objectives ? $objectives : array()); }
protected function buildAccordionTitle(ilCourseObjective $a_objective, array $a_lo_result = null) { $tpl = new ilTemplate("tpl.objective_accordion_title.html", true, true, "Services/Container"); if ($a_lo_result) { $tpl->setVariable("PROGRESS_BAR", self::buildObjectiveProgressBar((bool) $this->loc_settings->getInitialTest(), $a_objective->getObjectiveId(), $a_lo_result)); } // $tpl->setVariable("ICON_SRC", ilObject::_getIcon($a_objective->getObjectiveId(), "small", "lobj")); // $tpl->setVariable("ICON_TXT", $this->lng->txt("icon")." ".$this->lng->txt("crs_objectives")); $tpl->setVariable("TITLE", $this->lng->txt("crs_loc_learning_objective") . ": " . trim($a_objective->getTitle())); $tpl->setVariable("DESCRIPTION", nl2br(trim($a_objective->getDescription()))); // #15510 $tpl->setVariable("ANCHOR_ID", "objtv_acc_" . $a_objective->getObjectiveId()); return $tpl->get(); }
/** * render objective * * @access protected * @param int objective id * @return string html */ protected function renderObjective($a_objective_id) { 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); $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); $pos = 1; foreach ($items as $item) { if ($this->getDetailsLevel($a_objective_id) < self::DETAILS_ALL) { continue; } $chapters = $objectives_lm_obj->getChapters(); $item_list_gui2 = $this->getItemGUI($item); $item_list_gui2->enableIcon(true); if (count($chapters)) { $num = 0; $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'; $details[$num]['desc'] = $lng->txt('obj_' . $chapter['type']) . ' -> '; $details[$num]['target'] = '_top'; $details[$num]['link'] = "ilias.php?baseClass=ilLMPresentationGUI&ref_id=" . $chapter['ref_id'] . '&obj_id=' . $chapter['obj_id']; $details[$num]['name'] = ilLMObject::_lookupTitle($chapter['obj_id']); $num++; } if ($has_sections) { $item_list_gui2->enableItemDetailLinks(true); $item_list_gui2->setItemDetailLinks($details, $lng->txt('crs_suggested_sections') . ': '); } } if ($this->getContainerGUI()->isActiveAdministrationPanel()) { $item_list_gui2->enableCheckbox(true); if ($this->getContainerObject()->getOrderType() == ilContainer::SORT_MANUAL) { $item_list_gui2->setPositionInputField("[lobj][" . $a_objective_id . "][" . $item["ref_id"] . "]", sprintf('%.1f', $pos)); $pos++; } } $this->rendered_items[$item['child']] = true; $sub_item_html = $item_list_gui2->getListItemHTML($item['ref_id'], $item['obj_id'], $item['title'], $item['description']); $this->determineAdminCommands($item["ref_id"], $item_list_gui2->adminCommandsIncluded()); $this->objective_list_gui->addSubItemHTML($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); } $html = $this->objective_list_gui->getListItemHTML(0, $a_objective_id, $objective->getTitle(), $objective->getDescription()); return $html; }
/** * parse * * @access public * @param array array of objective id's */ public function parse($a_objective_ids) { $position = 1; foreach ($a_objective_ids as $objective_id) { $objective = new ilCourseObjective($this->course_obj, $objective_id); $objective_data['id'] = $objective_id; $objective_data['position'] = sprintf("%.1f", $position++) * 10; $objective_data['title'] = $objective->getTitle(); $objective_data['description'] = $objective->getDescription(); // begin-patch lok $objective_data['online'] = $objective->isActive(); $objective_data['passes'] = $objective->getPasses(); // end-patch lok // assigned materials $materials = array(); $ass_materials = new ilCourseObjectiveMaterials($objective_id); foreach ($ass_materials->getMaterials() as $material) { $materials[$material['ref_id']]['obj_id'] = $obj_id = ilObject::_lookupObjId($material['ref_id']); $materials[$material['ref_id']]['type'] = ilObject::_lookupType($obj_id); switch ($material['type']) { case 'pg': case 'st': $materials[$material['ref_id']]['items'][] = $material; break; default: } } $objective_data['materials'] = $materials; $question_obj = new ilCourseObjectiveQuestion($objective_id); // self assessment questions // begin-patch lok if ($this->getSettings()->worksWithInitialTest()) { if (ilLOUtils::lookupRandomTest(ilObject::_lookupObjId($this->getSettings()->getInitialTest()))) { $test = array(); include_once './Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php'; $rnd = new ilLORandomTestQuestionPools($this->course_obj->getId(), $objective_id, ilLOSettings::TYPE_TEST_INITIAL); $test['obj_id'] = ilObject::_lookupObjId($this->getSettings()->getInitialTest()); $qst = ilLOUtils::lookupQplBySequence($this->getSettings()->getInitialTest(), $rnd->getQplSequence()); if ($qst) { $test['questions'][] = array('title' => $qst); } $objective_data['self'] = array($test); } else { $tests = array(); foreach ($question_obj->getSelfAssessmentTests() as $test) { $questions = array(); foreach ($question_obj->getQuestionsOfTest($test['obj_id']) as $qst) { $questions[] = $qst; } $tmp_test = $test; $tmp_test['questions'] = $questions; $tests[] = $tmp_test; } $objective_data['self'] = $tests; } } // end-patch lok // final test questions // begin-patch lok if ($this->getSettings()->getQualifiedTest()) { if (ilLOUtils::lookupRandomTest(ilObject::_lookupObjId($this->getSettings()->getQualifiedTest()))) { $test = array(); include_once './Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php'; $rnd = new ilLORandomTestQuestionPools($this->course_obj->getId(), $objective_id, ilLOSettings::TYPE_TEST_QUALIFIED); $test['obj_id'] = ilObject::_lookupObjId($this->getSettings()->getQualifiedTest()); $qst = ilLOUtils::lookupQplBySequence($this->getSettings()->getQualifiedTest(), $rnd->getQplSequence()); if ($qst) { $test['questions'][] = array('title' => $qst); } $objective_data['final'] = array($test); } else { $tests = array(); foreach ($question_obj->getFinalTests() as $test) { $questions = array(); foreach ($question_obj->getQuestionsOfTest($test['obj_id']) as $qst) { $questions[] = $qst; } $tmp_test = $test; $tmp_test['questions'] = $questions; $tests[] = $tmp_test; } $objective_data['final'] = $tests; } } // end-patch lok $objectives[] = (array) $objective_data; } $this->setData($objectives ? $objectives : array()); }
/** * parse * * @access public * @param array array of objective id's */ public function parse($a_objective_ids) { include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php'; $objectives = array(); foreach ($a_objective_ids as $objective_id) { $objective = new ilCourseObjective($this->course_obj, $objective_id); // Self assessment tests $question_obj = new ilCourseObjectiveQuestion($objective_id); $tests = array(); foreach ($question_obj->getSelfAssessmentTests() as $tmp_test) { if (isset($_POST['self'][$objective_id])) { $objective_data['self_limit'] = $_POST['self'][$objective_id]; } else { $objective_data['self_limit'] = $tmp_test['limit']; } $questions = array(); foreach ($question_obj->getQuestionsOfTest($tmp_test['obj_id']) as $tmp_question) { $qst['title'] = $tmp_question['title']; $qst['description'] = $tmp_question['description']; $qst['points'] = $tmp_question['points']; $questions[] = $qst; } $tst['questions'] = $questions; $tst['title'] = ilObject::_lookupTitle($tmp_test['obj_id']); $tst['description'] = ilObject::_lookupDescription($tmp_test['obj_id']); $tests[] = $tst; } $objective_data['self_tests'] = $tests; $objective_data['self_max_points'] = $question_obj->getSelfAssessmentPoints(); // Final tests $tests = array(); foreach ($question_obj->getFinalTests() as $tmp_test) { if (isset($_POST['final'][$objective_id])) { $objective_data['final_limit'] = $_POST['final'][$objective_id]; } else { $objective_data['final_limit'] = $tmp_test['limit']; } $questions = array(); foreach ($question_obj->getQuestionsOfTest($tmp_test['obj_id']) as $tmp_question) { $qst['title'] = $tmp_question['title']; $qst['description'] = $tmp_question['description']; $qst['points'] = $tmp_question['points']; $questions[] = $qst; } $tst['questions'] = $questions; $tst['title'] = ilObject::_lookupTitle($tmp_test['obj_id']); $tst['description'] = ilObject::_lookupDescription($tmp_test['obj_id']); $tests[] = $tst; } $objective_data['final_tests'] = $tests; $objective_data['final_max_points'] = $question_obj->getFinalTestPoints(); $objective_data['id'] = $objective_id; $objective_data['title'] = $objective->getTitle(); $objective_data['description'] = $objective->getDescription(); $objectives[] = $objective_data; } $this->setData($objectives ? $objectives : array()); }