/** * parse * * @access public * @param array array of assignable nodes (tree node data) * @return */ public function parse($a_assignable) { global $objDefinition; // begin-patch lok $a_assignable = $this->getTestNode(); // end-patch lok $tests = array(); foreach ($a_assignable as $node) { $tmp_data = array(); $subobjects = array(); if (!($tmp_tst = ilObjectFactory::getInstanceByRefId((int) $node['ref_id'], false))) { continue; } include_once './Modules/Test/classes/class.ilObjTest.php'; $tmp_data['random'] = ilObjTest::_lookupRandomTest($node['obj_id']); $tmp_data['random'] = false; foreach ($qst = $this->sortQuestions($tmp_tst->getAllQuestions()) as $question_data) { $tmp_question = ilObjTest::_instanciateQuestion($question_data['question_id']); #$sub['qst_txt'] = $tmp_question->_getQuestionText($question_data['question_id']); $sub['qst_txt'] = ''; $sub['qst_points'] = $tmp_question->_getMaximumPoints($question_data['question_id']); $sub['title'] = $tmp_question->getTitle(); $sub['description'] = $tmp_question->getComment(); $sub['id'] = $question_data['question_id']; $subobjects[] = $sub; } $tmp_data['title'] = $node['title']; $tmp_data['description'] = $node['description']; $tmp_data['type'] = $node['type']; $tmp_data['id'] = $node['child']; $tmp_data['obj_id'] = $node['obj_id']; $tmp_data['sub'] = $subobjects; $tests[] = $tmp_data; } $this->setData($tests); }
/** * Check if test is a random test * @param type $a_test_obj_id * @return bool */ public static function lookupRandomTest($a_test_obj_id) { include_once './Modules/Test/classes/class.ilObjTest.php'; return ilObjTest::_lookupRandomTest($a_test_obj_id); }
/** * Check if test is of type random test * @param type $a_type * @return type * @todo refactor */ public function isRandomTestType($a_type) { $tst = $this->getTestByType($a_type); include_once './Modules/Test/classes/class.ilObjTest.php'; return ilObjTest::_lookupRandomTest(ilObject::_lookupObjId($tst)); }
protected function isRandomTestType($a_tst_type = 0) { if (!$a_tst_type) { $a_tst_type = $this->test_type; } $tst_ref_id = $this->getSettings()->getTestByType($a_tst_type); if (!$tst_ref_id) { return false; } include_once './Modules/Test/classes/class.ilObjTest.php'; return ilObjTest::_lookupRandomTest(ilObject::_lookupObjId($tst_ref_id)); }