ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilObjectLP Class Reference

Base class for object lp connectors. 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 ()
 Post vars for input groups is taken from array keys. More...
 
 shouldFetchIndividualModeFromFormSubmission ()
 
 fetchIndividualModeFromFormSubmission (string $selected_group, array $group_data)
 
 appendModeConfiguration (int $mode)
 
 saveModeConfiguration (string $selected_group, array $group_data, 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

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

Constructor & Destructor Documentation

◆ __construct()

ilObjectLP::__construct ( int  $obj_id)
protected

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

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

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

Member Function Documentation

◆ appendModeConfiguration()

ilObjectLP::appendModeConfiguration ( int  $mode)
Returns
array<string, Input> A map of Input elements mapped to a corresponding key

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

729  : array
730  {
731  return [];
732  }

◆ fetchIndividualModeFromFormSubmission()

ilObjectLP::fetchIndividualModeFromFormSubmission ( string  $selected_group,
array  $group_data 
)
Parameters
string$selected_grouppost var of the selected group
array$group_datadata of the that group as array, as processed by the KS

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

722  : int {
723  return 0;
724  }

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

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

459  : array {
460  global $DIC;
461 
462  $tree = $DIC->repositoryTree();
463 
464  $found = [];
465 
466  // walk path to find course or group object and check members of that object
467  $path = $tree->getPathId($parent_ref_id);
468  foreach (array_reverse($path) as $path_ref_id) {
469  $type = ilObject::_lookupType($path_ref_id, true);
470  if ($type == "crs" || $type == "grp") {
471  $class = self::getTypeClass($type);
472  $path_ob_id = ilObject::_lookupObjId($path_ref_id);
473  $chk = [];
474  $class::isLPMember($chk, $usr_id, [$path_ob_id]);
475  if (!$mapped_ref_ids) {
476  // we found a grp/crs in path of (single) parent - mark all objects
477  foreach ($obj_ids as $obj_id) {
478  $found[] = $obj_id;
479  if ($chk[$path_ob_id] ?? false) {
480  $res[$obj_id] = true;
481  }
482  }
483  } else {
484  // all children from current node are "lp-valid"
485  foreach ($obj_ids as $obj_id => $ref_ids) {
486  foreach ($ref_ids as $ref_id) {
487  if ($tree->isGrandChild($path_ref_id, $ref_id)) {
488  $found[$obj_id][] = $ref_id;
489  if ($chk[$path_ob_id] ?? false) {
490  $res[$obj_id] = true;
491  }
492  break;
493  }
494  }
495  }
496  }
497  break;
498  }
499  }
500 
501  return $found;
502  }
$res
Definition: ltiservices.php:66
$path
Definition: ltiservices.php:29
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
$ref_id
Definition: ltiauth.php:65
global $DIC
Definition: shib_login.php:22
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 331 of file class.ilObjectLP.php.

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

Referenced by resetLPDataForCompleteObject().

331  : array
332  {
333  $user_ids = ilLPMarks::_getAllUserIds($this->obj_id);
334  return array_merge($user_ids, ilChangeEvent::_getAllUserIds($this->obj_id));
335  }
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 264 of file class.ilObjectLP.php.

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

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

264  : ?ilLPCollection
265  {
266  if ($this->collection_instance === null) {
267  $this->collection_instance = ilLPCollection::getInstanceByMode($this->obj_id, $this->getCurrentMode());
268  }
270  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 210 of file class.ilObjectLP.php.

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

Referenced by getCollectionInstance(), ilTrSummaryTableGUI\getItems(), ilForumLP\getModeText(), ilCmiXapiLP\initModeOptions(), and isActive().

210  : int
211  {
212  if ($this->mode === null) {
213  // using global type default if LP is inactive
215  $mode = self::getTypeDefaultFromDB(ilObject::_lookupType($this->obj_id));
216  if ($mode === null) {
217  // fallback: inactive as type default may not be suitable
219  }
220  }
221  // use object LP setting
222  else {
223  $mode = ilLPObjSettings::_lookupDBMode($this->obj_id);
224  if ($mode === null) {
225  // fallback: object type default
226  $mode = $this->getDefaultMode();
227  }
228  }
229  $this->mode = (int) $mode;
230  }
231 
232  return $this->mode;
233  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 197 of file class.ilObjectLP.php.

References ilLPObjSettings\LP_MODE_UNDEFINED.

Referenced by getCurrentMode().

197  : int
198  {
200  }
+ 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 650 of file class.ilObjectLP.php.

References ilLPObjSettings\LP_MODE_UNDEFINED.

650  : array
651  {
653  }

◆ getInstance()

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

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

References $obj_id, and ilObject\_lookupType().

Referenced by ilLearningProgressBaseGUI\__appendLPDetails(), ilScormPlaceholderDescription\__construct(), ilLPListOfSettingsGUI\__construct(), ilLPProgressTableGUI\__construct(), ilTrSummaryTableGUI\__construct(), ilLPTableBaseGUI\__construct(), ILIAS\Forum\Statistics\ForumStatisticsTable\__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(), ilFileKioskModeView\buildControls(), 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(), ilObjSAHSLearningModule\getCreditMode(), ilLSItemsDB\getCurrentLPMode(), ilScormMailTemplateLPContext\getDescription(), ilCertificateObjectLPHelper\getInstance(), ilTrSummaryTableGUI\getItems(), ilObjCmiXapi\getLPMode(), ilObjFile\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(), ilColumnGUI\isGloballyActivated(), 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(), ILIAS\Tracking\View\DataRetrieval\DataRetrieval\retrieveViewInfo(), ilLPTableBaseGUI\searchFilterListener(), ilLPTableBaseGUI\sendMail(), ilInfoScreenGUI\showLearningProgress(), ilLearningProgressGUI\showtlt(), ilContentPageKioskModeView\toggleLearningProgress(), ilLearningModuleKioskModeView\toggleLearningProgress(), ilConditionHandlerGUI\updateCondition(), ilObjCourseGUI\updateLPFromStatus(), ilLearningProgressGUI\updateManual(), ilLPCollectionOfRepositoryObjects\validateEntry(), and ilCourseLPBadgeGUI\validateForm().

58  {
59  static $instances = [];
60 
61  if (!isset($instances[$obj_id])) {
62  $type = ilObject::_lookupType($obj_id);
63  $class = self::getTypeClass($type);
64  if ($class) {
65  $instance = new $class($obj_id);
66  } else {
67  // :TODO: should we return anything?
68  $instance = new self($obj_id);
69  }
70  $instances[$obj_id] = $instance;
71  }
72  return $instances[$obj_id];
73  }
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 507 of file class.ilObjectLP.php.

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

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

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

620  : string
621  {
622  return '';
623  }

◆ getMembers()

ilObjectLP::getMembers ( bool  $search = true)

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

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

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

◆ getModeInfoText()

ilObjectLP::getModeInfoText ( int  $mode)

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

References ilLPObjSettings\_mode2InfoText().

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

◆ getModeText()

ilObjectLP::getModeText ( int  $mode)

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

References ilLPObjSettings\_mode2Text().

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

◆ getSettingsInfo()

ilObjectLP::getSettingsInfo ( )

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

257  : string
258  {
259  // type-specific
260  return "";
261  }

◆ getSupportedObjectTypes()

static ilObjectLP::getSupportedObjectTypes ( )
static

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

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

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

134  : array
135  {
136  global $DIC;
137  $component_repository = $DIC["component.repository"];
138 
139  $valid = [
140  "crs",
141  "grp",
142  "fold",
143  "lm",
144  "htlm",
145  "sahs",
146  "tst",
147  "exc",
148  "sess",
149  "svy",
150  "file",
151  "mcst",
152  "prg",
153  "iass",
154  "copa",
155  "lso",
156  'cmix',
157  'lti',
158  'crsr',
159  'frm'
160  ];
161 
162  $plugins = $component_repository->getPluginSlotById("robj")->getActivePlugins();
163  foreach ($plugins as $plugin) {
164  $type = $plugin->getId();
166  $valid[] = $type;
167  }
168  }
169 
170 
171  return $valid;
172  }
$valid
global $DIC
Definition: shib_login.php:22
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 75 of file class.ilObjectLP.php.

References $DIC.

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

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

◆ getTypeDefault()

static ilObjectLP::getTypeDefault ( string  $type)
static

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

References $db, and null.

Referenced by ilObjUserTrackingGUI\initLPDefaultsForm().

684  : int
685  {
686  $db = self::getTypeDefaultFromDB($type);
687  if ($db !== null) {
688  return $db;
689  }
690 
691  $class = self::getTypeClass($type);
692  $olp = new $class(0);
693  return $olp->getDefaultMode();
694  }
ilDBInterface $db
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ getTypeDefaultFromDB()

static ilObjectLP::getTypeDefaultFromDB ( string  $type)
staticprotected

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

References $DIC, $ilDB, and null.

655  : ?int
656  {
657  global $DIC;
658  $ilDB = $DIC->database();
659 
660  if (is_null(self::$type_defaults)) {
661  self::$type_defaults = [];
662  $result = $ilDB->query("SELECT type_id, lp_mode FROM ut_lp_defaults");
663  while ($row = $ilDB->fetchAssoc($result)) {
664  self::$type_defaults[(string) $row["type_id"]] = (int) $row["lp_mode"];
665  }
666  }
667  return self::$type_defaults[$type] ?? null;
668  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22

◆ getValidModes()

ilObjectLP::getValidModes ( )
Returns
int[]

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

205  : array
206  {
207  return [];
208  }

◆ handleDelete()

ilObjectLP::handleDelete ( )
final

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

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

401  : void
402  {
403  ilLPMarks::deleteObject($this->obj_id);
404 
405  ilChangeEvent::_delete($this->obj_id);
406 
407  $collection = $this->getCollectionInstance();
408  if ($collection) {
409  $collection->delete();
410  }
411 
412  $this->updateParentCollections();
413  }
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 337 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().

337  : void
338  {
339  global $DIC;
340 
341  $tree = $DIC->repositoryTree();
342  $ilDB = $DIC->database();
343 
344  $ref_ids = $tree->getSubTreeIds($source_ref_id);
345  $ref_ids[] = $source_ref_id;
346 
347  // get "parent" path to source node (not including source node)
348  $new_path = $tree->getPathId($source_ref_id);
349  array_pop($new_path);
350  $new_path = implode("/", $new_path);
351 
352  // find collections with ref_ids
353  $sql =
354  "SELECT DISTINCT(ut_lp_collections.obj_id) obj_id" . PHP_EOL
355  . "FROM object_reference" . PHP_EOL
356  . "JOIN ut_lp_collections ON" . PHP_EOL
357  . "(" . $ilDB->in("object_reference.ref_id", $ref_ids, false, "integer") . PHP_EOL
358  . "AND object_reference.ref_id = ut_lp_collections.item_id)" . PHP_EOL
359  ;
360  $result = $ilDB->query($sql);
361  while ($row = $ilDB->fetchAssoc($result)) {
362  if (in_array(ilObject::_lookupType((int) $row["obj_id"]), ["crs", "grp", "fold"])) {
363  $coll_ref_id = ilObject::_getAllReferences((int) $row["obj_id"]);
364  $coll_ref_id = array_pop($coll_ref_id);
365 
366  // #13402
367  if ($coll_ref_id == $source_ref_id) {
368  continue;
369  }
370 
371  // #17703 - collection has also been moved - nothing todo
372  if ($tree->isGrandChild($source_ref_id, $coll_ref_id)) {
373  continue;
374  }
375 
376  // get path to collection (including collection "parent")
377  $coll_path = $tree->getPathId($coll_ref_id);
378  $coll_path = implode("/", $coll_path);
379 
380  // collection path is not inside new path
381  if (!stristr($new_path, $coll_path)) {
382  // delete all items of moved (sub-)tree
383  $sql =
384  "DELETE FROM ut_lp_collections" . PHP_EOL
385  . "WHERE obj_id = " . $ilDB->quote($row["obj_id"], "integer") . PHP_EOL
386  . "AND " . $ilDB->in("item_id", $ref_ids, false, "integer") . PHP_EOL
387  ;
388  $ilDB->manipulate($sql);
389 
390  ilLPStatusWrapper::_refreshStatus((int) $row["obj_id"]);
391  }
392  }
393  }
394  }
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: shib_login.php:22
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 396 of file class.ilObjectLP.php.

References updateParentCollections().

396  : void
397  {
398  $this->updateParentCollections();
399  }
+ Here is the call graph for this function:

◆ hasIndividualModeOptions()

ilObjectLP::hasIndividualModeOptions ( )

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

696  : bool
697  {
698  return false;
699  }

◆ initInvidualModeOptions()

ilObjectLP::initInvidualModeOptions ( )

Post vars for input groups is taken from array keys.

Returns
Group[]

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

705  : array
706  {
707  return [];
708  }

◆ isActive()

ilObjectLP::isActive ( )

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

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

235  : bool
236  {
237  // :TODO: check LP activation?
238 
239  $mode = $this->getCurrentMode();
242  return false;
243  }
244  return true;
245  }
+ Here is the call graph for this function:

◆ isAnonymized()

ilObjectLP::isAnonymized ( )

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

191  : bool
192  {
193  // see ilLPCollectionOfRepositoryObjects::validateEntry()
194  return false;
195  }

◆ isLPMember()

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

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

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

444  : bool
445  {
446  // should be overwritten by object-type-specific class
447  return false;
448  }

◆ isSupportedObjectType()

◆ resetCaches()

ilObjectLP::resetCaches ( )

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

References null.

185  : void
186  {
187  $this->mode = null;
188  $this->collection_instance = null;
189  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ resetCustomLPDataForUserIds()

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

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

Referenced by resetLPDataForUserIds().

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

◆ resetLPDataForCompleteObject()

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

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

References gatherLPUsers(), and resetLPDataForUserIds().

294  : void
295  {
296  $user_ids = $this->gatherLPUsers();
297  if (sizeof($user_ids)) {
298  $this->resetLPDataForUserIds(array_unique($user_ids), $recursive);
299  }
300  }
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 302 of file class.ilObjectLP.php.

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

Referenced by resetLPDataForCompleteObject().

302  : void
303  {
304  if ($recursive && method_exists($this, "getPossibleCollectionItems")) { // #15203
305  $subitems = $this->getPossibleCollectionItems();
306  if (is_array($subitems)) {
307  foreach ($subitems as $sub_ref_id) {
308  $olp = self::getInstance(ilObject::_lookupObjId($sub_ref_id));
309  $olp->resetLPDataForUserIds($user_ids, false);
310  }
311  }
312  }
313 
314  $this->resetCustomLPDataForUserIds($user_ids, $recursive);
315 
316  ilLPMarks::_deleteForUsers($this->obj_id, $user_ids);
317 
318  ilChangeEvent::_deleteReadEventsForUsers($this->obj_id, $user_ids);
319 
320  // update LP status to get collections up-to-date
321  foreach ($user_ids as $user_id) {
322  ilLPStatusWrapper::_updateStatus($this->obj_id, $user_id);
323  }
324  }
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 ( string  $selected_group,
array  $group_data,
bool &  $modeChanged 
)
Parameters
string$selected_grouppost var of the selected group
array<string,mixed>$group_data data of the that group as array, as processed by the KS

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

742  : void {
743  }

◆ saveTypeDefaults()

static ilObjectLP::saveTypeDefaults ( array  $data)
static

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

References $DIC, and $ilDB.

Referenced by ilObjUserTrackingGUI\saveLPDefaultsObject().

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

◆ shouldFetchIndividualModeFromFormSubmission()

ilObjectLP::shouldFetchIndividualModeFromFormSubmission ( )

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

710  : bool
711  {
712  return false;
713  }

◆ supportsMark()

static ilObjectLP::supportsMark ( string  $obj_type)
static

◆ supportsMatrixView()

static ilObjectLP::supportsMatrixView ( string  $obj_type)
static

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

Referenced by ilLearningProgressBaseGUI\__setSubTabs().

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

◆ supportsSpentSeconds()

static ilObjectLP::supportsSpentSeconds ( string  $obj_type)
static

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

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

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

◆ updateParentCollections()

ilObjectLP::updateParentCollections ( )
finalprotected

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

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

Referenced by handleDelete(), and handleToTrash().

415  : void
416  {
417  // update parent collections?
418  $sql =
419  "SELECT ut_lp_collections.obj_id obj_id" . PHP_EOL
420  . "FROM object_reference" . PHP_EOL
421  . "JOIN ut_lp_collections ON" . PHP_EOL
422  . "(object_reference.obj_id = " . $this->db->quote($this->obj_id, "integer") . PHP_EOL
423  . "AND object_reference.ref_id = ut_lp_collections.item_id)" . PHP_EOL
424  ;
425  $result = $this->db->query($sql);
426  while ($row = $this->db->fetchAssoc($result)) {
427  if (in_array(ilObject::_lookupType((int) $row["obj_id"]), ["crs", "grp", "fold"])) {
428  // remove from parent collection
429  $sql =
430  "DELETE FROM ut_lp_collections" . PHP_EOL
431  . "WHERE obj_id = " . $this->db->quote($row["obj_id"], "integer") . PHP_EOL
432  . "AND item_id = " . $this->db->quote($this->obj_id, "integer") . PHP_EOL
433  ;
434  $this->db->manipulate($sql);
435 
436  ilLPStatusWrapper::_refreshStatus((int) $row["obj_id"]);
437  }
438  }
439  }
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 39 of file class.ilObjectLP.php.

Referenced by getCollectionInstance().

◆ $db

ilDBInterface ilObjectLP::$db
protected

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

Referenced by getTypeDefault().

◆ $mode

int ilObjectLP::$mode = null
protected

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

Referenced by getCurrentMode().

◆ $obj_id

int ilObjectLP::$obj_id
protected

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

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

◆ $objectDefinition

ilObjectDefinition ilObjectLP::$objectDefinition
protected

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

◆ $tree

ilTree ilObjectLP::$tree
protected

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

◆ $type_defaults

array ilObjectLP::$type_defaults = null
staticprotected

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


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