26 $this->container_id = $a_container_id;
28 include_once
'./Modules/Course/classes/Objectives/class.ilLOSettings.php';
41 if(self::$instances[$a_container_id])
43 return self::$instances[$a_container_id];
45 return self::$instances[$a_container_id] =
new self($a_container_id);
56 $query =
'SELECT container_id FROM loc_tst_assignments '.
57 'WHERE tst_ref_id = '.$ilDB->quote($a_test_ref_id,
'integer');
61 return $row->container_id;
98 $query =
'DELETE FROM loc_tst_assignments '.
99 'WHERE container_id = '.$ilDB->quote($a_container_id,
'integer');
100 $ilDB->manipulate(
$query);
106 foreach($this->assignments as $assignment)
108 if($assignment->getAssignmentType() ==
$a_type)
110 $by_type[] = $assignment;
129 $tests[] = $this->
getSettings()->getQualifiedTest();
131 foreach($this->assignments as $assignment)
133 $tests[] = $assignment->getTestRefId();
149 if(!$this->
getSettings()->hasSeparateInitialTests())
156 if(!$this->
getSettings()->hasSeparateQualifiedTests())
166 return $assignment->getTestRefId();
173 if(!$this->
getSettings()->hasSeparateInitialTests())
175 if($this->
getSettings()->getInitialTest() == $a_test_ref_id)
180 if(!$this->
getSettings()->hasSeparateQualifiedTests())
182 if($this->
getSettings()->getQualifiedTest() == $a_test_ref_id)
198 if($this->
getSettings()->getInitialTest() == $a_test_ref_id)
203 elseif($this->
getSettings()->worksWithInitialTest())
205 foreach($this->assignments as $assignment)
207 if($assignment->getTestRefId() == $a_test_ref_id)
214 if(!$this->
getSettings()->hasSeparateQualifiedTests())
216 if($this->
getSettings()->getQualifiedTest() == $a_test_ref_id)
223 foreach($this->assignments as $assignment)
225 if($assignment->getTestRefId() == $a_test_ref_id)
244 foreach($this->assignments as $assignment)
247 ($assignment->getObjectiveId() == $a_objective_id) &&
248 ($assignment->getAssignmentType() ==
$a_type)
265 $query =
'SELECT assignment_id FROM loc_tst_assignments '.
266 'WHERE container_id = '.$ilDB->quote($this->
getContainerId(),
'integer');
270 include_once
'./Modules/Course/classes/Objectives/class.ilLOTestAssignment.php';
273 $this->assignments[] = $assignment;
285 if($assignment->getObjectiveId() != $a_objective_id)
290 include_once
'./Modules/Course/classes/Objectives/class.ilLOXmlWriter.php';
295 'refId' => $assignment->getTestRefId(),
296 'testType' => $assignment->getAssignmentType()
312 $objectives =
array();
314 $query =
'SELECT objective_id FROM loc_tst_assignments '.
315 'WHERE tst_ref_id = '.$ilDB->quote($a_test_ref_id,
'integer');
319 $objectives[] =
$row->objective_id;
static getInstanceByObjId($a_obj_id)
get singleton instance
static getInstance($a_container_id)
Get instance by container id.
getSettings()
get objective settings
__construct($a_container_id)
Constructor.
getAssignmentsByType($a_type)
xmlElement($tag, $attrs=NULL, $data=Null, $encode=TRUE, $escape=TRUE)
Writes a basic element (no children, just textual content)
getTests()
Get all assigned tests.
getAssignmentByObjective($a_objective_id, $a_type)
Get assignment by objective.
getTestByObjective($a_objective_id, $a_type)
readTestAssignments()
Read assignments type $ilDB.
isSeparateTest($a_test_ref_id)
static deleteByContainer($a_container_id)
Delete assignments by container id (obj_id of course) type $ilDB.
getAssignments()
Get assignments.
Create styles array
The data for the language used.
static lookupObjectivesForTest($a_test_ref_id)
Get all objectives that are assigned to given test.
static lookupContainerForTest($a_test_ref_id)
const TYPE_TEST_QUALIFIED
toXml(ilXmlWriter $writer, $a_objective_id)
to xml
const TYPE_TEST_UNDEFINED
getTypeByTest($a_test_ref_id)
Get test type by test id.