ILIAS  release_8 Revision v8.24
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

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

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

79 {
80 $this->factory = $factory;
81 $this->renderer = $renderer;
82
83 switch ($variant) {
85 $this->image_path_in_progress = ilUtil::getImagePath('scorm/incomplete.svg');
86 $this->image_path_completed = ilUtil::getImagePath('scorm/complete.svg');
87 $this->image_path_not_attempted = ilUtil::getImagePath('scorm/not_attempted.svg');
88 $this->image_path_failed = ilUtil::getImagePath('scorm/failed.svg');
89 $this->image_path_asset = ilUtil::getImagePath('scorm/asset.svg');
90 $this->image_path_running = ilUtil::getImagePath('scorm/running.svg');
91 break;
92
94 $this->image_path_in_progress = ilUtil::getImagePath('learning_progress/short/in_progress.svg');
95 $this->image_path_completed = ilUtil::getImagePath('learning_progress/short/completed.svg');
96 $this->image_path_not_attempted = ilUtil::getImagePath('learning_progress/short/not_attempted.svg');
97 $this->image_path_failed = ilUtil::getImagePath('learning_progress/short/failed.svg');
98 $this->image_path_asset = ilUtil::getImagePath('learning_progress/short/asset.svg');
99 $this->image_path_running = ilUtil::getImagePath('learning_progress/short/running.svg');
100 break;
101
103 $this->image_path_in_progress = ilUtil::getImagePath('learning_progress/in_progress.svg');
104 $this->image_path_completed = ilUtil::getImagePath('learning_progress/completed.svg');
105 $this->image_path_not_attempted = ilUtil::getImagePath('learning_progress/not_attempted.svg');
106 $this->image_path_failed = ilUtil::getImagePath('learning_progress/failed.svg');
107 break;
108
109 default:
110 throw new ilLPException("No such variant of the LP icons exists.");
111 }
112 }
Base class for learning progress exceptions.
ILIAS UI Renderer $renderer
ILIAS UI Factory $factory
static getImagePath(string $img, string $module_path="", string $mode="output", bool $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 165 of file class.ilLPStatusIcons.php.

166 {
167 return $this->factory->symbol()->icon()->custom($path, $alt, \ILIAS\UI\Component\Symbol\Icon\Icon::SMALL);
168 }
This describes the behavior of an custom icon.
Definition: Custom.php:27
$path
Definition: ltiservices.php:32
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.

References $path.

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

137 : string
138 {
139 if ($this->image_path_asset) {
141 }
142 throw new ilLPException("A long variant of the 'asset' LP icon does not exist.");
143 }

References $image_path_asset.

◆ getImagePathCompleted()

ilLPStatusIcons::getImagePathCompleted ( )

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

119 : string
120 {
122 }

References $image_path_completed.

Referenced by getImagePathForStatus().

+ Here is the caller graph for this function:

◆ getImagePathFailed()

ilLPStatusIcons::getImagePathFailed ( )

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

129 : string
130 {
132 }

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

173 : string
174 {
175 switch ($a_status) {
177 return $this->getImagePathInProgress();
178
180 return $this->getImagePathCompleted();
181
183 return $this->getImagePathNotAttempted();
184
186 return $this->getImagePathFailed();
187
188 default:
189 return $this->getImagePathNotAttempted();
190 }
191 }
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 114 of file class.ilLPStatusIcons.php.

114 : string
115 {
117 }

References $image_path_in_progress.

Referenced by getImagePathForStatus().

+ Here is the caller graph for this function:

◆ getImagePathNotAttempted()

ilLPStatusIcons::getImagePathNotAttempted ( )

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

124 : string
125 {
127 }

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

148 : string
149 {
150 if ($this->image_path_running) {
152 }
153 throw new ilLPException("A long variant of the 'running' LP icon does not exist.");
154 }

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

47 {
48 if (!$renderer || !$factory) {
49 global $DIC;
50 $renderer = $DIC->ui()->renderer();
51 $factory = $DIC->ui()->factory();
52 }
53
54 switch ($variant) {
56 if (self::$instance_variant_scorm) {
58 }
59 return self::$instance_variant_scorm = new self(ilLPStatusIcons::ICON_VARIANT_SCORM, $renderer, $factory);
60
62 if (self::$instance_variant_short) {
64 }
65 return self::$instance_variant_short = new self(ilLPStatusIcons::ICON_VARIANT_SHORT, $renderer, $factory);
66
68 if (self::$instance_variant_long) {
70 }
71 return self::$instance_variant_long = new self(ilLPStatusIcons::ICON_VARIANT_LONG, $renderer, $factory);
72
73 default:
74 throw new ilLPException("No such variant of the LP icons exists.");
75 }
76 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static self $instance_variant_short
static self $instance_variant_scorm
static self $instance_variant_long
global $DIC
Definition: feed.php:28

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 ilLSTOCGUI\__construct(), ilLearningProgressBaseGUI\__getLegendHTML(), ilLMExplorerGUI\checkLPIcon(), ilCourseParticipantsTableGUI\fillRow(), ilForumStatisticsTableGUI\fillRow(), ilGroupParticipantsTableGUI\fillRow(), ilWikiContributorsTableGUI\fillRow(), ilLPProgressTableGUI\fillRow(), ilTrUserObjectsPropsTableGUI\fillRow(), ilLPObjectStatisticsLPTableGUI\getDetailItems(), ilExGradesTableGUI\getIconForStatus(), ilExAssignmentGUI\getIconForStatus(), ilTrSummaryTableGUI\getItems(), ilDclRecordListTableGUI\getStatus(), ilMyStaffGUI\getUserLpStatusAsHtml(), ilLPObjectStatisticsLPTableGUI\init(), ilLearningProgressGUI\initCollectionManualForm(), ilCourseObjectiveListGUI\insertProgressInfo(), ilSCORM2004TrackingItemsTableGUI\parseValue(), ilSCORMTrackingItemsTableGUI\parseValue(), ilLPStatus\preloadListGUIData(), 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 156 of file class.ilLPStatusIcons.php.

156 : string
157 {
158 if ($this === self::$instance_variant_scorm) {
159 throw new ilLPException("SCORM variants of the LP icons cannot be rendered.");
160 }
161
162 return $this->renderer->render($this->getIconComponent($path, $alt));
163 }
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 196 of file class.ilLPStatusIcons.php.

196 : string
197 {
198 return $this->renderIcon(
199 $this->getImagePathForStatus($a_status),
201 );
202 }
renderIcon(string $path, string $alt)
getImagePathForStatus(int $a_status)
static _getStatusText(int $a_status, ?ilLanguage $a_lng=null)
Get status alt text.

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

+ Here is the call graph for this function:

Field Documentation

◆ $factory

ILIAS UI Factory ilLPStatusIcons::$factory
private

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

Referenced by __construct(), and getInstance().

◆ $image_path_asset

string ilLPStatusIcons::$image_path_asset = ''
private

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

Referenced by getImagePathAsset().

◆ $image_path_completed

string ilLPStatusIcons::$image_path_completed = ''
private

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

Referenced by getImagePathCompleted().

◆ $image_path_failed

string ilLPStatusIcons::$image_path_failed = ''
private

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

Referenced by getImagePathFailed().

◆ $image_path_in_progress

string ilLPStatusIcons::$image_path_in_progress = ''
private

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

Referenced by getImagePathInProgress().

◆ $image_path_not_attempted

string ilLPStatusIcons::$image_path_not_attempted = ''
private

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

Referenced by getImagePathNotAttempted().

◆ $image_path_running

string ilLPStatusIcons::$image_path_running = ''
private

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

Referenced by getImagePathRunning().

◆ $instance_variant_long

self ilLPStatusIcons::$instance_variant_long = null
staticprivate

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

Referenced by getInstance().

◆ $instance_variant_scorm

self ilLPStatusIcons::$instance_variant_scorm = null
staticprivate

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

Referenced by getInstance().

◆ $instance_variant_short

self ilLPStatusIcons::$instance_variant_short = null
staticprivate

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

Referenced by getInstance().

◆ $renderer

ILIAS UI Renderer ilLPStatusIcons::$renderer
private

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