ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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)
 
 getSettingsInfo ()
 
 getCollectionInstance ()
 
 getMembers ($a_search=true)
 
 resetLPDataForCompleteObject ($a_recursive=true)
 
 resetLPDataForUserIds (array $a_user_ids, $a_recursive=true)
 
 handleToTrash ()
 
 handleDelete ()
 
 getMailTemplateId ()
 

Static Public Member Functions

static getInstance ($a_obj_id)
 
static getTypeClass ($a_type)
 
static isSupportedObjectType ($a_type)
 
static handleMove ($a_source_ref_id)
 
static getLPMemberships ($a_usr_id, array $a_obj_ids, $a_parent_ref_id=null, $a_mapped_ref_ids=false)
 Get all objects where given user is member (from LP POV) More...
 
static supportsSpentSeconds ($a_obj_type)
 
static supportsMark ($a_obj_type)
 
static supportsMatrixView ($a_obj_type)
 
static getDefaultModes ($a_lp_active)
 Get available type-specific default modes (no administration needed) More...
 
static saveTypeDefaults (array $a_data)
 
static getTypeDefault ($a_type)
 Get current type default. More...
 

Protected Member Functions

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

Static Protected Member Functions

static isLPMember (array &$a_res, $a_usr_id, $a_obj_ids)
 Find (lp-relevant) members for given object ids. More...
 
static findMembershipsByPath (array &$a_res, $a_usr_id, $a_parent_ref_id, array $a_obj_ids, $a_mapped_ref_ids=false)
 Find (lp-relevant) memberships by path. More...
 
static getTypeDefaultFromDB ($a_type)
 

Protected Attributes

 $obj_id
 
 $collection_instance
 
 $mode
 

Static Protected Attributes

static $type_defaults
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilObjectLP::__construct (   $a_obj_id)
protected

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

23  {
24  $this->obj_id = (int)$a_obj_id;
25  }

Member Function Documentation

◆ findMembershipsByPath()

static ilObjectLP::findMembershipsByPath ( array $a_res,
  $a_usr_id,
  $a_parent_ref_id,
array  $a_obj_ids,
  $a_mapped_ref_ids = false 
)
staticprotected

Find (lp-relevant) memberships by path.

Parameters
array$a_res
int$a_usr_id
int$a_parent_ref_id
array$a_obj_ids
bool$a_mapped_ref_ids
Returns
array

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

References $obj_id, $path, $ref_id, ilObject\_lookupObjId(), ilObject\_lookupType(), and array.

486  {
487  global $tree;
488 
489  $found = array();
490 
491  // walk path to find course or group object and check members of that object
492  $path = $tree->getPathId($a_parent_ref_id);
493  foreach(array_reverse($path) as $path_ref_id)
494  {
495  $type = ilObject::_lookupType($path_ref_id, true);
496  if($type == "crs" ||
497  $type == "grp")
498  {
499  $class = self::getTypeClass($type);
500  $path_ob_id = ilObject::_lookupObjId($path_ref_id);
501  $chk = array();
502  $class::isLPMember($chk, $a_usr_id, array($path_ob_id));
503  if(!$a_mapped_ref_ids)
504  {
505  // we found a grp/crs in path of (single) parent - mark all objects
506  foreach($a_obj_ids as $obj_id)
507  {
508  $found[] = $obj_id;
509  if($chk[$path_ob_id])
510  {
511  $a_res[$obj_id] = true;
512  }
513  }
514  }
515  else
516  {
517  // all children from current node are "lp-valid"
518  foreach($a_obj_ids as $obj_id => $ref_ids)
519  {
520  foreach($ref_ids as $ref_id)
521  {
522  if($tree->isGrandChild($path_ref_id, $ref_id))
523  {
524  $found[$obj_id][] = $ref_id;
525  if($chk[$path_ob_id])
526  {
527  $a_res[$obj_id] = true;
528  }
529  break;
530  }
531  }
532  }
533  }
534  break;
535  }
536  }
537 
538  return $found;
539  }
$path
Definition: aliased.php:25
static _lookupObjId($a_id)
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
$ref_id
Definition: sahs_server.php:39
+ Here is the call graph for this function:

◆ gatherLPUsers()

ilObjectLP::gatherLPUsers ( )
protected

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

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

Referenced by resetLPDataForCompleteObject().

336  {
337  include_once "Services/Tracking/classes/class.ilLPMarks.php";
338  $user_ids = ilLPMarks::_getAllUserIds($this->obj_id);
339 
340  include_once "Services/Tracking/classes/class.ilChangeEvent.php";
341  $user_ids = array_merge($user_ids, ilChangeEvent::_getAllUserIds($this->obj_id));
342 
343  return $user_ids;
344  }
static _getAllUserIds($a_obj_id)
static _getAllUserIds($a_obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCollectionInstance()

ilObjectLP::getCollectionInstance ( )

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

References $collection_instance, getCurrentMode(), and ilLPCollection\getInstanceByMode().

Referenced by handleDelete().

243  {
244  if($this->collection_instance === null)
245  {
246  include_once "Services/Tracking/classes/collection/class.ilLPCollection.php";
247  $this->collection_instance = ilLPCollection::getInstanceByMode($this->obj_id, $this->getCurrentMode());
248  }
249 
251  }
static getInstanceByMode($a_obj_id, $a_mode)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCurrentMode()

ilObjectLP::getCurrentMode ( )

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

References $mode, ilObjUserTracking\_enabledLearningProgress(), ilLPObjSettings\_lookupDBMode(), ilObject\_lookupType(), getDefaultMode(), and ilLPObjSettings\LP_MODE_DEACTIVATED.

Referenced by getCollectionInstance(), and isActive().

179  {
180  if($this->mode === null)
181  {
182  // using global type default if LP is inactive
183  include_once "Services/Tracking/classes/class.ilObjUserTracking.php";
185  {
186  $mode = self::getTypeDefaultFromDB(ilObject::_lookupType($this->obj_id));
187  if($mode === null)
188  {
189  // fallback: inactive as type default may not be suitable
191  }
192  }
193  // use object LP setting
194  else
195  {
196  $mode = ilLPObjSettings::_lookupDBMode($this->obj_id);
197  if($mode === null)
198  {
199  // fallback: object type default
200  $mode = $this->getDefaultMode();
201  }
202  }
203  $this->mode = (int)$mode;
204  }
205 
206  return $this->mode;
207  }
static _enabledLearningProgress()
check wether learing progress is enabled or not
static _lookupDBMode($a_obj_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDefaultMode()

ilObjectLP::getDefaultMode ( )

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

References ilLPObjSettings\LP_MODE_UNDEFINED.

Referenced by getCurrentMode().

168  {
169 
171  }
+ Here is the caller graph for this function:

◆ getDefaultModes()

static ilObjectLP::getDefaultModes (   $a_lp_active)
static

Get available type-specific default modes (no administration needed)

Parameters
bool$a_lp_active
Returns
array

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

References array, and ilLPObjSettings\LP_MODE_UNDEFINED.

705  {
707  }
Create styles array
The data for the language used.

◆ getInstance()

static ilObjectLP::getInstance (   $a_obj_id)
static

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

References ilObject\_lookupType(), and array.

Referenced by ilLearningProgressBaseGUI\__appendLPDetails(), ilTrSummaryTableGUI\__construct(), ilLPProgressTableGUI\__construct(), ilLPTableBaseGUI\__construct(), ilLPListOfSettingsGUI\__construct(), ilLearningProgressBaseGUI\__construct(), ilLPObjSettings\__construct(), ilLearningProgressGUI\__getNextClass(), ilLPListOfProgressGUI\__initDetails(), ilLPListOfObjectsGUI\__initDetails(), ilLearningProgressBaseGUI\__readItemStatusInfo(), ilLearningProgressBaseGUI\__setSubTabs(), ilLearningProgressBaseGUI\__showObjectDetails(), ilLPStatusFactory\_getClassById(), ilLPStatusCollection\_getCompleted(), ilLPStatusCollection\_getFailed(), ilLPStatusCollection\_getInProgress(), ilLPStatusFactory\_getInstance(), ilLPStatusCollectionTLT\_getStatusInfo(), ilLPStatusCollectionManual\_getStatusInfo(), ilLPStatusSCORM\_getStatusInfo(), ilLPStatusCollection\_getStatusInfo(), ilLPStatusCollectionManual\_setObjectStatus(), ilTimingCache\_showWarning(), ilConditionHandlerGUI\assign(), ilLearningProgressAccess\checkAccess(), ilLMExplorerGUI\checkLPIcon(), ilLPStatus\checkLPModesForObjects(), ilContainer\cloneDependencies(), ilObjSurvey\deleteAllUserData(), ilLPStatusSCORM\determinePercentage(), ilLPStatusSCORM\determineStatus(), ilLPStatusCollection\determineStatus(), ilLearningProgressGUI\editManual(), ilLPProgressTableGUI\fillRow(), ilLPCronObjectStatistics\gatherCourseLPData(), ilSCORMCertificateAdapter\getCertificateVariablesDescription(), ilSCORMCertificateAdapter\getCertificateVariablesForPresentation(), ilSCORMCertificateAdapter\getCertificateVariablesForPreview(), ilLPStatusCollectionMobs\getCollectionItems(), ilScormMailTemplateLPContext\getDescription(), ilTrSummaryTableGUI\getItems(), ilLPListOfSettingsGUI\getLPPathInfo(), ilTrQuery\getObjectIds(), ilTrQuery\getObjectsStatusForUser(), ilCourseMembershipGUI\getPrintMemberData(), ilLPTableBaseGUI\getSelectableUserColumns(), ilObjSCORMInitData\getStatus(), ilTrQuery\getSubItemsStatusForUser(), ilTrQuery\getSubTree(), ilTrackingAppEventListener\handleEvent(), ilCourseAppEventListener\handleEvent(), ilSCORMOfflineMode\il2sop(), ilObjSCORM2004LearningModule\importSuccess(), ilObjSCORMLearningModule\importSuccess(), ilLearningProgressGUI\initCollectionManualForm(), ilCourseLPBadgeGUI\initConfigForm(), ilObjCourseGUI\initEditForm(), ilLearningProgressBaseGUI\initEditUserForm(), ilTrUserObjectsPropsTableGUI\initFilter(), ilConditionHandlerGUI\initFormCondition(), ilGroupMembershipGUI\initParticipantTableGUI(), ilCourseMembershipGUI\initParticipantTableGUI(), ilLPStatusPlugin\initPluginObj(), ilIndividualAssessmentLPInterface\isActiveLP(), ilLPTableBaseGUI\isPercentageAvailable(), ilSCORMTrackingItems\markedLearningStatusForExportSelected(), ilLMObject\MDUpdateListener(), ilObjContentObject\MDUpdateListener(), ilLPCollectionOfRepositoryObjects\parseTableGUIItem(), ilLPTableBaseGUI\parseTitle(), ilMembershipGUI\printMembersOutput(), ilObjGroupGUI\readMemberData(), ilObjCourseGUI\readMemberData(), ilObjSurvey\removeSelectedSurveyResults(), ilObjTest\removeTestResults(), ilCourseObjectiveResult\resetTestForUser(), ilInfoScreenGUI\saveProgress(), ilLPTableBaseGUI\searchFilterListener(), ilLPTableBaseGUI\sendMail(), ilObjContentObjectGUI\setilLMMenu(), ilLPListOfProgressGUI\show(), ilInfoScreenGUI\showLearningProgress(), ilLearningProgressGUI\showtlt(), ilConditionHandlerGUI\updateCondition(), ilObjCourseGUI\updateLPFromStatus(), ilLearningProgressGUI\updateManual(), ilLPCollectionOfRepositoryObjects\validateEntry(), and ilCourseLPBadgeGUI\validateForm().

28  {
29  static $instances = array();
30 
31  if(!isset($instances[$a_obj_id]))
32  {
33  $type = ilObject::_lookupType($a_obj_id);
34  $class = self::getTypeClass($type);
35  if($class)
36  {
37  $instance = new $class($a_obj_id);
38  }
39  else
40  {
41  // :TODO: should we return anything?
42  $instance = new self($a_obj_id);
43  }
44  $instances[$a_obj_id] = $instance;
45  }
46 
47  return $instances[$a_obj_id];
48  }
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLPMemberships()

static ilObjectLP::getLPMemberships (   $a_usr_id,
array  $a_obj_ids,
  $a_parent_ref_id = null,
  $a_mapped_ref_ids = false 
)
static

Get all objects where given user is member (from LP POV)

Parameters
int$a_usr_id
array$a_obj_ids
int$a_parent_ref_id
bool$a_mapped_ref_ids
Returns
array

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

References $ilDB, $obj_id, $query, $ref_id, $res, $row, and array.

Referenced by ilLPProgressTableGUI\getItems(), and ilLPStatus\validateLPForObjects().

551  {
552  global $ilDB, $tree;
553 
554  // see ilTrQuery::getParticipantsForObject() [single object only]
555  // this is optimized for larger number of objects, e.g. list GUIs
556 
557  if((bool)$a_mapped_ref_ids)
558  {
559  $ref_map = $a_obj_ids;
560  $a_obj_ids = array_keys($a_obj_ids);
561  }
562 
563  $res = array();
564 
565  // get object types
566  $types_map = array();
567  $query = " SELECT obj_id, type".
568  " FROM object_data".
569  " WHERE ".$ilDB->in("obj_id", $a_obj_ids, "", "integer");
570  $set = $ilDB->query($query);
571  while($row = $ilDB->fetchAssoc($set))
572  {
573  $types_map[$row["type"]][] = $row["obj_id"];
574  $res[$row["obj_id"]] = false;
575  }
576 
577  $find_by_parent = array();
578  foreach($types_map as $type => $type_obj_ids)
579  {
580  $class = self::getTypeClass($type);
581  if($class)
582  {
583  // lp-supported type?
584  if(!$class::isLPMember($res, $a_usr_id, $type_obj_ids))
585  {
586  $find_by_parent = array_merge($find_by_parent, $type_obj_ids);
587  }
588  }
589  }
590 
591  if(sizeof($find_by_parent))
592  {
593  // single parent for all objects (repository/ilObjectListGUI)
594  if($a_parent_ref_id)
595  {
596  if(self::findMembershipsByPath($res, $a_usr_id, $a_parent_ref_id, $find_by_parent))
597  {
598  // we found a crs/grp in path, so no need to check read_events
599  $find_by_parent = null;
600  }
601  }
602  // different parents (PD > LP)
603  else if(sizeof($ref_map))
604  {
605  foreach($find_by_parent as $obj_id)
606  {
607  // maybe already found by path search from other object/reference
608  if($res[$obj_id] === false)
609  {
610  if(isset($ref_map[$obj_id]))
611  {
612  // check all references
613  foreach($ref_map[$obj_id] as $ref_id)
614  {
615  $parent_ref_id = $tree->getParentId($ref_id);
616  if($parent_ref_id == ROOT_FOLDER_ID)
617  {
618  continue;
619  }
620 
621  // we are checking the complete ref_map
622  // to find all relevant objects in subtree of current ref_id
623  $found = self::findMembershipsByPath($res, $a_usr_id, $parent_ref_id, $ref_map, true);
624  if(sizeof($found))
625  {
626  // if any references were found in a crs/grp-subtree
627  // remove from "read-event"-last-resort-pool
628  foreach($found as $found_obj_id => $found_ref_ids)
629  {
630  $diff = array_diff($ref_map[$found_obj_id], $found_ref_ids);
631  if($diff)
632  {
633  // 1-n refs are in another subtree
634  // have to be checked separately
635  $ref_map[$found_obj_id] = $diff;
636  }
637  else
638  {
639  // all references found in subtree
640  // no need to check again
641  unset($ref_map[$found_obj_id]);
642  }
643  }
644  break;
645  }
646  }
647  }
648  }
649  }
650 
651  $find_by_parent = array_keys($ref_map);
652  }
653 
654  // last resort: use read_event?
655  if(sizeof($find_by_parent))
656  {
657  $set = $ilDB->query("SELECT obj_id".
658  " FROM read_event".
659  " WHERE ".$ilDB->in("obj_id", $find_by_parent, "", "integer").
660  " AND usr_id = ".$ilDB->quote($a_usr_id, "integer"));
661  while($row = $ilDB->fetchAssoc($set))
662  {
663  $res[$row["obj_id"]] = true;
664  }
665  }
666  }
667 
668  return $res;
669  }
Create styles array
The data for the language used.
$ref_id
Definition: sahs_server.php:39
global $ilDB
+ Here is the caller graph for this function:

◆ getMailTemplateId()

ilObjectLP::getMailTemplateId ( )

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

672  {
673  // type-specific
674  }

◆ getMembers()

ilObjectLP::getMembers (   $a_search = true)

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

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

259  {
260  global $tree;
261 
262  if(!$a_search)
263  {
264  return;
265  }
266 
267  $ref_ids = ilObject::_getAllReferences($this->obj_id);
268  $ref_id = current($ref_ids);
269 
270  // walk path to find parent with specific members
271  $path = $tree->getPathId($ref_id);
272  array_pop($path);
273  foreach(array_reverse($path) as $path_ref_id)
274  {
275  $olp = self::getInstance(ilObject::_lookupObjId($path_ref_id));
276  $all = $olp->getMembers(false);
277  if(is_array($all))
278  {
279  return $all;
280  }
281  }
282  }
$path
Definition: aliased.php:25
static _getAllReferences($a_id)
get all reference ids of object
static _lookupObjId($a_id)
$ref_id
Definition: sahs_server.php:39
+ Here is the call graph for this function:

◆ getModeInfoText()

ilObjectLP::getModeInfoText (   $a_mode)

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

References ilLPObjSettings\_mode2InfoText().

228  {
229  return ilLPObjSettings::_mode2InfoText($a_mode);
230  }
static _mode2InfoText($a_mode)
+ Here is the call graph for this function:

◆ getModeText()

ilObjectLP::getModeText (   $a_mode)

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

References ilLPObjSettings\_mode2Text().

223  {
224  return ilLPObjSettings::_mode2Text($a_mode);
225  }
static _mode2Text($a_mode)
+ Here is the call graph for this function:

◆ getSettingsInfo()

ilObjectLP::getSettingsInfo ( )

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

233  {
234  // type-specific
235  }

◆ getTypeClass()

static ilObjectLP::getTypeClass (   $a_type)
static

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

References $a_type.

Referenced by ilCourseLPBadgeGUI\getLPTypes(), and ilObjUserTrackingGUI\initLPDefaultsForm().

51  {
52  global $objDefinition;
53 
54  if(self::isSupportedObjectType($a_type))
55  {
56  switch($a_type)
57  {
58  // container
59 
60  case "crs":
61  include_once "Modules/Course/classes/class.ilCourseLP.php";
62  return "ilCourseLP";
63 
64  case "grp":
65  include_once "Modules/Group/classes/class.ilGroupLP.php";
66  return "ilGroupLP";
67 
68  case "fold":
69  include_once "Modules/Folder/classes/class.ilFolderLP.php";
70  return "ilFolderLP";
71 
72 
73  // learning resources
74 
75  case "lm":
76  include_once "Modules/LearningModule/classes/class.ilLearningModuleLP.php";
77  return "ilLearningModuleLP";
78 
79  case "htlm":
80  include_once "Modules/HTMLLearningModule/classes/class.ilHTMLLearningModuleLP.php";
81  return "ilHTMLLearningModuleLP";
82 
83  case "sahs":
84  include_once "Modules/ScormAicc/classes/class.ilScormLP.php";
85  return "ilScormLP";
86 
87 
88  // misc
89 
90  case "tst":
91  include_once "Modules/Test/classes/class.ilTestLP.php";
92  return "ilTestLP";
93 
94  case "exc":
95  include_once "Modules/Exercise/classes/class.ilExerciseLP.php";
96  return "ilExerciseLP";
97 
98  case 'file':
99  require_once 'Modules/File/classes/class.ilFileLP.php';
100  return 'ilFileLP';
101 
102  case "mcst":
103  require_once "Modules/MediaCast/classes/class.ilMediaCastLP.php";
104  return "ilMediaCastLP";
105 
106  case "sess":
107  include_once "Modules/Session/classes/class.ilSessionLP.php";
108  return "ilSessionLP";
109 
110  case "svy":
111  include_once "Modules/Survey/classes/class.ilSurveyLP.php";
112  return "ilSurveyLP";
113 
114  case "prg":
115  include_once "Modules/StudyProgramme/classes/class.ilStudyProgrammeLP.php";
116  return "ilStudyProgrammeLP";
117 
118  case "iass":
119  include_once "Modules/IndividualAssessment/classes/class.ilIndividualAssessmentLP.php";
120  return "ilIndividualAssessmentLP";
121 
122  // plugin
123  case $objDefinition->isPluginTypeName($a_type):
124  include_once "Services/Component/classes/class.ilPluginLP.php";
125  return "ilPluginLP";
126  }
127  }
128  }
$a_type
Definition: workflow.php:93
+ Here is the caller graph for this function:

◆ getTypeDefault()

static ilObjectLP::getTypeDefault (   $a_type)
static

Get current type default.

Parameters
string$a_type
Returns
int

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

References $a_type.

Referenced by ilObjUserTrackingGUI\initLPDefaultsForm().

746  {
747  $db = self::getTypeDefaultFromDB($a_type);
748  if($db !== null)
749  {
750  return $db;
751  }
752 
753  $class = self::getTypeClass($a_type);
754  $olp = new $class(0);
755  return $olp->getDefaultMode();
756  }
$a_type
Definition: workflow.php:93
+ Here is the caller graph for this function:

◆ getTypeDefaultFromDB()

static ilObjectLP::getTypeDefaultFromDB (   $a_type)
staticprotected

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

References $a_type, $ilDB, $row, and array.

710  {
711  global $ilDB;
712 
713  if(!is_array(self::$type_defaults))
714  {
715  self::$type_defaults = array();
716  $set = $ilDB->query("SELECT * FROM ut_lp_defaults");
717  while($row = $ilDB->fetchAssoc($set))
718  {
719  self::$type_defaults[$row["type_id"]] = $row["lp_mode"];
720  }
721  }
722  return self::$type_defaults[$a_type];
723  }
$a_type
Definition: workflow.php:93
Create styles array
The data for the language used.
global $ilDB

◆ getValidModes()

ilObjectLP::getValidModes ( )

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

References array.

174  {
175  return array();
176  }
Create styles array
The data for the language used.

◆ handleDelete()

ilObjectLP::handleDelete ( )
final

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

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

415  {
416  include_once "Services/Tracking/classes/class.ilLPMarks.php";
417  ilLPMarks::deleteObject($this->obj_id);
418 
419  include_once "Services/Tracking/classes/class.ilChangeEvent.php";
420  ilChangeEvent::_delete($this->obj_id);
421 
422  $collection = $this->getCollectionInstance();
423  if($collection)
424  {
425  $collection->delete();
426  }
427 
428  $this->updateParentCollections();
429  }
static _delete($a_obj_id)
Delete object entries.
static deleteObject($a_obj_id)
Delete object.
+ Here is the call graph for this function:

◆ handleMove()

static ilObjectLP::handleMove (   $a_source_ref_id)
staticfinal

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

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

Referenced by ilTrackingAppEventListener\handleEvent().

352  {
353  global $tree, $ilDB;
354 
355  $ref_ids = $tree->getSubTreeIds($a_source_ref_id);
356  $ref_ids[] = $a_source_ref_id;
357 
358  // get "parent" path to source node (not including source node)
359  $new_path = $tree->getPathId($a_source_ref_id);
360  array_pop($new_path);
361  $new_path = implode("/", $new_path);
362 
363  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
364 
365  // find collections with ref_ids
366  $set = $ilDB->query("SELECT DISTINCT(ut_lp_collections.obj_id) obj_id".
367  " FROM object_reference".
368  " JOIN ut_lp_collections ON".
369  " (".$ilDB->in("object_reference.ref_id", $ref_ids, "", "integer").
370  " AND object_reference.ref_id = ut_lp_collections.item_id)");
371  while ($rec = $ilDB->fetchAssoc($set))
372  {
373  if (in_array(ilObject::_lookupType($rec["obj_id"]), array("crs", "grp", "fold")))
374  {
375  $coll_ref_id = ilObject::_getAllReferences($rec["obj_id"]);
376  $coll_ref_id = array_pop($coll_ref_id);
377 
378  // #13402
379  if($coll_ref_id == $a_source_ref_id)
380  {
381  continue;
382  }
383 
384  // #17703 - collection has also been moved - nothing todo
385  if($tree->isGrandChild($a_source_ref_id, $coll_ref_id))
386  {
387  continue;
388  }
389 
390  // get path to collection (including collection "parent")
391  $coll_path = $tree->getPathId($coll_ref_id);
392  $coll_path = implode("/", $coll_path);
393 
394  // collection path is not inside new path
395  if(!stristr($new_path, $coll_path))
396  {
397  // delete all items of moved (sub-)tree
398  $query = "DELETE FROM ut_lp_collections".
399  " WHERE obj_id = ".$ilDB->quote($rec["obj_id"], "integer").
400  " AND ".$ilDB->in("item_id", $ref_ids, "", "integer");
401  $ilDB->manipulate($query);
402 
403  ilLPStatusWrapper::_refreshStatus($rec["obj_id"]);
404  }
405  }
406  }
407  }
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
static _getAllReferences($a_id)
get all reference ids of object
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleToTrash()

ilObjectLP::handleToTrash ( )
final

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

References updateParentCollections().

410  {
411  $this->updateParentCollections();
412  }
+ Here is the call graph for this function:

◆ isActive()

ilObjectLP::isActive ( )

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

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

210  {
211  // :TODO: check LP activation?
212 
213  $mode = $this->getCurrentMode();
216  {
217  return false;
218  }
219  return true;
220  }
+ Here is the call graph for this function:

◆ isAnonymized()

ilObjectLP::isAnonymized ( )

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

157  {
158  // see ilLPCollectionOfRepositoryObjects::validateEntry()
159  return false;
160  }

◆ isLPMember()

static ilObjectLP::isLPMember ( array $a_res,
  $a_usr_id,
  $a_obj_ids 
)
staticprotected

Find (lp-relevant) members for given object ids.

Parameters
array$a_res
int$a_usr_id
array$a_obj_ids

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

470  {
471  // should be overwritten by object-type-specific class
472  return false;
473  }

◆ isSupportedObjectType()

static ilObjectLP::isSupportedObjectType (   $a_type)
static

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

References $a_type, $valid, array, and ilRepositoryObjectPluginSlot\isTypePluginWithLP().

Referenced by ilCtrl\checkLPSettingsForward(), ilLPListOfSettingsGUI\getLPPathInfo(), ilCourseLPBadgeGUI\getLPTypes(), ilConditionHandler\getOperatorsByTargetType(), ilObjUserTrackingGUI\initLPDefaultsForm(), and ilObjUserTrackingGUI\saveLPDefaultsObject().

131  {
132  global $objDefinition;
133 
134  $valid = array("crs", "grp", "fold", "lm", "htlm", "sahs", "tst", "exc", "sess", "svy", "file", "mcst", "prg", "iass");
135 
136  if(in_array($a_type, $valid))
137  {
138  return true;
139  }
140 
141  if($objDefinition->isPluginTypeName($a_type))
142  {
143  include_once 'Services/Repository/classes/class.ilRepositoryObjectPluginSlot.php';
145  }
146 
147  return false;
148  }
static isTypePluginWithLP($a_type, $a_active_status=true)
Check whether a repository type is a plugin which has active learning progress.
$valid
$a_type
Definition: workflow.php:93
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetCaches()

ilObjectLP::resetCaches ( )

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

151  {
152  $this->mode = null;
153  $this->collection_instance = null;
154  }

◆ resetCustomLPDataForUserIds()

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

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

Referenced by resetLPDataForUserIds().

331  {
332  // this should delete all data that is relevant for the supported LP modes
333  }
+ Here is the caller graph for this function:

◆ resetLPDataForCompleteObject()

ilObjectLP::resetLPDataForCompleteObject (   $a_recursive = true)
final

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

References gatherLPUsers(), and resetLPDataForUserIds().

290  {
291  $user_ids = $this->gatherLPUsers();
292  if(sizeof($user_ids))
293  {
294  $this->resetLPDataForUserIds(array_unique($user_ids), $a_recursive);
295  }
296  }
resetLPDataForUserIds(array $a_user_ids, $a_recursive=true)
+ Here is the call graph for this function:

◆ resetLPDataForUserIds()

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

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

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

Referenced by resetLPDataForCompleteObject().

299  {
300  if((bool)$a_recursive &&
301  method_exists($this, "getPossibleCollectionItems")) // #15203
302  {
303  $subitems = $this->getPossibleCollectionItems();
304  if(is_array($subitems))
305  {
306  foreach($subitems as $sub_ref_id)
307  {
308  $olp = self::getInstance(ilObject::_lookupObjId($sub_ref_id));
309  $olp->resetLPDataForUserIds($a_user_ids, false);
310  }
311  }
312  }
313 
314  $this->resetCustomLPDataForUserIds($a_user_ids, (bool)$a_recursive);
315 
316  include_once "Services/Tracking/classes/class.ilLPMarks.php";
317  ilLPMarks::_deleteForUsers($this->obj_id, $a_user_ids);
318 
319  include_once "Services/Tracking/classes/class.ilChangeEvent.php";
320  ilChangeEvent::_deleteReadEventsForUsers($this->obj_id, $a_user_ids);
321 
322  // update LP status to get collections up-to-date
323  include_once "Services/Tracking/classes/class.ilLPStatusWrapper.php";
324  foreach($a_user_ids as $user_id)
325  {
326  ilLPStatusWrapper::_updateStatus($this->obj_id, $user_id);
327  }
328  }
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
resetCustomLPDataForUserIds(array $a_user_ids, $a_recursive=true)
static _lookupObjId($a_id)
static _deleteForUsers($a_obj_id, array $a_user_ids)
static _deleteReadEventsForUsers($a_obj_id, array $a_user_ids)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveTypeDefaults()

static ilObjectLP::saveTypeDefaults ( array  $a_data)
static

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

References $ilDB, $mode, and array.

Referenced by ilObjUserTrackingGUI\saveLPDefaultsObject().

726  {
727  global $ilDB;
728 
729  $ilDB->manipulate("DELETE FROM ut_lp_defaults");
730  foreach($a_data as $type => $mode)
731  {
732  $ilDB->insert("ut_lp_defaults", array(
733  "type_id" => array("text", $type),
734  "lp_mode" => array("integer", $mode)
735  ));
736  }
737  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ supportsMark()

static ilObjectLP::supportsMark (   $a_obj_type)
static

◆ supportsMatrixView()

static ilObjectLP::supportsMatrixView (   $a_obj_type)
static

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

References array.

Referenced by ilLearningProgressBaseGUI\__setSubTabs().

692  {
693  return !in_array($a_obj_type, array('svy', 'tst', 'htlm', 'exc', 'sess', 'file', 'prg'));
694  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ supportsSpentSeconds()

static ilObjectLP::supportsSpentSeconds (   $a_obj_type)
static

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

References array.

Referenced by ilLearningProgressBaseGUI\__appendLPDetails(), ilTrUserObjectsPropsTableGUI\fillRow(), ilTrSummaryTableGUI\getSelectableColumns(), ilLPTableBaseGUI\getSelectableUserColumns(), ilTrSummaryTableGUI\initFilter(), ilTrObjectUsersPropsTableGUI\initFilter(), ilLPTableBaseGUI\parseValue(), and ilTrSummaryTableGUI\parseValue().

682  {
683  return !in_array($a_obj_type, array("exc", "file", "mcst", "mob", "htlm"));
684  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ updateParentCollections()

ilObjectLP::updateParentCollections ( )
finalprotected

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

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

Referenced by handleDelete(), and handleToTrash().

432  {
433  global $ilDB;
434 
435  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
436 
437  // update parent collections?
438  $set = $ilDB->query("SELECT ut_lp_collections.obj_id obj_id FROM ".
439  "object_reference JOIN ut_lp_collections ON ".
440  "(object_reference.obj_id = ".$ilDB->quote($this->obj_id, "integer").
441  " AND object_reference.ref_id = ut_lp_collections.item_id)");
442  while ($rec = $ilDB->fetchAssoc($set))
443  {
444  if (in_array(ilObject::_lookupType($rec["obj_id"]), array("crs", "grp", "fold")))
445  {
446  // remove from parent collection
447  $query = "DELETE FROM ut_lp_collections".
448  " WHERE obj_id = ".$ilDB->quote($rec["obj_id"], "integer").
449  " AND item_id = ".$ilDB->quote($this->obj_id, "integer");
450  $ilDB->manipulate($query);
451 
452  ilLPStatusWrapper::_refreshStatus($rec["obj_id"]);
453  }
454  }
455  }
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
global $ilDB
+ 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 getCurrentMode(), isActive(), and saveTypeDefaults().

◆ $obj_id

ilObjectLP::$obj_id
protected

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

Referenced by findMembershipsByPath(), and getLPMemberships().

◆ $type_defaults

ilObjectLP::$type_defaults
staticprotected

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


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