ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 28 of file class.ilLPStatusFactory.php.

Constructor & Destructor Documentation

◆ __construct()

ilLPStatusFactory::__construct ( )
private

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

44 {
45 global $DIC;
46
47 $this->logger = $DIC->logger()->trac();
48 }
global $DIC
Definition: shib_login.php:26

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

58 : string {
59 if ($a_mode === null) {
60 $olp = ilObjectLP::getInstance($a_obj_id);
61 $a_mode = $olp->getCurrentMode();
62
63 // please keep the cache in this if-block, otherwise default values
64 if (isset(self::$class_by_obj_id[$a_obj_id])) {
65 return self::$class_by_obj_id[$a_obj_id];
66 }
67 }
68
70
71 if (array_key_exists($a_mode, $map)) {
72 $class = $map[$a_mode];
73
74 // undefined? try object lp directly
75 if ($class === null) {
76 $olp = ilObjectLP::getInstance($a_obj_id);
77 $mode = $olp->getCurrentMode();
79 return self::_getClassById($a_obj_id, $mode);
80 }
81 } else {
82 self::$class_by_obj_id[$a_obj_id] = $class;
83 return $class;
84 }
85 }
86
87 $factory = self::getFactoryInstance();
88 $message = 'Unknown LP mode given: ' . $a_mode;
89 $factory->getLogger()->logStack(ilLogLevel::ERROR, $message);
91 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getClassById(int $a_obj_id, ?int $a_mode=null)
static getInstance(int $obj_id)
$message
Definition: xapiexit.php:31

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

96 : string {
97 // id is ignored in the moment
98 switch ($a_type) {
99 case 'event':
100 return 'ilLPStatusEvent';
101
102 default:
103 $factory = self::getFactoryInstance();
104 $message = 'Unknown LP type given: ' . $a_type;
105 $factory->getLogger()->logStack(ilLogLevel::ERROR, $message);
107 }
108 }

References $message, and ilLogLevel\ERROR.

◆ _getInstance()

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

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

113 : ilLPStatus {
114 if ($a_mode === null) {
115 $olp = ilObjectLP::getInstance($a_obj_id);
116 $a_mode = $olp->getCurrentMode();
117 }
118
120
121 if (array_key_exists($a_mode, $map)) {
122 $class = $map[$a_mode];
123
124 // undefined? try object lp directly
125 if ($class === null) {
126 $olp = ilObjectLP::getInstance($a_obj_id);
127 $mode = $olp->getCurrentMode();
129 return self::_getInstance($a_obj_id, $mode);
130 }
131 } else {
132 return new $class($a_obj_id);
133 }
134 }
135
136 $factory = self::getFactoryInstance();
137 $message = 'Unknown LP mode given: ' . $a_mode;
138 $factory->getLogger()->logStack(ilLogLevel::ERROR, $message);
140 }
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 35 of file class.ilLPStatusFactory.php.

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

References $instance.

◆ getLogger()

ilLPStatusFactory::getLogger ( )
private

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

50 : ilLogger
51 {
52 return $this->logger;
53 }
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 31 of file class.ilLPStatusFactory.php.

◆ $instance

self ilLPStatusFactory::$instance = null
staticprivate

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

Referenced by getFactoryInstance().

◆ $logger

ilLogger ilLPStatusFactory::$logger
private

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

Referenced by getLogger().


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