37 $this->objective_id = $a_objective_id;
38 if ($this->objective_id) {
63 $query =
"SELECT crs_id FROM crs_objectives " .
64 "WHERE objective_id = " . $ilDB->quote($a_objective_id,
'integer');
90 $query =
'SELECT passes from crs_objectives ' .
91 'WHERE objective_id = ' . $ilDB->quote($a_objective_id,
'integer');
94 return (
int)
$row->passes;
103 $query =
'SELECT title,description from crs_objectives ' .
104 'WHERE objective_id = ' . $ilDB->quote($a_objective_id,
'integer');
106 while (
$row = $ilDB->fetchAssoc(
$res)) {
107 if (!$a_add_description) {
108 return $row[
'title'];
125 public function ilClone($a_target_id, $a_copy_id)
131 $query =
"SELECT * FROM crs_objectives " .
132 "WHERE crs_id = " . $this->db->quote($this->course_obj->getId(),
'integer') .
' ' .
133 "ORDER BY position ";
135 if (!
$res->numRows()) {
146 $new_objective->setTitle(
$row->title);
147 $new_objective->setDescription(
$row->description);
148 $new_objective->setActive(
$row->active);
153 include_once(
'Modules/Course/classes/class.ilCourseObjectiveQuestion.php');
155 $objective_qst->cloneDependencies(
$objective_id, $a_copy_id);
157 include_once
'./Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php';
158 include_once
'./Modules/Course/classes/Objectives/class.ilLOSettings.php';
165 $random_i->copy($a_copy_id, $new_course->getId(),
$objective_id);
173 $random_q->copy($a_copy_id, $new_course->getId(),
$objective_id);
175 include_once
'./Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
178 if ($assignment_it) {
179 $assignment_it->cloneSettings($a_copy_id, $new_course->getId(),
$objective_id);
183 if ($assignment_qt) {
184 $assignment_qt->cloneSettings($a_copy_id, $new_course->getId(),
$objective_id);
190 include_once(
'Modules/Course/classes/class.ilCourseObjectiveMaterials.php');
192 $objective_material->cloneDependencies(
$objective_id, $a_copy_id);
200 $this->active = $a_stat;
210 $this->passes = $a_passes;
220 return $this->passes > 0;
226 $this->title = $a_title;
234 $this->description = $a_description;
242 $this->objective_id = $a_objective_id;
252 $this->position = $a_pos;
261 $next_id = $ilDB->nextId(
'crs_objectives');
262 $query =
"INSERT INTO crs_objectives (crs_id,objective_id,active,title,description,position,created,passes) " .
264 $ilDB->quote($this->course_obj->getId(),
'integer') .
", " .
265 $ilDB->quote($next_id,
'integer') .
", " .
266 $ilDB->quote($this->
isActive(),
'integer') .
', ' .
267 $ilDB->quote($this->
getTitle(),
'text') .
", " .
270 $ilDB->quote(
time(),
'integer') .
", " .
271 $ilDB->quote($this->
getPasses(),
'integer') .
' ' .
277 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
280 return $this->objective_id = $next_id;
288 $query =
"UPDATE crs_objectives " .
289 "SET title = " . $ilDB->quote($this->
getTitle(),
'text') .
", " .
290 'active = ' . $ilDB->quote($this->
isActive(),
'integer') .
', ' .
291 "description = " . $ilDB->quote($this->
getDescription(),
'text') .
", " .
292 'passes = ' . $ilDB->quote($this->
getPasses(),
'integer') .
' ' .
293 "WHERE objective_id = " . $ilDB->quote($this->
getObjectiveId(),
'integer') .
" " .
294 "AND crs_id = " . $ilDB->quote($this->course_obj->getId(),
'integer') .
" ";
312 $query =
"UPDATE crs_objectives " .
313 "SET position = " . $this->db->quote((
string) $a_position,
'integer') .
" " .
314 "WHERE objective_id = " . $this->db->quote($this->
getObjectiveId(),
'integer') .
" ";
327 return (
bool) strlen($this->
getTitle());
330 public function delete()
334 include_once
'./Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
337 $tmp_obj_qst->deleteAll();
339 include_once
'./Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
342 $tmp_obj_lm->deleteAll();
345 $query =
"DELETE FROM crs_objectives " .
346 "WHERE crs_id = " . $ilDB->quote($this->course_obj->getId(),
'integer') .
" " .
347 "AND objective_id = " . $ilDB->quote($this->getObjectiveId(),
'integer') .
" ";
351 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
369 $query =
"UPDATE crs_objectives " .
370 "SET position = position + 1 " .
371 "WHERE position = " . $ilDB->quote($this->
__getPosition() - 1,
'integer') .
" " .
372 "AND crs_id = " . $ilDB->quote($this->course_obj->getId(),
'integer') .
" ";
375 $query =
"UPDATE crs_objectives " .
376 "SET position = position - 1 " .
377 "WHERE objective_id = " . $ilDB->quote($this->
getObjectiveId(),
'integer') .
" " .
378 "AND crs_id = " . $ilDB->quote($this->course_obj->getId(),
'integer') .
" ";
398 $query =
"UPDATE crs_objectives " .
399 "SET position = position - 1 " .
400 "WHERE position = " . $ilDB->quote($this->
__getPosition() + 1,
'integer') .
" " .
401 "AND crs_id = " . $ilDB->quote($this->course_obj->getId(),
'integer') .
" ";
404 $query =
"UPDATE crs_objectives " .
405 "SET position = position + 1 " .
406 "WHERE objective_id = " . $ilDB->quote($this->
getObjectiveId(),
'integer') .
" " .
407 "AND crs_id = " . $ilDB->quote($this->course_obj->getId(),
'integer') .
" ";
418 $this->position = $a_position;
422 return $this->position;
426 $this->created = $a_created;
430 return $this->created;
439 $query =
"SELECT * FROM crs_objectives " .
440 "WHERE crs_id = " . $ilDB->quote($this->course_obj->getId(),
'integer') .
" " .
441 "AND objective_id = " . $ilDB->quote($this->getObjectiveId(),
'integer') .
" ";
463 switch ($this->course_obj->getOrderType()) {
465 return 'ORDER BY position';
468 return 'ORDER BY title';
471 return 'ORDER BY create';
480 $query =
"UPDATE crs_objectives " .
481 "SET position = position - 1 " .
482 "WHERE position > " . $ilDB->quote($this->
__getPosition(),
'integer') .
" " .
483 "AND crs_id = " . $ilDB->quote($this->course_obj->getId(),
'integer') .
" ";
493 $query =
"SELECT MAX(position) pos FROM crs_objectives " .
494 "WHERE crs_id = " . $ilDB->quote($this->course_obj->getId(),
'integer') .
" ";
509 if ($a_activated_only) {
510 $query =
"SELECT objective_id FROM crs_objectives " .
511 "WHERE crs_id = " . $ilDB->quote($course_id,
'integer') .
" " .
512 'AND active = ' . $ilDB->quote(1,
'integer') .
' ' .
515 $query =
"SELECT objective_id FROM crs_objectives " .
516 "WHERE crs_id = " . $ilDB->quote($course_id,
'integer') .
" " .
522 $ids[] =
$row->objective_id;
525 return $ids ? $ids :
array();
540 $in = $ilDB->in(
'objective_id', $ids,
false,
'integer');
543 $query =
"DELETE FROM crs_objective_lm WHERE " .
$in;
546 $query =
"DELETE FROM crs_objective_tst WHERE " .
$in;
549 $query =
"DELETE FROM crs_objective_qst WHERE " .
$in;
552 $query =
"DELETE FROM crs_objectives WHERE crs_id = " . $ilDB->quote($course_id,
'integer');
556 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
572 'online' => (
int) $this->
isActive(),
573 'position' => (
int) $this->position,
581 include_once
'./Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
583 $materials->toXml($writer);
586 include_once
'./Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
588 $test->toXml($writer);
590 include_once
'./Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
594 include_once
'./Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php';
static getInstance($a_container_id)
Get instance by container id.
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
static lookupObjectiveTitle($a_objective_id, $a_add_description=false)
static toXml(ilXmlWriter $writer, $a_objective_id)
static _lookupContainerIdByObjectiveId($a_objective_id)
Get container of object.
static lookupMaxPasses($a_objective_id)
toXml(ilXmlWriter $writer)
write objective xml
static _getObjectiveIds($course_id, $a_activated_only=false)
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
setObjectiveId($a_objective_id)
xmlEndTag($tag)
Writes an endtag.
class ilCourseObjectiveMaterials
foreach($_POST as $key=> $value) $res
writePosition($a_position)
write position
Create styles array
The data for the language used.
if(php_sapi_name() !='cli') $in
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
__setPosition($a_position)
static _getCountObjectives($a_obj_id, $a_activated_only=false)
get count objectives
ilClone($a_target_id, $a_copy_id)
clone objectives
static _deleteAll($course_id)
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
const TYPE_TEST_QUALIFIED
static getLogger($a_component_id)
Get component logger.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
class ilcourseobjectiveQuestion
__construct($course_obj, $a_objective_id=0)
Constructor.
setDescription($a_description)