ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
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.

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

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  }
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
Base class for learning progress exceptions.
ILIAS UI Factory $factory
ILIAS UI Renderer $renderer
+ 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.

Referenced by renderIcon().

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

References $image_path_asset.

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  }
Base class for learning progress exceptions.

◆ getImagePathCompleted()

ilLPStatusIcons::getImagePathCompleted ( )

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

References $image_path_completed.

Referenced by getImagePathForStatus().

119  : string
120  {
122  }
+ Here is the caller graph for this function:

◆ getImagePathFailed()

ilLPStatusIcons::getImagePathFailed ( )

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

References $image_path_failed.

Referenced by getImagePathForStatus().

129  : string
130  {
132  }
+ 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.

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

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

References $image_path_in_progress.

Referenced by getImagePathForStatus().

114  : string
115  {
117  }
+ Here is the caller graph for this function:

◆ getImagePathNotAttempted()

ilLPStatusIcons::getImagePathNotAttempted ( )

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

References $image_path_not_attempted.

Referenced by getImagePathForStatus().

124  : string
125  {
127  }
+ 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.

References $image_path_running.

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  }
Base class for learning progress exceptions.

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

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

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

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) {
57  return 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) {
63  return 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) {
69  return 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...
Base class for learning progress exceptions.
global $DIC
Definition: feed.php:28
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 207 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.

207  : int
208  {
209  switch ($a_status) {
212 
215 
218 
221 
222  default:
223  throw new ilLPException("Not a valid status");
224  }
225  }
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_NOT_ATTEMPTED
const LP_STATUS_IN_PROGRESS_NUM
Base class for learning progress exceptions.
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 156 of file class.ilLPStatusIcons.php.

References getIconComponent().

Referenced by renderIconForStatus().

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  }
Base class for learning progress exceptions.
$path
Definition: ltiservices.php:32
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 196 of file class.ilLPStatusIcons.php.

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

196  : string
197  {
198  return $this->renderIcon(
199  $this->getImagePathForStatus($a_status),
201  );
202  }
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 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.

◆ $instance_variant_scorm

self ilLPStatusIcons::$instance_variant_scorm = null
staticprivate

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

◆ $instance_variant_short

self ilLPStatusIcons::$instance_variant_short = null
staticprivate

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

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