ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilLPStatusFactory Class Reference

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

+ Collaboration diagram for ilLPStatusFactory:

Public Member Functions

 _getClassById ($a_obj_id, $a_mode=NULL)
 
 _getClassByIdAndType ($a_obj_id, $a_type)
 
 _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()

ilLPStatusFactory::_getClassById (   $a_obj_id,
  $a_mode = NULL 
)

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

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 includeClass($a_class)
_getClassById($a_obj_id, $a_mode=NULL)
static getInstance($a_obj_id)
exit
Definition: login.php:54

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

Referenced by _getClassById(), 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getClassByIdAndType()

ilLPStatusFactory::_getClassByIdAndType (   $a_obj_id,
  $a_type 
)

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

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 }

References exit, and includeClass().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getInstance()

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

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

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 }
_getInstance($a_obj_id, $a_mode=NULL)

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

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

+ 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.

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: index.php:22

References $path.

Referenced by _getClassById(), _getClassByIdAndType(), and _getInstance().

+ Here is the caller graph for this function:

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: