Public Member Functions | |
| ilCourseObjectiveQuestion ($a_objective_id) | |
| setTestStatus ($a_status) | |
| getTestStatus () | |
| setTestSuggestedLimit ($a_limit) | |
| getTestSuggestedLimit () | |
| __addTest () | |
| __deleteTest ($a_test_ref_id) | |
| updateTest ($a_test_objective_id) | |
| getTests () | |
| _getTest ($a_test_objective_id) | |
| getQuestions () | |
| getQuestion ($question_id) | |
| getObjectiveId () | |
| setTestRefId ($a_ref_id) | |
| getTestRefId () | |
| setTestObjId ($a_obj_id) | |
| getTestObjId () | |
| setQuestionId ($a_question_id) | |
| getQuestionId () | |
| getMaxPointsByObjective () | |
| getMaxPointsByTest ($a_test_ref_id) | |
| getNumberOfQuestionsByTest ($a_test_ref_id) | |
| getQuestionsByTest ($a_test_ref_id) | |
| add () | |
| delete ($qst_id) | |
| deleteAll () | |
| __read () | |
| _isAssigned ($a_objective_id, $a_tst_ref_id, $a_question_id) | |
Data Fields | |
| $db = null | |
| $objective_id = null | |
| $questions | |
Definition at line 35 of file class.ilCourseObjectiveQuestion.php.
| ilCourseObjectiveQuestion::__addTest | ( | ) |
Definition at line 70 of file class.ilCourseObjectiveQuestion.php.
Referenced by add().
{
// CHECK if entry already exists
$query = "SELECT * FROM crs_objective_tst ".
"WHERE objective_id = '".$this->getObjectiveId()."' ".
"AND ref_id = '".$this->getTestRefId()."'";
$res = $this->db->query($query);
if($res->numRows())
{
return false;
}
$query = "INSERT INTO crs_objective_tst ".
"SET objective_id = '".$this->getObjectiveId()."', ".
"ref_id = '".$this->getTestRefId()."', ".
"obj_id = '".$this->getTestObjId()."', ".
"tst_status = '".$this->getTestStatus()."', ".
"tst_limit = '100'";
$this->db->query($query);
return true;
}
Here is the caller graph for this function:| ilCourseObjectiveQuestion::__deleteTest | ( | $ | a_test_ref_id | ) |
Definition at line 94 of file class.ilCourseObjectiveQuestion.php.
References $query.
Referenced by __read(), and delete().
{
// Delete questions
$query = "DELETE FROM crs_objective_qst ".
"WHERE objective_id = '".$this->getObjectiveId()."' ".
"AND ref_id = '".$a_test_ref_id."'";
$this->db->query($query);
// delete tst entries
$query = "DELETE FROM crs_objective_tst ".
"WHERE objective_id = '".$this->getObjectiveId()."' ".
"AND ref_id = '".$a_test_ref_id."'";
$this->db->query($query);
return true;
}
Here is the caller graph for this function:| ilCourseObjectiveQuestion::__read | ( | ) |
Definition at line 344 of file class.ilCourseObjectiveQuestion.php.
References $query, $res, $row, $tree, __deleteTest(), and ilObjTest::_instanciateQuestion().
Referenced by ilCourseObjectiveQuestion().
{
include_once './assessment/classes/class.ilObjTest.php';
global $tree;
$this->questions = array();
$query = "SELECT * FROM crs_objective_qst ".
"WHERE objective_id = '".$this->getObjectiveId()."'";
$res = $this->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
if(!$tree->isInTree($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();
$this->questions[$row->qst_ass_id] = $qst;
}
return true;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilCourseObjectiveQuestion::_getTest | ( | $ | a_test_objective_id | ) |
Definition at line 146 of file class.ilCourseObjectiveQuestion.php.
References $query, $res, and $row.
Referenced by ilCourseObjectivesGUI::updateQuestionAssignment().
{
global $ilDB;
$query = "SELECT * FROM crs_objective_tst ".
"WHERE test_objective_id = '".$a_test_objective_id."'";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$test['test_objective_id'] = $row->test_objective_id;
$test['objective_id'] = $row->objective_id;
$test['ref_id'] = $row->ref_id;
$test['obj_id'] = $row->obj_id;
$test['tst_status'] = $row->tst_status;
$test['tst_limit'] = $row->tst_limit;
}
return $test ? $test : array();
}
Here is the caller graph for this function:| ilCourseObjectiveQuestion::_isAssigned | ( | $ | a_objective_id, | |
| $ | a_tst_ref_id, | |||
| $ | a_question_id | |||
| ) |
Definition at line 379 of file class.ilCourseObjectiveQuestion.php.
References $objective_id, $query, $res, and $row.
Referenced by ilCourseObjectivesGUI::assignQuestion(), and ilCourseObjectivesGUI::assignQuestionSelect().
{
global $ilDB;
$query = "SELECT crs_qst.objective_id as objective_id FROM crs_objective_qst as crs_qst, crs_objectives as crs_obj ".
"WHERE crs_qst.objective_id = crs_obj.objective_id ".
"AND crs_qst.objective_id = '".$a_objective_id ."' ".
"AND ref_id = '".$a_tst_ref_id."' ".
"AND question_id = '".$a_question_id."'";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$objective_id = $row->objective_id;
}
return $objective_id ? $objective_id : 0;
}
Here is the caller graph for this function:| ilCourseObjectiveQuestion::add | ( | ) |
Definition at line 277 of file class.ilCourseObjectiveQuestion.php.
References $query, and __addTest().
{
$query = "INSERT INTO crs_objective_qst ".
"SET objective_id = '".$this->getObjectiveId()."', ".
"ref_id = '".$this->getTestRefId()."', ".
"obj_id = '".$this->getTestObjId()."', ".
"question_id = '".$this->getQuestionId()."'";
$this->db->query($query);
$this->__addTest();
return true;
}
Here is the call graph for this function:| ilCourseObjectiveQuestion::delete | ( | $ | qst_id | ) |
Definition at line 291 of file class.ilCourseObjectiveQuestion.php.
References $query, $res, $row, and __deleteTest().
{
if(!$qst_id)
{
return false;
}
$query = "SELECT * FROM crs_objective_qst ".
"WHERE qst_ass_id = '".$qst_id."'";
$res = $this->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$test_rid = $row->ref_id;
$test_oid = $row->obj_id;
}
$query = "DELETE FROM crs_objective_qst ".
"WHERE qst_ass_id = '".$qst_id."'";
$this->db->query($query);
// delete test if it was the last question
$query = "SELECT * FROM crs_objective_qst ".
"WHERE ref_id = '".$test_rid."' ".
"AND obj_id = '".$test_oid."'";
$res = $this->db->query($query);
if(!$res->numRows())
{
$this->__deleteTest($test_rid);
}
return true;
}
Here is the call graph for this function:| ilCourseObjectiveQuestion::deleteAll | ( | ) |
Definition at line 327 of file class.ilCourseObjectiveQuestion.php.
References $query.
| ilCourseObjectiveQuestion::getMaxPointsByObjective | ( | ) |
Definition at line 209 of file class.ilCourseObjectiveQuestion.php.
References ilObjTest::_instanciateQuestion(), ilObjectFactory::getInstanceByRefId(), and getQuestions().
{
include_once './assessment/classes/class.ilObjTest.php';
$points = 0;
foreach($this->getQuestions() as $question)
{
$tmp_test =& ilObjectFactory::getInstanceByRefId($question['ref_id']);
$tmp_question =& ilObjTest::_instanciateQuestion($question['question_id']);
$points += $tmp_question->getMaximumPoints();
unset($tmp_question);
unset($tmp_test);
}
return $points;
}
Here is the call graph for this function:| ilCourseObjectiveQuestion::getMaxPointsByTest | ( | $ | a_test_ref_id | ) |
Definition at line 228 of file class.ilCourseObjectiveQuestion.php.
References ilObjTest::_instanciateQuestion(), ilObjectFactory::getInstanceByRefId(), and getQuestions().
{
$points = 0;
$tmp_test =& ilObjectFactory::getInstanceByRefId($a_test_ref_id);
foreach($this->getQuestions() as $question)
{
if($question['ref_id'] == $a_test_ref_id)
{
$tmp_question =& ilObjTest::_instanciateQuestion($question['question_id']);
$points += $tmp_question->getMaximumPoints();
unset($tmp_question);
}
}
unset($tmp_test);
return $points;
}
Here is the call graph for this function:| ilCourseObjectiveQuestion::getNumberOfQuestionsByTest | ( | $ | a_test_ref_id | ) |
Definition at line 250 of file class.ilCourseObjectiveQuestion.php.
References $counter, and getQuestions().
{
$counter = 0;
foreach($this->getQuestions() as $question)
{
if($question['ref_id'] == $a_test_ref_id)
{
++$counter;
}
}
return $counter;
}
Here is the call graph for this function:| ilCourseObjectiveQuestion::getObjectiveId | ( | ) |
Definition at line 178 of file class.ilCourseObjectiveQuestion.php.
{
return $this->objective_id;
}
| ilCourseObjectiveQuestion::getQuestion | ( | $ | question_id | ) |
Definition at line 173 of file class.ilCourseObjectiveQuestion.php.
{
return $this->questions[$question_id] ? $this->questions[$question_id] : array();
}
| ilCourseObjectiveQuestion::getQuestionId | ( | ) |
Definition at line 203 of file class.ilCourseObjectiveQuestion.php.
{
return $this->question_id;
}
| ilCourseObjectiveQuestion::getQuestions | ( | ) |
Definition at line 168 of file class.ilCourseObjectiveQuestion.php.
Referenced by getMaxPointsByObjective(), getMaxPointsByTest(), getNumberOfQuestionsByTest(), and getQuestionsByTest().
{
return $this->questions ? $this->questions : array();
}
Here is the caller graph for this function:| ilCourseObjectiveQuestion::getQuestionsByTest | ( | $ | a_test_ref_id | ) |
Definition at line 264 of file class.ilCourseObjectiveQuestion.php.
References getQuestions().
{
foreach($this->getQuestions() as $question)
{
if($question['ref_id'] == $a_test_ref_id)
{
$qst[] = $question['question_id'];
}
}
return $qst ? $qst : array();
}
Here is the call graph for this function:| ilCourseObjectiveQuestion::getTestObjId | ( | ) |
Definition at line 195 of file class.ilCourseObjectiveQuestion.php.
{
return $this->tst_obj_id ? $this->tst_obj_id : 0;
}
| ilCourseObjectiveQuestion::getTestRefId | ( | ) |
Definition at line 187 of file class.ilCourseObjectiveQuestion.php.
{
return $this->tst_ref_id ? $this->tst_ref_id : 0;
}
| ilCourseObjectiveQuestion::getTests | ( | ) |
Definition at line 125 of file class.ilCourseObjectiveQuestion.php.
References $query, $res, and $row.
{
$query = "SELECT * FROM crs_objective_tst ".
"WHERE objective_id = '".$this->getObjectiveId()."'";
$res = $this->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$test['test_objective_id'] = $row->test_objective_id;
$test['objective_id'] = $row->objective_id;
$test['ref_id'] = $row->ref_id;
$test['obj_id'] = $row->obj_id;
$test['tst_status'] = $row->tst_status;
$test['tst_limit'] = $row->tst_limit;
$tests[] = $test;
}
return $tests ? $tests : array();
}
| ilCourseObjectiveQuestion::getTestStatus | ( | ) |
Definition at line 58 of file class.ilCourseObjectiveQuestion.php.
{
return (int) $this->tst_status;
}
| ilCourseObjectiveQuestion::getTestSuggestedLimit | ( | ) |
Definition at line 66 of file class.ilCourseObjectiveQuestion.php.
{
return (int) $this->tst_limit;
}
| ilCourseObjectiveQuestion::ilCourseObjectiveQuestion | ( | $ | a_objective_id | ) |
Definition at line 42 of file class.ilCourseObjectiveQuestion.php.
References __read().
{
global $ilDB;
$this->db =& $ilDB;
$this->objective_id = $a_objective_id;
$this->__read();
}
Here is the call graph for this function:| ilCourseObjectiveQuestion::setQuestionId | ( | $ | a_question_id | ) |
Definition at line 199 of file class.ilCourseObjectiveQuestion.php.
{
$this->question_id = $a_question_id;
}
| ilCourseObjectiveQuestion::setTestObjId | ( | $ | a_obj_id | ) |
Definition at line 191 of file class.ilCourseObjectiveQuestion.php.
{
$this->tst_obj_id = $a_obj_id;
}
| ilCourseObjectiveQuestion::setTestRefId | ( | $ | a_ref_id | ) |
Definition at line 183 of file class.ilCourseObjectiveQuestion.php.
{
$this->tst_ref_id = $a_ref_id;
}
| ilCourseObjectiveQuestion::setTestStatus | ( | $ | a_status | ) |
Definition at line 54 of file class.ilCourseObjectiveQuestion.php.
{
$this->tst_status = $a_status;
}
| ilCourseObjectiveQuestion::setTestSuggestedLimit | ( | $ | a_limit | ) |
Definition at line 62 of file class.ilCourseObjectiveQuestion.php.
{
$this->tst_limit = $a_limit;
}
| ilCourseObjectiveQuestion::updateTest | ( | $ | a_test_objective_id | ) |
Definition at line 113 of file class.ilCourseObjectiveQuestion.php.
References $query.
| ilCourseObjectiveQuestion::$db = null |
Definition at line 37 of file class.ilCourseObjectiveQuestion.php.
| ilCourseObjectiveQuestion::$objective_id = null |
Definition at line 39 of file class.ilCourseObjectiveQuestion.php.
Referenced by _isAssigned().
| ilCourseObjectiveQuestion::$questions |
Definition at line 40 of file class.ilCourseObjectiveQuestion.php.
1.7.1