ILIAS  release_7 Revision v7.30-3-g800a261c036
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)
 

Private Member Functions

 __construct ()
 ilLPStatusFactory constructor. More...
 
 getLogger ()
 

Static Private Member Functions

static getFactoryInstance ()
 

Private Attributes

 $logger
 

Static Private Attributes

static $instance
 
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

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

Constructor & Destructor Documentation

◆ __construct()

ilLPStatusFactory::__construct ( )
private

ilLPStatusFactory constructor.

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

46 {
47 global $DIC;
48
49 $this->logger = $DIC->logger()->trac();
50 }
global $DIC
Definition: goto.php:24

References $DIC.

Member Function Documentation

◆ _getClassById()

static ilLPStatusFactory::_getClassById (   $a_obj_id,
  $a_mode = null 
)
static
Parameters
$a_obj_id
null$a_mode
Returns
mixed
Exceptions
ilInvalidLPStatusException

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

67 {
68 if ($a_mode === null) {
69 include_once 'Services/Object/classes/class.ilObjectLP.php';
70 $olp = ilObjectLP::getInstance($a_obj_id);
71 $a_mode = $olp->getCurrentMode();
72
73 // please keep the cache in this if-block, otherwise default values
74 // will not trigger the include_once calls
75 if (isset(self::$class_by_obj_id[$a_obj_id])) {
76 return self::$class_by_obj_id[$a_obj_id];
77 }
78 }
79
81
82 if (array_key_exists($a_mode, $map)) {
83 $class = $map[$a_mode];
84
85 // undefined? try object lp directly
86 if ($class === null) {
87 include_once 'Services/Object/classes/class.ilObjectLP.php';
88 $olp = ilObjectLP::getInstance($a_obj_id);
89 $mode = $olp->getCurrentMode();
91 return self::_getClassById($a_obj_id, $mode);
92 }
93 } else {
94 self::includeClass($class);
95 self::$class_by_obj_id[$a_obj_id] = $class;
96 return $class;
97 }
98 }
99
101 $message = 'Unknown LP mode given: ' . $a_mode;
102 $factory->getLogger()->logStack(ilLogLevel::ERROR, $message);
104 }
static includeClass($a_class)
static _getClassById($a_obj_id, $a_mode=null)
static getInstance($a_obj_id)
$factory
Definition: metadata.php:58
$message
Definition: xapiexit.php:14

References $factory, $message, _getClassById(), ilLogLevel\ERROR, ilLPObjSettings\getClassMap(), getFactoryInstance(), 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()

static ilLPStatusFactory::_getClassByIdAndType (   $a_obj_id,
  $a_type 
)
static
Parameters
$a_obj_id
$a_type
Returns
string
Exceptions
ilInvalidLPStatusException

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

121 {
122 // id is ignored in the moment
123 switch ($a_type) {
124 case 'event':
125 self::includeClass('ilLPStatusEvent');
126 return 'ilLPStatusEvent';
127
128 default:
130 $message = 'Unknown LP type given: ' . $a_type;
131 $factory->getLogger()->logStack(ilLogLevel::ERROR, $message);
133 }
134 }

References $factory, $message, ilLogLevel\ERROR, getFactoryInstance(), 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()

static ilLPStatusFactory::_getInstance (   $a_obj_id,
  $a_mode = null 
)
static
Parameters
$a_obj_id
null$a_mode
Returns
mixed
Exceptions
ilInvalidLPStatusException

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

143 {
144 if ($a_mode === null) {
145 include_once 'Services/Object/classes/class.ilObjectLP.php';
146 $olp = ilObjectLP::getInstance($a_obj_id);
147 $a_mode = $olp->getCurrentMode();
148 }
149
151
152 if (array_key_exists($a_mode, $map)) {
153 $class = $map[$a_mode];
154
155 // undefined? try object lp directly
156 if ($class === null) {
157 include_once 'Services/Object/classes/class.ilObjectLP.php';
158 $olp = ilObjectLP::getInstance($a_obj_id);
159 $mode = $olp->getCurrentMode();
161 return self::_getInstance($a_obj_id, $mode);
162 }
163 } else {
164 self::includeClass($class);
165 return new $class($a_obj_id);
166 }
167 }
168
170 $message = 'Unknown LP mode given: ' . $a_mode;
171 $factory->getLogger()->logStack(ilLogLevel::ERROR, $message);
173 }
static _getInstance($a_obj_id, $a_mode=null)

References $factory, $message, _getInstance(), ilLogLevel\ERROR, ilLPObjSettings\getClassMap(), getFactoryInstance(), 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:

◆ getFactoryInstance()

static ilLPStatusFactory::getFactoryInstance ( )
staticprivate
Returns
ilLPStatusFactory

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

34 {
35 if (!self::$instance) {
36 self::$instance = new self();
37 }
38 return self::$instance;
39
40 }
Class ilLPStatusFactory Creates status class instances for learning progress modes of an object.

References $instance.

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

+ Here is the caller graph for this function:

◆ getLogger()

ilLPStatusFactory::getLogger ( )
private
Returns
ilLogger

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

References $logger.

◆ includeClass()

static ilLPStatusFactory::includeClass (   $a_class)
staticprotected

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

107 {
108 $path = ($a_class == 'ilLPStatus')
109 ? 'Services/Tracking/classes/'
110 : 'Services/Tracking/classes/status/';
111 include_once $path . 'class.' . $a_class . '.php';
112 }

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 28 of file class.ilLPStatusFactory.php.

◆ $instance

ilLPStatusFactory::$instance
staticprivate

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

Referenced by getFactoryInstance().

◆ $logger

ilLPStatusFactory::$logger
private

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

Referenced by getLogger().


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