ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilLPStatusFactory Class Reference

Class ilLPStatusFactory Creates status class instances for learning progress modes of an object. More...

+ Collaboration diagram for ilLPStatusFactory:

Static Public Member Functions

static _getClassById ($a_obj_id, $a_mode=null)
 
static _getClassByIdAndType ($a_obj_id, $a_type)
 
static _getInstance ($a_obj_id, $a_mode=null)
 

Static Protected Member Functions

static includeClass ($a_class)
 

Static Private Attributes

static $class_by_obj_id = array()
 

Detailed Description

Class ilLPStatusFactory Creates status class instances for learning progress modes of an object.

E.g obj_id of course returns an instance of ilLPStatusManual, ilLPStatusObjectives ...

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 19 of file class.ilLPStatusFactory.php.

Member Function Documentation

◆ _getClassById()

static ilLPStatusFactory::_getClassById (   $a_obj_id,
  $a_mode = null 
)
static

Definition at line 23 of file class.ilLPStatusFactory.php.

References exit, ilLPObjSettings\getClassMap(), ilObjectLP\getInstance(), and ilLPObjSettings\LP_MODE_UNDEFINED.

Referenced by ilLPStatusWrapper\_getCompleted(), ilLPStatusWrapper\_getFailed(), ilLPStatusWrapper\_getInProgress(), ilLPStatusWrapper\_getNotAttempted(), ilLPStatusWrapper\_getStatusInfo(), ilLPStatusWrapper\_getTypicalLearningTime(), ilLPStatusWrapper\_lookupCompletedForObject(), ilLPStatusWrapper\_lookupFailedForObject(), ilLPStatusWrapper\_lookupInProgressForObject(), ilLMExplorerGUI\checkLPIcon(), ilTrQuery\getParticipantsForObject(), ilLearningProgressGUI\initCollectionManualForm(), ilLearningProgressGUI\showtlt(), ilTrackingTest\testLPMarks(), and ilLearningProgressGUI\updateManual().

24  {
25  if ($a_mode === null) {
26  include_once 'Services/Object/classes/class.ilObjectLP.php';
27  $olp = ilObjectLP::getInstance($a_obj_id);
28  $a_mode = $olp->getCurrentMode();
29 
30  // please keep the cache in this if-block, otherwise default values
31  // will not trigger the include_once calls
32  if (isset(self::$class_by_obj_id[$a_obj_id])) {
33  return self::$class_by_obj_id[$a_obj_id];
34  }
35  }
36 
38 
39  if (array_key_exists($a_mode, $map)) {
40  $class = $map[$a_mode];
41 
42  // undefined? try object lp directly
43  if ($class === null) {
44  include_once 'Services/Object/classes/class.ilObjectLP.php';
45  $olp = ilObjectLP::getInstance($a_obj_id);
46  $mode = $olp->getCurrentMode();
48  return self::_getClassById($a_obj_id, $mode);
49  }
50  } else {
51  self::includeClass($class);
52  self::$class_by_obj_id[$a_obj_id] = $class;
53  return $class;
54  }
55  }
56 
57  // we probably can do better
58  echo "ilLPStatusFactory: unknown type " . $a_mode;
59  exit;
60  }
static getInstance($a_obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getClassByIdAndType()

static ilLPStatusFactory::_getClassByIdAndType (   $a_obj_id,
  $a_type 
)
static

Definition at line 70 of file class.ilLPStatusFactory.php.

References $a_type, and exit.

Referenced by ilLPStatusWrapper\_getCompletedByType(), ilLPStatusWrapper\_getFailedByType(), ilLPStatusWrapper\_getInProgressByType(), ilLPStatusWrapper\_getNotAttemptedByType(), and ilLPStatusWrapper\_getStatusInfoByType().

71  {
72  // id is ignored in the moment
73  switch ($a_type) {
74  case 'event':
75  self::includeClass('ilLPStatusEvent');
76  return 'ilLPStatusEvent';
77 
78  default:
79  echo "ilLPStatusFactory: unknown type: " . $a_type;
80  exit;
81  }
82  }
$a_type
Definition: workflow.php:92
+ Here is the caller graph for this function:

◆ _getInstance()

static ilLPStatusFactory::_getInstance (   $a_obj_id,
  $a_mode = null 
)
static

Definition at line 84 of file class.ilLPStatusFactory.php.

References exit, ilLPObjSettings\getClassMap(), ilObjectLP\getInstance(), and ilLPObjSettings\LP_MODE_UNDEFINED.

Referenced by ilLPStatusWrapper\_determineStatus(), ilLPStatusWrapper\_refreshStatus(), ilLPStatusWrapper\_setDirty(), ilLPStatusWrapper\_updateStatus(), ilLPStatus\checkStatusForObject(), ilTrQuery\getObjectIds(), and ilTestLP\resetCustomLPDataForUserIds().

85  {
86  if ($a_mode === null) {
87  include_once 'Services/Object/classes/class.ilObjectLP.php';
88  $olp = ilObjectLP::getInstance($a_obj_id);
89  $a_mode = $olp->getCurrentMode();
90  }
91 
93 
94  if (array_key_exists($a_mode, $map)) {
95  $class = $map[$a_mode];
96 
97  // undefined? try object lp directly
98  if ($class === null) {
99  include_once 'Services/Object/classes/class.ilObjectLP.php';
100  $olp = ilObjectLP::getInstance($a_obj_id);
101  $mode = $olp->getCurrentMode();
102  if ($mode != ilLPObjSettings::LP_MODE_UNDEFINED) {
103  return self::_getInstance($a_obj_id, $mode);
104  }
105  } else {
106  self::includeClass($class);
107  return new $class($a_obj_id);
108  }
109  }
110 
111  // we probably can do better
112  echo "ilLPStatusFactory: unknown type " . $a_mode;
113  exit;
114  }
static getInstance($a_obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ includeClass()

static ilLPStatusFactory::includeClass (   $a_class)
staticprotected

Definition at line 62 of file class.ilLPStatusFactory.php.

References $path.

63  {
64  $path = ($a_class == 'ilLPStatus')
65  ? 'Services/Tracking/classes/'
66  : 'Services/Tracking/classes/status/';
67  include_once $path . 'class.' . $a_class . '.php';
68  }

Field Documentation

◆ $class_by_obj_id

ilLPStatusFactory::$class_by_obj_id = array()
staticprivate

Definition at line 21 of file class.ilLPStatusFactory.php.


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