ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilLPStatusIcons Class Reference

Caches and supplies the paths to the learning progress status images. More...

+ Inheritance diagram for ilLPStatusIcons:
+ Collaboration diagram for ilLPStatusIcons:

Public Member Functions

 getImagePathInProgress ()
 
 getImagePathCompleted ()
 
 getImagePathNotAttempted ()
 
 getImagePathFailed ()
 
 getImagePathAsset ()
 A long variant of this icon is not available. More...
 
 getImagePathRunning ()
 A long variant of this icon is not available. More...
 
 renderIcon (string $path, string $alt)
 
 getIconComponent (string $path, string $alt)
 
 getImagePathForStatus (int $a_status)
 
 renderIconForStatus (int $a_status, ?ilLanguage $a_lng=null)
 Returns the rendered icon with alt text. More...
 
 lookupNumStatus (string $a_status)
 Transforms the string constants for the status to their interger equivalent. More...
 

Static Public Member Functions

static getInstance (int $variant=ilLPStatusIcons::ICON_VARIANT_DEFAULT, ?\ILIAS\UI\Renderer $renderer=null, ?\ILIAS\UI\Factory $factory=null)
 

Data Fields

const ICON_VARIANT_LONG = 0
 
const ICON_VARIANT_SHORT = 1
 
const ICON_VARIANT_SCORM = 2
 
const ICON_VARIANT_DEFAULT = ilLPStatusIcons::ICON_VARIANT_LONG
 

Protected Member Functions

 buildImagePath (string $image_name)
 

Private Member Functions

 __construct (int $variant, \ILIAS\UI\Renderer $renderer, \ILIAS\UI\Factory $factory)
 

Private Attributes

string $image_path_in_progress = ''
 
string $image_path_completed = ''
 
string $image_path_not_attempted = ''
 
string $image_path_failed = ''
 
string $image_path_asset = ''
 
string $image_path_running = ''
 
ILIAS UI Factory $factory
 
ILIAS UI Renderer $renderer
 

Static Private Attributes

static self $instance_variant_long = null
 
static self $instance_variant_short = null
 
static self $instance_variant_scorm = null
 

Detailed Description

Caches and supplies the paths to the learning progress status images.

Author
Tim Schmitz schmi.nosp@m.tz@l.nosp@m.eifos.nosp@m..de

Definition at line 25 of file class.ilLPStatusIcons.php.

Constructor & Destructor Documentation

◆ __construct()

ilLPStatusIcons::__construct ( int  $variant,
\ILIAS\UI\Renderer  $renderer,
\ILIAS\UI\Factory  $factory 
)
private

Definition at line 80 of file class.ilLPStatusIcons.php.

References $factory, $renderer, buildImagePath(), factory(), ICON_VARIANT_LONG, ICON_VARIANT_SCORM, ICON_VARIANT_SHORT, and renderer().

81  {
82  $this->factory = $factory;
83  $this->renderer = $renderer;
84 
85  switch ($variant) {
87  $this->image_path_in_progress = $this->buildImagePath('scorm/incomplete.svg');
88  $this->image_path_completed = $this->buildImagePath('scorm/complete.svg');
89  $this->image_path_not_attempted = $this->buildImagePath('scorm/not_attempted.svg');
90  $this->image_path_failed = $this->buildImagePath('scorm/failed.svg');
91  $this->image_path_asset = $this->buildImagePath('scorm/asset.svg');
92  $this->image_path_running = $this->buildImagePath('scorm/running.svg');
93  break;
94 
96  $this->image_path_in_progress = $this->buildImagePath('learning_progress/short/in_progress.svg');
97  $this->image_path_completed = $this->buildImagePath('learning_progress/short/completed.svg');
98  $this->image_path_not_attempted = $this->buildImagePath('learning_progress/short/not_attempted.svg');
99  $this->image_path_failed = $this->buildImagePath('learning_progress/short/failed.svg');
100  $this->image_path_asset = $this->buildImagePath('learning_progress/short/asset.svg');
101  $this->image_path_running = $this->buildImagePath('learning_progress/short/running.svg');
102  break;
103 
105  $this->image_path_in_progress = $this->buildImagePath('learning_progress/in_progress.svg');
106  $this->image_path_completed = $this->buildImagePath('learning_progress/completed.svg');
107  $this->image_path_not_attempted = $this->buildImagePath('learning_progress/not_attempted.svg');
108  $this->image_path_failed = $this->buildImagePath('learning_progress/failed.svg');
109  break;
110 
111  default:
112  throw new ilLPException("No such variant of the LP icons exists.");
113  }
114  }
factory()
renderer()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS UI Factory $factory
ILIAS UI Renderer $renderer
buildImagePath(string $image_name)
+ Here is the call graph for this function:

Member Function Documentation

◆ buildImagePath()

ilLPStatusIcons::buildImagePath ( string  $image_name)
protected

Definition at line 116 of file class.ilLPStatusIcons.php.

References ilUtil\getImagePath().

Referenced by __construct().

116  : string
117  {
118  return ilUtil::getImagePath($image_name);
119  }
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getIconComponent()

ilLPStatusIcons::getIconComponent ( string  $path,
string  $alt 
)

Definition at line 172 of file class.ilLPStatusIcons.php.

References factory().

Referenced by renderIcon().

172  : \ILIAS\UI\Component\Symbol\Icon\Custom
173  {
174  return $this->factory->symbol()->icon()->custom($path, $alt, \ILIAS\UI\Component\Symbol\Icon\Icon::SMALL);
175  }
Interface Observer Contains several chained tasks and infos about them.
factory()
$path
Definition: ltiservices.php:29
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getImagePathAsset()

ilLPStatusIcons::getImagePathAsset ( )

A long variant of this icon is not available.

Definition at line 144 of file class.ilLPStatusIcons.php.

References $image_path_asset.

144  : string
145  {
146  if ($this->image_path_asset) {
148  }
149  throw new ilLPException("A long variant of the 'asset' LP icon does not exist.");
150  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ getImagePathCompleted()

ilLPStatusIcons::getImagePathCompleted ( )

Definition at line 126 of file class.ilLPStatusIcons.php.

References $image_path_completed.

Referenced by getImagePathForStatus().

126  : string
127  {
129  }
+ Here is the caller graph for this function:

◆ getImagePathFailed()

ilLPStatusIcons::getImagePathFailed ( )

Definition at line 136 of file class.ilLPStatusIcons.php.

References $image_path_failed.

Referenced by getImagePathForStatus().

136  : string
137  {
139  }
+ Here is the caller graph for this function:

◆ getImagePathForStatus()

ilLPStatusIcons::getImagePathForStatus ( int  $a_status)
Todo:
Check whether the default can be replaced by an exception.

Definition at line 180 of file class.ilLPStatusIcons.php.

References getImagePathCompleted(), getImagePathFailed(), getImagePathInProgress(), getImagePathNotAttempted(), ilLPStatus\LP_STATUS_COMPLETED_NUM, ilLPStatus\LP_STATUS_FAILED_NUM, ilLPStatus\LP_STATUS_IN_PROGRESS_NUM, and ilLPStatus\LP_STATUS_NOT_ATTEMPTED_NUM.

Referenced by renderIconForStatus().

180  : string
181  {
182  switch ($a_status) {
184  return $this->getImagePathInProgress();
185 
187  return $this->getImagePathCompleted();
188 
190  return $this->getImagePathNotAttempted();
191 
193  return $this->getImagePathFailed();
194 
195  default:
196  return $this->getImagePathNotAttempted();
197  }
198  }
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_IN_PROGRESS_NUM
const LP_STATUS_NOT_ATTEMPTED_NUM
const LP_STATUS_FAILED_NUM
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getImagePathInProgress()

ilLPStatusIcons::getImagePathInProgress ( )

Definition at line 121 of file class.ilLPStatusIcons.php.

References $image_path_in_progress.

Referenced by getImagePathForStatus().

121  : string
122  {
124  }
+ Here is the caller graph for this function:

◆ getImagePathNotAttempted()

ilLPStatusIcons::getImagePathNotAttempted ( )

Definition at line 131 of file class.ilLPStatusIcons.php.

References $image_path_not_attempted.

Referenced by getImagePathForStatus().

131  : string
132  {
134  }
+ Here is the caller graph for this function:

◆ getImagePathRunning()

ilLPStatusIcons::getImagePathRunning ( )

A long variant of this icon is not available.

Definition at line 155 of file class.ilLPStatusIcons.php.

References $image_path_running.

155  : string
156  {
157  if ($this->image_path_running) {
159  }
160  throw new ilLPException("A long variant of the 'running' LP icon does not exist.");
161  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ getInstance()

static ilLPStatusIcons::getInstance ( int  $variant = ilLPStatusIcons::ICON_VARIANT_DEFAULT,
?\ILIAS\UI\Renderer  $renderer = null,
?\ILIAS\UI\Factory  $factory = null 
)
static

Definition at line 48 of file class.ilLPStatusIcons.php.

References $DIC, $factory, $renderer, ICON_VARIANT_LONG, ICON_VARIANT_SCORM, and ICON_VARIANT_SHORT.

Referenced by ilLearningProgressBaseGUI\__appendLPDetails(), ILIAS\Forum\Statistics\ForumStatisticsTable\__construct(), ilLSTOCGUI\__construct(), ilLearningProgressBaseGUI\__getLegendHTML(), ilLMExplorerGUI\checkLPIcon(), ilWikiContributorsTableGUI\fillRow(), ilGroupParticipantsTableGUI\fillRow(), ilCourseParticipantsTableGUI\fillRow(), ilLPProgressTableGUI\fillRow(), ilTrUserObjectsPropsTableGUI\fillRow(), ilLPObjectStatisticsLPTableGUI\getDetailItems(), ilLMTracker\getIconForLMObject(), ilExGradesTableGUI\getIconForStatus(), ILIAS\Exercise\Assignment\PropertyAndActionBuilderUI\getIconForStatus(), ilTrSummaryTableGUI\getItems(), ilObjExerciseGUI\getService(), ilDclRecordListTableGUI\getStatus(), ilMyStaffGUI\getUserLpStatusAsHtml(), ilLPObjectStatisticsLPTableGUI\init(), ilLearningProgressGUI\initCollectionManualForm(), ilCourseObjectiveListGUI\insertProgressInfo(), ilSCORMTrackingItemsTableGUI\parseValue(), ilSCORM2004TrackingItemsTableGUI\parseValue(), ilLPTableBaseGUI\parseValue(), ilLPStatus\preloadListGUIData(), ilPortfolioPageGUI\renderMyCourses(), ilLearningProgressGUI\showtlt(), ilLPStatusIconsTest\testGetInstanceForInvalidVariant(), and ilLPStatusIconsTest\testTripleton().

49  {
50  if (!$renderer || !$factory) {
51  global $DIC;
52  $renderer = $DIC->ui()->renderer();
53  $factory = $DIC->ui()->factory();
54  }
55 
56  switch ($variant) {
58  if (self::$instance_variant_scorm) {
59  return self::$instance_variant_scorm;
60  }
61  return self::$instance_variant_scorm = new self(ilLPStatusIcons::ICON_VARIANT_SCORM, $renderer, $factory);
62 
64  if (self::$instance_variant_short) {
65  return self::$instance_variant_short;
66  }
67  return self::$instance_variant_short = new self(ilLPStatusIcons::ICON_VARIANT_SHORT, $renderer, $factory);
68 
70  if (self::$instance_variant_long) {
71  return self::$instance_variant_long;
72  }
73  return self::$instance_variant_long = new self(ilLPStatusIcons::ICON_VARIANT_LONG, $renderer, $factory);
74 
75  default:
76  throw new ilLPException("No such variant of the LP icons exists.");
77  }
78  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: shib_login.php:22
ILIAS UI Factory $factory
ILIAS UI Renderer $renderer
+ Here is the caller graph for this function:

◆ lookupNumStatus()

ilLPStatusIcons::lookupNumStatus ( string  $a_status)

Transforms the string constants for the status to their interger equivalent.

Definition at line 214 of file class.ilLPStatusIcons.php.

References ilLPStatus\LP_STATUS_COMPLETED, ilLPStatus\LP_STATUS_COMPLETED_NUM, ilLPStatus\LP_STATUS_FAILED, ilLPStatus\LP_STATUS_FAILED_NUM, ilLPStatus\LP_STATUS_IN_PROGRESS, ilLPStatus\LP_STATUS_IN_PROGRESS_NUM, ilLPStatus\LP_STATUS_NOT_ATTEMPTED, and ilLPStatus\LP_STATUS_NOT_ATTEMPTED_NUM.

214  : int
215  {
216  switch ($a_status) {
219 
222 
225 
228 
229  default:
230  throw new ilLPException("Not a valid status");
231  }
232  }
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_NOT_ATTEMPTED
const LP_STATUS_IN_PROGRESS_NUM
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const LP_STATUS_IN_PROGRESS
const LP_STATUS_FAILED
const LP_STATUS_NOT_ATTEMPTED_NUM
const LP_STATUS_COMPLETED
const LP_STATUS_FAILED_NUM

◆ renderIcon()

ilLPStatusIcons::renderIcon ( string  $path,
string  $alt 
)

Definition at line 163 of file class.ilLPStatusIcons.php.

References getIconComponent(), and renderer().

Referenced by renderIconForStatus().

163  : string
164  {
165  if ($this === self::$instance_variant_scorm) {
166  throw new ilLPException("SCORM variants of the LP icons cannot be rendered.");
167  }
168 
169  return $this->renderer->render($this->getIconComponent($path, $alt));
170  }
renderer()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$path
Definition: ltiservices.php:29
getIconComponent(string $path, string $alt)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderIconForStatus()

ilLPStatusIcons::renderIconForStatus ( int  $a_status,
?ilLanguage  $a_lng = null 
)

Returns the rendered icon with alt text.

Definition at line 203 of file class.ilLPStatusIcons.php.

References ilLearningProgressBaseGUI\_getStatusText(), getImagePathForStatus(), and renderIcon().

203  : string
204  {
205  return $this->renderIcon(
206  $this->getImagePathForStatus($a_status),
208  );
209  }
static _getStatusText(int $a_status, ?ilLanguage $a_lng=null)
Get status alt text.
renderIcon(string $path, string $alt)
getImagePathForStatus(int $a_status)
+ Here is the call graph for this function:

Field Documentation

◆ $factory

ILIAS UI Factory ilLPStatusIcons::$factory
private

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

Referenced by __construct(), and getInstance().

◆ $image_path_asset

string ilLPStatusIcons::$image_path_asset = ''
private

Definition at line 42 of file class.ilLPStatusIcons.php.

Referenced by getImagePathAsset().

◆ $image_path_completed

string ilLPStatusIcons::$image_path_completed = ''
private

Definition at line 37 of file class.ilLPStatusIcons.php.

Referenced by getImagePathCompleted().

◆ $image_path_failed

string ilLPStatusIcons::$image_path_failed = ''
private

Definition at line 39 of file class.ilLPStatusIcons.php.

Referenced by getImagePathFailed().

◆ $image_path_in_progress

string ilLPStatusIcons::$image_path_in_progress = ''
private

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

Referenced by getImagePathInProgress().

◆ $image_path_not_attempted

string ilLPStatusIcons::$image_path_not_attempted = ''
private

Definition at line 38 of file class.ilLPStatusIcons.php.

Referenced by getImagePathNotAttempted().

◆ $image_path_running

string ilLPStatusIcons::$image_path_running = ''
private

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

Referenced by getImagePathRunning().

◆ $instance_variant_long

self ilLPStatusIcons::$instance_variant_long = null
staticprivate

Definition at line 32 of file class.ilLPStatusIcons.php.

◆ $instance_variant_scorm

self ilLPStatusIcons::$instance_variant_scorm = null
staticprivate

Definition at line 34 of file class.ilLPStatusIcons.php.

◆ $instance_variant_short

self ilLPStatusIcons::$instance_variant_short = null
staticprivate

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

◆ $renderer

ILIAS UI Renderer ilLPStatusIcons::$renderer
private

Definition at line 46 of file class.ilLPStatusIcons.php.

Referenced by __construct(), and getInstance().

◆ ICON_VARIANT_DEFAULT

const ilLPStatusIcons::ICON_VARIANT_DEFAULT = ilLPStatusIcons::ICON_VARIANT_LONG

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

◆ ICON_VARIANT_LONG

◆ ICON_VARIANT_SCORM

◆ ICON_VARIANT_SHORT


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