ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjectLP Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilObjectLP:
+ Collaboration diagram for ilObjectLP:

Public Member Functions

 resetCaches ()
 
 isAnonymized ()
 
 getDefaultMode ()
 
 getValidModes ()
 
 getCurrentMode ()
 
 isActive ()
 
 getModeText (int $mode)
 
 getModeInfoText (int $mode)
 
 getSettingsInfo ()
 
 getCollectionInstance ()
 
 getMembers (bool $search=true)
 
 resetLPDataForCompleteObject (bool $recursive=true)
 
 resetLPDataForUserIds (array $user_ids, bool $recursive=true)
 
 handleToTrash ()
 
 handleDelete ()
 
 getMailTemplateId ()
 
 hasIndividualModeOptions ()
 
 initInvidualModeOptions (ilRadioGroupInputGUI $modeRadio)
 
 shouldFetchIndividualModeFromFormSubmission ()
 
 fetchIndividualModeFromFormSubmission (ilPropertyFormGUI $form)
 
 appendModeConfiguration (int $mode, ilRadioOption $modeElement)
 
 saveModeConfiguration (ilPropertyFormGUI $form, bool &$modeChanged)
 

Static Public Member Functions

static getInstance (int $obj_id)
 
static getTypeClass (string $type)
 
static getSupportedObjectTypes ()
 
static isSupportedObjectType (string $type)
 
static handleMove (int $source_ref_id)
 
static getLPMemberships (int $usr_id, array $obj_ids, ?int $parent_ref_id=null, bool $mapped_ref_ids=false)
 Get all objects where given user is member (from LP POV) More...
 
static supportsSpentSeconds (string $obj_type)
 
static supportsMark (string $obj_type)
 
static supportsMatrixView (string $obj_type)
 
static getDefaultModes (bool $lp_active)
 Get available type-specific default modes (no administration needed) More...
 
static saveTypeDefaults (array $data)
 
static getTypeDefault (string $type)
 

Protected Member Functions

 __construct (int $obj_id)
 
 resetCustomLPDataForUserIds (array $user_ids, bool $recursive=true)
 
 gatherLPUsers ()
 
 updateParentCollections ()
 

Static Protected Member Functions

static isLPMember (array &$res, int $usr_id, array $obj_ids)
 Find (lp-relevant) members for given object ids. More...
 
static findMembershipsByPath (array &$res, int $usr_id, int $parent_ref_id, array $obj_ids, bool $mapped_ref_ids=false)
 Find (lp-relevant) memberships by path. More...
 
static getTypeDefaultFromDB (string $type)
 

Protected Attributes

ilTree $tree
 
ilDBInterface $db
 
ilObjectDefinition $objectDefinition
 
int $obj_id
 
ilLPCollection $collection_instance = null
 
int $mode = null
 

Static Protected Attributes

static array $type_defaults = null
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Base class for object lp connectors

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

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

Constructor & Destructor Documentation

◆ __construct()

ilObjectLP::__construct ( int  $obj_id)
protected

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

References $DIC, $obj_id, and ILIAS\Repository\objectDefinition().

40  {
41  global $DIC;
42 
43  $this->tree = $DIC->repositoryTree();
44  $this->db = $DIC->database();
45  $this->objectDefinition = $DIC['objDefinition'];
46 
47  $this->obj_id = $obj_id;
48  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ appendModeConfiguration()

ilObjectLP::appendModeConfiguration ( int  $mode,
ilRadioOption  $modeElement 
)

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

712  : void
713  {
714  }

◆ fetchIndividualModeFromFormSubmission()

ilObjectLP::fetchIndividualModeFromFormSubmission ( ilPropertyFormGUI  $form)

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

707  : int
708  {
709  return 0;
710  }

◆ findMembershipsByPath()

static ilObjectLP::findMembershipsByPath ( array &  $res,
int  $usr_id,
int  $parent_ref_id,
array  $obj_ids,
bool  $mapped_ref_ids = false 
)
staticprotected

Find (lp-relevant) memberships by path.

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

References $DIC, $obj_id, $path, $ref_id, $type, ilObject\_lookupObjId(), ilObject\_lookupType(), ilTree\getPathId(), and ilTree\isGrandChild().

456  : array {
457  global $DIC;
458 
459  $tree = $DIC->repositoryTree();
460 
461  $found = array();
462 
463  // walk path to find course or group object and check members of that object
464  $path = $tree->getPathId($parent_ref_id);
465  foreach (array_reverse($path) as $path_ref_id) {
466  $type = ilObject::_lookupType($path_ref_id, true);
467  if ($type == "crs" || $type == "grp") {
468  $class = self::getTypeClass($type);
469  $path_ob_id = ilObject::_lookupObjId($path_ref_id);
470  $chk = array();
471  $class::isLPMember($chk, $usr_id, array($path_ob_id));
472  if (!$mapped_ref_ids) {
473  // we found a grp/crs in path of (single) parent - mark all objects
474  foreach ($obj_ids as $obj_id) {
475  $found[] = $obj_id;
476  if ($chk[$path_ob_id] ?? false) {
477  $res[$obj_id] = true;
478  }
479  }
480  } else {
481  // all children from current node are "lp-valid"
482  foreach ($obj_ids as $obj_id => $ref_ids) {
483  foreach ($ref_ids as $ref_id) {
484  if ($tree->isGrandChild($path_ref_id, $ref_id)) {
485  $found[$obj_id][] = $ref_id;
486  if ($chk[$path_ob_id] ?? false) {
487  $res[$obj_id] = true;
488  }
489  break;
490  }
491  }
492  }
493  }
494  break;
495  }
496  }
497 
498  return $found;
499  }
$res
Definition: ltiservices.php:69
$type
$path
Definition: ltiservices.php:32
static _lookupObjId(int $ref_id)
isGrandChild(int $a_startnode_id, int $a_querynode_id)
checks if a node is in the path of an other node
global $DIC
Definition: feed.php:28
$ref_id
Definition: ltiauth.php:67
getPathId(int $a_endnode_id, int $a_startnode_id=0)
get path from a given startnode to a given endnode if startnode is not given the rootnode is startnod...
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:

◆ gatherLPUsers()

ilObjectLP::gatherLPUsers ( )
protected

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

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

Referenced by resetLPDataForCompleteObject().

328  : array
329  {
330  $user_ids = ilLPMarks::_getAllUserIds($this->obj_id);
331  return array_merge($user_ids, ilChangeEvent::_getAllUserIds($this->obj_id));
332  }
static _getAllUserIds(int $a_obj_id)
static _getAllUserIds(int $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 261 of file class.ilObjectLP.php.

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

Referenced by ilTrSummaryTableGUI\getItems(), and handleDelete().

261  : ?ilLPCollection
262  {
263  if ($this->collection_instance === null) {
264  $this->collection_instance = ilLPCollection::getInstanceByMode($this->obj_id, $this->getCurrentMode());
265  }
267  }
static getInstanceByMode(int $a_obj_id, int $a_mode)
ilLPCollection $collection_instance
LP collection base class.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCurrentMode()

ilObjectLP::getCurrentMode ( )

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

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

Referenced by getCollectionInstance(), ilTrSummaryTableGUI\getItems(), ilCmiXapiLP\initModeOptions(), isActive(), and ilCertificateSettingsCourseFormRepository\save().

207  : int
208  {
209  if ($this->mode === null) {
210  // using global type default if LP is inactive
212  $mode = self::getTypeDefaultFromDB(ilObject::_lookupType($this->obj_id));
213  if ($mode === null) {
214  // fallback: inactive as type default may not be suitable
216  }
217  }
218  // use object LP setting
219  else {
220  $mode = ilLPObjSettings::_lookupDBMode($this->obj_id);
221  if ($mode === null) {
222  // fallback: object type default
223  $mode = $this->getDefaultMode();
224  }
225  }
226  $this->mode = (int) $mode;
227  }
228 
229  return $this->mode;
230  }
static _lookupDBMode(int $a_obj_id)
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDefaultMode()

ilObjectLP::getDefaultMode ( )

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

References ilLPObjSettings\LP_MODE_UNDEFINED.

Referenced by getCurrentMode().

194  : int
195  {
197  }
+ Here is the caller graph for this function:

◆ getDefaultModes()

static ilObjectLP::getDefaultModes ( bool  $lp_active)
static

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

Returns
int[]

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

References ilLPObjSettings\LP_MODE_UNDEFINED.

647  : array
648  {
650  }

◆ getInstance()

static ilObjectLP::getInstance ( int  $obj_id)
static
Parameters
int$obj_id
Returns
ilObjectLP|mixed

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

References $obj_id, $type, and ilObject\_lookupType().

Referenced by ilLearningProgressBaseGUI\__appendLPDetails(), ilScormPlaceholderDescription\__construct(), ilLPListOfSettingsGUI\__construct(), ilForumStatisticsTableGUI\__construct(), ilCertificateSettingsCourseFormRepository\__construct(), ilLPProgressTableGUI\__construct(), ilTrSummaryTableGUI\__construct(), ilLPTableBaseGUI\__construct(), ilXapiStatementEvaluation\__construct(), ilLearningProgressBaseGUI\__construct(), ilLPObjSettings\__construct(), ilLearningProgressGUI\__getNextClass(), ilLPListOfProgressGUI\__initDetails(), ilLPListOfObjectsGUI\__initDetails(), ilLearningProgressBaseGUI\__setSubTabs(), ilLearningProgressBaseGUI\__showObjectDetails(), ilLPStatusFactory\_getClassById(), ilLPStatusCollection\_getCompleted(), ilLPStatusCollection\_getFailed(), ilLPStatusCollection\_getInProgress(), ilLPStatusFactory\_getInstance(), ilLPStatusSCORM\_getNotAttempted(), ilLPStatusCollectionManual\_getStatusInfo(), ilLPStatusCollectionTLT\_getStatusInfo(), ilLPStatusSCORM\_getStatusInfo(), ilLPStatusCollection\_getStatusInfo(), ilLPStatusCollectionManual\_setObjectStatus(), ILIAS\MediaCast\LearningProgress\LearningProgressManager\addItemToLP(), ilConditionHandlerGUI\assign(), ilContentPageKioskModeView\buildLearningProgressToggleControl(), ilLearningProgressAccess\checkAccess(), ilLMExplorerGUI\checkLPIcon(), ilLPStatus\checkLPModesForObjects(), ilContainer\cloneDependencies(), ilObjMediaCast\copyOrder(), ilObjSurvey\deleteAllUserData(), ilLPListOfProgressGUI\details(), ilLPStatusSCORM\determinePercentage(), ilLPStatusSCORM\determineStatus(), ilLPStatusCollection\determineStatus(), ilObjContentObject\doMDUpdateListener(), ilLearningProgressGUI\editManual(), ilLPProgressTableGUI\fillRow(), ilLPCronObjectStatistics\gatherCourseLPData(), ilLPStatusCollectionMobs\getCollectionItems(), ilScormMailTemplateLPContext\getDescription(), ilCertificateObjectLPHelper\getInstance(), ilTrSummaryTableGUI\getItems(), ilObjCmiXapi\getLPMode(), ilLPListOfSettingsGUI\getLPPathInfo(), ilTrQuery\getObjectIds(), ilTrQuery\getObjectsStatusForUser(), ilTimingsUser\getObjectsWithInactiveLP(), ilTrQuery\getParticipantsForObject(), ilCourseMembershipGUI\getPrintMemberData(), ilLPTableBaseGUI\getSelectableUserColumns(), ilObjSCORMInitData\getStatus(), ilTrQuery\getSubItemsStatusForUser(), ilTrQuery\getSubTree(), ilTrackingAppEventListener\handleEvent(), ilCourseAppEventListener\handleEvent(), ilLTIAppEventListener\handleOutcomeWithoutLP(), ilObjSCORM2004LearningModule\importSuccess(), ilObjSCORMLearningModule\importSuccess(), ilMembershipGUI\initAttendanceList(), ilLearningProgressGUI\initCollectionManualForm(), ilCourseLPBadgeGUI\initConfigForm(), ilObjCourseGUI\initEditForm(), ilLearningProgressBaseGUI\initEditUserForm(), ilTrUserObjectsPropsTableGUI\initFilter(), ilConditionHandlerGUI\initFormCondition(), ilGroupMembershipGUI\initParticipantTableGUI(), ilCourseMembershipGUI\initParticipantTableGUI(), ilLPStatusPlugin\initPluginObj(), ilIndividualAssessmentLPInterface\isActiveLP(), ILIAS\MediaCast\LearningProgress\LearningProgressManager\isCollectionMode(), ilLPTableBaseGUI\isPercentageAvailable(), ilSCORMTrackingItems\markedLearningStatusForExportSelected(), ilLearningModuleKioskModeView\maybeBuildLearningProgressToggleControl(), ilLMObject\MDUpdateListener(), ilLPCollectionOfRepositoryObjects\parseTableGUIItem(), ilLPTableBaseGUI\parseTitle(), ilObjSAHSLearningModule\populateByDirectoy(), ilLearningSequenceRoles\readMemberData(), ilObjGroupGUI\readMemberData(), ilObjCourseGUI\readMemberData(), ilTimingCache\readObjectInformation(), ilObjSurvey\removeSelectedSurveyResults(), ilObjTest\removeTestResults(), ilLMMenuRendererGUI\render(), ilCourseObjectiveResult\resetTestForUser(), ilCertificateSettingsCourseFormRepository\save(), ilLPTableBaseGUI\searchFilterListener(), ilLPTableBaseGUI\sendMail(), ilInfoScreenGUI\showLearningProgress(), ilLearningProgressGUI\showtlt(), ilContentPageKioskModeView\toggleLearningProgress(), ilLearningModuleKioskModeView\toggleLearningProgress(), ilConditionHandlerGUI\updateCondition(), ilObjCourseGUI\updateLPFromStatus(), ilLearningProgressGUI\updateManual(), ilLPCollectionOfRepositoryObjects\validateEntry(), and ilCourseLPBadgeGUI\validateForm().

55  {
56  static $instances = array();
57 
58  if (!isset($instances[$obj_id])) {
59  $type = ilObject::_lookupType($obj_id);
60  $class = self::getTypeClass($type);
61  if ($class) {
62  $instance = new $class($obj_id);
63  } else {
64  // :TODO: should we return anything?
65  $instance = new self($obj_id);
66  }
67  $instances[$obj_id] = $instance;
68  }
69  return $instances[$obj_id];
70  }
$type
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLPMemberships()

static ilObjectLP::getLPMemberships ( int  $usr_id,
array  $obj_ids,
?int  $parent_ref_id = null,
bool  $mapped_ref_ids = false 
)
static

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

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

References $DIC, $ilDB, $ref_id, $res, $type, ilTree\getParentId(), ILIAS\Repository\int(), and ROOT_FOLDER_ID.

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

509  : array {
510  global $DIC;
511 
512  $ilDB = $DIC->database();
513  $tree = $DIC->repositoryTree();
514 
515  // see ilTrQuery::getParticipantsForObject() [single object only]
516  // this is optimized for larger number of objects, e.g. list GUIs
517 
518  $ref_map = [];
519  if ($mapped_ref_ids) {
520  $ref_map = $obj_ids;
521  $obj_ids = array_keys($obj_ids);
522  }
523 
524  $res = [];
525 
526  // get object types
527  $types_map = [];
528  $sql =
529  "SELECT obj_id, type" . PHP_EOL
530  . "FROM object_data" . PHP_EOL
531  . "WHERE " . $ilDB->in("obj_id", $obj_ids, false, "integer") . PHP_EOL
532  ;
533  $result = $ilDB->query($sql);
534  while ($row = $ilDB->fetchAssoc($result)) {
535  $types_map[$row["type"]][] = (int) $row["obj_id"];
536  $res[(int) $row["obj_id"]] = false;
537  }
538 
539  $find_by_parent = [];
540  foreach ($types_map as $type => $type_obj_ids) {
541  $class = self::getTypeClass($type);
542  if ($class) {
543  // lp-supported type?
544  if (!$class::isLPMember($res, $usr_id, $type_obj_ids)) {
545  $find_by_parent = array_merge($find_by_parent, $type_obj_ids);
546  }
547  }
548  }
549 
550  if (sizeof($find_by_parent)) {
551  // single parent for all objects (repository/ilObjectListGUI)
552  if ($parent_ref_id) {
553  if (self::findMembershipsByPath($res, $usr_id, $parent_ref_id, $find_by_parent)) {
554  // we found a crs/grp in path, so no need to check read_events
555  $find_by_parent = null;
556  }
557  }
558  // different parents (PD > LP)
559  elseif (is_array($ref_map) && count($ref_map) > 0) {
560  foreach ($find_by_parent as $obj_id) {
561  // maybe already found by path search from other object/reference
562  if ($res[$obj_id] === false) {
563  if (isset($ref_map[$obj_id]) && is_array($ref_map[$obj_id])) {
564  // check all references
565  foreach ($ref_map[$obj_id] as $ref_id) {
566  $parent_ref_id = $tree->getParentId($ref_id);
567  if ($parent_ref_id == ROOT_FOLDER_ID) {
568  continue;
569  }
570 
571  // we are checking the complete ref_map
572  // to find all relevant objects in subtree of current ref_id
573  $found = self::findMembershipsByPath($res, $usr_id, $parent_ref_id, $ref_map, true);
574  if (is_array($found) && count($found) > 0) {
575  // if any references were found in a crs/grp-subtree
576  // remove from "read-event"-last-resort-pool
577  foreach ($found as $found_obj_id => $found_ref_ids) {
578  $diff = array_diff($ref_map[$found_obj_id], $found_ref_ids);
579  if ($diff) {
580  // 1-n refs are in another subtree
581  // have to be checked separately
582  $ref_map[$found_obj_id] = $diff;
583  } else {
584  // all references found in subtree
585  // no need to check again
586  unset($ref_map[$found_obj_id]);
587  }
588  }
589  break;
590  }
591  }
592  }
593  }
594  }
595 
596  $find_by_parent = array_keys($ref_map);
597  }
598 
599  // last resort: use read_event?
600  if (is_array($find_by_parent) && count($find_by_parent) > 0) {
601  $sql =
602  "SELECT obj_id" . PHP_EOL
603  . "FROM read_event" . PHP_EOL
604  . "WHERE " . $ilDB->in("obj_id", $find_by_parent, false, "integer") . PHP_EOL
605  . "AND usr_id = " . $ilDB->quote($usr_id, "integer") . PHP_EOL
606  ;
607  $result = $ilDB->query($sql);
608  while ($row = $ilDB->fetchAssoc($result)) {
609  $res[(int) $row["obj_id"]] = true;
610  }
611  }
612  }
613 
614  return $res;
615  }
$res
Definition: ltiservices.php:69
$type
const ROOT_FOLDER_ID
Definition: constants.php:32
global $DIC
Definition: feed.php:28
$ref_id
Definition: ltiauth.php:67
getParentId(int $a_node_id)
get parent id of given node
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMailTemplateId()

ilObjectLP::getMailTemplateId ( )

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

617  : string
618  {
619  return '';
620  }

◆ getMembers()

ilObjectLP::getMembers ( bool  $search = true)

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

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

269  : array
270  {
271  if (!$search) {
272  return [];
273  }
274 
275  $ref_ids = ilObject::_getAllReferences($this->obj_id);
276  $ref_id = current($ref_ids);
277 
278  // walk path to find parent with specific members
279  $path = $this->tree->getPathId($ref_id);
280  array_pop($path);
281  foreach (array_reverse($path) as $path_ref_id) {
282  $olp = self::getInstance(ilObject::_lookupObjId($path_ref_id));
283  $all = $olp->getMembers(false);
284  if (is_array($all)) {
285  return $all;
286  }
287  }
288  return [];
289  }
static _getAllReferences(int $id)
get all reference ids for object ID
$path
Definition: ltiservices.php:32
static _lookupObjId(int $ref_id)
$ref_id
Definition: ltiauth.php:67
+ Here is the call graph for this function:

◆ getModeInfoText()

ilObjectLP::getModeInfoText ( int  $mode)

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

References ilLPObjSettings\_mode2InfoText().

249  : string
250  {
252  }
static _mode2InfoText(int $a_mode)
+ Here is the call graph for this function:

◆ getModeText()

ilObjectLP::getModeText ( int  $mode)

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

References ilLPObjSettings\_mode2Text().

244  : string
245  {
247  }
static _mode2Text(int $a_mode)
+ Here is the call graph for this function:

◆ getSettingsInfo()

ilObjectLP::getSettingsInfo ( )

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

254  : string
255  {
256  // type-specific
257  return "";
258  }

◆ getSupportedObjectTypes()

static ilObjectLP::getSupportedObjectTypes ( )
static

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

References $DIC, XapiProxy\$plugin, $type, $valid, and ilRepositoryObjectPluginSlot\isTypePluginWithLP().

Referenced by ILIAS\Skill\Profile\SkillProfileCompletionManager\getActualMaxLevels().

131  : array
132  {
133  global $DIC;
134  $component_repository = $DIC["component.repository"];
135 
136  $valid = [
137  "crs",
138  "grp",
139  "fold",
140  "lm",
141  "htlm",
142  "sahs",
143  "tst",
144  "exc",
145  "sess",
146  "svy",
147  "file",
148  "mcst",
149  "prg",
150  "iass",
151  "copa",
152  "lso",
153  'cmix',
154  'lti',
155  'crsr',
156  'frm'
157  ];
158 
159  $plugins = $component_repository->getPluginSlotById("robj")->getActivePlugins();
160  foreach ($plugins as $plugin) {
161  $type = $plugin->getId();
163  $valid[] = $type;
164  }
165  }
166 
167 
168  return $valid;
169  }
$type
$valid
global $DIC
Definition: feed.php:28
static isTypePluginWithLP(string $a_type, bool $a_active_status=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTypeClass()

static ilObjectLP::getTypeClass ( string  $type)
static

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

References $DIC.

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

72  : string
73  {
74  global $DIC;
75  $objDefinition = $DIC["objDefinition"];
76  if (self::isSupportedObjectType($type)) {
77  switch ($type) {
78  // container
79  case "crs":
80  return "ilCourseLP";
81  case 'crsr':
82  return 'ilCourseReferenceLP';
83  case "grp":
84  return "ilGroupLP";
85  case "fold":
86  return "ilFolderLP";
87  case "lso":
88  return "ilLSLP";
89 
90  // learning resources
91  case "lm":
92  return "ilLearningModuleLP";
93  case "htlm":
94  return "ilHTMLLearningModuleLP";
95  case "sahs":
96  return "ilScormLP";
97 
98  // misc
99  case "tst":
100  return "ilTestLP";
101  case "exc":
102  return "ilExerciseLP";
103  case 'file':
104  return 'ilFileLP';
105  case "mcst":
106  return "ilMediaCastLP";
107  case "sess":
108  return "ilSessionLP";
109  case "svy":
110  return "ilSurveyLP";
111  case "prg":
112  return "ilStudyProgrammeLP";
113  case "iass":
114  return "ilIndividualAssessmentLP";
115  case "copa":
116  return "ilContentPageLP";
117  case 'cmix':
118  return ilCmiXapiLP::class;
119  case 'lti':
120  return ilLTIConsumerLP::class;
121  case 'frm':
122  return ilForumLP::class;
123  }
124  if ($objDefinition->isPluginTypeName($type)) {
125  return "ilPluginLP";
126  }
127  }
128  return "";
129  }
$type
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ getTypeDefault()

static ilObjectLP::getTypeDefault ( string  $type)
static

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

References $db.

Referenced by ilObjUserTrackingGUI\initLPDefaultsForm().

681  : int
682  {
683  $db = self::getTypeDefaultFromDB($type);
684  if ($db !== null) {
685  return $db;
686  }
687 
688  $class = self::getTypeClass($type);
689  $olp = new $class(0);
690  return $olp->getDefaultMode();
691  }
$type
ilDBInterface $db
+ Here is the caller graph for this function:

◆ getTypeDefaultFromDB()

static ilObjectLP::getTypeDefaultFromDB ( string  $type)
staticprotected

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

References $DIC, $ilDB, and $type.

652  : ?int
653  {
654  global $DIC;
655  $ilDB = $DIC->database();
656 
657  if (is_null(self::$type_defaults)) {
658  self::$type_defaults = [];
659  $result = $ilDB->query("SELECT type_id, lp_mode FROM ut_lp_defaults");
660  while ($row = $ilDB->fetchAssoc($result)) {
661  self::$type_defaults[(string) $row["type_id"]] = (int) $row["lp_mode"];
662  }
663  }
664  return self::$type_defaults[$type] ?? null;
665  }
$type
global $DIC
Definition: feed.php:28

◆ getValidModes()

ilObjectLP::getValidModes ( )
Returns
int[]

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

202  : array
203  {
204  return [];
205  }

◆ handleDelete()

ilObjectLP::handleDelete ( )
final

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

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

398  : void
399  {
400  ilLPMarks::deleteObject($this->obj_id);
401 
402  ilChangeEvent::_delete($this->obj_id);
403 
404  $collection = $this->getCollectionInstance();
405  if ($collection) {
406  $collection->delete();
407  }
408 
409  $this->updateParentCollections();
410  }
static _delete(int $a_obj_id)
Delete object entries.
static deleteObject(int $a_obj_id)
+ Here is the call graph for this function:

◆ handleMove()

static ilObjectLP::handleMove ( int  $source_ref_id)
staticfinal

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

References $DIC, $ilDB, ilObject\_getAllReferences(), ilObject\_lookupType(), ilLPStatusWrapper\_refreshStatus(), ilTree\getPathId(), ilTree\getSubTreeIds(), and ilTree\isGrandChild().

Referenced by ilTrackingAppEventListener\handleEvent().

334  : void
335  {
336  global $DIC;
337 
338  $tree = $DIC->repositoryTree();
339  $ilDB = $DIC->database();
340 
341  $ref_ids = $tree->getSubTreeIds($source_ref_id);
342  $ref_ids[] = $source_ref_id;
343 
344  // get "parent" path to source node (not including source node)
345  $new_path = $tree->getPathId($source_ref_id);
346  array_pop($new_path);
347  $new_path = implode("/", $new_path);
348 
349  // find collections with ref_ids
350  $sql =
351  "SELECT DISTINCT(ut_lp_collections.obj_id) obj_id" . PHP_EOL
352  . "FROM object_reference" . PHP_EOL
353  . "JOIN ut_lp_collections ON" . PHP_EOL
354  . "(" . $ilDB->in("object_reference.ref_id", $ref_ids, false, "integer") . PHP_EOL
355  . "AND object_reference.ref_id = ut_lp_collections.item_id)" . PHP_EOL
356  ;
357  $result = $ilDB->query($sql);
358  while ($row = $ilDB->fetchAssoc($result)) {
359  if (in_array(ilObject::_lookupType((int) $row["obj_id"]), ["crs", "grp", "fold"])) {
360  $coll_ref_id = ilObject::_getAllReferences((int) $row["obj_id"]);
361  $coll_ref_id = array_pop($coll_ref_id);
362 
363  // #13402
364  if ($coll_ref_id == $source_ref_id) {
365  continue;
366  }
367 
368  // #17703 - collection has also been moved - nothing todo
369  if ($tree->isGrandChild($source_ref_id, $coll_ref_id)) {
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  // delete all items of moved (sub-)tree
380  $sql =
381  "DELETE FROM ut_lp_collections" . PHP_EOL
382  . "WHERE obj_id = " . $ilDB->quote($row["obj_id"], "integer") . PHP_EOL
383  . "AND " . $ilDB->in("item_id", $ref_ids, false, "integer") . PHP_EOL
384  ;
385  $ilDB->manipulate($sql);
386 
387  ilLPStatusWrapper::_refreshStatus((int) $row["obj_id"]);
388  }
389  }
390  }
391  }
static _getAllReferences(int $id)
get all reference ids for object ID
getSubTreeIds(int $a_ref_id)
Get all ids of subnodes.
isGrandChild(int $a_startnode_id, int $a_querynode_id)
checks if a node is in the path of an other node
global $DIC
Definition: feed.php:28
static _refreshStatus(int $a_obj_id, ?array $a_users=null)
getPathId(int $a_endnode_id, int $a_startnode_id=0)
get path from a given startnode to a given endnode if startnode is not given the rootnode is startnod...
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleToTrash()

ilObjectLP::handleToTrash ( )
final

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

References updateParentCollections().

393  : void
394  {
395  $this->updateParentCollections();
396  }
+ Here is the call graph for this function:

◆ hasIndividualModeOptions()

ilObjectLP::hasIndividualModeOptions ( )

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

693  : bool
694  {
695  return false;
696  }

◆ initInvidualModeOptions()

ilObjectLP::initInvidualModeOptions ( ilRadioGroupInputGUI  $modeRadio)

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

698  : void
699  {
700  }

◆ isActive()

ilObjectLP::isActive ( )

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

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

232  : bool
233  {
234  // :TODO: check LP activation?
235 
236  $mode = $this->getCurrentMode();
239  return false;
240  }
241  return true;
242  }
+ Here is the call graph for this function:

◆ isAnonymized()

ilObjectLP::isAnonymized ( )

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

188  : bool
189  {
190  // see ilLPCollectionOfRepositoryObjects::validateEntry()
191  return false;
192  }

◆ isLPMember()

static ilObjectLP::isLPMember ( array &  $res,
int  $usr_id,
array  $obj_ids 
)
staticprotected

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

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

441  : bool
442  {
443  // should be overwritten by object-type-specific class
444  return false;
445  }

◆ isSupportedObjectType()

◆ resetCaches()

ilObjectLP::resetCaches ( )

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

182  : void
183  {
184  $this->mode = null;
185  $this->collection_instance = null;
186  }

◆ resetCustomLPDataForUserIds()

ilObjectLP::resetCustomLPDataForUserIds ( array  $user_ids,
bool  $recursive = true 
)
protected

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

Referenced by resetLPDataForUserIds().

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

◆ resetLPDataForCompleteObject()

ilObjectLP::resetLPDataForCompleteObject ( bool  $recursive = true)
final

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

References gatherLPUsers(), and resetLPDataForUserIds().

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

◆ resetLPDataForUserIds()

ilObjectLP::resetLPDataForUserIds ( array  $user_ids,
bool  $recursive = true 
)
final

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

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

Referenced by resetLPDataForCompleteObject().

299  : void
300  {
301  if ($recursive && method_exists($this, "getPossibleCollectionItems")) { // #15203
302  $subitems = $this->getPossibleCollectionItems();
303  if (is_array($subitems)) {
304  foreach ($subitems as $sub_ref_id) {
305  $olp = self::getInstance(ilObject::_lookupObjId($sub_ref_id));
306  $olp->resetLPDataForUserIds($user_ids, false);
307  }
308  }
309  }
310 
311  $this->resetCustomLPDataForUserIds($user_ids, $recursive);
312 
313  ilLPMarks::_deleteForUsers($this->obj_id, $user_ids);
314 
315  ilChangeEvent::_deleteReadEventsForUsers($this->obj_id, $user_ids);
316 
317  // update LP status to get collections up-to-date
318  foreach ($user_ids as $user_id) {
319  ilLPStatusWrapper::_updateStatus($this->obj_id, $user_id);
320  }
321  }
resetCustomLPDataForUserIds(array $user_ids, bool $recursive=true)
static _lookupObjId(int $ref_id)
static _deleteForUsers(int $a_obj_id, array $a_user_ids)
static _deleteReadEventsForUsers(int $a_obj_id, array $a_user_ids)
static _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveModeConfiguration()

ilObjectLP::saveModeConfiguration ( ilPropertyFormGUI  $form,
bool &  $modeChanged 
)

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

716  : void
717  {
718  }

◆ saveTypeDefaults()

static ilObjectLP::saveTypeDefaults ( array  $data)
static

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

References $DIC, $ilDB, and $type.

Referenced by ilObjUserTrackingGUI\saveLPDefaultsObject().

667  : void
668  {
669  global $DIC;
670  $ilDB = $DIC->database();
671 
672  $ilDB->manipulate("DELETE FROM ut_lp_defaults");
673  foreach ($data as $type => $mode) {
674  $ilDB->insert("ut_lp_defaults", [
675  "type_id" => ["text", $type],
676  "lp_mode" => ["integer", $mode]
677  ]);
678  }
679  }
$type
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ shouldFetchIndividualModeFromFormSubmission()

ilObjectLP::shouldFetchIndividualModeFromFormSubmission ( )

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

702  : bool
703  {
704  return false;
705  }

◆ supportsMark()

static ilObjectLP::supportsMark ( string  $obj_type)
static

◆ supportsMatrixView()

static ilObjectLP::supportsMatrixView ( string  $obj_type)
static

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

Referenced by ilLearningProgressBaseGUI\__setSubTabs().

637  : bool
638  {
639  $types = ['svy', 'tst', 'htlm', 'exc', 'sess', 'file', 'frm', 'prg', 'copa', 'cmix', 'lti','crsr'];
640  return !in_array($obj_type, $types);
641  }
+ Here is the caller graph for this function:

◆ supportsSpentSeconds()

static ilObjectLP::supportsSpentSeconds ( string  $obj_type)
static

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

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

627  : bool
628  {
629  return !in_array($obj_type, ["exc", "file", "mcst", "mob", "htlm", "copa", 'cmix', 'lti', 'frm']);
630  }
+ Here is the caller graph for this function:

◆ updateParentCollections()

ilObjectLP::updateParentCollections ( )
finalprotected

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

References ilObject\_lookupType(), and ilLPStatusWrapper\_refreshStatus().

Referenced by handleDelete(), and handleToTrash().

412  : void
413  {
414  // update parent collections?
415  $sql =
416  "SELECT ut_lp_collections.obj_id obj_id" . PHP_EOL
417  . "FROM object_reference" . PHP_EOL
418  . "JOIN ut_lp_collections ON" . PHP_EOL
419  . "(object_reference.obj_id = " . $this->db->quote($this->obj_id, "integer") . PHP_EOL
420  . "AND object_reference.ref_id = ut_lp_collections.item_id)" . PHP_EOL
421  ;
422  $result = $this->db->query($sql);
423  while ($row = $this->db->fetchAssoc($result)) {
424  if (in_array(ilObject::_lookupType((int) $row["obj_id"]), array("crs", "grp", "fold"))) {
425  // remove from parent collection
426  $sql =
427  "DELETE FROM ut_lp_collections" . PHP_EOL
428  . "WHERE obj_id = " . $this->db->quote($row["obj_id"], "integer") . PHP_EOL
429  . "AND item_id = " . $this->db->quote($this->obj_id, "integer") . PHP_EOL
430  ;
431  $this->db->manipulate($sql);
432 
433  ilLPStatusWrapper::_refreshStatus((int) $row["obj_id"]);
434  }
435  }
436  }
static _refreshStatus(int $a_obj_id, ?array $a_users=null)
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $collection_instance

ilLPCollection ilObjectLP::$collection_instance = null
protected

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

Referenced by getCollectionInstance().

◆ $db

ilDBInterface ilObjectLP::$db
protected

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

Referenced by getTypeDefault().

◆ $mode

int ilObjectLP::$mode = null
protected

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

Referenced by getCurrentMode().

◆ $obj_id

int ilObjectLP::$obj_id
protected

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

Referenced by __construct(), findMembershipsByPath(), and getInstance().

◆ $objectDefinition

ilObjectDefinition ilObjectLP::$objectDefinition
protected

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

◆ $tree

ilTree ilObjectLP::$tree
protected

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

◆ $type_defaults

array ilObjectLP::$type_defaults = null
staticprotected

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


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