ILIAS  release_7 Revision v7.30-3-g800a261c036
ilLPStatusIcons Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ 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
 

Private Member Functions

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

Private Attributes

 $image_path_in_progress = ''
 
 $image_path_completed = ''
 
 $image_path_not_attempted = ''
 
 $image_path_failed = ''
 
 $image_path_asset = ''
 
 $image_path_running = ''
 
 $factory
 
 $renderer
 

Static Private Attributes

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

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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 23 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 93 of file class.ilLPStatusIcons.php.

94 {
95 $this->factory = $factory;
96 $this->renderer = $renderer;
97
98 switch ($variant) {
100 $this->image_path_in_progress = ilUtil::getImagePath('scorm/incomplete.svg');
101 $this->image_path_completed = ilUtil::getImagePath('scorm/complete.svg');
102 $this->image_path_not_attempted = ilUtil::getImagePath('scorm/not_attempted.svg');
103 $this->image_path_failed = ilUtil::getImagePath('scorm/failed.svg');
104 $this->image_path_asset = ilUtil::getImagePath('scorm/asset.svg');
105 $this->image_path_running = ilUtil::getImagePath('scorm/running.svg');
106 break;
107
109 $this->image_path_in_progress = ilUtil::getImagePath('learning_progress/short/in_progress.svg');
110 $this->image_path_completed = ilUtil::getImagePath('learning_progress/short/completed.svg');
111 $this->image_path_not_attempted = ilUtil::getImagePath('learning_progress/short/not_attempted.svg');
112 $this->image_path_failed = ilUtil::getImagePath('learning_progress/short/failed.svg');
113 $this->image_path_asset = ilUtil::getImagePath('learning_progress/short/asset.svg');
114 $this->image_path_running = ilUtil::getImagePath('learning_progress/short/running.svg');
115 break;
116
118 $this->image_path_in_progress = ilUtil::getImagePath('learning_progress/in_progress.svg');
119 $this->image_path_completed = ilUtil::getImagePath('learning_progress/completed.svg');
120 $this->image_path_not_attempted = ilUtil::getImagePath('learning_progress/not_attempted.svg');
121 $this->image_path_failed = ilUtil::getImagePath('learning_progress/failed.svg');
122 break;
123
124 default:
125 throw new ilLPException("No such variant of the LP icons exists.");
126 }
127 }
Base class for learning progress exceptions.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)

References $factory, $renderer, ilUtil\getImagePath(), ICON_VARIANT_LONG, ICON_VARIANT_SCORM, and ICON_VARIANT_SHORT.

+ Here is the call graph for this function:

Member Function Documentation

◆ getIconComponent()

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

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

181 {
182 return $this->factory->symbol()->icon()->custom($path, $alt, \ILIAS\UI\Component\Symbol\Icon\Icon::SMALL);
183 }
This describes the behavior of an custom icon.
Definition: Custom.php:10
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.

Referenced by renderIcon().

+ Here is the caller graph for this function:

◆ getImagePathAsset()

ilLPStatusIcons::getImagePathAsset ( )

A long variant of this icon is not available.

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

152 : string
153 {
154 if ($this->image_path_asset) {
156 }
157 throw new ilLPException("A long variant of the 'asset' LP icon does not exist.");
158 }

References $image_path_asset.

◆ getImagePathCompleted()

ilLPStatusIcons::getImagePathCompleted ( )

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

134 : string
135 {
137 }

References $image_path_completed.

Referenced by getImagePathForStatus().

+ Here is the caller graph for this function:

◆ getImagePathFailed()

ilLPStatusIcons::getImagePathFailed ( )

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

144 : string
145 {
147 }

References $image_path_failed.

Referenced by getImagePathForStatus().

+ 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 188 of file class.ilLPStatusIcons.php.

188 : string
189 {
190 switch ($a_status) {
192 return $this->getImagePathInProgress();
193
195 return $this->getImagePathCompleted();
196
198 return $this->getImagePathNotAttempted();
199
201 return $this->getImagePathFailed();
202
203 default:
204 return $this->getImagePathNotAttempted();
205 }
206 }
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_IN_PROGRESS_NUM
const LP_STATUS_NOT_ATTEMPTED_NUM
const LP_STATUS_FAILED_NUM

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().

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

◆ getImagePathInProgress()

ilLPStatusIcons::getImagePathInProgress ( )

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

129 : string
130 {
132 }

References $image_path_in_progress.

Referenced by getImagePathForStatus().

+ Here is the caller graph for this function:

◆ getImagePathNotAttempted()

ilLPStatusIcons::getImagePathNotAttempted ( )

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

139 : string
140 {
142 }

References $image_path_not_attempted.

Referenced by getImagePathForStatus().

+ Here is the caller graph for this function:

◆ getImagePathRunning()

ilLPStatusIcons::getImagePathRunning ( )

A long variant of this icon is not available.

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

163 : string
164 {
165 if ($this->image_path_running) {
167 }
168 throw new ilLPException("A long variant of the 'running' LP icon does not exist.");
169 }

References $image_path_running.

◆ getInstance()

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

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

62 {
63 if (!$renderer || !$factory) {
64 global $DIC;
65 $renderer = $DIC->ui()->renderer();
66 $factory = $DIC->ui()->factory();
67 }
68
69 switch ($variant) {
71 if (self::$instance_variant_scorm) {
73 }
74 return self::$instance_variant_scorm = new self(ilLPStatusIcons::ICON_VARIANT_SCORM, $renderer, $factory);
75
77 if (self::$instance_variant_short) {
79 }
80 return self::$instance_variant_short = new self(ilLPStatusIcons::ICON_VARIANT_SHORT, $renderer, $factory);
81
83 if (self::$instance_variant_long) {
85 }
86 return self::$instance_variant_long = new self(ilLPStatusIcons::ICON_VARIANT_LONG, $renderer, $factory);
87
88 default:
89 throw new ilLPException("No such variant of the LP icons exists.");
90 }
91 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: goto.php:24

References $DIC, $factory, $instance_variant_long, $instance_variant_scorm, $instance_variant_short, $renderer, ICON_VARIANT_LONG, ICON_VARIANT_SCORM, and ICON_VARIANT_SHORT.

Referenced by ilLearningProgressBaseGUI\__appendLPDetails(), ilLPObjectStatisticsLPTableGUI\__construct(), ilLSTOCGUI\__construct(), ilLearningProgressBaseGUI\__getLegendHTML(), ilLMExplorerGUI\checkLPIcon(), ilCourseParticipantsTableGUI\fillRow(), ilGroupParticipantsTableGUI\fillRow(), ilWikiContributorsTableGUI\fillRow(), ilLPProgressTableGUI\fillRow(), ilTrUserObjectsPropsTableGUI\fillRow(), ilLPObjectStatisticsLPTableGUI\getDetailItems(), ilLMTracker\getIconForLMObject(), ilExGradesTableGUI\getIconForStatus(), ilExAssignmentGUI\getIconForStatus(), ilTrSummaryTableGUI\getItems(), ilDclRecordListTableGUI\getStatus(), ilMyStaffGUI\getUserLpStatusAsHtml(), ilLearningProgressGUI\initCollectionManualForm(), ilSCORM2004TrackingItemsTableGUI\parseValue(), ilSCORMTrackingItemsTableGUI\parseValue(), ilLPTableBaseGUI\parseValue(), ilLPStatus\preloadListGUIData(), ilPortfolioPageGUI\renderMyCourses(), ilLearningProgressGUI\showtlt(), ilLPStatusIconsTest\testGetInstanceForInvalidVariant(), and ilLPStatusIconsTest\testTripleton().

+ Here is the caller graph for this function:

◆ lookupNumStatus()

ilLPStatusIcons::lookupNumStatus ( string  $a_status)

◆ renderIcon()

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

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

171 : string
172 {
173 if ($this === self::$instance_variant_scorm) {
174 throw new ilLPException("SCORM variants of the LP icons cannot be rendered.");
175 }
176
177 return $this->renderer->render($this->getIconComponent($path, $alt));
178 }
getIconComponent(string $path, string $alt)

References getIconComponent().

Referenced by renderIconForStatus().

+ 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 211 of file class.ilLPStatusIcons.php.

211 : string
212 {
213 return $this->renderIcon(
214 $this->getImagePathForStatus($a_status),
216 );
217 }
renderIcon(string $path, string $alt)
getImagePathForStatus(int $a_status)
static _getStatusText($a_status, $a_lng=null)
Get status alt text.

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

+ Here is the call graph for this function:

Field Documentation

◆ $factory

ilLPStatusIcons::$factory
private

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

Referenced by __construct(), and getInstance().

◆ $image_path_asset

ilLPStatusIcons::$image_path_asset = ''
private

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

Referenced by getImagePathAsset().

◆ $image_path_completed

ilLPStatusIcons::$image_path_completed = ''
private

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

Referenced by getImagePathCompleted().

◆ $image_path_failed

ilLPStatusIcons::$image_path_failed = ''
private

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

Referenced by getImagePathFailed().

◆ $image_path_in_progress

ilLPStatusIcons::$image_path_in_progress = ''
private

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

Referenced by getImagePathInProgress().

◆ $image_path_not_attempted

ilLPStatusIcons::$image_path_not_attempted = ''
private

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

Referenced by getImagePathNotAttempted().

◆ $image_path_running

ilLPStatusIcons::$image_path_running = ''
private

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

Referenced by getImagePathRunning().

◆ $instance_variant_long

ilLPStatusIcons::$instance_variant_long = null
staticprivate

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

Referenced by getInstance().

◆ $instance_variant_scorm

ilLPStatusIcons::$instance_variant_scorm = null
staticprivate

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

Referenced by getInstance().

◆ $instance_variant_short

ilLPStatusIcons::$instance_variant_short = null
staticprivate

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

Referenced by getInstance().

◆ $renderer

ilLPStatusIcons::$renderer
private

Definition at line 59 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 28 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: