ILIAS  Release_4_1_x_branch Revision 61804
 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 meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
Id:
class.ilCourseObjectiveQuestion.php 23143 2010-03-09 12:15:33Z 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 $ilDB, $query, $res, $row, 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() ,'integer')." ".
"WHERE objective_id = ".$this->db->quote($this->getObjectiveId() ,'integer')." ".
"AND ref_id = ".$this->db->quote($this->getTestRefId() ,'integer')." ";
$res = $ilDB->manipulate($query);
// CHECK if entry already exists
$query = "SELECT * FROM crs_objective_tst ".
"WHERE objective_id = ".$ilDB->quote($this->getObjectiveId() ,'integer')." ".
"AND ref_id = ".$ilDB->quote($this->getTestRefId() ,'integer')."";
$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() ,'integer')." ".
"AND tst_status = ".$this->db->quote($this->getTestStatus() ,'integer')." ";
$res = $this->db->query($query);
$limit = -1;
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$limit = $row->tst_limit;
}
$next_id = $ilDB->nextId('crs_objective_tst');
$query = "INSERT INTO crs_objective_tst (test_objective_id,objective_id,ref_id,obj_id,tst_status,tst_limit) ".
"VALUES( ".
$ilDB->quote($next_id,'integer').", ".
$ilDB->quote($this->getObjectiveId() ,'integer').", ".
$ilDB->quote($this->getTestRefId() ,'integer').", ".
$ilDB->quote($this->getTestObjId() ,'integer').", ".
$ilDB->quote($this->getTestStatus() ,'integer').", ".
$this->db->quote($limit ,'integer')." ".
")";
$res = $ilDB->manipulate($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 227 of file class.ilCourseObjectiveQuestion.php.

References $ilDB, $query, $res, and getObjectiveId().

Referenced by __read(), and delete().

{
global $ilDB;
// Delete questions
$query = "DELETE FROM crs_objective_qst ".
"WHERE objective_id = ".$ilDB->quote($this->getObjectiveId() ,'integer')." ".
"AND ref_id = ".$ilDB->quote($a_test_ref_id ,'integer')." ";
$res = $ilDB->manipulate($query);
// delete tst entries
$query = "DELETE FROM crs_objective_tst ".
"WHERE objective_id = ".$ilDB->quote($this->getObjectiveId() ,'integer')." ".
"AND ref_id = ".$ilDB->quote($a_test_ref_id ,'integer')." ";
$res = $ilDB->manipulate($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 741 of file class.ilCourseObjectiveQuestion.php.

References $ilDB, $query, $res, $row, __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() ,'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;
}
$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;
}

+ 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 346 of file class.ilCourseObjectiveQuestion.php.

References $ilDB, $query, $res, $row, $test, and DB_FETCHMODE_OBJECT.

{
global $ilDB;
$query = "SELECT * FROM crs_objective_tst ".
"WHERE test_objective_id = ".$ilDB->quote($a_test_objective_id ,'integer')." ";
$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 807 of file class.ilCourseObjectiveQuestion.php.

References $ilDB, $query, and $res.

Referenced by ilCourseObjectivesGUI\setSubTabs().

{
global $ilDB;
$query = "SELECT co.objective_id FROM crs_objectives co JOIN ".
"crs_objective_tst cot ON co.objective_id = cot.objective_id ".
"WHERE crs_id = ".$ilDB->quote($a_course_id ,'integer')." ";
$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 819 of file class.ilCourseObjectiveQuestion.php.

References $ilDB, $objective_id, $query, $res, $row, and DB_FETCHMODE_OBJECT.

{
global $ilDB;
$query = "SELECT crs_qst.objective_id objective_id FROM crs_objective_qst crs_qst, crs_objectives crs_obj ".
"WHERE crs_qst.objective_id = crs_obj.objective_id ".
"AND crs_qst.objective_id = ".$ilDB->quote($a_objective_id ,'integer') ." ".
"AND ref_id = ".$ilDB->quote($a_tst_ref_id ,'integer')." ".
"AND question_id = ".$ilDB->quote($a_question_id ,'integer')." ";
$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 $ilDB, $query, and $res.

Referenced by ilCourseObjectivePresentationGUI\__showTests().

{
global $ilDB;
$query = "SELECT qst_ass_id FROM crs_objective_qst ".
"WHERE ref_id = ".$ilDB->quote($a_test_id ,'integer')." ".
"AND objective_id = ".$ilDB->quote($a_objective_id ,'integer');
$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 583 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 258 of file class.ilCourseObjectiveQuestion.php.

References $ilDB, $query, and $res.

Referenced by ilCourseObjectivesGUI\saveQuestionOverview().

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

+ Here is the caller graph for this function:

ilCourseObjectiveQuestion::add ( )

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

References $ilDB, $query, $res, __addTest(), __read(), getObjectiveId(), getQuestionId(), getTestObjId(), and getTestRefId().

{
global $ilDB;
$query = "DELETE FROM crs_objective_qst ".
"WHERE objective_id = ".$this->db->quote($this->getObjectiveId() ,'integer')." ".
"AND question_id = ".$this->db->quote($this->getQuestionId() ,'integer')." ";
$res = $ilDB->manipulate($query);
$next_id = $ilDB->nextId('crs_objective_qst');
$query = "INSERT INTO crs_objective_qst (qst_ass_id, objective_id,ref_id,obj_id,question_id) ".
"VALUES( ".
$ilDB->quote($next_id,'integer').", ".
$ilDB->quote($this->getObjectiveId() ,'integer').", ".
$ilDB->quote($this->getTestRefId() ,'integer').", ".
$ilDB->quote($this->getTestObjId() ,'integer').", ".
$ilDB->quote($this->getQuestionId() ,'integer').
")";
$res = $ilDB->manipulate($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 $ilDB, $ilLog, $query, $res, $test, ilCopyWizardOptions\_getInstance(), getQuestions(), getTests(), and ilCourseObjectiveQuestion().

{
global $ilObjDataCache,$ilLog,$ilDB;
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'] ,'integer').", ".
"tst_limit = ".$this->db->quote($test['tst_limit'] ,'integer')." ".
"WHERE objective_id = ".$this->db->quote($a_new_objective ,'integer')." ".
"AND ref_id = ".$this->db->quote($new_test_id ,'integer');
$res = $ilDB->manipulate($query);
}
}

+ Here is the call graph for this function:

ilCourseObjectiveQuestion::delete (   $qst_id)

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

References $ilDB, $query, $res, $row, __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 ,'integer')." ";
$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 ,'integer')." ";
$res = $ilDB->manipulate($query);
// delete test if it was the last question
$query = "SELECT * FROM crs_objective_qst ".
"WHERE ref_id = ".$ilDB->quote($test_rid ,'integer')." ".
"AND obj_id = ".$ilDB->quote($test_oid ,'integer')." ".
"AND objective_id = ".$ilDB->quote($this->getObjectiveId() ,'integer')." ";
$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 724 of file class.ilCourseObjectiveQuestion.php.

References $ilDB, $query, $res, and getObjectiveId().

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

+ Here is the call graph for this function:

ilCourseObjectiveQuestion::getFinalTestPoints ( )

get final test points

public

Returns

Definition at line 412 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 465 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 334 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 534 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 553 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 590 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 503 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 498 of file class.ilCourseObjectiveQuestion.php.

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

Definition at line 528 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 368 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 604 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 486 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 397 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 379 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 316 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 520 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 512 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 283 of file class.ilCourseObjectiveQuestion.php.

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

Referenced by cloneDependencies().

{
global $ilDB;
$query = "SELECT * FROM crs_objective_tst cot ".
"JOIN object_data obd ON cot.obj_id = obd.obj_id ".
"WHERE objective_id = ".$ilDB->quote($this->getObjectiveId() ,'integer')." ".
"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 $ilDB, and __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 446 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 427 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 524 of file class.ilCourseObjectiveQuestion.php.

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

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

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

Definition at line 508 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 623 of file class.ilCourseObjectiveQuestion.php.

References $ilDB, $query, $ref_id, $res, getFinalTestPoints(), getSelfAssessmentPoints(), and TYPE_SELF_ASSESSMENT.

{
global $ilDB;
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 ,'integer')." ".
"WHERE test_objective_id = ".$this->db->quote($test_data['test_objective_id'] ,'integer')." ";
$res = $ilDB->manipulate($query);
}
}
}

+ Here is the call graph for this function:

ilCourseObjectiveQuestion::updateTest (   $a_objective_id)

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

References $ilDB, $query, $res, getTestStatus(), and getTestSuggestedLimit().

{
global $ilDB;
$query = "UPDATE crs_objective_tst ".
"SET tst_status = ".$ilDB->quote($this->getTestStatus() ,'integer').", ".
"tst_limit = ".$ilDB->quote($this->getTestSuggestedLimit() ,'integer')." ".
"WHERE test_objective_id = ".$ilDB->quote($a_objective_id ,'integer')."";
$res = $ilDB->manipulate($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: