ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilCourseObjective Class Reference

class ilcourseobjective More...

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

Public Member Functions

 ilCourseObjective (&$course_obj, $a_objective_id=0)
 
 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 ()
 
 _deleteAll ($course_id)
 
 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)
 

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.

Member Function Documentation

◆ __getCreated()

ilCourseObjective::__getCreated ( )

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

438  {
439  return $this->created;
440  }

◆ __getLastPosition()

ilCourseObjective::__getLastPosition ( )

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

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

Referenced by add(), and moveDown().

502  {
503  global $ilDB;
504 
505  $query = "SELECT MAX(position) pos FROM crs_objectives ".
506  "WHERE crs_id = ".$ilDB->quote($this->course_obj->getId() ,'integer')." ";
507 
508  $res = $this->db->query($query);
509  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
510  {
511  return $row->pos;
512  }
513  return 0;
514  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
global $ilDB
+ Here is the caller graph for this function:

◆ __getOrderColumn()

ilCourseObjective::__getOrderColumn ( )

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

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

473  {
474  switch($this->course_obj->getOrderType())
475  {
477  return 'ORDER BY position';
478 
480  return 'ORDER BY title';
481 
483  return 'ORDER BY create';
484  }
485  return false;
486  }

◆ __getPosition()

ilCourseObjective::__getPosition ( )

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

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

430  {
431  return $this->position;
432  }
+ Here is the caller graph for this function:

◆ __read()

ilCourseObjective::__read ( )

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

References $ilDB, $query, $res, $row, __setCreated(), __setPosition(), DB_FETCHMODE_OBJECT, getObjectiveId(), setActive(), setDescription(), setObjectiveId(), setPasses(), and setTitle().

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

444  {
445  global $ilDB;
446 
447  if($this->getObjectiveId())
448  {
449  $query = "SELECT * FROM crs_objectives ".
450  "WHERE crs_id = ".$ilDB->quote($this->course_obj->getId() ,'integer')." ".
451  "AND objective_id = ".$ilDB->quote($this->getObjectiveId() ,'integer')." ";
452 
453 
454  $res = $this->db->query($query);
455  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
456  {
457  // begin-patch lok
458  $this->setActive($row->active);
459  $this->setPasses($row->passes);
460  // end-patch lok
461  $this->setObjectiveId($row->objective_id);
462  $this->setTitle($row->title);
463  $this->setDescription($row->description);
464  $this->__setPosition($row->position);
465  $this->__setCreated($row->created);
466  }
467  return true;
468  }
469  return false;
470  }
setObjectiveId($a_objective_id)
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
global $ilDB
setDescription($a_description)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __setCreated()

ilCourseObjective::__setCreated (   $a_created)

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

Referenced by __read().

434  {
435  $this->created = $a_created;
436  }
+ Here is the caller graph for this function:

◆ __setPosition()

ilCourseObjective::__setPosition (   $a_position)

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

Referenced by __read().

426  {
427  $this->position = $a_position;
428  }
+ Here is the caller graph for this function:

◆ __updateTop()

ilCourseObjective::__updateTop ( )

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

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

489  {
490  global $ilDB;
491 
492  $query = "UPDATE crs_objectives ".
493  "SET position = position - 1 ".
494  "WHERE position > ".$ilDB->quote($this->__getPosition() ,'integer')." ".
495  "AND crs_id = ".$ilDB->quote($this->course_obj->getId() ,'integer')." ";
496  $res = $ilDB->manipulate($query);
497 
498  return true;
499  }
global $ilDB
+ Here is the call graph for this function:

◆ _deleteAll()

ilCourseObjective::_deleteAll (   $course_id)

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

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

Referenced by ilObjCourse\delete().

547  {
548  global $ilDB;
549 
550  // begin-patch lok
551  $ids = ilCourseObjective::_getObjectiveIds($course_id,false);
552  // end-patch lok
553  if(!count($ids))
554  {
555  return true;
556  }
557 
558  $in = $ilDB->in('objective_id',$ids,false,'integer');
559 
560 
561  $query = "DELETE FROM crs_objective_lm WHERE ".$in;
562  $res = $ilDB->manipulate($query);
563 
564  $query = "DELETE FROM crs_objective_tst WHERE ".$in;
565  $res = $ilDB->manipulate($query);
566 
567  $query = "DELETE FROM crs_objective_qst WHERE ".$in;
568  $res = $ilDB->manipulate($query);
569 
570  $query = "DELETE FROM crs_objectives WHERE crs_id = ".$ilDB->quote($course_id ,'integer');
571  $res = $ilDB->manipulate($query);
572 
573  // refresh learning progress status after deleting objectives
574  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
576 
577  return true;
578  }
static _getObjectiveIds($course_id, $a_activated_only=false)
_refreshStatus($a_obj_id, $a_users=null)
Set dirty.
global $ilDB
+ 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

public

Parameters
intobj_id
Returns

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

References _getObjectiveIds().

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

79  {
80  return count(ilCourseObjective::_getObjectiveIds($a_obj_id,$a_activated_only));
81  }
static _getObjectiveIds($course_id, $a_activated_only=false)
+ 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 518 of file class.ilCourseObjective.php.

References $ilDB, $query, $res, $row, and DB_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(), and ilLOXmlWriter\write().

519  {
520  global $ilDB;
521 
522  if($a_activated_only)
523  {
524  $query = "SELECT objective_id FROM crs_objectives ".
525  "WHERE crs_id = ".$ilDB->quote($course_id ,'integer')." ".
526  'AND active = '.$ilDB->quote(1,'integer').' '.
527  "ORDER BY position";
528  }
529  else
530  {
531  $query = "SELECT objective_id FROM crs_objectives ".
532  "WHERE crs_id = ".$ilDB->quote($course_id ,'integer')." ".
533  "ORDER BY position";
534  }
535 
536  $res = $ilDB->query($query);
537  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
538  {
539  $ids[] = $row->objective_id;
540  }
541 
542  return $ids ? $ids : array();
543  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
global $ilDB
+ Here is the caller graph for this function:

◆ _lookupContainerIdByObjectiveId()

static ilCourseObjective::_lookupContainerIdByObjectiveId (   $a_objective_id)
static

Get container of object.

public

Parameters
intobjective id

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

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

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

56  {
57  global $ilDB;
58 
59  $query = "SELECT crs_id FROM crs_objectives ".
60  "WHERE objective_id = ".$ilDB->quote($a_objective_id ,'integer');
61  $res = $ilDB->query($query);
62  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
63  {
64  return $row->crs_id;
65  }
66  return false;
67  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
global $ilDB
+ Here is the caller graph for this function:

◆ add()

ilCourseObjective::add ( )

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

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

262  {
263  global $ilDB;
264 
265  // begin-patch lok
266  $next_id = $ilDB->nextId('crs_objectives');
267  $query = "INSERT INTO crs_objectives (crs_id,objective_id,active,title,description,position,created,passes) ".
268  "VALUES( ".
269  $ilDB->quote($this->course_obj->getId() ,'integer').", ".
270  $ilDB->quote($next_id,'integer').", ".
271  $ilDB->quote($this->isActive(),'integer').', '.
272  $ilDB->quote($this->getTitle() ,'text').", ".
273  $ilDB->quote($this->getDescription() ,'text').", ".
274  $ilDB->quote($this->__getLastPosition() + 1 ,'integer').", ".
275  $ilDB->quote(time() ,'integer').", ".
276  $ilDB->quote($this->getPasses(),'integer').' '.
277  ")";
278  $res = $ilDB->manipulate($query);
279  // end-patch lok
280 
281  // refresh learning progress status after adding new objective
282  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
283  ilLPStatusWrapper::_refreshStatus($this->course_obj->getId());
284 
285  return $this->objective_id = $next_id;
286  }
_refreshStatus($a_obj_id, $a_users=null)
Set dirty.
global $ilDB
+ Here is the call graph for this function:

◆ arePassesLimited()

ilCourseObjective::arePassesLimited ( )

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

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

◆ delete()

ilCourseObjective::delete ( )

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

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

336  {
337  global $ilDB;
338 
339  include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
340 
341  $tmp_obj_qst =& new ilCourseObjectiveQuestion($this->getObjectiveId());
342  $tmp_obj_qst->deleteAll();
343 
344  include_once './Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
345 
346  $tmp_obj_lm =& new ilCourseObjectiveMaterials($this->getObjectiveId());
347  $tmp_obj_lm->deleteAll();
348 
349 
350  $query = "DELETE FROM crs_objectives ".
351  "WHERE crs_id = ".$ilDB->quote($this->course_obj->getId() ,'integer')." ".
352  "AND objective_id = ".$ilDB->quote($this->getObjectiveId() ,'integer')." ";
353  $res = $ilDB->manipulate($query);
354 
355  // refresh learning progress status after deleting objective
356  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
357  ilLPStatusWrapper::_refreshStatus($this->course_obj->getId());
358 
359  return true;
360  }
class ilCourseObjectiveMaterials
_refreshStatus($a_obj_id, $a_users=null)
Set dirty.
global $ilDB
class ilcourseobjectiveQuestion
+ Here is the call graph for this function:

◆ getCourse()

ilCourseObjective::getCourse ( )
Returns
ilObjCourse

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

References $course_obj.

Referenced by ilClone().

43  {
44  return $this->course_obj;
45  }
+ Here is the caller graph for this function:

◆ getDescription()

ilCourseObjective::getDescription ( )

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

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

242  {
243  return $this->description;
244  }
+ Here is the caller graph for this function:

◆ getObjectiveId()

ilCourseObjective::getObjectiveId ( )

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

References $objective_id.

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

250  {
251  return $this->objective_id;
252  }
+ Here is the caller graph for this function:

◆ getPasses()

ilCourseObjective::getPasses ( )

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

References $passes.

Referenced by add(), and update().

219  {
220  return $this->passes;
221  }
+ Here is the caller graph for this function:

◆ getTitle()

ilCourseObjective::getTitle ( )

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

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

234  {
235  return $this->title;
236  }
+ Here is the caller graph for this function:

◆ ilClone()

ilCourseObjective::ilClone (   $a_target_id,
  $a_copy_id 
)

clone objectives

public

Parameters
inttarget id
intcopy id

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

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

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

◆ ilCourseObjective()

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

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

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

Referenced by ilClone().

26  {
27  global $ilDB;
28 
29  $this->db =& $ilDB;
30  $this->course_obj =& $course_obj;
31 
32  $this->objective_id = $a_objective_id;
33  if($this->objective_id)
34  {
35  $this->__read();
36  }
37  }
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isActive()

ilCourseObjective::isActive ( )

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

References $active.

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

209  {
210  return $this->active;
211  }
+ Here is the caller graph for this function:

◆ lookupMaxPasses()

static ilCourseObjective::lookupMaxPasses (   $a_objective_id)
static

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

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

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

84  {
85  global $ilDB;
86 
87  $query = 'SELECT passes from crs_objectives '.
88  'WHERE objective_id = '.$ilDB->quote($a_objective_id,'integer');
89  $res = $ilDB->query($query);
90  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
91  {
92  return (int) $row->passes;
93  }
94  return 0;
95  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
global $ilDB
+ Here is the caller graph for this function:

◆ lookupObjectiveTitle()

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

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

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

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

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

◆ moveDown()

ilCourseObjective::moveDown ( )

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

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

394  {
395  global $ilDB;
396 
397  if(!$this->getObjectiveId())
398  {
399  return false;
400  }
401  // Stop if position is last
402  if($this->__getPosition() == $this->__getLastPosition())
403  {
404  return false;
405  }
406 
407  $query = "UPDATE crs_objectives ".
408  "SET position = position - 1 ".
409  "WHERE position = ".$ilDB->quote($this->__getPosition() + 1 ,'integer')." ".
410  "AND crs_id = ".$ilDB->quote($this->course_obj->getId() ,'integer')." ";
411  $res = $ilDB->manipulate($query);
412 
413  $query = "UPDATE crs_objectives ".
414  "SET position = position + 1 ".
415  "WHERE objective_id = ".$ilDB->quote($this->getObjectiveId() ,'integer')." ".
416  "AND crs_id = ".$ilDB->quote($this->course_obj->getId() ,'integer')." ";
417  $res = $ilDB->manipulate($query);
418 
419  $this->__read();
420 
421  return true;
422  }
global $ilDB
+ Here is the call graph for this function:

◆ moveUp()

ilCourseObjective::moveUp ( )

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

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

363  {
364  global $ilDB;
365 
366  if(!$this->getObjectiveId())
367  {
368  return false;
369  }
370  // Stop if position is first
371  if($this->__getPosition() == 1)
372  {
373  return false;
374  }
375 
376  $query = "UPDATE crs_objectives ".
377  "SET position = position + 1 ".
378  "WHERE position = ".$ilDB->quote($this->__getPosition() - 1 ,'integer')." ".
379  "AND crs_id = ".$ilDB->quote($this->course_obj->getId() ,'integer')." ";
380  $res = $ilDB->manipulate($query);
381 
382  $query = "UPDATE crs_objectives ".
383  "SET position = position - 1 ".
384  "WHERE objective_id = ".$ilDB->quote($this->getObjectiveId() ,'integer')." ".
385  "AND crs_id = ".$ilDB->quote($this->course_obj->getId() ,'integer')." ";
386  $res = $ilDB->manipulate($query);
387 
388  $this->__read();
389 
390  return true;
391  }
global $ilDB
+ Here is the call graph for this function:

◆ setActive()

ilCourseObjective::setActive (   $a_stat)

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

Referenced by __read().

204  {
205  $this->active = $a_stat;
206  }
+ Here is the caller graph for this function:

◆ setDescription()

ilCourseObjective::setDescription (   $a_description)

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

Referenced by __read().

238  {
239  $this->description = $a_description;
240  }
+ Here is the caller graph for this function:

◆ setObjectiveId()

ilCourseObjective::setObjectiveId (   $a_objective_id)

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

Referenced by __read().

246  {
247  $this->objective_id = $a_objective_id;
248  }
+ Here is the caller graph for this function:

◆ setPasses()

ilCourseObjective::setPasses (   $a_passes)

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

Referenced by __read().

214  {
215  $this->passes = $a_passes;
216  }
+ Here is the caller graph for this function:

◆ setPosition()

ilCourseObjective::setPosition (   $a_pos)

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

256  {
257  $this->position = $a_pos;
258  }

◆ setTitle()

ilCourseObjective::setTitle (   $a_title)

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

Referenced by __read().

230  {
231  $this->title = $a_title;
232  }
+ Here is the caller graph for this function:

◆ toXml()

ilCourseObjective::toXml ( ilXmlWriter  $writer)

write objective xml

Parameters
ilXmlWriter$writer

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

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

586  {
587  $writer->xmlStartTag(
588  'Objective',
589  array(
590  'online' => (int) $this->isActive(),
591  'position' => (int) $this->position,
592  'id' => (int) $this->getObjectiveId()
593  )
594  );
595  $writer->xmlElement('Title',array(), $this->getTitle());
596  $writer->xmlElement('Description',array(), $this->getDescription());
597 
598  // materials
599  include_once './Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
600  $materials = new ilCourseObjectiveMaterials($this->getObjectiveId());
601  $materials->toXml($writer);
602 
603  // test/questions
604  include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
606  $test->toXml($writer);
607 
608  include_once './Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
609  $assignments = ilLOTestAssignments::getInstance($this->course_obj->getId());
610  $assignments->toXml($writer, $this->getObjectiveId());
611 
612  include_once './Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php';
614 
615  $writer->xmlEndTag('Objective');
616  }
static getInstance($a_container_id)
Get instance by container id.
static toXml(ilXmlWriter $writer, $a_objective_id)
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.
xmlElement($tag, $attrs=NULL, $data=Null, $encode=TRUE, $escape=TRUE)
Writes a basic element (no children, just textual content)
xmlEndTag($tag)
Writes an endtag.
class ilCourseObjectiveMaterials
class ilcourseobjectiveQuestion
$test
Definition: Utf8Test.php:85
+ Here is the call graph for this function:

◆ update()

ilCourseObjective::update ( )

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

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

289  {
290  global $ilDB;
291 
292  // begin-patch lok
293  $query = "UPDATE crs_objectives ".
294  "SET title = ".$ilDB->quote($this->getTitle() ,'text').", ".
295  'active = '.$ilDB->quote($this->isActive(),'integer').', '.
296  "description = ".$ilDB->quote($this->getDescription() ,'text').", ".
297  'passes = '.$ilDB->quote($this->getPasses(),'integer').' '.
298  "WHERE objective_id = ".$ilDB->quote($this->getObjectiveId() ,'integer')." ".
299  "AND crs_id = ".$ilDB->quote($this->course_obj->getId() ,'integer')." ";
300  $res = $ilDB->manipulate($query);
301  // end-patch lok
302 
303  return true;
304  }
global $ilDB
+ Here is the call graph for this function:

◆ validate()

ilCourseObjective::validate ( )

validate

public

Parameters

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

References getTitle().

331  {
332  return (bool) strlen($this->getTitle());
333  }
+ Here is the call graph for this function:

◆ writePosition()

ilCourseObjective::writePosition (   $a_position)

write position

public

Parameters
intnew position
Returns

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

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

314  {
315  global $ilDB;
316 
317  $query = "UPDATE crs_objectives ".
318  "SET position = ".$this->db->quote((string) $a_position ,'integer')." ".
319  "WHERE objective_id = ".$this->db->quote($this->getObjectiveId() ,'integer')." ";
320  $res = $ilDB->manipulate($query);
321  }
global $ilDB
+ 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 getCourse(), and ilCourseObjective().

◆ $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: