ILIAS  release_7 Revision v7.30-3-g800a261c036
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

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

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

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

Referenced by renderIcon().

181  {
182  return $this->factory->symbol()->icon()->custom($path, $alt, \ILIAS\UI\Component\Symbol\Icon\Icon::SMALL);
183  }
Class Factory.
Class ChatMainBarProvider .
This describes the behavior of an custom icon.
Definition: Custom.php:9
+ 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.

References $image_path_asset.

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

◆ getImagePathCompleted()

ilLPStatusIcons::getImagePathCompleted ( )

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

References $image_path_completed.

Referenced by getImagePathForStatus().

134  : string
135  {
137  }
+ Here is the caller graph for this function:

◆ getImagePathFailed()

ilLPStatusIcons::getImagePathFailed ( )

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

References $image_path_failed.

Referenced by getImagePathForStatus().

144  : string
145  {
147  }
+ 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.

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

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

References $image_path_in_progress.

Referenced by getImagePathForStatus().

129  : string
130  {
132  }
+ Here is the caller graph for this function:

◆ getImagePathNotAttempted()

ilLPStatusIcons::getImagePathNotAttempted ( )

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

References $image_path_not_attempted.

Referenced by getImagePathForStatus().

139  : string
140  {
142  }
+ 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.

References $image_path_running.

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

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

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

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) {
72  return 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) {
78  return 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) {
84  return 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...
Base class for learning progress exceptions.
global $DIC
Definition: goto.php:24
+ 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 222 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.

222  : int
223  {
224  switch ($a_status) {
227 
230 
233 
236 
237  default:
238  throw new ilLPException("Not a valid status");
239  }
240  }
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 171 of file class.ilLPStatusIcons.php.

References getIconComponent().

Referenced by renderIconForStatus().

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  }
Base class for learning progress exceptions.
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 211 of file class.ilLPStatusIcons.php.

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

211  : string
212  {
213  return $this->renderIcon(
214  $this->getImagePathForStatus($a_status),
216  );
217  }
static _getStatusText($a_status, $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

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.

◆ $instance_variant_scorm

ilLPStatusIcons::$instance_variant_scorm = null
staticprivate

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

◆ $instance_variant_short

ilLPStatusIcons::$instance_variant_short = null
staticprivate

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

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