ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilObjectLP Class Reference
+ Inheritance diagram for ilObjectLP:
+ Collaboration diagram for ilObjectLP:

Public Member Functions

 resetCaches ()
 
 isAnonymized ()
 
 getDefaultMode ()
 
 getValidModes ()
 
 getCurrentMode ()
 
 isActive ()
 
 getModeText ($a_mode)
 
 getModeInfoText ($a_mode)
 
 getCollectionInstance ()
 
 getMembers ($a_search=true)
 
 resetLPDataForCompleteObject ($a_recursive=true)
 
 resetLPDataForUserIds (array $a_user_ids, $a_recursive=true)
 
 handleToTrash ()
 
 handleDelete ()
 

Static Public Member Functions

static getInstance ($a_obj_id)
 
static isSupportedObjectType ($a_type)
 
static handleMove ($a_source_ref_id)
 

Protected Member Functions

 __construct ($a_obj_id)
 
 resetCustomLPDataForUserIds (array $a_user_ids, $a_recursive=true)
 
 gatherLPUsers ()
 
 updateParentCollections ()
 

Protected Attributes

 $obj_id
 
 $collection_instance
 
 $mode
 

Detailed Description

Definition at line 14 of file class.ilObjectLP.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjectLP::__construct (   $a_obj_id)
protected

Reimplemented in ilPluginLP.

Definition at line 20 of file class.ilObjectLP.php.

21 {
22 $this->obj_id = (int)$a_obj_id;
23 }

Member Function Documentation

◆ gatherLPUsers()

ilObjectLP::gatherLPUsers ( )
protected

Definition at line 318 of file class.ilObjectLP.php.

319 {
320 include_once "Services/Tracking/classes/class.ilLPMarks.php";
321 $user_ids = ilLPMarks::_getAllUserIds($this->obj_id);
322
323 include_once "Services/Tracking/classes/class.ilChangeEvent.php";
324 $user_ids = array_merge($user_ids, ilChangeEvent::_getAllUserIds($this->obj_id));
325
326 return $user_ids;
327 }
static _getAllUserIds($a_obj_id)
static _getAllUserIds($a_obj_id)

References ilChangeEvent\_getAllUserIds(), and ilLPMarks\_getAllUserIds().

Referenced by resetLPDataForCompleteObject().

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

◆ getCollectionInstance()

ilObjectLP::getCollectionInstance ( )

Definition at line 193 of file class.ilObjectLP.php.

194 {
195 // :TODO: factory if not plugin ?!
196 // => move to ilLPCollection::getInstance() ?!
197
198 if($this->collection_instance === null)
199 {
200 $path = "Services/Tracking/classes/collection/";
201
202 $mode = $this->getCurrentMode();
203 switch($mode)
204 {
207 include_once $path."class.ilLPCollectionOfRepositoryObjects.php";
208 $this->collection_instance = new ilLPCollectionOfRepositoryObjects($this->obj_id, $mode);
209 break;
210
212 include_once $path."class.ilLPCollectionOfObjectives.php";
213 $this->collection_instance = new ilLPCollectionOfObjectives($this->obj_id, $mode);
214 break;
215
217 include_once $path."class.ilLPCollectionOfSCOs.php";
218 $this->collection_instance = new ilLPCollectionOfSCOs($this->obj_id, $mode);
219 break;
220
223 include_once $path."class.ilLPCollectionOfLMChapters.php";
224 $this->collection_instance = new ilLPCollectionOfLMChapters($this->obj_id, $mode);
225 break;
226
227 default:
228 $this->collection_instance = false;
229 break;
230 }
231 }
232
234 }
LP collection of learning module chapters.
$path
Definition: index.php:22

References $collection_instance, $mode, $path, getCurrentMode(), ilLPObjSettings\LP_MODE_COLLECTION, ilLPObjSettings\LP_MODE_COLLECTION_MANUAL, ilLPObjSettings\LP_MODE_COLLECTION_TLT, ilLPObjSettings\LP_MODE_MANUAL_BY_TUTOR, ilLPObjSettings\LP_MODE_OBJECTIVES, and ilLPObjSettings\LP_MODE_SCORM.

Referenced by handleDelete().

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

◆ getCurrentMode()

ilObjectLP::getCurrentMode ( )

Reimplemented in ilCourseLP, ilScormLP, and ilPluginLP.

Definition at line 150 of file class.ilObjectLP.php.

151 {
152 if($this->mode === null)
153 {
154 $mode = ilLPObjSettings::_lookupDBMode($this->obj_id);
155 if($mode === null)
156 {
157 $mode = $this->getDefaultMode();
158 }
159 $this->mode = (int)$mode;
160 }
161
162 return $this->mode;
163 }
static _lookupDBMode($a_obj_id)

References $mode, ilLPObjSettings\_lookupDBMode(), and getDefaultMode().

Referenced by getCollectionInstance(), and isActive().

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

◆ getDefaultMode()

ilObjectLP::getDefaultMode ( )

Reimplemented in ilCourseLP, ilExerciseLP, ilFolderLP, ilGroupLP, ilHTMLLearningModuleLP, ilLearningModuleLP, ilScormLP, ilSessionLP, ilTestLP, and ilPluginLP.

Definition at line 140 of file class.ilObjectLP.php.

References ilLPObjSettings\LP_MODE_UNDEFINED.

Referenced by getCurrentMode().

+ Here is the caller graph for this function:

◆ getInstance()

static ilObjectLP::getInstance (   $a_obj_id)
static

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

26 {
27 global $objDefinition;
28
29 static $instances = array();
30
31 if(!isset($instances[$a_obj_id]))
32 {
33 $type = ilObject::_lookupType($a_obj_id);
34
35 // see self::isSupportedObjectType()
36
37 switch($type)
38 {
39 // container
40
41 case "crs":
42 include_once "Modules/Course/classes/class.ilCourseLP.php";
43 $instance = new ilCourseLP($a_obj_id);
44 break;
45
46 case "grp":
47 include_once "Modules/Group/classes/class.ilGroupLP.php";
48 $instance = new ilGroupLP($a_obj_id);
49 break;
50
51 case "fold":
52 include_once "Modules/Folder/classes/class.ilFolderLP.php";
53 $instance = new ilFolderLP($a_obj_id);
54 break;
55
56
57 // learning resources
58
59 case "lm":
60 include_once "Modules/LearningModule/classes/class.ilLearningModuleLP.php";
61 $instance = new ilLearningModuleLP($a_obj_id);
62 break;
63
64 case "htlm":
65 include_once "Modules/HTMLLearningModule/classes/class.ilHTMLLearningModuleLP.php";
66 $instance = new ilHTMLLearningModuleLP($a_obj_id);
67 break;
68
69 case "sahs":
70 include_once "Modules/ScormAicc/classes/class.ilScormLP.php";
71 $instance = new ilScormLP($a_obj_id);
72 break;
73
74
75 // misc
76
77 case "tst":
78 include_once "Modules/Test/classes/class.ilTestLP.php";
79 $instance = new ilTestLP($a_obj_id);
80 break;
81
82 case "exc":
83 include_once "Modules/Exercise/classes/class.ilExerciseLP.php";
84 $instance = new ilExerciseLP($a_obj_id);
85 break;
86
87 case "sess":
88 include_once "Modules/Session/classes/class.ilSessionLP.php";
89 $instance = new ilSessionLP($a_obj_id);
90 break;
91
92 // plugin
93 case $objDefinition->isPluginTypeName($type):
94 include_once "Services/Component/classes/class.ilPluginLP.php";
95 $instance = new ilPluginLP($a_obj_id);
96 break;
97
98 default:
99 // :TODO: should we return anything?
100 $instance = new self($a_obj_id);
101 break;
102 }
103
104 $instances[$a_obj_id] = $instance;
105 }
106
107 return $instances[$a_obj_id];
108 }
static _lookupType($a_id, $a_reference=false)
lookup object type

References ilObject\_lookupType().

Referenced by ilLearningProgressBaseGUI\__appendLPDetails(), ilLPListOfSettingsGUI\__construct(), ilTrSummaryTableGUI\__construct(), ilLPProgressTableGUI\__construct(), ilLPTableBaseGUI\__construct(), ilLearningProgressGUI\__getNextClass(), ilLPListOfObjectsGUI\__initDetails(), ilLPListOfProgressGUI\__initDetails(), ilLearningProgressBaseGUI\__readItemStatusInfo(), ilLearningProgressBaseGUI\__setSubTabs(), ilLearningProgressBaseGUI\__showObjectDetails(), ilLPStatusFactory\_getClassById(), ilLPStatusCollection\_getCompleted(), ilLPStatusCollection\_getFailed(), ilLPStatusCollection\_getInProgress(), ilLPStatusFactory\_getInstance(), ilLPStatusCollection\_getStatusInfo(), ilLPStatusCollectionManual\_getStatusInfo(), ilLPStatusSCORM\_getStatusInfo(), ilLPStatusCollectionTLT\_getStatusInfo(), ilLPStatusCollectionManual\_setObjectStatus(), ilTimingCache\_showWarning(), ilConditionHandlerGUI\assign(), ilLearningProgressAccess\checkAccess(), ilLMExplorerGUI\checkLPIcon(), ilContainer\cloneDependencies(), ilLPStatusSCORM\determinePercentage(), ilLPStatusCollection\determineStatus(), ilLPStatusSCORM\determineStatus(), ilLearningProgressGUI\editManual(), ilLPProgressTableGUI\fillRow(), ilLPCronObjectStatistics\gatherCourseLPData(), ilSCORMCertificateAdapter\getCertificateVariablesDescription(), ilSCORMCertificateAdapter\getCertificateVariablesForPresentation(), ilSCORMCertificateAdapter\getCertificateVariablesForPreview(), getMembers(), ilTrQuery\getObjectIds(), ilTrQuery\getObjectsStatusForUser(), ilLPTableBaseGUI\getSelectableUserColumns(), ilObjSCORMInitData\getStatus(), ilTrQuery\getSubItemsStatusForUser(), ilTrQuery\getSubTree(), ilCourseAppEventListener\handleEvent(), ilTrackingAppEventListener\handleEvent(), ilSCORMOfflineMode\il2sop(), ilLearningProgressBaseGUI\ilLearningProgressBaseGUI(), ilLPObjSettings\ilLPObjSettings(), ilObjSCORM2004LearningModule\importSuccess(), ilObjSCORMLearningModule\importSuccess(), ilObjCourseGUI\initAttendanceList(), ilObjGroupGUI\initAttendanceList(), ilLearningProgressGUI\initCollectionManualForm(), ilObjCourseGUI\initEditForm(), ilLearningProgressBaseGUI\initEditUserForm(), ilTrUserObjectsPropsTableGUI\initFilter(), ilConditionHandlerGUI\initFormCondition(), ilLPStatusPlugin\initPluginObj(), ilLPTableBaseGUI\isPercentageAvailable(), ilSCORMTrackingItems\markedLearningStatusForExportSelected(), ilObjCourseGUI\membersObject(), ilObjGroupGUI\membersObject(), ilLPCollectionOfRepositoryObjects\parseTableGUIItem(), ilLPTableBaseGUI\parseTitle(), ilLPStatus\preloadListGUIData(), ilObjTest\removeTestResults(), resetLPDataForUserIds(), ilCourseObjectiveResult\resetTestForUser(), ilInfoScreenGUI\saveProgress(), ilLPTableBaseGUI\searchFilterListener(), ilObjContentObjectGUI\setilLMMenu(), ilInfoScreenGUI\showLearningProgress(), ilLearningProgressGUI\showtlt(), ilConditionHandlerGUI\updateCondition(), ilObjCourseGUI\updateLPFromStatus(), ilLearningProgressGUI\updateManual(), and ilLPCollectionOfRepositoryObjects\validateEntry().

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

◆ getMembers()

ilObjectLP::getMembers (   $a_search = true)

Reimplemented in ilCourseLP, and ilGroupLP.

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

242 {
243 global $tree;
244
245 if(!$a_search)
246 {
247 return;
248 }
249
250 $ref_ids = ilObject::_getAllReferences($this->obj_id);
251 $ref_id = current($ref_ids);
252
253 // walk path to find parent with specific members
254 $path = $tree->getPathId($ref_id);
255 array_pop($path);
256 foreach(array_reverse($path) as $path_ref_id)
257 {
258 $olp = self::getInstance(ilObject::_lookupObjId($path_ref_id));
259 $all = $olp->getMembers(false);
260 if(is_array($all))
261 {
262 return $all;
263 }
264 }
265 }
static getInstance($a_obj_id)
static _lookupObjId($a_id)
static _getAllReferences($a_id)
get all reference ids of object
$ref_id
Definition: sahs_server.php:39

References $path, $ref_id, ilObject\_getAllReferences(), ilObject\_lookupObjId(), and getInstance().

+ Here is the call graph for this function:

◆ getModeInfoText()

ilObjectLP::getModeInfoText (   $a_mode)

Definition at line 183 of file class.ilObjectLP.php.

184 {
185 return ilLPObjSettings::_mode2InfoText($a_mode);
186 }
static _mode2InfoText($a_mode)

References ilLPObjSettings\_mode2InfoText().

+ Here is the call graph for this function:

◆ getModeText()

ilObjectLP::getModeText (   $a_mode)

Definition at line 178 of file class.ilObjectLP.php.

179 {
180 return ilLPObjSettings::_mode2Text($a_mode);
181 }
static _mode2Text($a_mode)

References ilLPObjSettings\_mode2Text().

+ Here is the call graph for this function:

◆ getValidModes()

ilObjectLP::getValidModes ( )

Reimplemented in ilCourseLP, ilExerciseLP, ilFolderLP, ilGroupLP, ilHTMLLearningModuleLP, ilLearningModuleLP, ilScormLP, ilSessionLP, ilTestLP, and ilPluginLP.

Definition at line 145 of file class.ilObjectLP.php.

146 {
147 return array();
148 }

◆ handleDelete()

ilObjectLP::handleDelete ( )
final

Definition at line 397 of file class.ilObjectLP.php.

398 {
399 include_once "Services/Tracking/classes/class.ilLPMarks.php";
400 ilLPMarks::deleteObject($this->obj_id);
401
402 include_once "Services/Tracking/classes/class.ilChangeEvent.php";
403 ilChangeEvent::_delete($this->obj_id);
404
405 $collection = $this->getCollectionInstance();
406 if($collection)
407 {
408 $collection->delete();
409 }
410
412 }
static _delete($a_obj_id)
Delete object entries.
static deleteObject($a_obj_id)
Delete object.

References ilChangeEvent\_delete(), ilLPMarks\deleteObject(), getCollectionInstance(), and updateParentCollections().

+ Here is the call graph for this function:

◆ handleMove()

static ilObjectLP::handleMove (   $a_source_ref_id)
staticfinal

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

335 {
336 global $tree, $ilDB;
337
338 $ref_ids = $tree->getSubTreeIds($a_source_ref_id);
339 $ref_ids[] = $a_source_ref_id;
340
341 // get "parent" path to source node (not including source node)
342 $new_path = $tree->getPathId($a_source_ref_id);
343 array_pop($new_path);
344 $new_path = implode("/", $new_path);
345
346 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
347
348 // find collections with ref_ids
349 $set = $ilDB->query("SELECT DISTINCT(ut_lp_collections.obj_id) obj_id".
350 " FROM object_reference".
351 " JOIN ut_lp_collections ON".
352 " (".$ilDB->in("object_reference.ref_id", $ref_ids, "", "integer").
353 " AND object_reference.ref_id = ut_lp_collections.item_id)");
354 while ($rec = $ilDB->fetchAssoc($set))
355 {
356 if (in_array(ilObject::_lookupType($rec["obj_id"]), array("crs", "grp", "fold")))
357 {
358 $coll_ref_id = ilObject::_getAllReferences($rec["obj_id"]);
359 $coll_ref_id = array_pop($coll_ref_id);
360
361 // #13402
362 if($coll_ref_id == $a_source_ref_id)
363 {
364 continue;
365 }
366
367 // #17703 - collection has also been moved - nothing todo
368 if($tree->isGrandChild($a_source_ref_id, $coll_ref_id))
369 {
370 continue;
371 }
372
373 // get path to collection (including collection "parent")
374 $coll_path = $tree->getPathId($coll_ref_id);
375 $coll_path = implode("/", $coll_path);
376
377 // collection path is not inside new path
378 if(!stristr($new_path, $coll_path))
379 {
380 // delete all items of moved (sub-)tree
381 $query = "DELETE FROM ut_lp_collections".
382 " WHERE obj_id = ".$ilDB->quote($rec["obj_id"], "integer").
383 " AND ".$ilDB->in("item_id", $ref_ids, "", "integer");
384 $ilDB->manipulate($query);
385
386 ilLPStatusWrapper::_refreshStatus($rec["obj_id"]);
387 }
388 }
389 }
390 }
_refreshStatus($a_obj_id, $a_users=null)
Set dirty.
global $ilDB

References $ilDB, $query, ilObject\_getAllReferences(), ilObject\_lookupType(), and ilLPStatusWrapper\_refreshStatus().

Referenced by ilTrackingAppEventListener\handleEvent().

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

◆ handleToTrash()

ilObjectLP::handleToTrash ( )
final

Definition at line 392 of file class.ilObjectLP.php.

393 {
394 $this->updateParentCollections();
395 }

References updateParentCollections().

+ Here is the call graph for this function:

◆ isActive()

ilObjectLP::isActive ( )

Definition at line 165 of file class.ilObjectLP.php.

166 {
167 // :TODO: check LP activation?
168
169 $mode = $this->getCurrentMode();
172 {
173 return false;
174 }
175 return true;
176 }

References $mode, getCurrentMode(), ilLPObjSettings\LP_MODE_DEACTIVATED, and ilLPObjSettings\LP_MODE_UNDEFINED.

+ Here is the call graph for this function:

◆ isAnonymized()

ilObjectLP::isAnonymized ( )

Reimplemented in ilTestLP.

Definition at line 129 of file class.ilObjectLP.php.

130 {
131 // see ilLPCollectionOfRepositoryObjects::validateEntry()
132 return false;
133 }

◆ isSupportedObjectType()

static ilObjectLP::isSupportedObjectType (   $a_type)
static

Definition at line 110 of file class.ilObjectLP.php.

111 {
112 global $objDefinition;
113
114 $valid = array("crs", "grp", "fold", "lm", "htlm", "sahs", "tst", "exc", "sess");
115 if(in_array($a_type, $valid))
116 {
117 return true;
118 }
119
120 return $objDefinition->isPluginTypeName($a_type);
121 }
$valid

References $valid.

Referenced by ilConditionHandler\getOperatorsByTargetType().

+ Here is the caller graph for this function:

◆ resetCaches()

ilObjectLP::resetCaches ( )

Definition at line 123 of file class.ilObjectLP.php.

124 {
125 $this->mode = null;
126 $this->collection_instance = null;
127 }

◆ resetCustomLPDataForUserIds()

ilObjectLP::resetCustomLPDataForUserIds ( array  $a_user_ids,
  $a_recursive = true 
)
protected

Reimplemented in ilTestLP.

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

314 {
315 // this should delete all data that is relevant for the supported LP modes
316 }

Referenced by resetLPDataForUserIds().

+ Here is the caller graph for this function:

◆ resetLPDataForCompleteObject()

ilObjectLP::resetLPDataForCompleteObject (   $a_recursive = true)
final

Definition at line 272 of file class.ilObjectLP.php.

273 {
274 $user_ids = $this->gatherLPUsers();
275 if(sizeof($user_ids))
276 {
277 $this->resetLPDataForUserIds(array_unique($user_ids), $a_recursive);
278 }
279 }
resetLPDataForUserIds(array $a_user_ids, $a_recursive=true)

References gatherLPUsers(), and resetLPDataForUserIds().

+ Here is the call graph for this function:

◆ resetLPDataForUserIds()

ilObjectLP::resetLPDataForUserIds ( array  $a_user_ids,
  $a_recursive = true 
)
final

Definition at line 281 of file class.ilObjectLP.php.

282 {
283 if((bool)$a_recursive &&
284 method_exists($this, "getPossibleCollectionItems")) // #15203
285 {
286 $subitems = $this->getPossibleCollectionItems();
287 if(is_array($subitems))
288 {
289 foreach($subitems as $sub_ref_id)
290 {
291 $olp = self::getInstance(ilObject::_lookupObjId($sub_ref_id));
292 $olp->resetLPDataForUserIds($a_user_ids, false);
293 }
294 }
295 }
296
297 $this->resetCustomLPDataForUserIds($a_user_ids, (bool)$a_recursive);
298
299 include_once "Services/Tracking/classes/class.ilLPMarks.php";
300 ilLPMarks::_deleteForUsers($this->obj_id, $a_user_ids);
301
302 include_once "Services/Tracking/classes/class.ilChangeEvent.php";
303 ilChangeEvent::_deleteReadEventsForUsers($this->obj_id, $a_user_ids);
304
305 // update LP status to get collections up-to-date
306 include_once "Services/Tracking/classes/class.ilLPStatusWrapper.php";
307 foreach($a_user_ids as $user_id)
308 {
309 ilLPStatusWrapper::_updateStatus($this->obj_id, $user_id);
310 }
311 }
static _deleteReadEventsForUsers($a_obj_id, array $a_user_ids)
static _deleteForUsers($a_obj_id, array $a_user_ids)
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_no_raise=false, $a_force_raise=false)
Update status.
resetCustomLPDataForUserIds(array $a_user_ids, $a_recursive=true)

References ilLPMarks\_deleteForUsers(), ilChangeEvent\_deleteReadEventsForUsers(), ilObject\_lookupObjId(), ilLPStatusWrapper\_updateStatus(), getInstance(), and resetCustomLPDataForUserIds().

Referenced by resetLPDataForCompleteObject().

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

◆ updateParentCollections()

ilObjectLP::updateParentCollections ( )
finalprotected

Definition at line 414 of file class.ilObjectLP.php.

415 {
416 global $ilDB;
417
418 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
419
420 // update parent collections?
421 $set = $ilDB->query("SELECT ut_lp_collections.obj_id obj_id FROM ".
422 "object_reference JOIN ut_lp_collections ON ".
423 "(object_reference.obj_id = ".$ilDB->quote($this->obj_id, "integer").
424 " AND object_reference.ref_id = ut_lp_collections.item_id)");
425 while ($rec = $ilDB->fetchAssoc($set))
426 {
427 if (in_array(ilObject::_lookupType($rec["obj_id"]), array("crs", "grp", "fold")))
428 {
429 // remove from parent collection
430 $query = "DELETE FROM ut_lp_collections".
431 " WHERE obj_id = ".$ilDB->quote($rec["obj_id"], "integer").
432 " AND item_id = ".$ilDB->quote($this->obj_id, "integer");
433 $ilDB->manipulate($query);
434
435 ilLPStatusWrapper::_refreshStatus($rec["obj_id"]);
436 }
437 }
438 }

References $ilDB, $query, ilObject\_lookupType(), and ilLPStatusWrapper\_refreshStatus().

Referenced by handleDelete(), and handleToTrash().

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

Field Documentation

◆ $collection_instance

ilObjectLP::$collection_instance
protected

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

Referenced by getCollectionInstance().

◆ $mode

ilObjectLP::$mode
protected

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

Referenced by getCollectionInstance(), getCurrentMode(), and isActive().

◆ $obj_id

ilObjectLP::$obj_id
protected

Definition at line 16 of file class.ilObjectLP.php.


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