ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  {
27  include_once 'Services/Object/classes/class.ilObjectLP.php';
28  $olp = ilObjectLP::getInstance($a_obj_id);
29  $a_mode = $olp->getCurrentMode();
30 
31  // please keep the cache in this if-block, otherwise default values
32  // will not trigger the include_once calls
33  if (isset(self::$class_by_obj_id[$a_obj_id]))
34  {
35  return self::$class_by_obj_id[$a_obj_id];
36  }
37  }
38 
40 
41  if(array_key_exists($a_mode, $map))
42  {
43  $class = $map[$a_mode];
44 
45  // undefined? try object lp directly
46  if($class === null)
47  {
48  include_once 'Services/Object/classes/class.ilObjectLP.php';
49  $olp = ilObjectLP::getInstance($a_obj_id);
50  $mode = $olp->getCurrentMode();
52  {
53  return self::_getClassById($a_obj_id, $mode);
54  }
55  }
56  else
57  {
58  self::includeClass($class);
59  self::$class_by_obj_id[$a_obj_id] = $class;
60  return $class;
61  }
62  }
63 
64  // we probably can do better
65  echo "ilLPStatusFactory: unknown type ".$a_mode;
66  exit;
67  }
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 77 of file class.ilLPStatusFactory.php.

References $a_type, and exit.

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

78  {
79  // id is ignored in the moment
80  switch($a_type)
81  {
82  case 'event':
83  self::includeClass('ilLPStatusEvent');
84  return 'ilLPStatusEvent';
85 
86  default:
87  echo "ilLPStatusFactory: unknown type: ".$a_type;
88  exit;
89  }
90  }
$a_type
Definition: workflow.php:93
+ Here is the caller graph for this function:

◆ _getInstance()

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

Definition at line 92 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().

93  {
94  if($a_mode === NULL)
95  {
96  include_once 'Services/Object/classes/class.ilObjectLP.php';
97  $olp = ilObjectLP::getInstance($a_obj_id);
98  $a_mode = $olp->getCurrentMode();
99  }
100 
102 
103  if(array_key_exists($a_mode, $map))
104  {
105  $class = $map[$a_mode];
106 
107  // undefined? try object lp directly
108  if($class === null)
109  {
110  include_once 'Services/Object/classes/class.ilObjectLP.php';
111  $olp = ilObjectLP::getInstance($a_obj_id);
112  $mode = $olp->getCurrentMode();
114  {
115  return self::_getInstance($a_obj_id, $mode);
116  }
117  }
118  else
119  {
120  self::includeClass($class);
121  return new $class($a_obj_id);
122  }
123  }
124 
125  // we probably can do better
126  echo "ilLPStatusFactory: unknown type ".$a_mode;
127  exit;
128  }
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 69 of file class.ilLPStatusFactory.php.

References $path.

70  {
71  $path = ($a_class == 'ilLPStatus')
72  ? 'Services/Tracking/classes/'
73  : 'Services/Tracking/classes/status/';
74  include_once $path.'class.'.$a_class.'.php';
75  }
$path
Definition: aliased.php:25

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: