ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCourseObjectiveQuestion Class Reference

class ilcourseobjectiveQuestion More...

+ Inheritance diagram for ilCourseObjectiveQuestion:
+ Collaboration diagram for ilCourseObjectiveQuestion:

Public Member Functions

 ilCourseObjectiveQuestion ($a_objective_id)
 cloneDependencies ($a_new_objective, $a_copy_id)
 clone objective questions
 setTestStatus ($a_status)
 getTestStatus ()
 setTestSuggestedLimit ($a_limit)
 getTestSuggestedLimit ()
 __addTest ()
 __deleteTest ($a_test_ref_id)
 updateTest ($a_objective_id)
 getTests ()
 getSelfAssessmentTests ()
 get self assessment tests
 getFinalTests ()
 get final tests
 _getTest ($a_test_objective_id)
 getQuestions ()
 getSelfAssessmentQuestions ()
 get self assessment questions
 getSelfAssessmentPoints ()
 get self assessment points
 getFinalTestPoints ()
 get final test points
 isSelfAssessmentQuestion ($a_question_id)
 check if question is self assessment question
 isFinalTestQuestion ($a_question_id)
 is final test question
 getFinalTestQuestions ()
 get final test questions
 getQuestionsOfTest ($a_test_id)
 Get questions of test.
 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)
 updateLimits ()
 update limits
 add ()
 delete ($qst_id)
 deleteAll ()
 __read ()
 _hasTests ($a_course_id)
 public
 _isAssigned ($a_objective_id, $a_tst_ref_id, $a_question_id)

Static Public Member Functions

static _isTestAssignedToObjective ($a_test_id, $a_objective_id)
 Check if test is assigned to objective.
static _getAssignableTests ($a_container_ref_id)
 Get assignable tests.
static _updateTestLimits ($a_objective_id, $a_status, $a_limit)
 update test limits
static _lookupMaximumPointsOfQuestion ($a_question_id)
 lookup maximimum point

Data Fields

const TYPE_SELF_ASSESSMENT = 0
const TYPE_FINAL_TEST = 1
 $db = null
 $objective_id = null
 $questions

Protected Attributes

 $tests = array()

Detailed Description

class ilcourseobjectiveQuestion

Author
Stefan Meyer smeye.nosp@m.r@da.nosp@m.tabay.nosp@m..de
Version
Id:
class.ilCourseObjectiveQuestion.php 17224 2008-08-22 12:28:22Z smeyer

Definition at line 34 of file class.ilCourseObjectiveQuestion.php.

Member Function Documentation

ilCourseObjectiveQuestion::__addTest ( )

Definition at line 177 of file class.ilCourseObjectiveQuestion.php.

References $res, DB_FETCHMODE_OBJECT, getObjectiveId(), getTestObjId(), getTestRefId(), and getTestStatus().

Referenced by add().

{
global $ilDB;
$query = "UPDATE crs_objective_tst ".
"SET tst_status = ".$this->db->quote($this->getTestStatus())." ".
"WHERE objective_id = ".$this->db->quote($this->getObjectiveId())." ".
"AND ref_id = ".$this->db->quote($this->getTestRefId())." ";
$this->db->query($query);
// CHECK if entry already exists
$query = "SELECT * FROM crs_objective_tst ".
"WHERE objective_id = ".$ilDB->quote($this->getObjectiveId())." ".
"AND ref_id = ".$ilDB->quote($this->getTestRefId())."";
$res = $this->db->query($query);
if($res->numRows())
{
return false;
}
// Check for existing limit
$query = "SELECT tst_limit FROM crs_objective_tst ".
"WHERE objective_id = ".$this->db->quote($this->getObjectiveId())." ".
"AND tst_status = ".$this->db->quote($this->getTestStatus())." ";
$res = $this->db->query($query);
$limit = -1;
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$limit = $row->tst_limit;
}
$query = "INSERT INTO crs_objective_tst ".
"SET objective_id = ".$ilDB->quote($this->getObjectiveId()).", ".
"ref_id = ".$ilDB->quote($this->getTestRefId()).", ".
"obj_id = ".$ilDB->quote($this->getTestObjId()).", ".
"tst_status = ".$ilDB->quote($this->getTestStatus()).", ".
"tst_limit = ".$this->db->quote($limit)." ";
$this->db->query($query);
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseObjectiveQuestion::__deleteTest (   $a_test_ref_id)

Definition at line 224 of file class.ilCourseObjectiveQuestion.php.

References getObjectiveId().

Referenced by __read(), and delete().

{
global $ilDB;
// Delete questions
$query = "DELETE FROM crs_objective_qst ".
"WHERE objective_id = ".$ilDB->quote($this->getObjectiveId())." ".
"AND ref_id = ".$ilDB->quote($a_test_ref_id)." ";
$this->db->query($query);
// delete tst entries
$query = "DELETE FROM crs_objective_tst ".
"WHERE objective_id = ".$ilDB->quote($this->getObjectiveId())." ".
"AND ref_id = ".$ilDB->quote($a_test_ref_id)." ";
$this->db->query($query);
unset($this->tests[$a_test_ref_id]);
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseObjectiveQuestion::__read ( )

Definition at line 742 of file class.ilCourseObjectiveQuestion.php.

References $res, __deleteTest(), ilObject\_getAllReferences(), ilObjTest\_instanciateQuestion(), ilCourseObjective\_lookupContainerIdByObjectiveId(), DB_FETCHMODE_OBJECT, and getObjectiveId().

Referenced by add(), and ilCourseObjectiveQuestion().

{
global $ilDB,$tree;
include_once './Modules/Test/classes/class.ilObjTest.php';
include_once('Modules/Course/classes/class.ilCourseObjective.php');
$container_ref_id = current($container_ref_ids);
// Read test data
$query = "SELECT * FROM crs_objective_tst ".
"WHERE objective_id = ".$ilDB->quote($this->getObjectiveId())." ";
$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;
}
$this->questions = array();
$query = "SELECT * FROM crs_objective_qst as coq ".
"JOIN qpl_questions as qq ON coq.question_id = qq.question_id ".
"WHERE objective_id = ".$ilDB->quote($this->getObjectiveId())." ".
"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;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilCourseObjectiveQuestion::_getAssignableTests (   $a_container_ref_id)
static

Get assignable tests.

public

Parameters

Definition at line 153 of file class.ilCourseObjectiveQuestion.php.

Referenced by ilCourseObjectivesGUI\finalTestAssignment(), and ilCourseObjectivesGUI\selfAssessmentAssignment().

{
global $tree;
return $tree->getSubTree($tree->getNodeData($a_container_ref_id),true,'tst');
}

+ Here is the caller graph for this function:

ilCourseObjectiveQuestion::_getTest (   $a_test_objective_id)

Definition at line 347 of file class.ilCourseObjectiveQuestion.php.

References $res, $test, and DB_FETCHMODE_OBJECT.

{
global $ilDB;
$query = "SELECT * FROM crs_objective_tst ".
"WHERE test_objective_id = ".$ilDB->quote($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();
}
ilCourseObjectiveQuestion::_hasTests (   $a_course_id)

public

Parameters
@return

Definition at line 808 of file class.ilCourseObjectiveQuestion.php.

References $res.

Referenced by ilCourseObjectivesGUI\setSubTabs().

{
global $ilDB;
$query = "SELECT co.objective_id FROM crs_objectives AS co JOIN ".
"crs_objective_tst AS cot ON co.objective_id = cot.objective_id ".
"WHERE crs_id = ".$ilDB->quote($a_course_id)." ";
$res = $ilDB->query($query);
return $res->numRows() ? true : false;
}

+ Here is the caller graph for this function:

ilCourseObjectiveQuestion::_isAssigned (   $a_objective_id,
  $a_tst_ref_id,
  $a_question_id 
)

Definition at line 820 of file class.ilCourseObjectiveQuestion.php.

References $objective_id, $res, and DB_FETCHMODE_OBJECT.

{
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 = ".$ilDB->quote($a_objective_id) ." ".
"AND ref_id = ".$ilDB->quote($a_tst_ref_id)." ".
"AND question_id = ".$ilDB->quote($a_question_id)." ";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$objective_id = $row->objective_id;
}
}
static ilCourseObjectiveQuestion::_isTestAssignedToObjective (   $a_test_id,
  $a_objective_id 
)
static

Check if test is assigned to objective.

public

Parameters
inttest ref_id
intobjective_id
Returns
boolean success

Definition at line 67 of file class.ilCourseObjectiveQuestion.php.

References $res.

Referenced by ilCourseObjectivePresentationGUI\__showTests().

{
global $ilDB;
$query = "SELECT qst_ass_id FROM crs_objective_qst ".
"WHERE ref_id = ".$ilDB->quote($a_test_id)." ".
"AND objective_id = ".$ilDB->quote($a_objective_id);
$res = $ilDB->query($query);
return $res->numRows() ? true : false;
}

+ Here is the caller graph for this function:

static ilCourseObjectiveQuestion::_lookupMaximumPointsOfQuestion (   $a_question_id)
static

lookup maximimum point

public

Parameters
intquestion id
Returns

Definition at line 584 of file class.ilCourseObjectiveQuestion.php.

References assQuestion\_getMaximumPoints().

{
include_once('Modules/TestQuestionPool/classes/class.assQuestion.php');
return assQuestion::_getMaximumPoints($a_question_id);
}

+ Here is the call graph for this function:

static ilCourseObjectiveQuestion::_updateTestLimits (   $a_objective_id,
  $a_status,
  $a_limit 
)
static

update test limits

public

Parameters
intobjective_id
intstatus
intlimit
Returns

Definition at line 257 of file class.ilCourseObjectiveQuestion.php.

Referenced by ilCourseObjectivesGUI\saveQuestionOverview().

{
global $ilDB;
$query = "UPDATE crs_objective_tst ".
"SET tst_limit = ".$ilDB->quote($a_limit)." ".
"WHERE tst_status = ".$ilDB->quote($a_status)." ".
"AND objective_id = ".$ilDB->quote($a_objective_id);
$ilDB->query($query);
return true;
}

+ Here is the caller graph for this function:

ilCourseObjectiveQuestion::add ( )

Definition at line 659 of file class.ilCourseObjectiveQuestion.php.

References __addTest(), __read(), getObjectiveId(), getQuestionId(), getTestObjId(), and getTestRefId().

{
global $ilDB;
$query = "DELETE FROM crs_objective_qst ".
"WHERE objective_id = ".$this->db->quote($this->getObjectiveId())." ".
"AND question_id = ".$this->db->quote($this->getQuestionId())." ";
$this->db->query($query);
$query = "INSERT INTO crs_objective_qst ".
"SET objective_id = ".$ilDB->quote($this->getObjectiveId()).", ".
"ref_id = ".$ilDB->quote($this->getTestRefId()).", ".
"obj_id = ".$ilDB->quote($this->getTestObjId()).", ".
"question_id = ".$ilDB->quote($this->getQuestionId())."";
$this->db->query($query);
$this->__addTest();
$this->__read();
return true;
}

+ Here is the call graph for this function:

ilCourseObjectiveQuestion::cloneDependencies (   $a_new_objective,
  $a_copy_id 
)

clone objective questions

public

Parameters
intsource objective
inttarget objective
intcopy id

Definition at line 87 of file class.ilCourseObjectiveQuestion.php.

References $ilLog, $test, ilCopyWizardOptions\_getInstance(), getQuestions(), getTests(), and ilCourseObjectiveQuestion().

{
global $ilObjDataCache,$ilLog;
include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
$mappings = $cwo->getMappings();
foreach($this->getQuestions() as $question)
{
if(!isset($mappings["$question[ref_id]"]) or !$mappings["$question[ref_id]"])
{
continue;
}
$question_ref_id = $question['ref_id'];
$question_obj_id = $question['obj_id'];
$question_qst_id = $question['question_id'];
$new_ref_id = $mappings[$question_ref_id];
$new_obj_id = $ilObjDataCache->lookupObjId($new_ref_id);
if($new_obj_id == $question_obj_id)
{
$ilLog->write(__METHOD__.': Test has been linked. Keeping question id.');
// Object has been linked
$new_question_id = $question_qst_id;
}
else
{
$new_question_info = $mappings[$question_ref_id.'_'.$question_qst_id];
$new_question_arr = explode('_',$new_question_info);
if(!isset($new_question_arr[1]) or !$new_question_arr[1])
{
continue;
}
$new_question_id = $new_question_arr[1];
$ilLog->write(__METHOD__.': New question id is: '.$new_question_id);
}
$new_question = new ilCourseObjectiveQuestion($a_new_objective);
$new_question->setTestRefId($new_ref_id);
$new_question->setTestObjId($new_obj_id);
$new_question->setQuestionId($new_question_id);
$new_question->add();
}
// Copy tests
foreach($this->getTests() as $test)
{
$new_test_id = $mappings["$test[ref_id]"];
$query = "UPDATE crs_objective_tst ".
"SET tst_status = ".$this->db->quote($test['tst_status']).", ".
"tst_limit = ".$this->db->quote($test['tst_limit'])." ".
"WHERE objective_id = ".$this->db->quote($a_new_objective)." ".
"AND ref_id = ".$this->db->quote($new_test_id);
$this->db->query($query);
}
}

+ Here is the call graph for this function:

ilCourseObjectiveQuestion::delete (   $qst_id)

Definition at line 683 of file class.ilCourseObjectiveQuestion.php.

References $res, __deleteTest(), DB_FETCHMODE_OBJECT, and getObjectiveId().

{
global $ilDB;
if(!$qst_id)
{
return false;
}
$query = "SELECT * FROM crs_objective_qst ".
"WHERE qst_ass_id = ".$ilDB->quote($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 = ".$ilDB->quote($qst_id)." ";
$this->db->query($query);
// delete test if it was the last question
$query = "SELECT * FROM crs_objective_qst ".
"WHERE ref_id = ".$ilDB->quote($test_rid)." ".
"AND obj_id = ".$ilDB->quote($test_oid)." ".
"AND objective_id = ".$ilDB->quote($this->getObjectiveId())." ";
$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 723 of file class.ilCourseObjectiveQuestion.php.

References getObjectiveId().

{
global $ilDB;
$query = "DELETE FROM crs_objective_qst ".
"WHERE objective_id = ".$ilDB->quote($this->getObjectiveId())." ";
$this->db->query($query);
$query = "DELETE FROM crs_objective_tst ".
"WHERE objective_id = ".$ilDB->quote($this->getObjectiveId())." ";
$this->db->query($query);
return true;
}

+ Here is the call graph for this function:

ilCourseObjectiveQuestion::getFinalTestPoints ( )

get final test points

public

Returns

Definition at line 413 of file class.ilCourseObjectiveQuestion.php.

References getFinalTestQuestions().

Referenced by updateLimits().

{
foreach($this->getFinalTestQuestions() as $question)
{
$points += $question['points'];
}
return $points ? $points : 0;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseObjectiveQuestion::getFinalTestQuestions ( )

get final test questions

public

Returns

Definition at line 466 of file class.ilCourseObjectiveQuestion.php.

Referenced by getFinalTestPoints().

{
foreach($this->questions as $question)
{
if($question['test_type'] == self::TYPE_FINAL_TEST)
{
$final[] = $question;
}
}
return $final ? $final : array();
}

+ Here is the caller graph for this function:

ilCourseObjectiveQuestion::getFinalTests ( )

get final tests

public

Returns

Definition at line 335 of file class.ilCourseObjectiveQuestion.php.

References $test.

{
foreach($this->tests as $test)
{
if($test['status'] == self::TYPE_FINAL_TEST)
{
$final[] = $test;
}
}
return $final ? $final : array();
}
ilCourseObjectiveQuestion::getMaxPointsByObjective ( )

Definition at line 535 of file class.ilCourseObjectiveQuestion.php.

References ilObjTest\_instanciateQuestion(), ilObjectFactory\getInstanceByRefId(), and getQuestions().

{
include_once './Modules/Test/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 554 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 591 of file class.ilCourseObjectiveQuestion.php.

References 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 504 of file class.ilCourseObjectiveQuestion.php.

References $objective_id.

Referenced by __addTest(), __deleteTest(), __read(), add(), delete(), deleteAll(), and getTests().

{
}

+ Here is the caller graph for this function:

ilCourseObjectiveQuestion::getQuestion (   $question_id)

Definition at line 499 of file class.ilCourseObjectiveQuestion.php.

{
return $this->questions[$question_id] ? $this->questions[$question_id] : array();
}
ilCourseObjectiveQuestion::getQuestionId ( )

Definition at line 529 of file class.ilCourseObjectiveQuestion.php.

Referenced by add().

{
return $this->question_id;
}

+ Here is the caller graph for this function:

ilCourseObjectiveQuestion::getQuestions ( )

Definition at line 369 of file class.ilCourseObjectiveQuestion.php.

Referenced by cloneDependencies(), getMaxPointsByObjective(), getMaxPointsByTest(), getNumberOfQuestionsByTest(), getQuestionsByTest(), and getQuestionsOfTest().

{
return $this->questions ? $this->questions : array();
}

+ Here is the caller graph for this function:

ilCourseObjectiveQuestion::getQuestionsByTest (   $a_test_ref_id)

Definition at line 605 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::getQuestionsOfTest (   $a_test_id)

Get questions of test.

public

Parameters
inttest id

Definition at line 487 of file class.ilCourseObjectiveQuestion.php.

References $questions, and getQuestions().

{
foreach($this->getQuestions() as $qst)
{
if($a_test_id == $qst['obj_id'])
{
$questions[] = $qst;
}
}
return $questions ? $questions : array();
}

+ Here is the call graph for this function:

ilCourseObjectiveQuestion::getSelfAssessmentPoints ( )

get self assessment points

public

Returns

Definition at line 398 of file class.ilCourseObjectiveQuestion.php.

References getSelfAssessmentQuestions().

Referenced by updateLimits().

{
foreach($this->getSelfAssessmentQuestions() as $question)
{
$points += $question['points'];
}
return $points ? $points : 0;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseObjectiveQuestion::getSelfAssessmentQuestions ( )

get self assessment questions

public

Returns

Definition at line 380 of file class.ilCourseObjectiveQuestion.php.

References TYPE_SELF_ASSESSMENT.

Referenced by getSelfAssessmentPoints().

{
foreach($this->questions as $question)
{
if($question['test_type'] == self::TYPE_SELF_ASSESSMENT)
{
$self[] = $question;
}
}
return $self ? $self : array();
}

+ Here is the caller graph for this function:

ilCourseObjectiveQuestion::getSelfAssessmentTests ( )

get self assessment tests

public

Parameters
@return

Definition at line 317 of file class.ilCourseObjectiveQuestion.php.

References $test, and TYPE_SELF_ASSESSMENT.

{
foreach($this->tests as $test)
{
if($test['status'] == self::TYPE_SELF_ASSESSMENT)
{
$self[] = $test;
}
}
return $self ? $self : array();
}
ilCourseObjectiveQuestion::getTestObjId ( )

Definition at line 521 of file class.ilCourseObjectiveQuestion.php.

Referenced by __addTest(), and add().

{
return $this->tst_obj_id ? $this->tst_obj_id : 0;
}

+ Here is the caller graph for this function:

ilCourseObjectiveQuestion::getTestRefId ( )

Definition at line 513 of file class.ilCourseObjectiveQuestion.php.

Referenced by __addTest(), and add().

{
return $this->tst_ref_id ? $this->tst_ref_id : 0;
}

+ Here is the caller graph for this function:

ilCourseObjectiveQuestion::getTests ( )

Definition at line 284 of file class.ilCourseObjectiveQuestion.php.

References $res, $test, $tests, DB_FETCHMODE_OBJECT, and getObjectiveId().

Referenced by cloneDependencies().

{
global $ilDB;
$query = "SELECT * FROM crs_objective_tst as cot ".
"JOIN object_data as obd ON cot.obj_id = obd.obj_id ".
"WHERE objective_id = ".$ilDB->quote($this->getObjectiveId())." ".
"ORDER BY title ";
$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;
$test['title'] = $row->title;
}
return $tests ? $tests : array();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseObjectiveQuestion::getTestStatus ( )

Definition at line 165 of file class.ilCourseObjectiveQuestion.php.

Referenced by __addTest(), and updateTest().

{
return (int) $this->tst_status;
}

+ Here is the caller graph for this function:

ilCourseObjectiveQuestion::getTestSuggestedLimit ( )

Definition at line 173 of file class.ilCourseObjectiveQuestion.php.

Referenced by updateTest().

{
return (int) $this->tst_limit;
}

+ Here is the caller graph for this function:

ilCourseObjectiveQuestion::ilCourseObjectiveQuestion (   $a_objective_id)

Definition at line 45 of file class.ilCourseObjectiveQuestion.php.

References __read().

Referenced by cloneDependencies().

{
global $ilDB;
$this->db =& $ilDB;
$this->objective_id = $a_objective_id;
$this->__read();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseObjectiveQuestion::isFinalTestQuestion (   $a_question_id)

is final test question

public

Parameters
intquestion id
Returns

Definition at line 447 of file class.ilCourseObjectiveQuestion.php.

References TYPE_FINAL_TEST.

{
foreach($this->questions as $question)
{
if($question['question_id'] == $a_question_id)
{
return $question['test_type'] == self::TYPE_FINAL_TEST;
}
}
return false;
}
ilCourseObjectiveQuestion::isSelfAssessmentQuestion (   $a_question_id)

check if question is self assessment question

Parameters
intquestion id public
Returns

Definition at line 428 of file class.ilCourseObjectiveQuestion.php.

References TYPE_SELF_ASSESSMENT.

{
foreach($this->questions as $question)
{
if($question['question_id'] == $a_question_id)
{
return $question['test_type'] == self::TYPE_SELF_ASSESSMENT;
}
}
return false;
}
ilCourseObjectiveQuestion::setQuestionId (   $a_question_id)

Definition at line 525 of file class.ilCourseObjectiveQuestion.php.

{
$this->question_id = $a_question_id;
}
ilCourseObjectiveQuestion::setTestObjId (   $a_obj_id)

Definition at line 517 of file class.ilCourseObjectiveQuestion.php.

{
$this->tst_obj_id = $a_obj_id;
}
ilCourseObjectiveQuestion::setTestRefId (   $a_ref_id)

Definition at line 509 of file class.ilCourseObjectiveQuestion.php.

{
$this->tst_ref_id = $a_ref_id;
}
ilCourseObjectiveQuestion::setTestStatus (   $a_status)

Definition at line 161 of file class.ilCourseObjectiveQuestion.php.

{
$this->tst_status = $a_status;
}
ilCourseObjectiveQuestion::setTestSuggestedLimit (   $a_limit)

Definition at line 169 of file class.ilCourseObjectiveQuestion.php.

{
$this->tst_limit = $a_limit;
}
ilCourseObjectiveQuestion::updateLimits ( )

update limits

public

Parameters
@return

Definition at line 624 of file class.ilCourseObjectiveQuestion.php.

References $ref_id, getFinalTestPoints(), getSelfAssessmentPoints(), and TYPE_SELF_ASSESSMENT.

{
foreach($this->tests as $ref_id => $test_data)
{
switch($test_data['status'])
{
$points = $this->getSelfAssessmentPoints();
break;
case self::TYPE_FINAL_TEST:
$points = $this->getFinalTestPoints();
break;
}
if($test_data['limit'] == -1 or $test_data['limit'] > $points)
{
switch($test_data['status'])
{
$points = $this->getSelfAssessmentPoints();
break;
case self::TYPE_FINAL_TEST:
$points = $this->getFinalTestPoints();
break;
}
$query = "UPDATE crs_objective_tst ".
"SET tst_limit = ".$this->db->quote($points)." ".
"WHERE test_objective_id = ".$this->db->quote($test_data['test_objective_id'])." ";
$this->db->query($query);
}
}
}

+ Here is the call graph for this function:

ilCourseObjectiveQuestion::updateTest (   $a_objective_id)

Definition at line 270 of file class.ilCourseObjectiveQuestion.php.

References getTestStatus(), and getTestSuggestedLimit().

{
global $ilDB;
$query = "UPDATE crs_objective_tst ".
"SET tst_status = ".$ilDB->quote($this->getTestStatus()).", ".
"tst_limit = ".$ilDB->quote($this->getTestSuggestedLimit())." ".
"WHERE test_objective_id = ".$ilDB->quote($a_objective_id)."";
$this->db->query($query);
return true;
}

+ Here is the call graph for this function:

Field Documentation

ilCourseObjectiveQuestion::$db = null

Definition at line 39 of file class.ilCourseObjectiveQuestion.php.

ilCourseObjectiveQuestion::$objective_id = null

Definition at line 41 of file class.ilCourseObjectiveQuestion.php.

Referenced by _isAssigned(), and getObjectiveId().

ilCourseObjectiveQuestion::$questions

Definition at line 42 of file class.ilCourseObjectiveQuestion.php.

Referenced by getQuestionsOfTest().

ilCourseObjectiveQuestion::$tests = array()
protected

Definition at line 43 of file class.ilCourseObjectiveQuestion.php.

Referenced by getTests().


The documentation for this class was generated from the following file: