ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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.

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

44  {
45  global $DIC;
46 
47  $this->logger = $DIC->logger()->trac();
48  }
global $DIC
Definition: shib_login.php:22
+ 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.

References $message, ilLogLevel\ERROR, ilLPObjSettings\getClassMap(), ilObjectLP\getInstance(), ilLPObjSettings\LP_MODE_UNDEFINED, and null.

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(), and ilLearningProgressGUI\updateManual().

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  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$message
Definition: xapiexit.php:31
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance(int $obj_id)
+ 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.

References $message, and ilLogLevel\ERROR.

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

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  }
$message
Definition: xapiexit.php:31
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the caller graph for this function:

◆ _getInstance()

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

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

References $message, ilLogLevel\ERROR, ilLPObjSettings\getClassMap(), ilObjectLP\getInstance(), ilLPObjSettings\LP_MODE_UNDEFINED, and null.

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

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();
128  if ($mode != ilLPObjSettings::LP_MODE_UNDEFINED) {
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  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$message
Definition: xapiexit.php:31
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance(int $obj_id)
+ 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...

◆ getLogger()

ilLPStatusFactory::getLogger ( )
private

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

References $logger.

50  : ilLogger
51  {
52  return $this->logger;
53  }

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.

◆ $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: