/** * Check access rights for a test question * This checks also tests with random selection of questions * * @param int object id (question pool or test) * @param int usage id (not yet used) * @return boolean access given (true/false) */ private function checkAccessTestQuestion($obj_id, $usage_id = 0) { global $ilAccess; // give access if direct usage is readable if ($this->checkAccessObject($obj_id)) { return true; } $obj_type = ilObject::_lookupType($obj_id); if ($obj_type == 'qpl') { // give access if question pool is used by readable test // for random selection of questions include_once './Modules/Test/classes/class.ilObjTestAccess.php'; $tests = ilObjTestAccess::_getRandomTestsForQuestionPool($obj_id); foreach ($tests as $test_id) { if ($this->checkAccessObject($test_id, 'tst')) { return true; } } } return false; }