public function loadObjectivesTitles()
 {
     require_once 'Modules/Course/classes/class.ilCourseObjective.php';
     foreach ($this->objectivesByQuestion as $objectiveId) {
         if (!isset($this->objectivesTitles[$objectiveId])) {
             $objectiveTitle = ilCourseObjective::lookupObjectiveTitle($objectiveId);
             $this->objectivesTitles[$objectiveId] = $objectiveTitle;
         }
     }
 }
 public function initForm($a_as_multi_assignment = FALSE)
 {
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setTitle($this->lng->txt('crs_loc_tst_assignment'));
     $form->setFormAction($this->ctrl->getFormAction($this->getGUI()));
     if ($a_as_multi_assignment) {
         $form->addCommandButton('saveMultiTestAssignment', $this->lng->txt('save'));
     } else {
         $form->addCommandButton('saveTest', $this->lng->txt('save'));
     }
     switch ($this->getTestType()) {
         case ilLOSettings::TYPE_TEST_INITIAL:
             $form->setTitle($this->lng->txt('crs_loc_settings_itest_tbl'));
             break;
         case ilLOSettings::TYPE_TEST_QUALIFIED:
             $form->setTitle($this->lng->txt('crs_loc_settings_qtest_tbl'));
             break;
     }
     $assignable = $this->getAssignableTests();
     $cr_mode = new ilRadioGroupInputGUI($this->lng->txt('crs_loc_form_assign_it'), 'mode');
     $cr_mode->setRequired(true);
     $cr_mode->setValue(self::TEST_NEW);
     $new = new ilRadioOption($this->lng->txt('crs_loc_form_tst_new'), self::TEST_NEW);
     switch ($this->getTestType()) {
         case ilLOSettings::TYPE_TEST_INITIAL:
             $new->setInfo($this->lng->txt("crs_loc_form_tst_new_initial_info"));
             break;
         case ilLOSettings::TYPE_TEST_QUALIFIED:
             $new->setInfo($this->lng->txt("crs_loc_form_tst_new_qualified_info"));
             break;
     }
     // title
     $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
     $ti->setMaxLength(128);
     $ti->setSize(40);
     $ti->setRequired(true);
     $new->addSubItem($ti);
     // description
     $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
     $ta->setCols(40);
     $ta->setRows(2);
     $new->addSubItem($ta);
     // Question assignment type
     include_once './Modules/Test/classes/class.ilObjTest.php';
     $this->lng->loadLanguageModule('assessment');
     $qst = new ilRadioGroupInputGUI($this->lng->txt('tst_question_set_type'), 'qtype');
     $qst->setRequired(true);
     $random = new ilRadioOption($this->lng->txt('tst_question_set_type_random'), ilObjTest::QUESTION_SET_TYPE_RANDOM);
     $qst->addOption($random);
     $fixed = new ilRadioOption($this->lng->txt('tst_question_set_type_fixed'), ilObjTest::QUESTION_SET_TYPE_FIXED);
     $qst->addOption($fixed);
     $new->addSubItem($qst);
     $cr_mode->addOption($new);
     // assign existing
     $existing = new ilRadioOption($this->lng->txt('crs_loc_form_assign'), self::TEST_ASSIGN);
     switch ($this->getTestType()) {
         case ilLOSettings::TYPE_TEST_INITIAL:
             $existing->setInfo($this->lng->txt("crs_loc_form_assign_initial_info"));
             break;
         case ilLOSettings::TYPE_TEST_QUALIFIED:
             $existing->setInfo($this->lng->txt("crs_loc_form_assign_qualified_info"));
             break;
     }
     if (!$assignable) {
         $existing->setDisabled(true);
     }
     $cr_mode->addOption($existing);
     $options = array();
     $options[''] = $this->lng->txt('select_one');
     foreach ((array) $assignable as $tst_ref_id) {
         $tst_obj_id = ilObject::_lookupObjId($tst_ref_id);
         $options[$tst_ref_id] = ilObject::_lookupTitle($tst_obj_id);
     }
     $selectable = new ilSelectInputGUI($this->lng->txt('crs_loc_form_available_tsts'), 'tst');
     $selectable->setRequired(true);
     $selectable->setOptions($options);
     $existing->addSubItem($selectable);
     $form->addItem($cr_mode);
     if ($a_as_multi_assignment) {
         include_once './Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
         $assignments = ilLOTestAssignments::getInstance($this->getContainer()->getId());
         include_once './Modules/Course/classes/class.ilCourseObjective.php';
         $objective_ids = ilCourseObjective::_getObjectiveIds($this->getContainer()->getId(), FALSE);
         $options = array();
         $options[''] = $this->lng->txt('select_one');
         foreach ($objective_ids as $oid) {
             $already_assigned_tst = $assignments->getTestByObjective($oid, $this->getTestType());
             if (!$already_assigned_tst) {
                 $options[$oid] = ilCourseObjective::lookupObjectiveTitle($oid);
             }
         }
         $objective = new ilSelectInputGUI($this->lng->txt('crs_objectives'), 'objective');
         $objective->setRequired(TRUE);
         $objective->setOptions($options);
         $form->addItem($objective);
     }
     return $form;
 }
 protected function buildObjectiveMap()
 {
     $objective_map = array();
     include_once './Modules/Course/classes/class.ilCourseObjective.php';
     // begin-patch lok
     if (count($objective_ids = ilCourseObjective::_getObjectiveIds($this->getContainerObject()->getId(), true))) {
         include_once './Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
         foreach ($objective_ids as $objective_id) {
             foreach (ilCourseObjectiveMaterials::_getAssignedMaterials($objective_id) as $mat_ref_id) {
                 $objective_map["material"][$mat_ref_id][] = $objective_id;
                 if (!isset($objective_map["names"][$objective_id])) {
                     $objective = new ilCourseObjective($this->getContainerObject(), $objective_id);
                     $objective_map["names"][$objective_id] = $objective->getTitle();
                 }
             }
         }
         // initial/qualifying test
         $tst = $this->loc_settings->getInitialTest();
         if ($tst) {
             $objective_map["test_i"] = $tst;
         }
         $tst = $this->loc_settings->getQualifiedTest();
         if ($tst) {
             $objective_map["test_q"] = $tst;
         }
         // patch LOK
         // objective test assignments
         include_once 'Modules/Course/classes/Objectives/class.ilLOSettings.php';
         include_once 'Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
         $ass_test = new ilLOTestAssignments($this->getContainerObject()->getId());
         foreach ($ass_test->getAssignmentsByType(ilLOSettings::TYPE_TEST_INITIAL) as $ass) {
             $title = ilCourseObjective::lookupObjectiveTitle($ass->getObjectiveId());
             $objective_map["test_ass"][$ass->getTestRefId()][$ass->getAssignmentType()][] = $title;
         }
         foreach ($ass_test->getAssignmentsByType(ilLOSettings::TYPE_TEST_QUALIFIED) as $ass) {
             $title = ilCourseObjective::lookupObjectiveTitle($ass->getObjectiveId());
             $objective_map["test_ass"][$ass->getTestRefId()][$ass->getAssignmentType()][] = $title;
         }
     }
     return $objective_map;
 }
 protected function renderTest($a_test_ref_id, $a_objective_id, $a_is_initial = false, $a_add_border = false, $a_lo_result = array())
 {
     $node_data = $GLOBALS['tree']->getNodeData($a_test_ref_id);
     // update ti
     if ($a_objective_id) {
         if ($a_is_initial) {
             $title = sprintf($this->lng->txt('crs_loc_itst_for_objective'), ilCourseObjective::lookupObjectiveTitle($a_objective_id));
         } else {
             $title = sprintf($this->lng->txt('crs_loc_qtst_for_objective'), ilCourseObjective::lookupObjectiveTitle($a_objective_id));
         }
         $node_data['objective_id'] = $a_objective_id;
         $node_data['objective_status'] = $a_lo_result['status'] == ilLOUserResults::STATUS_COMPLETED ? false : false;
     } else {
         $obj_id = ilObject::_lookupObjId($a_test_ref_id);
         $title = ilObject::_lookupTitle($obj_id);
         $title .= ' (' . ($a_is_initial ? $this->lng->txt('crs_loc_itest_info') : $this->lng->txt('crs_loc_qtest_info')) . ')';
         $node_data['objective_id'] = 0;
     }
     $node_data['title'] = $title;
     return "<div class='ilContObjectivesViewTestItem'>" . $this->renderItem($node_data) . "</div>";
 }
 /**
  * Parse user results for table
  * @return type
  */
 public function parse()
 {
     include_once './Modules/Course/classes/Objectives/class.ilLOUserResults.php';
     include_once './Modules/Course/classes/class.ilCourseObjective.php';
     $objective_ids = ilCourseObjective::_getObjectiveIds($this->getParentContainer()->getId(), TRUE);
     foreach ((array) $objective_ids as $objective_id) {
         $objective = array();
         $objective['id'] = $objective_id;
         $objective['title'] = ilCourseObjective::lookupObjectiveTitle($objective_id);
         if ($this->getSettings()->worksWithInitialTest()) {
             $results_it = ilLOUserResults::lookupResult($this->getParentContainer()->getId(), $this->getUserId(), $objective_id, ilLOSettings::TYPE_TEST_INITIAL);
             $objective['tries_it'] = $results_it['tries'];
             $objective['res_it'] = $results_it['result_perc'];
             $objective['link_it'] = $this->createTestResultLink(ilLOSettings::TYPE_TEST_INITIAL, $objective_id);
         }
         $results_qt = ilLOUserResults::lookupResult($this->getParentContainer()->getId(), $this->getUserId(), $objective_id, ilLOSettings::TYPE_TEST_QUALIFIED);
         $objective['tries_qt'] = $results_qt['tries'];
         $objective['res_qt'] = $results_qt['result_perc'];
         $objective['link_qt'] = $this->createTestResultLink(ilLOSettings::TYPE_TEST_QUALIFIED, $objective_id);
         $tbl_data[] = $objective;
     }
     return $this->setData($tbl_data);
 }
Exemplo n.º 6
0
 protected function getCoursesOfUser($a_user_id)
 {
     global $tree;
     // see ilPDSelectedItemsBlockGUI
     include_once 'Modules/Course/classes/class.ilObjCourseAccess.php';
     include_once 'Services/Membership/classes/class.ilParticipants.php';
     $items = ilParticipants::_getMembershipByType($a_user_id, 'crs');
     $references = $lp_obj_refs = array();
     foreach ($items as $obj_id) {
         $ref_id = ilObject::_getAllReferences($obj_id);
         if (is_array($ref_id) && count($ref_id)) {
             $ref_id = array_pop($ref_id);
             if (!$tree->isDeleted($ref_id)) {
                 $visible = false;
                 $active = ilObjCourseAccess::_isActivated($obj_id, $visible, false);
                 if ($active && $visible) {
                     $references[$ref_id] = array('ref_id' => $ref_id, 'obj_id' => $obj_id, 'title' => ilObject::_lookupTitle($obj_id));
                     $lp_obj_refs[$obj_id] = $ref_id;
                 }
             }
         }
     }
     // get lp data for valid courses
     if (sizeof($lp_obj_refs)) {
         // lp must be active, personal and not anonymized
         include_once "Services/Tracking/classes/class.ilObjUserTracking.php";
         if (ilObjUserTracking::_enabledLearningProgress() && ilObjUserTracking::_enabledUserRelatedData() && ilObjUserTracking::_hasLearningProgressLearner()) {
             // see ilLPProgressTableGUI
             include_once "Services/Tracking/classes/class.ilTrQuery.php";
             include_once "Services/Tracking/classes/class.ilLPStatusFactory.php";
             $lp_data = ilTrQuery::getObjectsStatusForUser($a_user_id, $lp_obj_refs);
             foreach ($lp_data as $item) {
                 $ref_id = $item["ref_ids"];
                 $references[$ref_id]["lp_status"] = $item["status"];
                 // add objectives
                 if ($item["u_mode"] == ilLPObjSettings::LP_MODE_OBJECTIVES) {
                     // we need the collection for the correct order
                     include_once "Services/Tracking/classes/collection/class.ilLPCollectionOfObjectives.php";
                     $coll_objtv = new ilLPCollectionOfObjectives($item["obj_id"], $item["u_mode"]);
                     $coll_objtv = $coll_objtv->getItems();
                     if ($coll_objtv) {
                         // #13373
                         $lo_results = $this->parseLOUserResults($item["obj_id"], $a_user_id);
                         $tmp = array();
                         include_once "Modules/Course/classes/class.ilCourseObjective.php";
                         foreach ($coll_objtv as $objective_id) {
                             $tmp[$objective_id] = array("id" => $objective_id, "title" => ilCourseObjective::lookupObjectiveTitle($objective_id));
                             if (array_key_exists($objective_id, $lo_results)) {
                                 $lo_result = $lo_results[$objective_id];
                                 $tmp[$objective_id]["result_perc"] = $lo_result["result_perc"];
                                 $tmp[$objective_id]["limit_perc"] = $lo_result["limit_perc"];
                                 $tmp[$objective_id]["status"] = $lo_result["status"];
                                 $tmp[$objective_id]["type"] = $lo_result["type"];
                             }
                         }
                         // order
                         foreach ($coll_objtv as $objtv_id) {
                             $references[$ref_id]["objectives"][] = $tmp[$objtv_id];
                         }
                     }
                 }
             }
         }
     }
     $references = ilUtil::sortArray($references, "title", "ASC");
     return $references;
 }
Exemplo n.º 7
0
 function getItems(array $a_user_fields, array $a_privary_fields = null)
 {
     include_once "./Services/Tracking/classes/class.ilTrQuery.php";
     $collection = ilTrQuery::getObjectIds($this->obj_id, $this->ref_id, true);
     if ($collection["object_ids"]) {
         // we need these for the timing warnings
         $this->ref_ids = $collection["ref_ids"];
         // only if object is [part of] course/group
         $check_agreement = false;
         if ($this->in_course) {
             // privacy (if course agreement is activated)
             include_once "Services/PrivacySecurity/classes/class.ilPrivacySettings.php";
             $privacy = ilPrivacySettings::_getInstance();
             if ($privacy->courseConfirmationRequired()) {
                 $check_agreement = $this->in_course;
             }
         } else {
             if ($this->in_group) {
                 // privacy (if group agreement is activated)
                 include_once "Services/PrivacySecurity/classes/class.ilPrivacySettings.php";
                 $privacy = ilPrivacySettings::_getInstance();
                 if ($privacy->groupConfirmationRequired()) {
                     $check_agreement = $this->in_group;
                 }
             }
         }
         $data = ilTrQuery::getUserObjectMatrix($this->ref_id, $collection["object_ids"], $this->filter["name"], $a_user_fields, $a_privary_fields, $check_agreement);
         if ($collection["objectives_parent_id"] && $data["users"]) {
             // sub-items: learning objectives
             $objectives = ilTrQuery::getUserObjectiveMatrix($collection["objectives_parent_id"], $data["users"]);
             $this->objective_ids = array();
             foreach ($objectives as $user_id => $objectives) {
                 if (isset($data["set"][$user_id])) {
                     foreach ($objectives as $objective_id => $status) {
                         $obj_id = "objtv_" . $objective_id;
                         $data["set"][$user_id][$obj_id] = $status;
                         if (!in_array($obj_id, $this->objective_ids)) {
                             $this->objective_ids[$objective_id] = ilCourseObjective::lookupObjectiveTitle($objective_id);
                         }
                     }
                 }
             }
         }
         // sub-items: SCOs
         if ($collection["scorm"] && $data["set"]) {
             $this->sco_ids = array();
             foreach (array_keys($data["set"]) as $user_id) {
                 foreach ($collection["scorm"]["scos"] as $sco) {
                     if (!in_array($sco, $this->sco_ids)) {
                         $this->sco_ids[$sco] = $collection["scorm"]["scos_title"][$sco];
                     }
                     // alex, 5 Nov 2011: we got users being in failed and in
                     // completed status, I changed the setting in: first check failed
                     // then check completed since failed should superseed completed
                     // (before completed has been checked before failed)
                     $status = ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM;
                     if (in_array($user_id, $collection["scorm"]["failed"][$sco])) {
                         $status = ilLPStatus::LP_STATUS_FAILED_NUM;
                     } else {
                         if (in_array($user_id, $collection["scorm"]["completed"][$sco])) {
                             $status = ilLPStatus::LP_STATUS_COMPLETED_NUM;
                         } else {
                             if (in_array($user_id, $collection["scorm"]["in_progress"][$sco])) {
                                 $status = ilLPStatus::LP_STATUS_IN_PROGRESS_NUM;
                             }
                         }
                     }
                     $obj_id = "objsco_" . $sco;
                     $data["set"][$user_id][$obj_id] = $status;
                 }
             }
         }
         // sub-items: generic, e.g. lm chapter
         if ($collection["subitems"] && $data["set"]) {
             foreach (array_keys($data["set"]) as $user_id) {
                 foreach ($collection["subitems"]["items"] as $item_id) {
                     $this->subitem_ids[$item_id] = $collection["subitems"]["item_titles"][$item_id];
                     $status = ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM;
                     if (in_array($user_id, $collection["subitems"]["completed"][$item_id])) {
                         $status = ilLPStatus::LP_STATUS_COMPLETED_NUM;
                     } else {
                         if (is_array($collection["subitems"]["in_progress"]) && in_array($user_id, $collection["subitems"]["in_progress"][$item_id])) {
                             $status = ilLPStatus::LP_STATUS_IN_PROGRESS_NUM;
                         }
                     }
                     $obj_id = "objsub_" . $item_id;
                     $data["set"][$user_id][$obj_id] = $status;
                 }
             }
         }
         // percentage export
         if ($data["set"]) {
             $this->perc_map = array();
             foreach ($data["set"] as $row) {
                 foreach ($row as $column => $value) {
                     if (substr($column, -5) == "_perc") {
                         if ((int) $value > 0) {
                             $obj_id = explode("_", $column);
                             $obj_id = (int) $obj_id[1];
                             $this->perc_map[$obj_id] = true;
                         }
                     }
                 }
             }
         }
         $this->setMaxCount($data["cnt"]);
         $this->setData($data["set"]);
         return $collection["object_ids"];
     }
     return false;
 }
Exemplo n.º 8
0
 /**
  * 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;
 }
 /**
  * Parse test
  * throws ilLOInvalidConfigurationException in case assigned test cannot be found.
  */
 protected function doParse($a_tst_ref_id, $a_objective_id = 0)
 {
     include_once './Modules/Test/classes/class.ilObjTest.php';
     $tst = ilObjectFactory::getInstanceByRefId($a_tst_ref_id, false);
     if (!$tst instanceof ilObjTest) {
         throw new ilLOInvalidConfigurationException('No valid test given');
     }
     $tst_data['ref_id'] = $tst->getRefId();
     $tst_data['title'] = $tst->getTitle();
     $tst_data['description'] = $tst->getLongDescription();
     $tst_data['ttype'] = $tst->getQuestionSetType();
     if ($this->getAssignmentType() == self::TYPE_MULTIPLE_ASSIGNMENTS) {
         include_once './Modules/Course/classes/class.ilCourseObjective.php';
         $tst_data['objective'] = ilCourseObjective::lookupObjectiveTitle($a_objective_id);
     }
     switch ($tst->getQuestionSetType()) {
         case ilObjTest::QUESTION_SET_TYPE_FIXED:
             $tst_data['qst_info'] = $this->lng->txt('crs_loc_tst_num_qst');
             $tst_data['qst_info'] .= ' ' . count($tst->getAllQuestions());
             break;
         default:
             // get available assiged question pools
             include_once './Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php';
             include_once './Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php';
             $list = new ilTestRandomQuestionSetSourcePoolDefinitionList($GLOBALS['ilDB'], $tst, new ilTestRandomQuestionSetSourcePoolDefinitionFactory($GLOBALS['ilDB'], $tst));
             $list->loadDefinitions();
             // tax translations
             include_once './Modules/Test/classes/class.ilTestTaxonomyFilterLabelTranslater.php';
             $translater = new ilTestTaxonomyFilterLabelTranslater($GLOBALS['ilDB']);
             $translater->loadLabels($list);
             $tst_data['qst_info'] = $this->lng->txt('crs_loc_tst_qpls');
             $num = 0;
             foreach ($list as $definition) {
                 /** @var ilTestRandomQuestionSetSourcePoolDefinition[] $definition */
                 $title = $definition->getPoolTitle();
                 $tax_id = $definition->getMappedFilterTaxId();
                 if ($tax_id) {
                     $title .= ' -> ' . $translater->getTaxonomyTreeLabel($tax_id);
                 }
                 $tax_node = $definition->getMappedFilterTaxNodeId();
                 if ($tax_node) {
                     $title .= ' -> ' . $translater->getTaxonomyNodeLabel($tax_node);
                 }
                 $tst_data['qpls'][] = $title;
                 ++$num;
             }
             if (!$num) {
                 $tst_data['qst_info'] .= ' ' . (int) 0;
             }
             break;
     }
     return $tst_data;
 }
Exemplo n.º 10
0
 protected function parseObjectives($a_obj_id, $a_user_id)
 {
     $res = array();
     // we need the collection for the correct order
     include_once "Services/Tracking/classes/class.ilLPObjSettings.php";
     include_once "Services/Tracking/classes/collection/class.ilLPCollectionOfObjectives.php";
     $coll_objtv = new ilLPCollectionOfObjectives($a_obj_id, ilLPObjSettings::LP_MODE_OBJECTIVES);
     $coll_objtv = $coll_objtv->getItems();
     if ($coll_objtv) {
         // #13373
         $lo_results = $this->parseLOUserResults($a_obj_id, $a_user_id);
         include_once "Modules/Course/classes/Objectives/class.ilLOTestAssignments.php";
         $lo_ass = ilLOTestAssignments::getInstance($a_obj_id);
         $tmp = array();
         include_once "Modules/Course/classes/class.ilCourseObjective.php";
         foreach ($coll_objtv as $objective_id) {
             // patch optes start
             $title = ilCourseObjective::lookupObjectiveTitle($objective_id, true);
             $tmp[$objective_id] = array("id" => $objective_id, "title" => $title["title"], "desc" => $title["description"], "itest" => $lo_ass->getTestByObjective($objective_id, ilLOSettings::TYPE_TEST_INITIAL), "qtest" => $lo_ass->getTestByObjective($objective_id, ilLOSettings::TYPE_TEST_QUALIFIED));
             // patch optes end
             if (array_key_exists($objective_id, $lo_results)) {
                 $lo_result = $lo_results[$objective_id];
                 $tmp[$objective_id]["user_id"] = $lo_result["user_id"];
                 $tmp[$objective_id]["result_perc"] = $lo_result["result_perc"];
                 $tmp[$objective_id]["limit_perc"] = $lo_result["limit_perc"];
                 $tmp[$objective_id]["status"] = $lo_result["status"];
                 $tmp[$objective_id]["type"] = $lo_result["type"];
                 $tmp[$objective_id]["initial"] = $lo_result["initial"];
             }
         }
         // order
         foreach ($coll_objtv as $objtv_id) {
             $res[] = $tmp[$objtv_id];
         }
     }
     return $res;
 }
 private function getObjectiveTitle(ilLOTestRun $loRun)
 {
     require_once 'Modules/Course/classes/class.ilCourseObjective.php';
     return ilCourseObjective::lookupObjectiveTitle($loRun->getObjectiveId());
 }