/**
  * 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)
 {
     $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());
 }
 /**
  * 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());
 }