ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilCourseObjective Class Reference

class ilcourseobjective More...

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

Public Member Functions

 __construct (ilObject $course_obj, int $a_objective_id=0)
 
 getCourse ()
 
 ilClone (int $a_target_id, int $a_copy_id)
 
 setActive (bool $a_stat)
 
 isActive ()
 
 setPasses (int $a_passes)
 
 getPasses ()
 
 arePassesLimited ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setDescription (string $a_description)
 
 getDescription ()
 
 setObjectiveId (int $a_objective_id)
 
 getObjectiveId ()
 
 setPosition (int $a_pos)
 
 add ()
 
 update ()
 
 writePosition (int $a_position)
 
 validate ()
 
 delete ()
 
 moveUp ()
 
 moveDown ()
 
 __setPosition (int $a_position)
 
 __getPosition ()
 
 __setCreated (int $a_created)
 
 __getCreated ()
 
 __read ()
 
 __getOrderColumn ()
 
 __updateTop ()
 
 __getLastPosition ()
 
 toXml (ilXmlWriter $writer)
 

Static Public Member Functions

static _lookupContainerIdByObjectiveId (int $a_objective_id)
 
static _getCountObjectives (int $a_obj_id, bool $a_activated_only=false)
 
static lookupMaxPasses (int $a_objective_id)
 
static lookupObjectiveTitle (int $a_objective_id, bool $a_add_description=false)
 
static _getObjectiveIds (int $course_id, bool $a_activated_only=false)
 
static _deleteAll (int $course_id)
 

Protected Attributes

ilObject $course_obj
 
ilDBInterface $db
 
ilLogger $logger
 

Private Attributes

int $objective_id = 0
 
string $title = ''
 
string $description = ''
 
int $position
 
bool $active = true
 
int $passes = 0
 
int $created = 0
 

Detailed Description

class ilcourseobjective

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

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

Constructor & Destructor Documentation

◆ __construct()

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

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

References $course_obj, $DIC, __read(), and ILIAS\Repository\logger().

43  {
44  global $DIC;
45 
46  $this->db = $DIC->database();
47  $this->logger = $DIC->logger()->crs();
48 
49  $this->course_obj = $course_obj;
50  $this->objective_id = $a_objective_id;
51  if ($this->objective_id) {
52  $this->__read();
53  }
54  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ __getCreated()

ilCourseObjective::__getCreated ( )

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

References $created.

374  : int
375  {
376  return $this->created;
377  }

◆ __getLastPosition()

ilCourseObjective::__getLastPosition ( )

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

References $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by add(), and moveDown().

425  : int
426  {
427  $query = "SELECT MAX(position) pos FROM crs_objectives " .
428  "WHERE crs_id = " . $this->db->quote($this->course_obj->getId(), 'integer') . " ";
429 
430  $res = $this->db->query($query);
431  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
432  return (int) $row->pos;
433  }
434  return 0;
435  }
$res
Definition: ltiservices.php:66
+ Here is the caller graph for this function:

◆ __getOrderColumn()

ilCourseObjective::__getOrderColumn ( )

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

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

401  : string
402  {
403  switch ($this->course_obj->getOrderType()) {
405  return 'ORDER BY position';
406 
408  return 'ORDER BY title';
409 
411  return 'ORDER BY create';
412  }
413  return '';
414  }

◆ __getPosition()

ilCourseObjective::__getPosition ( )

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

References $position.

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

364  : int
365  {
366  return $this->position;
367  }
+ Here is the caller graph for this function:

◆ __read()

ilCourseObjective::__read ( )

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

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

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

379  : void
380  {
381  if ($this->getObjectiveId()) {
382  $query = "SELECT * FROM crs_objectives " .
383  "WHERE crs_id = " . $this->db->quote($this->course_obj->getId(), 'integer') . " " .
384  "AND objective_id = " . $this->db->quote($this->getObjectiveId(), 'integer') . " ";
385 
386  $res = $this->db->query($query);
387  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
388  // begin-patch lok
389  $this->setActive((bool) $row->active);
390  $this->setPasses((int) $row->passes);
391  // end-patch lok
392  $this->setObjectiveId((int) $row->objective_id);
393  $this->setTitle((string) $row->title);
394  $this->setDescription((string) $row->description);
395  $this->__setPosition((int) $row->position);
396  $this->__setCreated((int) $row->created);
397  }
398  }
399  }
$res
Definition: ltiservices.php:66
setDescription(string $a_description)
__setPosition(int $a_position)
setObjectiveId(int $a_objective_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __setCreated()

ilCourseObjective::__setCreated ( int  $a_created)

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

Referenced by __read().

369  : void
370  {
371  $this->created = $a_created;
372  }
+ Here is the caller graph for this function:

◆ __setPosition()

ilCourseObjective::__setPosition ( int  $a_position)

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

Referenced by __read().

359  : void
360  {
361  $this->position = $a_position;
362  }
+ Here is the caller graph for this function:

◆ __updateTop()

ilCourseObjective::__updateTop ( )

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

References $res, and __getPosition().

416  : void
417  {
418  $query = "UPDATE crs_objectives " .
419  "SET position = position - 1 " .
420  "WHERE position > " . $this->db->quote($this->__getPosition(), 'integer') . " " .
421  "AND crs_id = " . $this->db->quote($this->course_obj->getId(), 'integer') . " ";
422  $res = $this->db->manipulate($query);
423  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:

◆ _deleteAll()

static ilCourseObjective::_deleteAll ( int  $course_id)
static

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

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

Referenced by ilObjCourse\delete().

462  : void
463  {
464  global $DIC;
465 
466  $ilDB = $DIC['ilDB'];
467 
468  // begin-patch lok
469  $ids = ilCourseObjective::_getObjectiveIds($course_id, false);
470  // end-patch lok
471  if ($ids === []) {
472  return;
473  }
474 
475  $in = $ilDB->in('objective_id', $ids, false, 'integer');
476 
477  $query = "DELETE FROM crs_objective_lm WHERE " . $in;
478  $res = $ilDB->manipulate($query);
479 
480  $query = "DELETE FROM crs_objective_tst WHERE " . $in;
481  $res = $ilDB->manipulate($query);
482 
483  $query = "DELETE FROM crs_objective_qst WHERE " . $in;
484  $res = $ilDB->manipulate($query);
485 
486  $query = "DELETE FROM crs_objectives WHERE crs_id = " . $ilDB->quote($course_id, 'integer');
487  $res = $ilDB->manipulate($query);
488 
489  // refresh learning progress status after deleting objectives
491  }
$res
Definition: ltiservices.php:66
static _getObjectiveIds(int $course_id, bool $a_activated_only=false)
global $DIC
Definition: shib_login.php:22
static _refreshStatus(int $a_obj_id, ?array $a_users=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getCountObjectives()

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

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

References _getObjectiveIds().

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

75  : int
76  {
77  return count(ilCourseObjective::_getObjectiveIds($a_obj_id, $a_activated_only));
78  }
static _getObjectiveIds(int $course_id, bool $a_activated_only=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getObjectiveIds()

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

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

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

Referenced by ilLOEditorStatus\__construct(), _deleteAll(), ilCourseObjectiveResult\_getAccomplished(), _getCountObjectives(), ilLPStatusObjectives\_getStatusInfo(), ilCourseObjectiveResult\_getSuggested(), ilLOEditorGUI\activateObjectives(), ilLOEditorGUI\deactivateObjectives(), ilLPStatusObjectives\determineStatus(), ILIAS\UI\Component\Legacy\Content\ItemBlock\ItemBlockSequenceGenerator\getBlocksForPart(), ilLOEditorStatus\getObjectivesStatus(), ilTrQuery\getObjectsDataForUser(), ilCourseObjectiveResult\getStatus(), ilTrQuery\getUserObjectiveMatrix(), ilCourseExporter\getXmlExportTailDependencies(), ilLOTestAssignmentForm\initForm(), ilConditionHandlerGUI\initRangeConditionInputItem(), ilCourseObjectivesGUI\listObjectives(), ilLOEditorGUI\listObjectives(), ilLOTestQuestionAdapter\lookupRelevantObjectiveIdsForTest(), ilLOMemberTestResultTableGUI\parse(), ilCourseObjectivesGUI\questionOverview(), ilLPCollectionOfObjectives\read(), ilCourseObjectiveResult\readStatus(), ilObjCourseGUI\redirectLocToTestObject(), ilCourseObjectiveResult\reset(), ILIAS\Containter\Content\ObjectiveRenderer\showObjectives(), ilLOEditorGUI\updateMaterialAssignments(), and ilLOXmlWriter\write().

437  : array
438  {
439  global $DIC;
440 
441  $ilDB = $DIC['ilDB'];
442 
443  if ($a_activated_only) {
444  $query = "SELECT objective_id FROM crs_objectives " .
445  "WHERE crs_id = " . $ilDB->quote($course_id, 'integer') . " " .
446  'AND active = ' . $ilDB->quote(1, 'integer') . ' ' .
447  "ORDER BY position";
448  } else {
449  $query = "SELECT objective_id FROM crs_objectives " .
450  "WHERE crs_id = " . $ilDB->quote($course_id, 'integer') . " " .
451  "ORDER BY position";
452  }
453 
454  $res = $ilDB->query($query);
455  $ids = [];
456  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
457  $ids[] = $row->objective_id;
458  }
459  return $ids;
460  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _lookupContainerIdByObjectiveId()

static ilCourseObjective::_lookupContainerIdByObjectiveId ( int  $a_objective_id)
static

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

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

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

61  : int
62  {
63  global $DIC;
64 
65  $ilDB = $DIC->database();
66  $query = "SELECT crs_id FROM crs_objectives " .
67  "WHERE objective_id = " . $ilDB->quote($a_objective_id, 'integer');
68  $res = $ilDB->query($query);
69  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
70  return (int) $row->crs_id;
71  }
72  return 0;
73  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ add()

ilCourseObjective::add ( )

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

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

246  : int
247  {
248  $next_id = $this->db->nextId('crs_objectives');
249  $query = "INSERT INTO crs_objectives (crs_id,objective_id,active,title,description,position,created,passes) " .
250  "VALUES( " .
251  $this->db->quote($this->course_obj->getId(), 'integer') . ", " .
252  $this->db->quote($next_id, 'integer') . ", " .
253  $this->db->quote($this->isActive(), 'integer') . ', ' .
254  $this->db->quote($this->getTitle(), 'text') . ", " .
255  $this->db->quote($this->getDescription(), 'text') . ", " .
256  $this->db->quote($this->__getLastPosition() + 1, 'integer') . ", " .
257  $this->db->quote(time(), 'integer') . ", " .
258  $this->db->quote($this->getPasses(), 'integer') . ' ' .
259  ")";
260  $res = $this->db->manipulate($query);
261 
262  // refresh learning progress status after adding new objective
263  ilLPStatusWrapper::_refreshStatus($this->course_obj->getId());
264  return $this->objective_id = $next_id;
265  }
$res
Definition: ltiservices.php:66
static _refreshStatus(int $a_obj_id, ?array $a_users=null)
+ Here is the call graph for this function:

◆ arePassesLimited()

ilCourseObjective::arePassesLimited ( )

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

204  : bool
205  {
206  return $this->passes > 0;
207  }

◆ delete()

ilCourseObjective::delete ( )

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

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

292  : void
293  {
294  $tmp_obj_qst = new ilCourseObjectiveQuestion($this->getObjectiveId());
295  $tmp_obj_qst->deleteAll();
296 
297  $tmp_obj_lm = new ilCourseObjectiveMaterials($this->getObjectiveId());
298  $tmp_obj_lm->deleteAll();
299 
300  $query = "DELETE FROM crs_objectives " .
301  "WHERE crs_id = " . $this->db->quote($this->course_obj->getId(), 'integer') . " " .
302  "AND objective_id = " . $this->db->quote($this->getObjectiveId(), 'integer') . " ";
303  $res = $this->db->manipulate($query);
304 
305  // refresh learning progress status after deleting objective
306  ilLPStatusWrapper::_refreshStatus($this->course_obj->getId());
307  }
$res
Definition: ltiservices.php:66
class ilCourseObjectiveMaterials
static _refreshStatus(int $a_obj_id, ?array $a_users=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ getCourse()

ilCourseObjective::getCourse ( )

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

References $course_obj.

Referenced by ilClone().

56  : ilObject
57  {
58  return $this->course_obj;
59  }
+ Here is the caller graph for this function:

◆ getDescription()

ilCourseObjective::getDescription ( )

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

References $description.

Referenced by add(), ILIAS\Containter\Content\ObjectiveRenderer\buildAccordionTitle(), toXml(), and update().

226  : string
227  {
228  return $this->description;
229  }
+ Here is the caller graph for this function:

◆ getObjectiveId()

ilCourseObjective::getObjectiveId ( )

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

References $objective_id.

Referenced by __read(), ILIAS\Containter\Content\ObjectiveRenderer\buildAccordionTitle(), delete(), moveDown(), moveUp(), toXml(), update(), and writePosition().

236  : int
237  {
238  return $this->objective_id;
239  }
+ Here is the caller graph for this function:

◆ getPasses()

ilCourseObjective::getPasses ( )

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

References $passes.

Referenced by add(), and update().

199  : int
200  {
201  return $this->passes;
202  }
+ Here is the caller graph for this function:

◆ getTitle()

ilCourseObjective::getTitle ( )

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

References $title.

Referenced by add(), ILIAS\Containter\Content\ObjectiveRenderer\buildAccordionTitle(), toXml(), update(), and validate().

216  : string
217  {
218  return $this->title;
219  }
+ Here is the caller graph for this function:

◆ ilClone()

ilCourseObjective::ilClone ( int  $a_target_id,
int  $a_copy_id 
)

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

References $objective_id, $res, ilDBConstants\FETCHMODE_OBJECT, getCourse(), ILIAS\Survey\Mode\getId(), ilLOTestAssignments\getInstance(), ilObjectFactory\getInstanceByRefId(), ILIAS\Repository\logger(), ilLOSettings\TYPE_TEST_INITIAL, and ilLOSettings\TYPE_TEST_QUALIFIED.

115  : void
116  {
117  $query = "SELECT * FROM crs_objectives " .
118  "WHERE crs_id = " . $this->db->quote($this->course_obj->getId(), 'integer') . ' ' .
119  "ORDER BY position ";
120  $res = $this->db->query($query);
121  if ($res->numRows() === 0) {
122  $this->logger->debug('.. no objectives found');
123  return;
124  }
125 
126  if (!is_object($new_course = ilObjectFactory::getInstanceByRefId($a_target_id, false))) {
127  $this->logger->warning('Cannot create course instance');
128  return;
129  }
130  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
131  $new_objective = new ilCourseObjective($new_course);
132  $new_objective->setTitle((string) $row->title);
133  $new_objective->setDescription((string) $row->description);
134  $new_objective->setActive((bool) $row->active);
135  $objective_id = $new_objective->add();
136  $this->logger->debug('Added new objective nr: ' . $objective_id);
137 
138  // Clone crs_objective_tst entries
139  $objective_qst = new ilCourseObjectiveQuestion((int) $row->objective_id);
140  $objective_qst->cloneDependencies($objective_id, $a_copy_id);
141 
142  $random_i = new ilLORandomTestQuestionPools(
143  $this->getCourse()->getId(),
144  (int) $row->objective_id,
146  0
147  );
148  $random_i->copy($a_copy_id, $new_course->getId(), $objective_id);
149 
150  $random_q = new ilLORandomTestQuestionPools(
151  $this->getCourse()->getId(),
152  (int) $row->objective_id,
154  0
155  );
156  $random_q->copy($a_copy_id, $new_course->getId(), $objective_id);
157 
158  $assignments = ilLOTestAssignments::getInstance($this->course_obj->getId());
159  $assignment_it = $assignments->getAssignmentByObjective(
160  (int) $row->objective_id,
162  );
163  if ($assignment_it) {
164  $assignment_it->cloneSettings($a_copy_id, $new_course->getId(), $objective_id);
165  }
166 
167  $assignment_qt = $assignments->getAssignmentByObjective(
168  (int) $row->objective_id,
170  );
171  if ($assignment_qt) {
172  $assignment_qt->cloneSettings($a_copy_id, $new_course->getId(), $objective_id);
173  }
174 
175  $this->logger->debug('Finished copying question dependencies');
176 
177  // Clone crs_objective_lm entries (assigned course materials)
178  $objective_material = new ilCourseObjectiveMaterials((int) $row->objective_id);
179  $objective_material->cloneDependencies($objective_id, $a_copy_id);
180  }
181  $this->logger->debug('Finished copying objectives');
182  }
$res
Definition: ltiservices.php:66
class ilCourseObjectiveMaterials
class ilcourseobjective
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
static getInstance(int $a_container_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ isActive()

ilCourseObjective::isActive ( )

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

References $active.

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

189  : bool
190  {
191  return $this->active;
192  }
+ Here is the caller graph for this function:

◆ lookupMaxPasses()

static ilCourseObjective::lookupMaxPasses ( int  $a_objective_id)
static

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

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

Referenced by ilLOEditorStatus\checkNumberOfTries().

80  : int
81  {
82  global $DIC;
83 
84  $ilDB = $DIC['ilDB'];
85  $query = 'SELECT passes from crs_objectives ' .
86  'WHERE objective_id = ' . $ilDB->quote($a_objective_id, 'integer');
87  $res = $ilDB->query($query);
88  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
89  return (int) $row->passes;
90  }
91  return 0;
92  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ lookupObjectiveTitle()

static ilCourseObjective::lookupObjectiveTitle ( int  $a_objective_id,
bool  $a_add_description = false 
)
static
Returns
array|string

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

References $DIC, $ilDB, and $res.

Referenced by ilLOEditorGUI\executeCommand(), ilPortfolioPageGUI\getCoursesOfUser(), ilTrMatrixTableGUI\getItems(), ilTestLearningObjectivesStatusGUI\getUsersObjectivesStatus(), ilLOTestAssignmentForm\initForm(), ilPCResourcesGUI\insertResourcesIntoPageContent(), ilTestQuestionRelatedObjectivesList\loadObjectivesTitles(), ilLOMemberTestResultTableGUI\parse(), ilLOTestAssignmentTableGUI\parse(), ILIAS\Containter\Content\ObjectiveRenderer\renderTest(), and ilConditionHandlerGUI\translateOperator().

98  {
99  global $DIC;
100 
101  $ilDB = $DIC->database();
102  $query = 'SELECT title,description from crs_objectives ' .
103  'WHERE objective_id = ' . $ilDB->quote($a_objective_id, 'integer');
104  $res = $ilDB->query($query);
105  while ($row = $ilDB->fetchAssoc($res)) {
106  if (!$a_add_description) {
107  return $row['title'];
108  } else {
109  return $row;
110  }
111  }
112  return "";
113  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ moveDown()

ilCourseObjective::moveDown ( )

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

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

334  : void
335  {
336  if (!$this->getObjectiveId()) {
337  return;
338  }
339  // Stop if position is last
340  if ($this->__getPosition() == $this->__getLastPosition()) {
341  return;
342  }
343 
344  $query = "UPDATE crs_objectives " .
345  "SET position = position - 1 " .
346  "WHERE position = " . $this->db->quote($this->__getPosition() + 1, 'integer') . " " .
347  "AND crs_id = " . $this->db->quote($this->course_obj->getId(), 'integer') . " ";
348  $res = $this->db->manipulate($query);
349 
350  $query = "UPDATE crs_objectives " .
351  "SET position = position + 1 " .
352  "WHERE objective_id = " . $this->db->quote($this->getObjectiveId(), 'integer') . " " .
353  "AND crs_id = " . $this->db->quote($this->course_obj->getId(), 'integer') . " ";
354  $res = $this->db->manipulate($query);
355 
356  $this->__read();
357  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:

◆ moveUp()

ilCourseObjective::moveUp ( )

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

References $res, __getPosition(), __read(), and getObjectiveId().

309  : void
310  {
311  if (!$this->getObjectiveId()) {
312  return;
313  }
314  // Stop if position is first
315  if ($this->__getPosition() == 1) {
316  return;
317  }
318 
319  $query = "UPDATE crs_objectives " .
320  "SET position = position + 1 " .
321  "WHERE position = " . $this->db->quote($this->__getPosition() - 1, 'integer') . " " .
322  "AND crs_id = " . $this->db->quote($this->course_obj->getId(), 'integer') . " ";
323  $res = $this->db->manipulate($query);
324 
325  $query = "UPDATE crs_objectives " .
326  "SET position = position - 1 " .
327  "WHERE objective_id = " . $this->db->quote($this->getObjectiveId(), 'integer') . " " .
328  "AND crs_id = " . $this->db->quote($this->course_obj->getId(), 'integer') . " ";
329  $res = $this->db->manipulate($query);
330 
331  $this->__read();
332  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:

◆ setActive()

ilCourseObjective::setActive ( bool  $a_stat)

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

Referenced by __read().

184  : void
185  {
186  $this->active = $a_stat;
187  }
+ Here is the caller graph for this function:

◆ setDescription()

ilCourseObjective::setDescription ( string  $a_description)

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

Referenced by __read().

221  : void
222  {
223  $this->description = $a_description;
224  }
+ Here is the caller graph for this function:

◆ setObjectiveId()

ilCourseObjective::setObjectiveId ( int  $a_objective_id)

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

Referenced by __read().

231  : void
232  {
233  $this->objective_id = $a_objective_id;
234  }
+ Here is the caller graph for this function:

◆ setPasses()

ilCourseObjective::setPasses ( int  $a_passes)

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

Referenced by __read().

194  : void
195  {
196  $this->passes = $a_passes;
197  }
+ Here is the caller graph for this function:

◆ setPosition()

ilCourseObjective::setPosition ( int  $a_pos)

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

241  : void
242  {
243  $this->position = $a_pos;
244  }

◆ setTitle()

ilCourseObjective::setTitle ( string  $a_title)

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

Referenced by __read().

211  : void
212  {
213  $this->title = $a_title;
214  }
+ Here is the caller graph for this function:

◆ toXml()

ilCourseObjective::toXml ( ilXmlWriter  $writer)

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

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

493  : void
494  {
495  $writer->xmlStartTag(
496  'Objective',
497  array(
498  'online' => (int) $this->isActive(),
499  'position' => $this->position,
500  'id' => $this->getObjectiveId()
501  )
502  );
503  $writer->xmlElement('Title', array(), $this->getTitle());
504  $writer->xmlElement('Description', array(), $this->getDescription());
505 
506  // materials
507  $materials = new ilCourseObjectiveMaterials($this->getObjectiveId());
508  $materials->toXml($writer);
509 
510  // test/questions
511  $test = new ilCourseObjectiveQuestion($this->getObjectiveId());
512  $test->toXml($writer);
513 
514  $assignments = ilLOTestAssignments::getInstance($this->course_obj->getId());
515  $assignments->toXml($writer, $this->getObjectiveId());
516 
518 
519  $writer->xmlEndTag('Objective');
520  }
static toXml(ilXmlWriter $writer, int $a_objective_id)
xmlEndTag(string $tag)
Writes an endtag.
class ilCourseObjectiveMaterials
static getInstance(int $a_container_id)
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ update()

ilCourseObjective::update ( )

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

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

267  : void
268  {
269  $query = "UPDATE crs_objectives " .
270  "SET title = " . $this->db->quote($this->getTitle(), 'text') . ", " .
271  'active = ' . $this->db->quote($this->isActive(), 'integer') . ', ' .
272  "description = " . $this->db->quote($this->getDescription(), 'text') . ", " .
273  'passes = ' . $this->db->quote($this->getPasses(), 'integer') . ' ' .
274  "WHERE objective_id = " . $this->db->quote($this->getObjectiveId(), 'integer') . " " .
275  "AND crs_id = " . $this->db->quote($this->course_obj->getId(), 'integer') . " ";
276  $res = $this->db->manipulate($query);
277  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:

◆ validate()

ilCourseObjective::validate ( )

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

References getTitle().

287  : bool
288  {
289  return (bool) strlen($this->getTitle());
290  }
+ Here is the call graph for this function:

◆ writePosition()

ilCourseObjective::writePosition ( int  $a_position)

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

References $res, and getObjectiveId().

279  : void
280  {
281  $query = "UPDATE crs_objectives " .
282  "SET position = " . $this->db->quote((string) $a_position, 'integer') . " " .
283  "WHERE objective_id = " . $this->db->quote($this->getObjectiveId(), 'integer') . " ";
284  $res = $this->db->manipulate($query);
285  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:

Field Documentation

◆ $active

bool ilCourseObjective::$active = true
private

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

Referenced by isActive().

◆ $course_obj

ilObject ilCourseObjective::$course_obj
protected

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

Referenced by __construct(), and getCourse().

◆ $created

int ilCourseObjective::$created = 0
private

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

Referenced by __getCreated().

◆ $db

ilDBInterface ilCourseObjective::$db
protected

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

◆ $description

string ilCourseObjective::$description = ''
private

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

Referenced by getDescription().

◆ $logger

ilLogger ilCourseObjective::$logger
protected

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

◆ $objective_id

int ilCourseObjective::$objective_id = 0
private

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

Referenced by getObjectiveId(), and ilClone().

◆ $passes

int ilCourseObjective::$passes = 0
private

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

Referenced by getPasses().

◆ $position

int ilCourseObjective::$position
private

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

Referenced by __getPosition().

◆ $title

string ilCourseObjective::$title = ''
private

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

Referenced by getTitle().


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