ILIAS  release_8 Revision v8.24
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 (int $a_obj_id, ?int $a_mode=null)
 
static _getClassByIdAndType (int $a_obj_id, string $a_type)
 
static _getInstance (int $a_obj_id, ?int $a_mode=null)
 

Private Member Functions

 __construct ()
 
 getLogger ()
 

Static Private Member Functions

static getFactoryInstance ()
 

Private Attributes

ilLogger $logger
 

Static Private Attributes

static self $instance = null
 
static array $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

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

30 {
31 global $DIC;
32
33 $this->logger = $DIC->logger()->trac();
34 }
global $DIC
Definition: feed.php:28

References $DIC, and ILIAS\Repository\logger().

+ Here is the call graph for this function:

Member Function Documentation

◆ _getClassById()

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

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

44 : string {
45 if ($a_mode === null) {
46 $olp = ilObjectLP::getInstance($a_obj_id);
47 $a_mode = $olp->getCurrentMode();
48
49 // please keep the cache in this if-block, otherwise default values
50 if (isset(self::$class_by_obj_id[$a_obj_id])) {
51 return self::$class_by_obj_id[$a_obj_id];
52 }
53 }
54
56
57 if (array_key_exists($a_mode, $map)) {
58 $class = $map[$a_mode];
59
60 // undefined? try object lp directly
61 if ($class === null) {
62 $olp = ilObjectLP::getInstance($a_obj_id);
63 $mode = $olp->getCurrentMode();
65 return self::_getClassById($a_obj_id, $mode);
66 }
67 } else {
68 self::$class_by_obj_id[$a_obj_id] = $class;
69 return $class;
70 }
71 }
72
74 $message = 'Unknown LP mode given: ' . $a_mode;
75 $factory->getLogger()->logStack(ilLogLevel::ERROR, $message);
77 }
static _getClassById(int $a_obj_id, ?int $a_mode=null)
static getInstance(int $obj_id)
$factory
Definition: metadata.php:75
$message
Definition: xapiexit.php:32

References ilObjectLP\getInstance().

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

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

◆ _getClassByIdAndType()

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

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

82 : string {
83 // id is ignored in the moment
84 switch ($a_type) {
85 case 'event':
86 return 'ilLPStatusEvent';
87
88 default:
90 $message = 'Unknown LP type given: ' . $a_type;
91 $factory->getLogger()->logStack(ilLogLevel::ERROR, $message);
93 }
94 }

References $factory, $message, and ilLogLevel\ERROR.

◆ _getInstance()

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

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

99 : ilLPStatus {
100 if ($a_mode === null) {
101 $olp = ilObjectLP::getInstance($a_obj_id);
102 $a_mode = $olp->getCurrentMode();
103 }
104
106
107 if (array_key_exists($a_mode, $map)) {
108 $class = $map[$a_mode];
109
110 // undefined? try object lp directly
111 if ($class === null) {
112 $olp = ilObjectLP::getInstance($a_obj_id);
113 $mode = $olp->getCurrentMode();
115 return self::_getInstance($a_obj_id, $mode);
116 }
117 } else {
118 return new $class($a_obj_id);
119 }
120 }
121
123 $message = 'Unknown LP mode given: ' . $a_mode;
124 $factory->getLogger()->logStack(ilLogLevel::ERROR, $message);
126 }
static _getInstance(int $a_obj_id, ?int $a_mode=null)
Abstract class ilLPStatus for all learning progress modes E.g ilLPStatusManual, ilLPStatusObjectives ...

References ilObjectLP\getInstance().

Referenced by ilLPStatusWrapper\_determineStatus(), ilLPStatusWrapper\_setDirty(), and ilTestLP\resetCustomLPDataForUserIds().

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

◆ getFactoryInstance()

static ilLPStatusFactory::getFactoryInstance ( )
staticprivate

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

22 {
23 if (!self::$instance) {
24 self::$instance = new self();
25 }
26 return self::$instance;
27 }
Class ilLPStatusFactory Creates status class instances for learning progress modes of an object.

References $instance.

◆ getLogger()

ilLPStatusFactory::getLogger ( )
private

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

36 : ilLogger
37 {
38 return $this->logger;
39 }
Component logger with individual log levels by component id.

References $logger.

Field Documentation

◆ $class_by_obj_id

array ilLPStatusFactory::$class_by_obj_id = array()
staticprivate

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

◆ $instance

self ilLPStatusFactory::$instance = null
staticprivate

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

Referenced by getFactoryInstance().

◆ $logger

ilLogger ilLPStatusFactory::$logger
private

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

Referenced by getLogger().


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