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

 $tree
 
 $db
 
 $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 32 of file class.ilObjectLP.php.

References $DIC.

33  {
34  global $DIC;
35 
36  $this->tree = $DIC->repositoryTree();
37  $this->db = $DIC->database();
38  $this->obj_id = (int) $a_obj_id;
39  }
global $DIC
Definition: saml.php:7

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 474 of file class.ilObjectLP.php.

References $DIC, $obj_id, $path, $tree, $type, ilObject\_lookupObjId(), ilObject\_lookupType(), and array.

475  {
476  global $DIC;
477 
478  $tree = $DIC->repositoryTree();
479 
480  $found = array();
481 
482  // walk path to find course or group object and check members of that object
483  $path = $tree->getPathId($a_parent_ref_id);
484  foreach (array_reverse($path) as $path_ref_id) {
485  $type = ilObject::_lookupType($path_ref_id, true);
486  if ($type == "crs" ||
487  $type == "grp") {
488  $class = self::getTypeClass($type);
489  $path_ob_id = ilObject::_lookupObjId($path_ref_id);
490  $chk = array();
491  $class::isLPMember($chk, $a_usr_id, array($path_ob_id));
492  if (!$a_mapped_ref_ids) {
493  // we found a grp/crs in path of (single) parent - mark all objects
494  foreach ($a_obj_ids as $obj_id) {
495  $found[] = $obj_id;
496  if ($chk[$path_ob_id]) {
497  $a_res[$obj_id] = true;
498  }
499  }
500  } else {
501  // all children from current node are "lp-valid"
502  foreach ($a_obj_ids as $obj_id => $ref_ids) {
503  foreach ($ref_ids as $ref_id) {
504  if ($tree->isGrandChild($path_ref_id, $ref_id)) {
505  $found[$obj_id][] = $ref_id;
506  if ($chk[$path_ob_id]) {
507  $a_res[$obj_id] = true;
508  }
509  break;
510  }
511  }
512  }
513  }
514  break;
515  }
516  }
517 
518  return $found;
519  }
$type
global $DIC
Definition: saml.php:7
static _lookupObjId($a_id)
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:

◆ gatherLPUsers()

ilObjectLP::gatherLPUsers ( )
protected

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

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

Referenced by resetLPDataForCompleteObject().

330  {
331  include_once "Services/Tracking/classes/class.ilLPMarks.php";
332  $user_ids = ilLPMarks::_getAllUserIds($this->obj_id);
333 
334  include_once "Services/Tracking/classes/class.ilChangeEvent.php";
335  $user_ids = array_merge($user_ids, ilChangeEvent::_getAllUserIds($this->obj_id));
336 
337  return $user_ids;
338  }
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 245 of file class.ilObjectLP.php.

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

Referenced by handleDelete().

246  {
247  if ($this->collection_instance === null) {
248  include_once "Services/Tracking/classes/collection/class.ilLPCollection.php";
249  $this->collection_instance = ilLPCollection::getInstanceByMode($this->obj_id, $this->getCurrentMode());
250  }
251 
253  }
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 187 of file class.ilObjectLP.php.

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

Referenced by getCollectionInstance(), and isActive().

188  {
189  if ($this->mode === null) {
190  // using global type default if LP is inactive
191  include_once "Services/Tracking/classes/class.ilObjUserTracking.php";
193  $mode = self::getTypeDefaultFromDB(ilObject::_lookupType($this->obj_id));
194  if ($mode === null) {
195  // fallback: inactive as type default may not be suitable
197  }
198  }
199  // use object LP setting
200  else {
201  $mode = ilLPObjSettings::_lookupDBMode($this->obj_id);
202  if ($mode === null) {
203  // fallback: object type default
204  $mode = $this->getDefaultMode();
205  }
206  }
207  $this->mode = (int) $mode;
208  }
209 
210  return $this->mode;
211  }
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 177 of file class.ilObjectLP.php.

References ilLPObjSettings\LP_MODE_UNDEFINED.

Referenced by getCurrentMode().

178  {
180  }
+ 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 667 of file class.ilObjectLP.php.

References array, and ilLPObjSettings\LP_MODE_UNDEFINED.

668  {
670  }
Create styles array
The data for the language used.

◆ getInstance()

static ilObjectLP::getInstance (   $a_obj_id)
static

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

References $type, 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(), ilLPStatusSCORM\_getNotAttempted(), 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(), 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(), ilMembershipGUI\jump2UsersGallery(), ilSCORMTrackingItems\markedLearningStatusForExportSelected(), ilLMObject\MDUpdateListener(), ilObjContentObject\MDUpdateListener(), ilLPCollectionOfRepositoryObjects\parseTableGUIItem(), ilLPTableBaseGUI\parseTitle(), ilObjSAHSLearningModule\populateByDirectoy(), ilObjGroupGUI\readMemberData(), ilObjCourseGUI\readMemberData(), ilTimingCache\readObjectInformation(), ilObjSurvey\removeSelectedSurveyResults(), ilObjTest\removeTestResults(), ilCourseObjectiveResult\resetTestForUser(), ilObjMediaCast\saveOrder(), ilLPTableBaseGUI\searchFilterListener(), ilLPTableBaseGUI\sendMail(), ilObjContentObjectGUI\setilLMMenu(), ilLPListOfProgressGUI\show(), ilInfoScreenGUI\showLearningProgress(), ilLearningProgressGUI\showtlt(), ilSCORMOfflineMode\tracking2sop(), ilConditionHandlerGUI\updateCondition(), ilObjCourseGUI\updateLPFromStatus(), ilLearningProgressGUI\updateManual(), ilLPCollectionOfRepositoryObjects\validateEntry(), and ilCourseLPBadgeGUI\validateForm().

42  {
43  static $instances = array();
44 
45  if (!isset($instances[$a_obj_id])) {
46  $type = ilObject::_lookupType($a_obj_id);
47  $class = self::getTypeClass($type);
48  if ($class) {
49  $instance = new $class($a_obj_id);
50  } else {
51  // :TODO: should we return anything?
52  $instance = new self($a_obj_id);
53  }
54  $instances[$a_obj_id] = $instance;
55  }
56 
57  return $instances[$a_obj_id];
58  }
$type
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 530 of file class.ilObjectLP.php.

References $DIC, $ilDB, $obj_id, $query, $res, $row, $tree, $type, and array.

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

531  {
532  global $DIC;
533 
534  $ilDB = $DIC->database();
535  $tree = $DIC->repositoryTree();
536 
537  // see ilTrQuery::getParticipantsForObject() [single object only]
538  // this is optimized for larger number of objects, e.g. list GUIs
539 
540  $ref_map = [];
541  if ((bool) $a_mapped_ref_ids) {
542  $ref_map = $a_obj_ids;
543  $a_obj_ids = array_keys($a_obj_ids);
544  }
545 
546  $res = array();
547 
548  // get object types
549  $types_map = array();
550  $query = " SELECT obj_id, type" .
551  " FROM object_data" .
552  " WHERE " . $ilDB->in("obj_id", $a_obj_ids, "", "integer");
553  $set = $ilDB->query($query);
554  while ($row = $ilDB->fetchAssoc($set)) {
555  $types_map[$row["type"]][] = $row["obj_id"];
556  $res[$row["obj_id"]] = false;
557  }
558 
559  $find_by_parent = array();
560  foreach ($types_map as $type => $type_obj_ids) {
561  $class = self::getTypeClass($type);
562  if ($class) {
563  // lp-supported type?
564  if (!$class::isLPMember($res, $a_usr_id, $type_obj_ids)) {
565  $find_by_parent = array_merge($find_by_parent, $type_obj_ids);
566  }
567  }
568  }
569 
570  if (sizeof($find_by_parent)) {
571  // single parent for all objects (repository/ilObjectListGUI)
572  if ($a_parent_ref_id) {
573  if (self::findMembershipsByPath($res, $a_usr_id, $a_parent_ref_id, $find_by_parent)) {
574  // we found a crs/grp in path, so no need to check read_events
575  $find_by_parent = null;
576  }
577  }
578  // different parents (PD > LP)
579  elseif (is_array($ref_map) && count($ref_map) > 0) {
580  foreach ($find_by_parent as $obj_id) {
581  // maybe already found by path search from other object/reference
582  if ($res[$obj_id] === false) {
583  if (isset($ref_map[$obj_id]) && is_array($ref_map[$obj_id])) {
584  // check all references
585  foreach ($ref_map[$obj_id] as $ref_id) {
586  $parent_ref_id = $tree->getParentId($ref_id);
587  if ($parent_ref_id == ROOT_FOLDER_ID) {
588  continue;
589  }
590 
591  // we are checking the complete ref_map
592  // to find all relevant objects in subtree of current ref_id
593  $found = self::findMembershipsByPath($res, $a_usr_id, $parent_ref_id, $ref_map, true);
594  if (is_array($found) && count($found) > 0) {
595  // if any references were found in a crs/grp-subtree
596  // remove from "read-event"-last-resort-pool
597  foreach ($found as $found_obj_id => $found_ref_ids) {
598  $diff = array_diff($ref_map[$found_obj_id], $found_ref_ids);
599  if ($diff) {
600  // 1-n refs are in another subtree
601  // have to be checked separately
602  $ref_map[$found_obj_id] = $diff;
603  } else {
604  // all references found in subtree
605  // no need to check again
606  unset($ref_map[$found_obj_id]);
607  }
608  }
609  break;
610  }
611  }
612  }
613  }
614  }
615 
616  $find_by_parent = array_keys($ref_map);
617  }
618 
619  // last resort: use read_event?
620  if (is_array($find_by_parent) && count($find_by_parent) > 0) {
621  $set = $ilDB->query("SELECT obj_id" .
622  " FROM read_event" .
623  " WHERE " . $ilDB->in("obj_id", $find_by_parent, "", "integer") .
624  " AND usr_id = " . $ilDB->quote($a_usr_id, "integer"));
625  while ($row = $ilDB->fetchAssoc($set)) {
626  $res[$row["obj_id"]] = true;
627  }
628  }
629  }
630 
631  return $res;
632  }
$type
global $DIC
Definition: saml.php:7
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:

◆ getMailTemplateId()

ilObjectLP::getMailTemplateId ( )

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

635  {
636  // type-specific
637  }

◆ getMembers()

ilObjectLP::getMembers (   $a_search = true)

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

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

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

◆ getModeInfoText()

ilObjectLP::getModeInfoText (   $a_mode)

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

References ilLPObjSettings\_mode2InfoText().

231  {
232  return ilLPObjSettings::_mode2InfoText($a_mode);
233  }
static _mode2InfoText($a_mode)
+ Here is the call graph for this function:

◆ getModeText()

ilObjectLP::getModeText (   $a_mode)

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

References ilLPObjSettings\_mode2Text().

226  {
227  return ilLPObjSettings::_mode2Text($a_mode);
228  }
static _mode2Text($a_mode)
+ Here is the call graph for this function:

◆ getSettingsInfo()

ilObjectLP::getSettingsInfo ( )

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

236  {
237  // type-specific
238  }

◆ getTypeClass()

static ilObjectLP::getTypeClass (   $a_type)
static

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

References $a_type, and $DIC.

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

61  {
62  global $DIC;
63 
64  $objDefinition = $DIC["objDefinition"];
65 
66  if (self::isSupportedObjectType($a_type)) {
67  switch ($a_type) {
68  // container
69 
70  case "crs":
71  include_once "Modules/Course/classes/class.ilCourseLP.php";
72  return "ilCourseLP";
73 
74  case "grp":
75  include_once "Modules/Group/classes/class.ilGroupLP.php";
76  return "ilGroupLP";
77 
78  case "fold":
79  include_once "Modules/Folder/classes/class.ilFolderLP.php";
80  return "ilFolderLP";
81 
82 
83  // learning resources
84 
85  case "lm":
86  include_once "Modules/LearningModule/classes/class.ilLearningModuleLP.php";
87  return "ilLearningModuleLP";
88 
89  case "htlm":
90  include_once "Modules/HTMLLearningModule/classes/class.ilHTMLLearningModuleLP.php";
91  return "ilHTMLLearningModuleLP";
92 
93  case "sahs":
94  include_once "Modules/ScormAicc/classes/class.ilScormLP.php";
95  return "ilScormLP";
96 
97 
98  // misc
99 
100  case "tst":
101  include_once "Modules/Test/classes/class.ilTestLP.php";
102  return "ilTestLP";
103 
104  case "exc":
105  include_once "Modules/Exercise/classes/class.ilExerciseLP.php";
106  return "ilExerciseLP";
107 
108  case 'file':
109  require_once 'Modules/File/classes/class.ilFileLP.php';
110  return 'ilFileLP';
111 
112  case "mcst":
113  require_once "Modules/MediaCast/classes/class.ilMediaCastLP.php";
114  return "ilMediaCastLP";
115 
116  case "sess":
117  include_once "Modules/Session/classes/class.ilSessionLP.php";
118  return "ilSessionLP";
119 
120  case "svy":
121  include_once "Modules/Survey/classes/class.ilSurveyLP.php";
122  return "ilSurveyLP";
123 
124  case "prg":
125  include_once "Modules/StudyProgramme/classes/class.ilStudyProgrammeLP.php";
126  return "ilStudyProgrammeLP";
127 
128  case "iass":
129  include_once "Modules/IndividualAssessment/classes/class.ilIndividualAssessmentLP.php";
130  return "ilIndividualAssessmentLP";
131 
132  // plugin
133  case $objDefinition->isPluginTypeName($a_type):
134  include_once "Services/Component/classes/class.ilPluginLP.php";
135  return "ilPluginLP";
136  }
137  }
138  }
global $DIC
Definition: saml.php:7
$a_type
Definition: workflow.php:92
+ 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 709 of file class.ilObjectLP.php.

References $a_type, and $db.

Referenced by ilObjUserTrackingGUI\initLPDefaultsForm().

710  {
711  $db = self::getTypeDefaultFromDB($a_type);
712  if ($db !== null) {
713  return $db;
714  }
715 
716  $class = self::getTypeClass($a_type);
717  $olp = new $class(0);
718  return $olp->getDefaultMode();
719  }
$a_type
Definition: workflow.php:92
+ Here is the caller graph for this function:

◆ getTypeDefaultFromDB()

static ilObjectLP::getTypeDefaultFromDB (   $a_type)
staticprotected

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

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

673  {
674  global $DIC;
675 
676  $ilDB = $DIC->database();
677 
678  if (!is_array(self::$type_defaults)) {
679  self::$type_defaults = array();
680  $set = $ilDB->query("SELECT * FROM ut_lp_defaults");
681  while ($row = $ilDB->fetchAssoc($set)) {
682  self::$type_defaults[$row["type_id"]] = $row["lp_mode"];
683  }
684  }
685  return self::$type_defaults[$a_type];
686  }
global $DIC
Definition: saml.php:7
$a_type
Definition: workflow.php:92
Create styles array
The data for the language used.
global $ilDB

◆ getValidModes()

ilObjectLP::getValidModes ( )

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

References array.

183  {
184  return array();
185  }
Create styles array
The data for the language used.

◆ handleDelete()

ilObjectLP::handleDelete ( )
final

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

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

407  {
408  include_once "Services/Tracking/classes/class.ilLPMarks.php";
409  ilLPMarks::deleteObject($this->obj_id);
410 
411  include_once "Services/Tracking/classes/class.ilChangeEvent.php";
412  ilChangeEvent::_delete($this->obj_id);
413 
414  $collection = $this->getCollectionInstance();
415  if ($collection) {
416  $collection->delete();
417  }
418 
419  $this->updateParentCollections();
420  }
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 345 of file class.ilObjectLP.php.

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

Referenced by ilTrackingAppEventListener\handleEvent().

346  {
347  global $DIC;
348 
349  $tree = $DIC->repositoryTree();
350  $ilDB = $DIC->database();
351 
352  $ref_ids = $tree->getSubTreeIds($a_source_ref_id);
353  $ref_ids[] = $a_source_ref_id;
354 
355  // get "parent" path to source node (not including source node)
356  $new_path = $tree->getPathId($a_source_ref_id);
357  array_pop($new_path);
358  $new_path = implode("/", $new_path);
359 
360  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
361 
362  // find collections with ref_ids
363  $set = $ilDB->query("SELECT DISTINCT(ut_lp_collections.obj_id) obj_id" .
364  " FROM object_reference" .
365  " JOIN ut_lp_collections ON" .
366  " (" . $ilDB->in("object_reference.ref_id", $ref_ids, "", "integer") .
367  " AND object_reference.ref_id = ut_lp_collections.item_id)");
368  while ($rec = $ilDB->fetchAssoc($set)) {
369  if (in_array(ilObject::_lookupType($rec["obj_id"]), array("crs", "grp", "fold"))) {
370  $coll_ref_id = ilObject::_getAllReferences($rec["obj_id"]);
371  $coll_ref_id = array_pop($coll_ref_id);
372 
373  // #13402
374  if ($coll_ref_id == $a_source_ref_id) {
375  continue;
376  }
377 
378  // #17703 - collection has also been moved - nothing todo
379  if ($tree->isGrandChild($a_source_ref_id, $coll_ref_id)) {
380  continue;
381  }
382 
383  // get path to collection (including collection "parent")
384  $coll_path = $tree->getPathId($coll_ref_id);
385  $coll_path = implode("/", $coll_path);
386 
387  // collection path is not inside new path
388  if (!stristr($new_path, $coll_path)) {
389  // delete all items of moved (sub-)tree
390  $query = "DELETE FROM ut_lp_collections" .
391  " WHERE obj_id = " . $ilDB->quote($rec["obj_id"], "integer") .
392  " AND " . $ilDB->in("item_id", $ref_ids, "", "integer");
393  $ilDB->manipulate($query);
394 
395  ilLPStatusWrapper::_refreshStatus($rec["obj_id"]);
396  }
397  }
398  }
399  }
global $DIC
Definition: saml.php:7
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
static _getAllReferences($a_id)
get all reference ids of object
$query
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 401 of file class.ilObjectLP.php.

References updateParentCollections().

402  {
403  $this->updateParentCollections();
404  }
+ Here is the call graph for this function:

◆ isActive()

ilObjectLP::isActive ( )

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

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

214  {
215  // :TODO: check LP activation?
216 
217  $mode = $this->getCurrentMode();
220  return false;
221  }
222  return true;
223  }
+ Here is the call graph for this function:

◆ isAnonymized()

ilObjectLP::isAnonymized ( )

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

167  {
168  // see ilLPCollectionOfRepositoryObjects::validateEntry()
169  return false;
170  }

◆ 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 458 of file class.ilObjectLP.php.

459  {
460  // should be overwritten by object-type-specific class
461  return false;
462  }

◆ isSupportedObjectType()

static ilObjectLP::isSupportedObjectType (   $a_type)
static

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

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

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

141  {
142  global $DIC;
143 
144  $objDefinition = $DIC["objDefinition"];
145 
146  $valid = array("crs", "grp", "fold", "lm", "htlm", "sahs", "tst", "exc", "sess", "svy", "file", "mcst", "prg", "iass");
147 
148  if (in_array($a_type, $valid)) {
149  return true;
150  }
151 
152  if ($objDefinition->isPluginTypeName($a_type)) {
153  include_once 'Services/Repository/classes/class.ilRepositoryObjectPluginSlot.php';
155  }
156 
157  return false;
158  }
static isTypePluginWithLP($a_type, $a_active_status=true)
Check whether a repository type is a plugin which has active learning progress.
global $DIC
Definition: saml.php:7
$valid
$a_type
Definition: workflow.php:92
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 160 of file class.ilObjectLP.php.

161  {
162  $this->mode = null;
163  $this->collection_instance = null;
164  }

◆ resetCustomLPDataForUserIds()

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

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

Referenced by resetLPDataForUserIds().

325  {
326  // this should delete all data that is relevant for the supported LP modes
327  }
+ Here is the caller graph for this function:

◆ resetLPDataForCompleteObject()

ilObjectLP::resetLPDataForCompleteObject (   $a_recursive = true)
final

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

References gatherLPUsers(), and resetLPDataForUserIds().

289  {
290  $user_ids = $this->gatherLPUsers();
291  if (sizeof($user_ids)) {
292  $this->resetLPDataForUserIds(array_unique($user_ids), $a_recursive);
293  }
294  }
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 296 of file class.ilObjectLP.php.

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

Referenced by resetLPDataForCompleteObject().

297  {
298  if ((bool) $a_recursive &&
299  method_exists($this, "getPossibleCollectionItems")) { // #15203
300  $subitems = $this->getPossibleCollectionItems();
301  if (is_array($subitems)) {
302  foreach ($subitems as $sub_ref_id) {
303  $olp = self::getInstance(ilObject::_lookupObjId($sub_ref_id));
304  $olp->resetLPDataForUserIds($a_user_ids, false);
305  }
306  }
307  }
308 
309  $this->resetCustomLPDataForUserIds($a_user_ids, (bool) $a_recursive);
310 
311  include_once "Services/Tracking/classes/class.ilLPMarks.php";
312  ilLPMarks::_deleteForUsers($this->obj_id, $a_user_ids);
313 
314  include_once "Services/Tracking/classes/class.ilChangeEvent.php";
315  ilChangeEvent::_deleteReadEventsForUsers($this->obj_id, $a_user_ids);
316 
317  // update LP status to get collections up-to-date
318  include_once "Services/Tracking/classes/class.ilLPStatusWrapper.php";
319  foreach ($a_user_ids as $user_id) {
320  ilLPStatusWrapper::_updateStatus($this->obj_id, $user_id);
321  }
322  }
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 688 of file class.ilObjectLP.php.

References $DIC, $ilDB, $mode, $type, and array.

Referenced by ilObjUserTrackingGUI\saveLPDefaultsObject().

689  {
690  global $DIC;
691 
692  $ilDB = $DIC->database();
693 
694  $ilDB->manipulate("DELETE FROM ut_lp_defaults");
695  foreach ($a_data as $type => $mode) {
696  $ilDB->insert("ut_lp_defaults", array(
697  "type_id" => array("text", $type),
698  "lp_mode" => array("integer", $mode)
699  ));
700  }
701  }
$type
global $DIC
Definition: saml.php:7
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 654 of file class.ilObjectLP.php.

References array.

Referenced by ilLearningProgressBaseGUI\__setSubTabs().

655  {
656  return !in_array($a_obj_type, array('svy', 'tst', 'htlm', 'exc', 'sess', 'file', 'prg'));
657  }
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 644 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().

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

◆ updateParentCollections()

ilObjectLP::updateParentCollections ( )
finalprotected

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

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

Referenced by handleDelete(), and handleToTrash().

423  {
424  $ilDB = $this->db;
425 
426  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
427 
428  // update parent collections?
429  $set = $ilDB->query("SELECT ut_lp_collections.obj_id obj_id FROM " .
430  "object_reference JOIN ut_lp_collections ON " .
431  "(object_reference.obj_id = " . $ilDB->quote($this->obj_id, "integer") .
432  " AND object_reference.ref_id = ut_lp_collections.item_id)");
433  while ($rec = $ilDB->fetchAssoc($set)) {
434  if (in_array(ilObject::_lookupType($rec["obj_id"]), array("crs", "grp", "fold"))) {
435  // remove from parent collection
436  $query = "DELETE FROM ut_lp_collections" .
437  " WHERE obj_id = " . $ilDB->quote($rec["obj_id"], "integer") .
438  " AND item_id = " . $ilDB->quote($this->obj_id, "integer");
439  $ilDB->manipulate($query);
440 
441  ilLPStatusWrapper::_refreshStatus($rec["obj_id"]);
442  }
443  }
444  }
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
$query
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 27 of file class.ilObjectLP.php.

Referenced by getCollectionInstance().

◆ $db

ilObjectLP::$db
protected

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

Referenced by getTypeDefault(), and updateParentCollections().

◆ $mode

ilObjectLP::$mode
protected

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

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

◆ $obj_id

ilObjectLP::$obj_id
protected

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

Referenced by findMembershipsByPath(), and getLPMemberships().

◆ $tree

ilObjectLP::$tree
protected

◆ $type_defaults

ilObjectLP::$type_defaults
staticprotected

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


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