Ejemplo n.º 1
0
 /**
  * 
  * @param type $a_container_id
  * @param type $a_objective_id
  * @param type $a_test_type
  */
 public static function lookupObjectiveRequiredPercentage($a_container_id, $a_objective_id, $a_test_ref_id, $a_max_points)
 {
     include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
     $settings = ilLOSettings::getInstanceByObjId($a_container_id);
     include_once './Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
     $assignments = ilLOTestAssignments::getInstance($a_container_id);
     $a_test_type = $assignments->getTypeByTest($a_test_ref_id);
     if ($assignments->isSeparateTest($a_test_ref_id)) {
         include_once './Services/Object/classes/class.ilObjectFactory.php';
         $factory = new ilObjectFactory();
         $tst = $factory->getInstanceByRefId($a_test_ref_id, FALSE);
         if ($tst instanceof ilObjTest) {
             $schema = $tst->getMarkSchema();
             foreach ($schema->getMarkSteps() as $mark) {
                 if ($mark->getPassed()) {
                     return (int) $mark->getMinimumLevel();
                 }
             }
         }
     }
     $tst_ref_id = $a_test_ref_id;
     if (self::lookupRandomTest(ilObject::_lookupObjId($tst_ref_id))) {
         include_once './Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php';
         return (int) ilLORandomTestQuestionPools::lookupLimit($a_container_id, $a_objective_id, $a_test_type);
     } else {
         include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
         $limit = ilCourseObjectiveQuestion::loookupTestLimit(ilObject::_lookupObjId($tst_ref_id), $a_objective_id);
         return $limit;
     }
 }
Ejemplo n.º 2
0
 /**
  * 
  * @param type $a_container_id
  * @param type $a_objective_id
  * @param type $a_test_type
  */
 public static function lookupObjectiveRequiredPercentage($a_container_id, $a_objective_id, $a_test_type, $a_max_points)
 {
     include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
     $settings = ilLOSettings::getInstanceByObjId($a_container_id);
     if ($a_test_type == ilLOSettings::TYPE_TEST_QUALIFIED) {
         $tst_ref_id = $settings->getQualifiedTest();
     } else {
         $tst_ref_id = $settings->getInitialTest();
     }
     if (self::lookupRandomTest(ilObject::_lookupObjId($tst_ref_id))) {
         include_once './Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php';
         return (int) ilLORandomTestQuestionPools::lookupLimit($a_container_id, $a_objective_id, $a_test_type);
     } else {
         include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
         $limit = ilCourseObjectiveQuestion::loookupTestLimit(ilObject::_lookupObjId($tst_ref_id), $a_objective_id);
         return $limit;
     }
 }
 /**
  * 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());
 }
 /**
  * get suggested questions ids
  * @param object $a_usr_id
  * @param object $a_crs_id
  * @return 
  */
 public static function getSuggestedQuestions($a_usr_id, $a_crs_id)
 {
     foreach (self::_getSuggested($a_usr_id, $a_crs_id) as $objective_id) {
         include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
         $obj = new ilCourseObjectiveQuestion($objective_id);
         foreach ($obj->getFinalTestQuestions() as $qst) {
             $qsts[] = $qst['question_id'];
         }
     }
     return $qsts ? $qsts : array();
 }
Ejemplo n.º 5
0
 /**
  * Check if questions are assigned
  * @param type $a_test_ref_id
  */
 protected function lookupQuestionsAssigned($a_test_ref_id)
 {
     include_once './Modules/Course/classes/Objectives/class.ilLOUtils.php';
     if (ilLOUtils::lookupRandomTest(ilObject::_lookupObjId($a_test_ref_id))) {
         foreach ($this->getObjectives() as $objective_id) {
             include_once './Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php';
             $seq = ilLORandomTestQuestionPools::lookupSequence($this->parent_obj->getId(), $objective_id, ilObject::_lookupObjId($a_test_ref_id));
             if (!$seq) {
                 return false;
             }
         }
     } else {
         foreach ($this->getObjectives() as $objective_id) {
             include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
             $qsts = ilCourseObjectiveQuestion::lookupQuestionsByObjective(ilObject::_lookupObjId($a_test_ref_id), $objective_id);
             if (!count($qsts)) {
                 return false;
             }
         }
     }
     return true;
 }
 function __showTests()
 {
     global $ilias, $rbacsystem, $ilObjDataCache, $ilUser;
     include_once './Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
     if (!count($tests = $this->__getAllTests())) {
         return false;
     }
     $this->tpl->addBlockfile('TEST_BLOCK', 'test_block', 'tpl.crs_objectives_view_tst_table.html', 'Modules/Course');
     $this->tpl->setVariable("TBL_TITLE_TST", $this->lng->txt('tests'));
     $this->__showHideLinks('tst');
     if (isset($_SESSION['crs_hide_tst'])) {
         return true;
     }
     $this->tpl->setVariable("TBL_HEADER_WIDTH_TST_1", "75%");
     $this->tpl->setVariable("TBL_HEADER_NAME_TST_1", $this->lng->txt('description'));
     $this->tpl->setVariable("TBL_HEADER_WIDTH_TST", "5%");
     $this->tpl->setVariable("TBL_HEADER_NAME_TST", $this->lng->txt('crs_nr'));
     $this->tpl->setVariable("TBL_HEADER_WIDTH_TST_2", "20%");
     $this->tpl->setVariable("TBL_HEADER_NAME_TST_2", '');
     $counter = 1;
     foreach ($tests as $tst_id) {
         $obj_id = $ilObjDataCache->lookupObjId($tst_id);
         $obj_type = $ilObjDataCache->lookupType($obj_id);
         $conditions_ok = ilConditionHandler::_checkAllConditionsOfTarget($tst_id, $obj_id);
         $obj_link = ilRepositoryExplorer::buildLinkTarget($tst_id, $obj_type);
         $obj_link = "ilias.php?baseClass=ilObjTestGUI&ref_id=" . $tst_id . "&cmd=infoScreen";
         $obj_frame = '';
         if (ilRepositoryExplorer::isClickable($obj_type, $tst_id, $obj_id)) {
             $this->tpl->setCurrentBlock("tst_read");
             $this->tpl->setVariable("READ_TITLE_TST", $ilObjDataCache->lookupTitle($obj_id));
             $this->tpl->setVariable("READ_TARGET_TST", $obj_frame);
             $this->tpl->setVariable("READ_LINK_TST", $obj_link . '&crs_show_result=' . $this->course_obj->getRefId());
             $this->tpl->parseCurrentBlock();
         } else {
             $this->tpl->setCurrentBlock("tst_visible");
             $this->tpl->setVariable("VISIBLE_LINK_TST", $ilObjDataCache->lookupTitle($obj_id));
             $this->tpl->parseCurrentBlock();
         }
         // add to desktop link
         if (!$ilUser->isDesktopItem($tst_id, $obj_type) and $this->course_obj->getAboStatus() == $this->course_obj->ABO_ENABLED) {
             if ($rbacsystem->checkAccess('read', $tst_id)) {
                 $this->tpl->setCurrentBlock("tst_desklink");
                 $this->ctrl->setParameterByClass(get_class($this->container_gui), 'item_ref_id', $tst_id);
                 $this->ctrl->setParameterByClass(get_class($this->container_gui), 'item_id', $tst_id);
                 $this->ctrl->setParameterByClass(get_class($this->container_gui), 'type', $obj_type);
                 $this->tpl->setVariable("DESK_LINK_TST", $this->ctrl->getLinkTarget($this->container_gui, 'addToDesk'));
                 $this->tpl->setVariable("TXT_DESK_TST", $this->lng->txt("to_desktop"));
                 $this->tpl->parseCurrentBlock();
             }
         }
         $this->tpl->setCurrentBlock("tst_row");
         $this->tpl->setVariable("OBJ_TITLE_TST", $ilObjDataCache->lookupTitle($obj_id));
         $this->tpl->setVariable("OBJ_NR_TST", $counter . '.');
         // Check if test is assigned to objective
         include_once 'Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
         if ($this->details_id and ilCourseObjectiveQuestion::_isTestAssignedToObjective($tst_id, $this->details_id)) {
             $this->tpl->setVariable("OBJ_CLASS_CENTER_TST", 'option_value_center_details');
             $this->tpl->setVariable("OBJ_CLASS_TST", 'option_value_details');
         } else {
             $this->tpl->setVariable("OBJ_CLASS_CENTER_TST", 'option_value_center');
             $this->tpl->setVariable("OBJ_CLASS_TST", 'option_value');
         }
         $this->tpl->parseCurrentBlock();
         ++$counter;
     }
 }
Ejemplo n.º 7
0
 /**
  * clone objectives
  *
  * @access public
  * @param int target id
  * @param int copy id
  * 
  */
 public function ilClone($a_target_id, $a_copy_id)
 {
     global $ilLog;
     $ilLog->write(__METHOD__ . ': Start cloning learning objectives...');
     $query = "SELECT * FROM crs_objectives " . "WHERE crs_id  = " . $this->db->quote($this->course_obj->getId(), 'integer') . ' ' . "ORDER BY position ";
     $res = $this->db->query($query);
     if (!$res->numRows()) {
         $ilLog->write(__METHOD__ . ': ... no objectives found.');
         return true;
     }
     if (!is_object($new_course = ilObjectFactory::getInstanceByRefId($a_target_id, false))) {
         $ilLog->write(__METHOD__ . ': Cannot init new course object.');
         return true;
     }
     while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
         $new_objective = new ilCourseObjective($new_course);
         $new_objective->setTitle($row->title);
         $new_objective->setDescription($row->description);
         $new_objective->setActive($row->active);
         $objective_id = $new_objective->add();
         $ilLog->write(__METHOD__ . ': Added new objective nr: ' . $objective_id);
         // Clone crs_objective_tst entries
         include_once 'Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
         $objective_qst = new ilCourseObjectiveQuestion($row->objective_id);
         $objective_qst->cloneDependencies($objective_id, $a_copy_id);
         // Clone test assignments
         include_once './Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
         include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
         $assignments = ilLOTestAssignments::getInstance($this->course_obj->getId());
         $assignment_it = $assignments->getAssignmentByObjective($row->objective_id, ilLOSettings::TYPE_TEST_INITIAL);
         if ($assignment_it) {
             $assignment_it->cloneSettings($a_copy_id, $new_course->getId(), $objective_id);
         }
         $assignment_qt = $assignments->getAssignmentByObjective($row->objective_id, ilLOSettings::TYPE_TEST_QUALIFIED);
         if ($assignment_qt) {
             $assignment_qt->cloneSettings($a_copy_id, $new_course->getId(), $objective_id);
         }
         $ilLog->write(__METHOD__ . ': Finished objective question dependencies: ' . $objective_id);
         // Clone crs_objective_lm entries (assigned course materials)
         include_once 'Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
         $objective_material = new ilCourseObjectiveMaterials($row->objective_id);
         $objective_material->cloneDependencies($objective_id, $a_copy_id);
     }
     $ilLog->write(__METHOD__ . ': Finished cloning objectives.');
 }
 /**
  * clone objective questions
  *
  * @access public
  *
  * @param int source objective
  * @param int target objective
  * @param int copy id
  */
 public function cloneDependencies($a_new_objective, $a_copy_id)
 {
     global $ilObjDataCache, $ilLog, $ilDB;
     include_once 'Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
     $cwo = ilCopyWizardOptions::_getInstance($a_copy_id);
     $mappings = $cwo->getMappings();
     foreach ($this->getQuestions() as $question) {
         if (!isset($mappings["{$question['ref_id']}"]) or !$mappings["{$question['ref_id']}"]) {
             continue;
         }
         $question_ref_id = $question['ref_id'];
         $question_obj_id = $question['obj_id'];
         $question_qst_id = $question['question_id'];
         $new_ref_id = $mappings[$question_ref_id];
         $new_obj_id = $ilObjDataCache->lookupObjId($new_ref_id);
         if ($new_obj_id == $question_obj_id) {
             $ilLog->write(__METHOD__ . ': Test has been linked. Keeping question id.');
             // Object has been linked
             $new_question_id = $question_qst_id;
         } else {
             $new_question_info = $mappings[$question_ref_id . '_' . $question_qst_id];
             $new_question_arr = explode('_', $new_question_info);
             if (!isset($new_question_arr[1]) or !$new_question_arr[1]) {
                 continue;
             }
             $new_question_id = $new_question_arr[1];
             $ilLog->write(__METHOD__ . ': New question id is: ' . $new_question_id);
         }
         $new_question = new ilCourseObjectiveQuestion($a_new_objective);
         $new_question->setTestRefId($new_ref_id);
         $new_question->setTestObjId($new_obj_id);
         $new_question->setQuestionId($new_question_id);
         $new_question->add();
     }
     // Copy tests
     foreach ($this->getTests() as $test) {
         $new_test_id = $mappings["{$test['ref_id']}"];
         $query = "UPDATE crs_objective_tst " . "SET tst_status = " . $this->db->quote($test['tst_status'], 'integer') . ", " . "tst_limit_p = " . $this->db->quote($test['tst_limit'], 'integer') . " " . "WHERE objective_id = " . $this->db->quote($a_new_objective, 'integer') . " " . "AND ref_id = " . $this->db->quote($new_test_id, 'integer');
         $res = $ilDB->manipulate($query);
     }
 }
 /**
  * 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());
 }
Ejemplo n.º 10
0
 /**
  * Delete test assignment
  */
 protected function deleteTest()
 {
     $this->setTestType((int) $_REQUEST['tt']);
     $this->ctrl->setParameter($this, 'tt', $this->getTestType());
     $settings = ilLOSettings::getInstanceByObjId($this->getParentObject()->getId());
     switch ($this->getTestType()) {
         case ilLOSettings::TYPE_TEST_INITIAL:
             $GLOBALS['ilTabs']->activateSubTab('itest');
             break;
         case ilLOSettings::TYPE_TEST_QUALIFIED:
             $GLOBALS['ilTabs']->activateSubTab('qtest');
             break;
     }
     foreach ((array) $_REQUEST['tst'] as $tst_id) {
         switch ($this->getTestType()) {
             case ilLOSettings::TYPE_TEST_INITIAL:
                 $settings->setInitialTest(0);
                 break;
             case ilLOSettings::TYPE_TEST_QUALIFIED:
                 $settings->setQualifiedTest(0);
                 break;
         }
         $settings->update();
         // finally delete start object assignment
         include_once './Services/Container/classes/class.ilContainerStartObjects.php';
         $start = new ilContainerStartObjects($this->getParentObject()->getRefId(), $this->getParentObject()->getId());
         $start->deleteItem($tst_id);
         // ... and assigned questions
         include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
         ilCourseObjectiveQuestion::deleteTest($tst_id);
     }
     ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
     $this->ctrl->redirect($this, 'testOverview');
 }
 /**
  * final test assignment
  *
  * @access protected
  * @param
  * @return
  */
 protected function finalTestAssignment()
 {
     global $ilAccess, $ilErr, $tpl;
     if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
         $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
     }
     if (!$_GET['objective_id']) {
         ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
         $this->ctrl->redirect($this, 'listObjectives');
     }
     $this->ctrl->saveParameter($this, 'objective_id');
     $this->objective = new ilCourseObjective($this->course_obj, (int) $_GET['objective_id']);
     include_once './Modules/Course/classes/class.ilCourseObjectiveQuestionAssignmentTableGUI.php';
     $table = new ilCourseObjectiveQuestionAssignmentTableGUI($this, $this->course_obj, (int) $_GET['objective_id'], ilCourseObjectiveQuestion::TYPE_FINAL_TEST);
     $table->setTitle($this->lng->txt('crs_objective_wiz_final'), 'icon_lobj.png', $this->lng->txt('crs_objective'));
     $table->parse(ilCourseObjectiveQuestion::_getAssignableTests($this->course_obj->getRefId()));
     $this->__initQuestionObject((int) $_GET['objective_id']);
     $w_tpl = $this->initWizard(5);
     $w_tpl->setVariable('WIZ_CONTENT', $table->getHTML());
     $tpl->setContent($w_tpl->get());
 }
 /**
  * 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());
 }
 protected function updateRandomQuestions(ilTestSession $session, ilTestSequenceRandomQuestionSet $seq)
 {
     include_once './Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php';
     include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
     foreach ($this->run as $tst_run) {
         // Clear questions of previous run
         $tst_run->clearQuestions();
         $rnd = new ilLORandomTestQuestionPools($this->container_id, $tst_run->getObjectiveId(), $this->getSettings()->getQualifiedTest() == $session->getRefId() ? ilLOSettings::TYPE_TEST_QUALIFIED : ilLOSettings::TYPE_TEST_INITIAL);
         $stored_sequence_id = $rnd->getQplSequence();
         $points = 0;
         foreach ($seq->getQuestionIds() as $qst) {
             if ($stored_sequence_id == $seq->getResponsibleSourcePoolDefinitionId($qst)) {
                 $tst_run->addQuestion($qst);
                 $points += ilCourseObjectiveQuestion::_lookupMaximumPointsOfQuestion($qst);
             }
         }
         $tst_run->setMaxPoints($points);
     }
 }
 /**
  * final test assignment
  *
  * @access protected
  * @param
  * @return
  */
 protected function finalTestAssignment()
 {
     global $ilAccess, $ilErr, $tpl;
     if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
         $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
     }
     if (!$_GET['objective_id']) {
         ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
         $this->ctrl->redirect($this, 'listObjectives');
     }
     $this->setSubTabs("final_test_assign");
     $this->ctrl->saveParameter($this, 'objective_id');
     $this->objective = new ilCourseObjective($this->course_obj, (int) $_GET['objective_id']);
     // begin-patch lok
     $this->ctrl->setParameter($this, 'tt', ilLOSettings::TYPE_TEST_QUALIFIED);
     $this->test_type = $_REQUEST['tt'] = ilLOSettings::TYPE_TEST_QUALIFIED;
     if ($this->isRandomTestType(ilLOSettings::TYPE_TEST_QUALIFIED)) {
         return $this->showRandomTestAssignment();
     }
     // end-patch lok
     include_once './Modules/Course/classes/class.ilCourseObjectiveQuestionAssignmentTableGUI.php';
     $table = new ilCourseObjectiveQuestionAssignmentTableGUI($this, $this->course_obj, (int) $_GET['objective_id'], ilCourseObjectiveQuestion::TYPE_FINAL_TEST);
     $table->setTitle($this->lng->txt('crs_objective_wiz_final'), '', $this->lng->txt('crs_objective'));
     $table->parse(ilCourseObjectiveQuestion::_getAssignableTests($this->course_obj->getRefId()));
     $this->__initQuestionObject((int) $_GET['objective_id']);
     $this->initWizard(5);
     $GLOBALS['tpl']->setContent($table->getHTML());
     #$w_tpl->setVariable('WIZ_CONTENT',$table->getHTML());
     #$tpl->setContent($w_tpl->get());
 }