ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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.

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 }
renderer()
factory()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS UI Renderer $renderer
ILIAS UI Factory $factory
buildImagePath(string $image_name)

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

+ Here is the call graph for this function:

Member Function Documentation

◆ buildImagePath()

ilLPStatusIcons::buildImagePath ( string  $image_name)
protected

Reimplemented in ilLPStatusIconsMock.

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

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)

References ilUtil\getImagePath().

Referenced by __construct().

+ 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.

173 {
174 return $this->factory->symbol()->icon()->custom($path, $alt, \ILIAS\UI\Component\Symbol\Icon\Icon::SMALL);
175 }
This describes the behavior of an custom icon.
Definition: Custom.php:27
$path
Definition: ltiservices.php:30
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.

References factory().

Referenced by renderIcon().

+ 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.

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 }

References $image_path_asset.

◆ getImagePathCompleted()

ilLPStatusIcons::getImagePathCompleted ( )

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

126 : string
127 {
129 }

References $image_path_completed.

Referenced by getImagePathForStatus().

+ Here is the caller graph for this function:

◆ getImagePathFailed()

ilLPStatusIcons::getImagePathFailed ( )

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

136 : string
137 {
139 }

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

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

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

121 : string
122 {
124 }

References $image_path_in_progress.

Referenced by getImagePathForStatus().

+ Here is the caller graph for this function:

◆ getImagePathNotAttempted()

ilLPStatusIcons::getImagePathNotAttempted ( )

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

131 : string
132 {
134 }

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

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 }

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

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) {
60 }
61 return self::$instance_variant_scorm = new self(ilLPStatusIcons::ICON_VARIANT_SCORM, $renderer, $factory);
62
64 if (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) {
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 }
Caches and supplies the paths to the learning progress status images.
static self $instance_variant_short
static self $instance_variant_scorm
static self $instance_variant_long
global $DIC
Definition: shib_login.php:26

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(), ILIAS\Forum\Statistics\ForumStatisticsTable\__construct(), ilLearningProgressBaseGUI\__getLegendHTML(), ilLMExplorerGUI\checkLPIcon(), ilCourseParticipantsTableGUI\fillRow(), ilGroupParticipantsTableGUI\fillRow(), ilLPProgressTableGUI\fillRow(), ilTrUserObjectsPropsTableGUI\fillRow(), ilWikiContributorsTableGUI\fillRow(), ilLPObjectStatisticsLPTableGUI\getDetailItems(), ilExGradesTableGUI\getIconForStatus(), ILIAS\Exercise\Assignment\PropertyAndActionBuilderUI\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 163 of file class.ilLPStatusIcons.php.

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 }
getIconComponent(string $path, string $alt)

References getIconComponent(), and renderer().

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

203 : string
204 {
205 return $this->renderIcon(
206 $this->getImagePathForStatus($a_status),
208 );
209 }
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 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.

Referenced by getInstance().

◆ $instance_variant_scorm

self ilLPStatusIcons::$instance_variant_scorm = null
staticprivate

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

Referenced by getInstance().

◆ $instance_variant_short

self ilLPStatusIcons::$instance_variant_short = null
staticprivate

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

Referenced by getInstance().

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