ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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.

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

31  {
32  global $ilDB;
33 
34  $this->db = $ilDB;
35  $this->course_obj = $course_obj;
36 
37  $this->objective_id = $a_objective_id;
38  if ($this->objective_id) {
39  $this->__read();
40  }
41  }
global $ilDB
+ Here is the call graph for this function:

Member Function Documentation

◆ __getCreated()

ilCourseObjective::__getCreated ( )

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

429  {
430  return $this->created;
431  }

◆ __getLastPosition()

ilCourseObjective::__getLastPosition ( )

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

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

Referenced by add(), and moveDown().

490  {
491  global $ilDB;
492 
493  $query = "SELECT MAX(position) pos FROM crs_objectives " .
494  "WHERE crs_id = " . $ilDB->quote($this->course_obj->getId(), 'integer') . " ";
495 
496  $res = $this->db->query($query);
497  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
498  return $row->pos;
499  }
500  return 0;
501  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the caller graph for this function:

◆ __getOrderColumn()

ilCourseObjective::__getOrderColumn ( )

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

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

462  {
463  switch ($this->course_obj->getOrderType()) {
465  return 'ORDER BY position';
466 
468  return 'ORDER BY title';
469 
471  return 'ORDER BY create';
472  }
473  return false;
474  }

◆ __getPosition()

ilCourseObjective::__getPosition ( )

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

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

421  {
422  return $this->position;
423  }
+ Here is the caller graph for this function:

◆ __read()

ilCourseObjective::__read ( )

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

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

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

435  {
436  global $ilDB;
437 
438  if ($this->getObjectiveId()) {
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') . " ";
442 
443 
444  $res = $this->db->query($query);
445  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
446  // begin-patch lok
447  $this->setActive($row->active);
448  $this->setPasses($row->passes);
449  // end-patch lok
450  $this->setObjectiveId($row->objective_id);
451  $this->setTitle($row->title);
452  $this->setDescription($row->description);
453  $this->__setPosition($row->position);
454  $this->__setCreated($row->created);
455  }
456  return true;
457  }
458  return false;
459  }
setObjectiveId($a_objective_id)
foreach($_POST as $key=> $value) $res
$query
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 424 of file class.ilCourseObjective.php.

Referenced by __read().

425  {
426  $this->created = $a_created;
427  }
+ Here is the caller graph for this function:

◆ __setPosition()

ilCourseObjective::__setPosition (   $a_position)

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

Referenced by __read().

417  {
418  $this->position = $a_position;
419  }
+ Here is the caller graph for this function:

◆ __updateTop()

ilCourseObjective::__updateTop ( )

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

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

477  {
478  global $ilDB;
479 
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') . " ";
484  $res = $ilDB->manipulate($query);
485 
486  return true;
487  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:

◆ _deleteAll()

static ilCourseObjective::_deleteAll (   $course_id)
static

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

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

Referenced by ilObjCourse\delete().

530  {
531  global $ilDB;
532 
533  // begin-patch lok
534  $ids = ilCourseObjective::_getObjectiveIds($course_id, false);
535  // end-patch lok
536  if (!count($ids)) {
537  return true;
538  }
539 
540  $in = $ilDB->in('objective_id', $ids, false, 'integer');
541 
542 
543  $query = "DELETE FROM crs_objective_lm WHERE " . $in;
544  $res = $ilDB->manipulate($query);
545 
546  $query = "DELETE FROM crs_objective_tst WHERE " . $in;
547  $res = $ilDB->manipulate($query);
548 
549  $query = "DELETE FROM crs_objective_qst WHERE " . $in;
550  $res = $ilDB->manipulate($query);
551 
552  $query = "DELETE FROM crs_objectives WHERE crs_id = " . $ilDB->quote($course_id, 'integer');
553  $res = $ilDB->manipulate($query);
554 
555  // refresh learning progress status after deleting objectives
556  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
558 
559  return true;
560  }
static _getObjectiveIds($course_id, $a_activated_only=false)
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
foreach($_POST as $key=> $value) $res
$query
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37
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 81 of file class.ilCourseObjective.php.

References _getObjectiveIds().

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

82  {
83  return count(ilCourseObjective::_getObjectiveIds($a_obj_id, $a_activated_only));
84  }
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 505 of file class.ilCourseObjective.php.

References $ilDB, $query, $res, $row, array, 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().

506  {
507  global $ilDB;
508 
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') . ' ' .
513  "ORDER BY position";
514  } else {
515  $query = "SELECT objective_id FROM crs_objectives " .
516  "WHERE crs_id = " . $ilDB->quote($course_id, 'integer') . " " .
517  "ORDER BY position";
518  }
519 
520  $res = $ilDB->query($query);
521  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
522  $ids[] = $row->objective_id;
523  }
524 
525  return $ids ? $ids : array();
526  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
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 59 of file class.ilCourseObjective.php.

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

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

60  {
61  global $ilDB;
62 
63  $query = "SELECT crs_id FROM crs_objectives " .
64  "WHERE objective_id = " . $ilDB->quote($a_objective_id, 'integer');
65  $res = $ilDB->query($query);
66  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
67  return $row->crs_id;
68  }
69  return false;
70  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the caller graph for this function:

◆ add()

ilCourseObjective::add ( )

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

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

257  {
258  global $ilDB;
259 
260  // begin-patch lok
261  $next_id = $ilDB->nextId('crs_objectives');
262  $query = "INSERT INTO crs_objectives (crs_id,objective_id,active,title,description,position,created,passes) " .
263  "VALUES( " .
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') . ", " .
268  $ilDB->quote($this->getDescription(), 'text') . ", " .
269  $ilDB->quote($this->__getLastPosition() + 1, 'integer') . ", " .
270  $ilDB->quote(time(), 'integer') . ", " .
271  $ilDB->quote($this->getPasses(), 'integer') . ' ' .
272  ")";
273  $res = $ilDB->manipulate($query);
274  // end-patch lok
275 
276  // refresh learning progress status after adding new objective
277  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
278  ilLPStatusWrapper::_refreshStatus($this->course_obj->getId());
279 
280  return $this->objective_id = $next_id;
281  }
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
foreach($_POST as $key=> $value) $res
$query
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:

◆ arePassesLimited()

ilCourseObjective::arePassesLimited ( )

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

219  {
220  return $this->passes > 0;
221  }

◆ delete()

ilCourseObjective::delete ( )

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

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

331  {
332  global $ilDB;
333 
334  include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
335 
336  $tmp_obj_qst = new ilCourseObjectiveQuestion($this->getObjectiveId());
337  $tmp_obj_qst->deleteAll();
338 
339  include_once './Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
340 
341  $tmp_obj_lm = new ilCourseObjectiveMaterials($this->getObjectiveId());
342  $tmp_obj_lm->deleteAll();
343 
344 
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') . " ";
348  $res = $ilDB->manipulate($query);
349 
350  // refresh learning progress status after deleting objective
351  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
352  ilLPStatusWrapper::_refreshStatus($this->course_obj->getId());
353 
354  return true;
355  }
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
class ilCourseObjectiveMaterials
foreach($_POST as $key=> $value) $res
$query
global $ilDB
class ilcourseobjectiveQuestion
+ Here is the call graph for this function:

◆ getCourse()

ilCourseObjective::getCourse ( )
Returns
ilObjCourse

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

References $course_obj.

Referenced by ilClone().

47  {
48  return $this->course_obj;
49  }
+ Here is the caller graph for this function:

◆ getDescription()

ilCourseObjective::getDescription ( )

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

References $description.

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

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

◆ getObjectiveId()

ilCourseObjective::getObjectiveId ( )

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

References $objective_id.

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

245  {
246  return $this->objective_id;
247  }
+ Here is the caller graph for this function:

◆ getPasses()

ilCourseObjective::getPasses ( )

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

References $passes.

Referenced by add(), and update().

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

◆ getTitle()

ilCourseObjective::getTitle ( )

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

References $title.

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

229  {
230  return $this->title;
231  }
+ 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 125 of file class.ilCourseObjective.php.

References $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.

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

◆ isActive()

ilCourseObjective::isActive ( )

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

References $active.

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

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

◆ lookupMaxPasses()

static ilCourseObjective::lookupMaxPasses (   $a_objective_id)
static

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

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

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

87  {
88  global $ilDB;
89 
90  $query = 'SELECT passes from crs_objectives ' .
91  'WHERE objective_id = ' . $ilDB->quote($a_objective_id, 'integer');
92  $res = $ilDB->query($query);
93  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
94  return (int) $row->passes;
95  }
96  return 0;
97  }
foreach($_POST as $key=> $value) $res
$query
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 99 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().

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

◆ moveDown()

ilCourseObjective::moveDown ( )

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

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

387  {
388  global $ilDB;
389 
390  if (!$this->getObjectiveId()) {
391  return false;
392  }
393  // Stop if position is last
394  if ($this->__getPosition() == $this->__getLastPosition()) {
395  return false;
396  }
397 
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') . " ";
402  $res = $ilDB->manipulate($query);
403 
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') . " ";
408  $res = $ilDB->manipulate($query);
409 
410  $this->__read();
411 
412  return true;
413  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:

◆ moveUp()

ilCourseObjective::moveUp ( )

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

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

358  {
359  global $ilDB;
360 
361  if (!$this->getObjectiveId()) {
362  return false;
363  }
364  // Stop if position is first
365  if ($this->__getPosition() == 1) {
366  return false;
367  }
368 
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') . " ";
373  $res = $ilDB->manipulate($query);
374 
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') . " ";
379  $res = $ilDB->manipulate($query);
380 
381  $this->__read();
382 
383  return true;
384  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:

◆ setActive()

ilCourseObjective::setActive (   $a_stat)

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

Referenced by __read().

199  {
200  $this->active = $a_stat;
201  }
+ Here is the caller graph for this function:

◆ setDescription()

ilCourseObjective::setDescription (   $a_description)

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

Referenced by __read().

233  {
234  $this->description = $a_description;
235  }
+ Here is the caller graph for this function:

◆ setObjectiveId()

ilCourseObjective::setObjectiveId (   $a_objective_id)

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

Referenced by __read().

241  {
242  $this->objective_id = $a_objective_id;
243  }
+ Here is the caller graph for this function:

◆ setPasses()

ilCourseObjective::setPasses (   $a_passes)

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

Referenced by __read().

209  {
210  $this->passes = $a_passes;
211  }
+ Here is the caller graph for this function:

◆ setPosition()

ilCourseObjective::setPosition (   $a_pos)

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

251  {
252  $this->position = $a_pos;
253  }

◆ setTitle()

ilCourseObjective::setTitle (   $a_title)

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

Referenced by __read().

225  {
226  $this->title = $a_title;
227  }
+ Here is the caller graph for this function:

◆ toXml()

ilCourseObjective::toXml ( ilXmlWriter  $writer)

write objective xml

Parameters
ilXmlWriter$writer

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

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

568  {
569  $writer->xmlStartTag(
570  'Objective',
571  array(
572  'online' => (int) $this->isActive(),
573  'position' => (int) $this->position,
574  'id' => (int) $this->getObjectiveId()
575  )
576  );
577  $writer->xmlElement('Title', array(), $this->getTitle());
578  $writer->xmlElement('Description', array(), $this->getDescription());
579 
580  // materials
581  include_once './Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
582  $materials = new ilCourseObjectiveMaterials($this->getObjectiveId());
583  $materials->toXml($writer);
584 
585  // test/questions
586  include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
588  $test->toXml($writer);
589 
590  include_once './Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
591  $assignments = ilLOTestAssignments::getInstance($this->course_obj->getId());
592  $assignments->toXml($writer, $this->getObjectiveId());
593 
594  include_once './Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php';
596 
597  $writer->xmlEndTag('Objective');
598  }
static getInstance($a_container_id)
Get instance by container id.
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
static toXml(ilXmlWriter $writer, $a_objective_id)
xmlEndTag($tag)
Writes an endtag.
class ilCourseObjectiveMaterials
Create styles array
The data for the language used.
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
class ilcourseobjectiveQuestion
$test
Definition: Utf8Test.php:84
+ Here is the call graph for this function:

◆ update()

ilCourseObjective::update ( )

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

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

284  {
285  global $ilDB;
286 
287  // begin-patch lok
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') . " ";
295  $res = $ilDB->manipulate($query);
296  // end-patch lok
297 
298  return true;
299  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:

◆ validate()

ilCourseObjective::validate ( )

validate

public

Parameters

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

References getTitle().

326  {
327  return (bool) strlen($this->getTitle());
328  }
+ Here is the call graph for this function:

◆ writePosition()

ilCourseObjective::writePosition (   $a_position)

write position

public

Parameters
intnew position
Returns

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

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

309  {
310  global $ilDB;
311 
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') . " ";
315  $res = $ilDB->manipulate($query);
316  }
foreach($_POST as $key=> $value) $res
$query
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 __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: