ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilCourseObjective Class Reference

class ilcourseobjective More...

+ Inheritance diagram for ilCourseObjective:
+ Collaboration diagram for ilCourseObjective:

Public Member Functions

 __construct ($course_obj, $a_objective_id=0)
 Constructor. More...
 
 getCourse ()
 
 ilClone ($a_target_id, $a_copy_id)
 clone objectives More...
 
 setActive ($a_stat)
 
 isActive ()
 
 setPasses ($a_passes)
 
 getPasses ()
 
 arePassesLimited ()
 
 setTitle ($a_title)
 
 getTitle ()
 
 setDescription ($a_description)
 
 getDescription ()
 
 setObjectiveId ($a_objective_id)
 
 getObjectiveId ()
 
 setPosition ($a_pos)
 
 add ()
 
 update ()
 
 writePosition ($a_position)
 write position More...
 
 validate ()
 validate More...
 
 delete ()
 
 moveUp ()
 
 moveDown ()
 
 __setPosition ($a_position)
 
 __getPosition ()
 
 __setCreated ($a_created)
 
 __getCreated ()
 
 __read ()
 
 __getOrderColumn ()
 
 __updateTop ()
 
 __getLastPosition ()
 
 toXml (ilXmlWriter $writer)
 write objective xml More...
 

Static Public Member Functions

static _lookupContainerIdByObjectiveId ($a_objective_id)
 Get container of object. More...
 
static _getCountObjectives ($a_obj_id, $a_activated_only=false)
 get count objectives More...
 
static lookupMaxPasses ($a_objective_id)
 
static lookupObjectiveTitle ($a_objective_id, $a_add_description=false)
 
static _getObjectiveIds ($course_id, $a_activated_only=false)
 
static _deleteAll ($course_id)
 

Data Fields

 $db = null
 
 $course_obj = null
 
 $objective_id = null
 

Protected Attributes

 $active = true
 
 $passes = 0
 

Detailed Description

class ilcourseobjective

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 13 of file class.ilCourseObjective.php.

Constructor & Destructor Documentation

◆ __construct()

ilCourseObjective::__construct (   $course_obj,
  $a_objective_id = 0 
)

Constructor.

Parameters
ilObject$course_obj
int$a_objective_id

Definition at line 30 of file class.ilCourseObjective.php.

31 {
32 global $DIC;
33
34 $ilDB = $DIC['ilDB'];
35
36 $this->db = $ilDB;
37 $this->course_obj = $course_obj;
38
39 $this->objective_id = $a_objective_id;
40 if ($this->objective_id) {
41 $this->__read();
42 }
43 }
global $DIC
Definition: saml.php:7
global $ilDB

References $course_obj, $DIC, $ilDB, and __read().

+ Here is the call graph for this function:

Member Function Documentation

◆ __getCreated()

ilCourseObjective::__getCreated ( )

Definition at line 450 of file class.ilCourseObjective.php.

451 {
452 return $this->created;
453 }

◆ __getLastPosition()

ilCourseObjective::__getLastPosition ( )

Definition at line 515 of file class.ilCourseObjective.php.

516 {
517 global $DIC;
518
519 $ilDB = $DIC['ilDB'];
520
521 $query = "SELECT MAX(position) pos FROM crs_objectives " .
522 "WHERE crs_id = " . $ilDB->quote($this->course_obj->getId(), 'integer') . " ";
523
524 $res = $this->db->query($query);
525 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
526 return $row->pos;
527 }
528 return 0;
529 }
$row
$query
foreach($_POST as $key=> $value) $res

References $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by add(), and moveDown().

+ Here is the caller graph for this function:

◆ __getOrderColumn()

ilCourseObjective::__getOrderColumn ( )

Definition at line 485 of file class.ilCourseObjective.php.

486 {
487 switch ($this->course_obj->getOrderType()) {
489 return 'ORDER BY position';
490
492 return 'ORDER BY title';
493
495 return 'ORDER BY create';
496 }
497 return false;
498 }

References ilContainer\SORT_ACTIVATION, ilContainer\SORT_MANUAL, and ilContainer\SORT_TITLE.

◆ __getPosition()

ilCourseObjective::__getPosition ( )

Definition at line 442 of file class.ilCourseObjective.php.

443 {
444 return $this->position;
445 }

Referenced by __updateTop(), moveDown(), and moveUp().

+ Here is the caller graph for this function:

◆ __read()

ilCourseObjective::__read ( )

Definition at line 456 of file class.ilCourseObjective.php.

457 {
458 global $DIC;
459
460 $ilDB = $DIC['ilDB'];
461
462 if ($this->getObjectiveId()) {
463 $query = "SELECT * FROM crs_objectives " .
464 "WHERE crs_id = " . $ilDB->quote($this->course_obj->getId(), 'integer') . " " .
465 "AND objective_id = " . $ilDB->quote($this->getObjectiveId(), 'integer') . " ";
466
467
468 $res = $this->db->query($query);
469 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
470 // begin-patch lok
471 $this->setActive($row->active);
472 $this->setPasses($row->passes);
473 // end-patch lok
474 $this->setObjectiveId($row->objective_id);
475 $this->setTitle($row->title);
476 $this->setDescription($row->description);
477 $this->__setPosition($row->position);
478 $this->__setCreated($row->created);
479 }
480 return true;
481 }
482 return false;
483 }
setDescription($a_description)
setObjectiveId($a_objective_id)

References $DIC, $ilDB, $query, $res, $row, __setCreated(), __setPosition(), ilDBConstants\FETCHMODE_OBJECT, getObjectiveId(), setActive(), setDescription(), setObjectiveId(), setPasses(), and setTitle().

Referenced by __construct(), moveDown(), and moveUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __setCreated()

ilCourseObjective::__setCreated (   $a_created)

Definition at line 446 of file class.ilCourseObjective.php.

447 {
448 $this->created = $a_created;
449 }

Referenced by __read().

+ Here is the caller graph for this function:

◆ __setPosition()

ilCourseObjective::__setPosition (   $a_position)

Definition at line 438 of file class.ilCourseObjective.php.

439 {
440 $this->position = $a_position;
441 }

Referenced by __read().

+ Here is the caller graph for this function:

◆ __updateTop()

ilCourseObjective::__updateTop ( )

Definition at line 500 of file class.ilCourseObjective.php.

501 {
502 global $DIC;
503
504 $ilDB = $DIC['ilDB'];
505
506 $query = "UPDATE crs_objectives " .
507 "SET position = position - 1 " .
508 "WHERE position > " . $ilDB->quote($this->__getPosition(), 'integer') . " " .
509 "AND crs_id = " . $ilDB->quote($this->course_obj->getId(), 'integer') . " ";
510 $res = $ilDB->manipulate($query);
511
512 return true;
513 }

References $DIC, $ilDB, $query, $res, and __getPosition().

+ Here is the call graph for this function:

◆ _deleteAll()

static ilCourseObjective::_deleteAll (   $course_id)
static

Definition at line 559 of file class.ilCourseObjective.php.

560 {
561 global $DIC;
562
563 $ilDB = $DIC['ilDB'];
564
565 // begin-patch lok
566 $ids = ilCourseObjective::_getObjectiveIds($course_id, false);
567 // end-patch lok
568 if (!count($ids)) {
569 return true;
570 }
571
572 $in = $ilDB->in('objective_id', $ids, false, 'integer');
573
574
575 $query = "DELETE FROM crs_objective_lm WHERE " . $in;
576 $res = $ilDB->manipulate($query);
577
578 $query = "DELETE FROM crs_objective_tst WHERE " . $in;
579 $res = $ilDB->manipulate($query);
580
581 $query = "DELETE FROM crs_objective_qst WHERE " . $in;
582 $res = $ilDB->manipulate($query);
583
584 $query = "DELETE FROM crs_objectives WHERE crs_id = " . $ilDB->quote($course_id, 'integer');
585 $res = $ilDB->manipulate($query);
586
587 // refresh learning progress status after deleting objectives
588 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
590
591 return true;
592 }
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37
static _getObjectiveIds($course_id, $a_activated_only=false)
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.

References $DIC, $ilDB, $in, $query, $res, _getObjectiveIds(), and ilLPStatusWrapper\_refreshStatus().

Referenced by ilObjCourse\delete().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getCountObjectives()

static ilCourseObjective::_getCountObjectives (   $a_obj_id,
  $a_activated_only = false 
)
static

get count objectives

@access public

Parameters
intobj_id
Returns

Definition at line 85 of file class.ilCourseObjective.php.

86 {
87 return count(ilCourseObjective::_getObjectiveIds($a_obj_id, $a_activated_only));
88 }

References _getObjectiveIds().

Referenced by ilLOEditorStatus\getObjectivesStatus(), and ilObjCourseGUI\getTabs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getObjectiveIds()

static ilCourseObjective::_getObjectiveIds (   $course_id,
  $a_activated_only = false 
)
static

Definition at line 533 of file class.ilCourseObjective.php.

534 {
535 global $DIC;
536
537 $ilDB = $DIC['ilDB'];
538
539 if ($a_activated_only) {
540 $query = "SELECT objective_id FROM crs_objectives " .
541 "WHERE crs_id = " . $ilDB->quote($course_id, 'integer') . " " .
542 'AND active = ' . $ilDB->quote(1, 'integer') . ' ' .
543 "ORDER BY position";
544 } else {
545 $query = "SELECT objective_id FROM crs_objectives " .
546 "WHERE crs_id = " . $ilDB->quote($course_id, 'integer') . " " .
547 "ORDER BY position";
548 }
549
550 $res = $ilDB->query($query);
551 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
552 $ids[] = $row->objective_id;
553 }
554
555 return $ids ? $ids : array();
556 }

References $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilLOEditorStatus\__construct(), _deleteAll(), ilCourseObjectiveResult\_getAccomplished(), _getCountObjectives(), ilLPStatusObjectives\_getStatusInfo(), ilCourseObjectiveResult\_getSuggested(), ilLOEditorGUI\activateObjectives(), ilContainerObjectiveGUI\buildObjectiveMap(), ilLOEditorGUI\deactivateObjectives(), ilLPStatusObjectives\determineStatus(), ilLOEditorStatus\getObjectivesStatus(), ilTrQuery\getObjectsDataForUser(), ilCourseObjectiveResult\getStatus(), ilTrQuery\getUserObjectiveMatrix(), ilCourseExporter\getXmlExportTailDependencies(), ilLOTestAssignmentForm\initForm(), ilCourseObjectivesGUI\listObjectives(), ilLOEditorGUI\listObjectives(), ilLOTestQuestionAdapter\lookupRelevantObjectiveIdsForTest(), ilLOMemberTestResultTableGUI\parse(), ilCourseObjectivesGUI\questionOverview(), ilLPCollectionOfObjectives\read(), ilCourseObjectiveResult\readStatus(), ilObjCourseGUI\redirectLocToTestObject(), ilCourseObjectiveResult\reset(), ilContainerObjectiveGUI\showObjectives(), ilLOEditorGUI\updateMaterialAssignments(), and ilLOXmlWriter\write().

+ Here is the caller graph for this function:

◆ _lookupContainerIdByObjectiveId()

static ilCourseObjective::_lookupContainerIdByObjectiveId (   $a_objective_id)
static

Get container of object.

@access public

Parameters
intobjective id

Definition at line 61 of file class.ilCourseObjective.php.

62 {
63 global $DIC;
64
65 $ilDB = $DIC['ilDB'];
66
67 $query = "SELECT crs_id FROM crs_objectives " .
68 "WHERE objective_id = " . $ilDB->quote($a_objective_id, 'integer');
69 $res = $ilDB->query($query);
70 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
71 return $row->crs_id;
72 }
73 return false;
74 }

References $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilCourseObjectiveMaterials\__read(), ilCourseObjectiveQuestion\__read(), and ilObjMediaObjectAccess\checkAccessLearningObjectivePage().

+ Here is the caller graph for this function:

◆ add()

ilCourseObjective::add ( )

Definition at line 266 of file class.ilCourseObjective.php.

267 {
268 global $DIC;
269
270 $ilDB = $DIC['ilDB'];
271
272 // begin-patch lok
273 $next_id = $ilDB->nextId('crs_objectives');
274 $query = "INSERT INTO crs_objectives (crs_id,objective_id,active,title,description,position,created,passes) " .
275 "VALUES( " .
276 $ilDB->quote($this->course_obj->getId(), 'integer') . ", " .
277 $ilDB->quote($next_id, 'integer') . ", " .
278 $ilDB->quote($this->isActive(), 'integer') . ', ' .
279 $ilDB->quote($this->getTitle(), 'text') . ", " .
280 $ilDB->quote($this->getDescription(), 'text') . ", " .
281 $ilDB->quote($this->__getLastPosition() + 1, 'integer') . ", " .
282 $ilDB->quote(time(), 'integer') . ", " .
283 $ilDB->quote($this->getPasses(), 'integer') . ' ' .
284 ")";
285 $res = $ilDB->manipulate($query);
286 // end-patch lok
287
288 // refresh learning progress status after adding new objective
289 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
290 ilLPStatusWrapper::_refreshStatus($this->course_obj->getId());
291
292 return $this->objective_id = $next_id;
293 }

References $DIC, $ilDB, $query, $res, __getLastPosition(), ilLPStatusWrapper\_refreshStatus(), getDescription(), getPasses(), getTitle(), and isActive().

+ Here is the call graph for this function:

◆ arePassesLimited()

ilCourseObjective::arePassesLimited ( )

Definition at line 228 of file class.ilCourseObjective.php.

229 {
230 return $this->passes > 0;
231 }

◆ delete()

ilCourseObjective::delete ( )

Definition at line 346 of file class.ilCourseObjective.php.

347 {
348 global $DIC;
349
350 $ilDB = $DIC['ilDB'];
351
352 include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
353
354 $tmp_obj_qst = new ilCourseObjectiveQuestion($this->getObjectiveId());
355 $tmp_obj_qst->deleteAll();
356
357 include_once './Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
358
359 $tmp_obj_lm = new ilCourseObjectiveMaterials($this->getObjectiveId());
360 $tmp_obj_lm->deleteAll();
361
362
363 $query = "DELETE FROM crs_objectives " .
364 "WHERE crs_id = " . $ilDB->quote($this->course_obj->getId(), 'integer') . " " .
365 "AND objective_id = " . $ilDB->quote($this->getObjectiveId(), 'integer') . " ";
366 $res = $ilDB->manipulate($query);
367
368 // refresh learning progress status after deleting objective
369 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
370 ilLPStatusWrapper::_refreshStatus($this->course_obj->getId());
371
372 return true;
373 }
class ilCourseObjectiveMaterials
class ilcourseobjectiveQuestion

References $DIC, $ilDB, $query, $res, ilLPStatusWrapper\_refreshStatus(), and getObjectiveId().

+ Here is the call graph for this function:

◆ getCourse()

ilCourseObjective::getCourse ( )
Returns
ilObjCourse

Definition at line 48 of file class.ilCourseObjective.php.

49 {
50 return $this->course_obj;
51 }

References $course_obj.

Referenced by ilClone().

+ Here is the caller graph for this function:

◆ getDescription()

ilCourseObjective::getDescription ( )

Definition at line 246 of file class.ilCourseObjective.php.

247 {
248 return $this->description;
249 }

References $description.

Referenced by add(), ilContainerObjectiveGUI\buildAccordionTitle(), toXml(), and update().

+ Here is the caller graph for this function:

◆ getObjectiveId()

ilCourseObjective::getObjectiveId ( )

Definition at line 254 of file class.ilCourseObjective.php.

References $objective_id.

Referenced by __read(), ilContainerObjectiveGUI\buildAccordionTitle(), delete(), moveDown(), moveUp(), toXml(), update(), and writePosition().

+ Here is the caller graph for this function:

◆ getPasses()

ilCourseObjective::getPasses ( )

Definition at line 223 of file class.ilCourseObjective.php.

224 {
225 return $this->passes;
226 }

References $passes.

Referenced by add(), and update().

+ Here is the caller graph for this function:

◆ getTitle()

ilCourseObjective::getTitle ( )

Definition at line 238 of file class.ilCourseObjective.php.

239 {
240 return $this->title;
241 }

References $title.

Referenced by add(), ilContainerObjectiveGUI\buildAccordionTitle(), toXml(), update(), and validate().

+ Here is the caller graph for this function:

◆ ilClone()

ilCourseObjective::ilClone (   $a_target_id,
  $a_copy_id 
)

clone objectives

@access public

Parameters
inttarget id
intcopy id

Definition at line 133 of file class.ilCourseObjective.php.

134 {
135 global $DIC;
136
137 $ilLog = $DIC['ilLog'];
138
139 ilLoggerFactory::getLogger('crs')->debug('Start cloning learning objectives');
140
141 $query = "SELECT * FROM crs_objectives " .
142 "WHERE crs_id = " . $this->db->quote($this->course_obj->getId(), 'integer') . ' ' .
143 "ORDER BY position ";
144 $res = $this->db->query($query);
145 if (!$res->numRows()) {
146 ilLoggerFactory::getLogger('crs')->debug('.. no objectives found');
147 return true;
148 }
149
150 if (!is_object($new_course = ilObjectFactory::getInstanceByRefId($a_target_id, false))) {
151 ilLoggerFactory::getLogger('crs')->warning('Cannot create course instance');
152 return true;
153 }
154 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
155 $new_objective = new ilCourseObjective($new_course);
156 $new_objective->setTitle($row->title);
157 $new_objective->setDescription($row->description);
158 $new_objective->setActive($row->active);
159 $objective_id = $new_objective->add();
160 ilLoggerFactory::getLogger('crs')->debug('Added new objective nr: ' . $objective_id);
161
162 // Clone crs_objective_tst entries
163 include_once('Modules/Course/classes/class.ilCourseObjectiveQuestion.php');
164 $objective_qst = new ilCourseObjectiveQuestion($row->objective_id);
165 $objective_qst->cloneDependencies($objective_id, $a_copy_id);
166
167 include_once './Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php';
168 include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
169 $random_i = new ilLORandomTestQuestionPools(
170 $this->getCourse()->getId(),
171 $row->objective_id,
173 0
174 );
175 $random_i->copy($a_copy_id, $new_course->getId(), $objective_id);
176
177 $random_q = new ilLORandomTestQuestionPools(
178 $this->getCourse()->getId(),
179 $row->objective_id,
181 0
182 );
183 $random_q->copy($a_copy_id, $new_course->getId(), $objective_id);
184
185 include_once './Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
186 $assignments = ilLOTestAssignments::getInstance($this->course_obj->getId());
187 $assignment_it = $assignments->getAssignmentByObjective($row->objective_id, ilLOSettings::TYPE_TEST_INITIAL);
188 if ($assignment_it) {
189 $assignment_it->cloneSettings($a_copy_id, $new_course->getId(), $objective_id);
190 }
191
192 $assignment_qt = $assignments->getAssignmentByObjective($row->objective_id, ilLOSettings::TYPE_TEST_QUALIFIED);
193 if ($assignment_qt) {
194 $assignment_qt->cloneSettings($a_copy_id, $new_course->getId(), $objective_id);
195 }
196
197 ilLoggerFactory::getLogger('crs')->debug('Finished copying question dependencies');
198
199 // Clone crs_objective_lm entries (assigned course materials)
200 include_once('Modules/Course/classes/class.ilCourseObjectiveMaterials.php');
201 $objective_material = new ilCourseObjectiveMaterials($row->objective_id);
202 $objective_material->cloneDependencies($objective_id, $a_copy_id);
203 }
204 ilLoggerFactory::getLogger('crs')->debug('Finished copying objectives');
205 }
class ilcourseobjective
static getInstance($a_container_id)
Get instance by container id.
static getLogger($a_component_id)
Get component logger.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id

References $DIC, $ilLog, $objective_id, $query, $res, $row, ilDBConstants\FETCHMODE_OBJECT, getCourse(), ilLOTestAssignments\getInstance(), ilObjectFactory\getInstanceByRefId(), ilLoggerFactory\getLogger(), ilLOSettings\TYPE_TEST_INITIAL, and ilLOSettings\TYPE_TEST_QUALIFIED.

+ Here is the call graph for this function:

◆ isActive()

ilCourseObjective::isActive ( )

Definition at line 213 of file class.ilCourseObjective.php.

214 {
215 return $this->active;
216 }

References $active.

Referenced by add(), toXml(), and update().

+ Here is the caller graph for this function:

◆ lookupMaxPasses()

static ilCourseObjective::lookupMaxPasses (   $a_objective_id)
static

Definition at line 90 of file class.ilCourseObjective.php.

91 {
92 global $DIC;
93
94 $ilDB = $DIC['ilDB'];
95
96 $query = 'SELECT passes from crs_objectives ' .
97 'WHERE objective_id = ' . $ilDB->quote($a_objective_id, 'integer');
98 $res = $ilDB->query($query);
99 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
100 return (int) $row->passes;
101 }
102 return 0;
103 }

References $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilContainerObjectiveGUI\addItemDetails(), and ilLOEditorStatus\checkNumberOfTries().

+ Here is the caller graph for this function:

◆ lookupObjectiveTitle()

static ilCourseObjective::lookupObjectiveTitle (   $a_objective_id,
  $a_add_description = false 
)
static

Definition at line 105 of file class.ilCourseObjective.php.

106 {
107 global $DIC;
108
109 $ilDB = $DIC['ilDB'];
110
111 $query = 'SELECT title,description from crs_objectives ' .
112 'WHERE objective_id = ' . $ilDB->quote($a_objective_id, 'integer');
113 $res = $ilDB->query($query);
114 while ($row = $ilDB->fetchAssoc($res)) {
115 if (!$a_add_description) {
116 return $row['title'];
117 } else {
118 return $row;
119 }
120 }
121 return "";
122 }

References $DIC, $ilDB, $query, $res, and $row.

Referenced by ilContainerObjectiveGUI\buildObjectiveMap(), ilLOEditorGUI\executeCommand(), ilTrMatrixTableGUI\getItems(), ilTestResultHeaderLabelBuilder\getObjectiveTitle(), ilTestLearningObjectivesStatusGUI\getUsersObjectivesStatus(), ilLOTestAssignmentForm\initForm(), ilTestQuestionRelatedObjectivesList\loadObjectivesTitles(), ilLOMemberTestResultTableGUI\parse(), ilPortfolioPageGUI\parseObjectives(), and ilContainerObjectiveGUI\renderTest().

+ Here is the caller graph for this function:

◆ moveDown()

ilCourseObjective::moveDown ( )

Definition at line 406 of file class.ilCourseObjective.php.

407 {
408 global $DIC;
409
410 $ilDB = $DIC['ilDB'];
411
412 if (!$this->getObjectiveId()) {
413 return false;
414 }
415 // Stop if position is last
416 if ($this->__getPosition() == $this->__getLastPosition()) {
417 return false;
418 }
419
420 $query = "UPDATE crs_objectives " .
421 "SET position = position - 1 " .
422 "WHERE position = " . $ilDB->quote($this->__getPosition() + 1, 'integer') . " " .
423 "AND crs_id = " . $ilDB->quote($this->course_obj->getId(), 'integer') . " ";
424 $res = $ilDB->manipulate($query);
425
426 $query = "UPDATE crs_objectives " .
427 "SET position = position + 1 " .
428 "WHERE objective_id = " . $ilDB->quote($this->getObjectiveId(), 'integer') . " " .
429 "AND crs_id = " . $ilDB->quote($this->course_obj->getId(), 'integer') . " ";
430 $res = $ilDB->manipulate($query);
431
432 $this->__read();
433
434 return true;
435 }

References $DIC, $ilDB, $query, $res, __getLastPosition(), __getPosition(), __read(), and getObjectiveId().

+ Here is the call graph for this function:

◆ moveUp()

ilCourseObjective::moveUp ( )

Definition at line 375 of file class.ilCourseObjective.php.

376 {
377 global $DIC;
378
379 $ilDB = $DIC['ilDB'];
380
381 if (!$this->getObjectiveId()) {
382 return false;
383 }
384 // Stop if position is first
385 if ($this->__getPosition() == 1) {
386 return false;
387 }
388
389 $query = "UPDATE crs_objectives " .
390 "SET position = position + 1 " .
391 "WHERE position = " . $ilDB->quote($this->__getPosition() - 1, 'integer') . " " .
392 "AND crs_id = " . $ilDB->quote($this->course_obj->getId(), 'integer') . " ";
393 $res = $ilDB->manipulate($query);
394
395 $query = "UPDATE crs_objectives " .
396 "SET position = position - 1 " .
397 "WHERE objective_id = " . $ilDB->quote($this->getObjectiveId(), 'integer') . " " .
398 "AND crs_id = " . $ilDB->quote($this->course_obj->getId(), 'integer') . " ";
399 $res = $ilDB->manipulate($query);
400
401 $this->__read();
402
403 return true;
404 }

References $DIC, $ilDB, $query, $res, __getPosition(), __read(), and getObjectiveId().

+ Here is the call graph for this function:

◆ setActive()

ilCourseObjective::setActive (   $a_stat)

Definition at line 208 of file class.ilCourseObjective.php.

209 {
210 $this->active = $a_stat;
211 }

Referenced by __read().

+ Here is the caller graph for this function:

◆ setDescription()

ilCourseObjective::setDescription (   $a_description)

Definition at line 242 of file class.ilCourseObjective.php.

243 {
244 $this->description = $a_description;
245 }

Referenced by __read().

+ Here is the caller graph for this function:

◆ setObjectiveId()

ilCourseObjective::setObjectiveId (   $a_objective_id)

Definition at line 250 of file class.ilCourseObjective.php.

251 {
252 $this->objective_id = $a_objective_id;
253 }

Referenced by __read().

+ Here is the caller graph for this function:

◆ setPasses()

ilCourseObjective::setPasses (   $a_passes)

Definition at line 218 of file class.ilCourseObjective.php.

219 {
220 $this->passes = $a_passes;
221 }

Referenced by __read().

+ Here is the caller graph for this function:

◆ setPosition()

ilCourseObjective::setPosition (   $a_pos)

Definition at line 260 of file class.ilCourseObjective.php.

261 {
262 $this->position = $a_pos;
263 }

◆ setTitle()

ilCourseObjective::setTitle (   $a_title)

Definition at line 234 of file class.ilCourseObjective.php.

235 {
236 $this->title = $a_title;
237 }

Referenced by __read().

+ Here is the caller graph for this function:

◆ toXml()

ilCourseObjective::toXml ( ilXmlWriter  $writer)

write objective xml

Parameters
ilXmlWriter$writer

Definition at line 599 of file class.ilCourseObjective.php.

600 {
601 $writer->xmlStartTag(
602 'Objective',
603 array(
604 'online' => (int) $this->isActive(),
605 'position' => (int) $this->position,
606 'id' => (int) $this->getObjectiveId()
607 )
608 );
609 $writer->xmlElement('Title', array(), $this->getTitle());
610 $writer->xmlElement('Description', array(), $this->getDescription());
611
612 // materials
613 include_once './Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
614 $materials = new ilCourseObjectiveMaterials($this->getObjectiveId());
615 $materials->toXml($writer);
616
617 // test/questions
618 include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
620 $test->toXml($writer);
621
622 include_once './Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
623 $assignments = ilLOTestAssignments::getInstance($this->course_obj->getId());
624 $assignments->toXml($writer, $this->getObjectiveId());
625
626 include_once './Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php';
628
629 $writer->xmlEndTag('Objective');
630 }
$test
Definition: Utf8Test.php:84
static toXml(ilXmlWriter $writer, $a_objective_id)
xmlEndTag($tag)
Writes an endtag.
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.

References $test, getDescription(), ilLOTestAssignments\getInstance(), getObjectiveId(), getTitle(), isActive(), ilLORandomTestQuestionPools\toXml(), ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

+ Here is the call graph for this function:

◆ update()

ilCourseObjective::update ( )

Definition at line 295 of file class.ilCourseObjective.php.

296 {
297 global $DIC;
298
299 $ilDB = $DIC['ilDB'];
300
301 // begin-patch lok
302 $query = "UPDATE crs_objectives " .
303 "SET title = " . $ilDB->quote($this->getTitle(), 'text') . ", " .
304 'active = ' . $ilDB->quote($this->isActive(), 'integer') . ', ' .
305 "description = " . $ilDB->quote($this->getDescription(), 'text') . ", " .
306 'passes = ' . $ilDB->quote($this->getPasses(), 'integer') . ' ' .
307 "WHERE objective_id = " . $ilDB->quote($this->getObjectiveId(), 'integer') . " " .
308 "AND crs_id = " . $ilDB->quote($this->course_obj->getId(), 'integer') . " ";
309 $res = $ilDB->manipulate($query);
310 // end-patch lok
311
312 return true;
313 }

References $DIC, $ilDB, $query, $res, getDescription(), getObjectiveId(), getPasses(), getTitle(), and isActive().

+ Here is the call graph for this function:

◆ validate()

ilCourseObjective::validate ( )

validate

@access public

Parameters

return

Definition at line 341 of file class.ilCourseObjective.php.

342 {
343 return (bool) strlen($this->getTitle());
344 }

References getTitle().

+ Here is the call graph for this function:

◆ writePosition()

ilCourseObjective::writePosition (   $a_position)

write position

@access public

Parameters
intnew position
Returns

Definition at line 322 of file class.ilCourseObjective.php.

323 {
324 global $DIC;
325
326 $ilDB = $DIC['ilDB'];
327
328 $query = "UPDATE crs_objectives " .
329 "SET position = " . $this->db->quote((string) $a_position, 'integer') . " " .
330 "WHERE objective_id = " . $this->db->quote($this->getObjectiveId(), 'integer') . " ";
331 $res = $ilDB->manipulate($query);
332 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $active

ilCourseObjective::$active = true
protected

Definition at line 21 of file class.ilCourseObjective.php.

Referenced by isActive().

◆ $course_obj

ilCourseObjective::$course_obj = null

Definition at line 17 of file class.ilCourseObjective.php.

Referenced by __construct(), and getCourse().

◆ $db

ilCourseObjective::$db = null

Definition at line 15 of file class.ilCourseObjective.php.

◆ $objective_id

ilCourseObjective::$objective_id = null

Definition at line 18 of file class.ilCourseObjective.php.

Referenced by getObjectiveId(), and ilClone().

◆ $passes

ilCourseObjective::$passes = 0
protected

Definition at line 22 of file class.ilCourseObjective.php.

Referenced by getPasses().


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