function __read()
 {
     global $ilDB, $tree;
     include_once './Modules/Test/classes/class.ilObjTest.php';
     include_once 'Modules/Course/classes/class.ilCourseObjective.php';
     $container_ref_ids = ilObject::_getAllReferences(ilCourseObjective::_lookupContainerIdByObjectiveId($this->objective_id));
     $container_ref_id = current($container_ref_ids);
     // Read test data
     $query = "SELECT * FROM crs_objective_tst " . "WHERE objective_id = " . $ilDB->quote($this->getObjectiveId(), 'integer') . " ";
     $res = $this->db->query($query);
     while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
         $this->tests[$row->ref_id]['test_objective_id'] = $row->test_objective_id;
         $this->tests[$row->ref_id]['ref_id'] = $row->ref_id;
         $this->tests[$row->ref_id]['obj_id'] = $row->obj_id;
         $this->tests[$row->ref_id]['status'] = $row->tst_status;
         $this->tests[$row->ref_id]['limit'] = $row->tst_limit_p;
     }
     $this->questions = array();
     $query = "SELECT * FROM crs_objective_qst coq " . "JOIN qpl_questions qq ON coq.question_id = qq.question_id " . "WHERE objective_id = " . $ilDB->quote($this->getObjectiveId(), 'integer') . " " . "ORDER BY title";
     $res = $this->db->query($query);
     while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
         if (!$tree->isInTree($row->ref_id) or !$tree->isGrandChild($container_ref_id, $row->ref_id)) {
             $this->__deleteTest($row->ref_id);
             continue;
         }
         if (!($question = ilObjTest::_instanciateQuestion($row->question_id))) {
             $this->delete($row->question_id);
             continue;
         }
         $qst['ref_id'] = $row->ref_id;
         $qst['obj_id'] = $row->obj_id;
         $qst['question_id'] = $row->question_id;
         $qst['qst_ass_id'] = $row->qst_ass_id;
         $qst['title'] = $question->getTitle();
         $qst['description'] = $question->getComment();
         $qst['test_type'] = $this->tests[$row->ref_id]['status'];
         $qst['points'] = $question->getPoints();
         $this->questions[$row->qst_ass_id] = $qst;
     }
     return true;
 }
 function __read()
 {
     global $tree, $ilDB;
     include_once 'Modules/Course/classes/class.ilCourseObjective.php';
     $container_ref_ids = ilObject::_getAllReferences(ilCourseObjective::_lookupContainerIdByObjectiveId($this->objective_id));
     $container_ref_id = current($container_ref_ids);
     // begin-patch lok
     $this->lms = array();
     $query = "SELECT position,lm_ass_id,lm.ref_id,lm.obj_id,lm.type FROM crs_objective_lm lm " . "JOIN object_reference obr ON lm.ref_id = obr.ref_id " . "JOIN object_data obd ON obr.obj_id = obd.obj_id " . "LEFT JOIN lm_data lmd ON lmd.obj_id = lm.obj_id " . "WHERE objective_id = " . $ilDB->quote($this->getObjectiveId(), 'integer') . " " . "ORDER BY position,obd.title,lmd.title";
     $res = $this->db->query($query);
     while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
         if (!$tree->isInTree($row->ref_id) or !$tree->isGrandChild($container_ref_id, $row->ref_id)) {
             $this->delete($row->lm_ass_id);
             continue;
         }
         $lm['ref_id'] = $row->ref_id;
         $lm['obj_id'] = $row->obj_id;
         $lm['type'] = $row->type;
         $lm['lm_ass_id'] = $row->lm_ass_id;
         $lm['position'] = $row->position;
         $this->lms[$row->lm_ass_id] = $lm;
     }
     // end-patch lok
     return true;
 }
Exemplo n.º 3
0
 private function checkAccessLearningObjectivePage($obj_id, $page_id)
 {
     include_once "Modules/Course/classes/class.ilCourseObjective.php";
     $crs_obj_id = ilCourseObjective::_lookupContainerIdByObjectiveId($page_id);
     return $this->checkAccessObject($crs_obj_id, 'crs');
 }