ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 $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 {
40 $this->__read();
41 }
42 }
global $ilDB

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

+ Here is the call graph for this function:

Member Function Documentation

◆ __getCreated()

ilCourseObjective::__getCreated ( )

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

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

◆ __getLastPosition()

ilCourseObjective::__getLastPosition ( )

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

507 {
508 global $ilDB;
509
510 $query = "SELECT MAX(position) pos FROM crs_objectives ".
511 "WHERE crs_id = ".$ilDB->quote($this->course_obj->getId() ,'integer')." ";
512
513 $res = $this->db->query($query);
514 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
515 {
516 return $row->pos;
517 }
518 return 0;
519 }

References $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 477 of file class.ilCourseObjective.php.

478 {
479 switch($this->course_obj->getOrderType())
480 {
482 return 'ORDER BY position';
483
485 return 'ORDER BY title';
486
488 return 'ORDER BY create';
489 }
490 return false;
491 }

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

◆ __getPosition()

ilCourseObjective::__getPosition ( )

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

435 {
436 return $this->position;
437 }

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

+ Here is the caller graph for this function:

◆ __read()

ilCourseObjective::__read ( )

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

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

References $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 438 of file class.ilCourseObjective.php.

439 {
440 $this->created = $a_created;
441 }

Referenced by __read().

+ Here is the caller graph for this function:

◆ __setPosition()

ilCourseObjective::__setPosition (   $a_position)

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

431 {
432 $this->position = $a_position;
433 }

Referenced by __read().

+ Here is the caller graph for this function:

◆ __updateTop()

ilCourseObjective::__updateTop ( )

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

494 {
495 global $ilDB;
496
497 $query = "UPDATE crs_objectives ".
498 "SET position = position - 1 ".
499 "WHERE position > ".$ilDB->quote($this->__getPosition() ,'integer')." ".
500 "AND crs_id = ".$ilDB->quote($this->course_obj->getId() ,'integer')." ";
501 $res = $ilDB->manipulate($query);
502
503 return true;
504 }

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

+ Here is the call graph for this function:

◆ _deleteAll()

static ilCourseObjective::_deleteAll (   $course_id)
static

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

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

84 {
85 return count(ilCourseObjective::_getObjectiveIds($a_obj_id,$a_activated_only));
86 }

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 523 of file class.ilCourseObjective.php.

524 {
525 global $ilDB;
526
527 if($a_activated_only)
528 {
529 $query = "SELECT objective_id FROM crs_objectives ".
530 "WHERE crs_id = ".$ilDB->quote($course_id ,'integer')." ".
531 'AND active = '.$ilDB->quote(1,'integer').' '.
532 "ORDER BY position";
533 }
534 else
535 {
536 $query = "SELECT objective_id FROM crs_objectives ".
537 "WHERE crs_id = ".$ilDB->quote($course_id ,'integer')." ".
538 "ORDER BY position";
539 }
540
541 $res = $ilDB->query($query);
542 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
543 {
544 $ids[] = $row->objective_id;
545 }
546
547 return $ids ? $ids : array();
548 }

References $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 60 of file class.ilCourseObjective.php.

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

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

References $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 340 of file class.ilCourseObjective.php.

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

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

+ Here is the call graph for this function:

◆ getCourse()

ilCourseObjective::getCourse ( )
Returns
ilObjCourse

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

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

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 }

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 132 of file class.ilCourseObjective.php.

133 {
134 global $ilLog;
135
136 ilLoggerFactory::getLogger('crs')->debug('Start cloning learning objectives');
137
138 $query = "SELECT * FROM crs_objectives ".
139 "WHERE crs_id = ".$this->db->quote($this->course_obj->getId() ,'integer').' '.
140 "ORDER BY position ";
141 $res = $this->db->query($query);
142 if(!$res->numRows())
143 {
144 ilLoggerFactory::getLogger('crs')->debug('.. no objectives found');
145 return true;
146 }
147
148 if(!is_object($new_course = ilObjectFactory::getInstanceByRefId($a_target_id,false)))
149 {
150 ilLoggerFactory::getLogger('crs')->warning('Cannot create course instance');
151 return true;
152 }
153 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
154 {
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 );
174 $random_i->copy($a_copy_id, $new_course->getId(), $objective_id);
175
176 $random_q = new ilLORandomTestQuestionPools(
177 $this->getCourse()->getId(),
178 $row->objective_id,
180 );
181 $random_q->copy($a_copy_id, $new_course->getId(), $objective_id);
182
183 include_once './Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
184 $assignments = ilLOTestAssignments::getInstance($this->course_obj->getId());
185 $assignment_it = $assignments->getAssignmentByObjective($row->objective_id, ilLOSettings::TYPE_TEST_INITIAL);
186 if($assignment_it)
187 {
188 $assignment_it->cloneSettings($a_copy_id, $new_course->getId(), $objective_id);
189 }
190
191 $assignment_qt = $assignments->getAssignmentByObjective($row->objective_id, ilLOSettings::TYPE_TEST_QUALIFIED);
192 if($assignment_qt)
193 {
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 $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 88 of file class.ilCourseObjective.php.

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

References $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 102 of file class.ilCourseObjective.php.

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

References $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 398 of file class.ilCourseObjective.php.

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

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

+ Here is the call graph for this function:

◆ moveUp()

ilCourseObjective::moveUp ( )

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

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

References $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 590 of file class.ilCourseObjective.php.

591 {
592 $writer->xmlStartTag(
593 'Objective',
594 array(
595 'online' => (int) $this->isActive(),
596 'position' => (int) $this->position,
597 'id' => (int) $this->getObjectiveId()
598 )
599 );
600 $writer->xmlElement('Title',array(), $this->getTitle());
601 $writer->xmlElement('Description',array(), $this->getDescription());
602
603 // materials
604 include_once './Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
605 $materials = new ilCourseObjectiveMaterials($this->getObjectiveId());
606 $materials->toXml($writer);
607
608 // test/questions
609 include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
611 $test->toXml($writer);
612
613 include_once './Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
614 $assignments = ilLOTestAssignments::getInstance($this->course_obj->getId());
615 $assignments->toXml($writer, $this->getObjectiveId());
616
617 include_once './Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php';
619
620 $writer->xmlEndTag('Objective');
621 }
$test
Definition: Utf8Test.php:84
static toXml(ilXmlWriter $writer, $a_objective_id)
xmlEndTag($tag)
Writes an endtag.
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)

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 293 of file class.ilCourseObjective.php.

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

References $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 335 of file class.ilCourseObjective.php.

336 {
337 return (bool) strlen($this->getTitle());
338 }

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 318 of file class.ilCourseObjective.php.

319 {
320 global $ilDB;
321
322 $query = "UPDATE crs_objectives ".
323 "SET position = ".$this->db->quote((string) $a_position ,'integer')." ".
324 "WHERE objective_id = ".$this->db->quote($this->getObjectiveId() ,'integer')." ";
325 $res = $ilDB->manipulate($query);
326 }

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