ILIAS  release_8 Revision v8.23
ilStudyProgrammeDashboardViewGUI 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 ilStudyProgrammeDashboardViewGUI:

Public Member Functions

 __construct (ilLanguage $lng, ilAccess $access, ilSetting $setting, ILIAS\UI\Factory $factory, ILIAS\UI\Renderer $renderer, ilCtrl $ctrl, ilStudyProgrammeUserTable $user_table, int $usr_id)
 
 getHTML ()
 

Protected Member Functions

 getVisibleOnPDMode ()
 
 isReadable (ilObjStudyProgramme $prg)
 
 txt (string $code)
 
 buildItem (ilObjStudyProgramme $prg, array $properties)
 
 getDefaultTargetUrl (int $prg_ref_id)
 

Protected Attributes

ilLanguage $lng
 
ilAccessHandler $access
 
ilSetting $setting
 
ILIAS UI Factory $factory
 
ILIAS UI Renderer $renderer
 
ilCtrl $ctrl
 
ilStudyProgrammeUserTable $user_table
 
int $usr_id
 
string $visible_on_pd_mode = 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

Definition at line 21 of file class.ilStudyProgrammeDashboardViewGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilStudyProgrammeDashboardViewGUI::__construct ( ilLanguage  $lng,
ilAccess  $access,
ilSetting  $setting,
ILIAS\UI\Factory  $factory,
ILIAS\UI\Renderer  $renderer,
ilCtrl  $ctrl,
ilStudyProgrammeUserTable  $user_table,
int  $usr_id 
)

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

References $access, $ctrl, $factory, $lng, $renderer, $setting, $user_table, $usr_id, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

41  {
42  $this->lng = $lng;
43  $this->lng->loadLanguageModule('prg');
44  $this->lng->loadLanguageModule('certificate');
45  $this->access = $access;
46  $this->setting = $setting;
47  $this->factory = $factory;
48  $this->renderer = $renderer;
49  $this->ctrl = $ctrl;
50  $this->user_table = $user_table;
51  $this->usr_id = $usr_id;
52  }
+ Here is the call graph for this function:

Member Function Documentation

◆ buildItem()

ilStudyProgrammeDashboardViewGUI::buildItem ( ilObjStudyProgramme  $prg,
array  $properties 
)
protected

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

References getDefaultTargetUrl(), ilObject\getLongDescription(), ilObject\getRefId(), ilObject\getTitle(), ILIAS\Repository\int(), and ilStr\shortenTextExtended().

Referenced by getHTML().

135  $title = $prg->getTitle();
136  $link = $this->getDefaultTargetUrl($prg->getRefId());
137  $title_btn = $this->factory->button()->shy($title, $link);
138  $description = $prg->getLongDescription() ?? "";
139  $max = (int) $this->setting->get("rep_shorten_description_length");
140  if ($this->setting->get("rep_shorten_description") && $max !== 0) {
141  $description = ilStr::shortenTextExtended($description, $max, true);
142  }
143 
144  $icon = $this->factory->symbol()->icon()->standard('prg', $title, 'medium');
145  return $this->factory->item()->standard($title_btn)
146  ->withProperties(array_merge(...$properties))
147  ->withDescription($description)
148  ->withLeadIcon($icon)
149  ;
150  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static shortenTextExtended(string $a_str, int $a_len, bool $a_dots=false, bool $a_next_blank=false, bool $a_keep_extension=false)
getLongDescription()
get object long description (stored in object_description)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDefaultTargetUrl()

ilStudyProgrammeDashboardViewGUI::getDefaultTargetUrl ( int  $prg_ref_id)
protected

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

References ILIAS\Repository\ctrl().

Referenced by buildItem().

152  : string
153  {
154  $this->ctrl->setParameterByClass(
155  ilObjStudyProgrammeGUI::class,
156  'ref_id',
157  $prg_ref_id
158  );
159  $link = $this->ctrl->getLinkTargetByClass(
160  [
161  ilRepositoryGUI::class,
162  ilObjStudyProgrammeGUI::class,
163  ]
164  );
165  $this->ctrl->setParameterByClass(
166  ilObjStudyProgrammeGUI::class,
167  'ref_id',
168  null
169  );
170  return $link;
171  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHTML()

ilStudyProgrammeDashboardViewGUI::getHTML ( )

Definition at line 54 of file class.ilStudyProgrammeDashboardViewGUI.php.

References $panel, $rows, buildItem(), ilObjStudyProgramme\getInstanceByObjId(), isReadable(), ILIAS\Repository\lng(), ilPRGProgress\STATUS_ACCREDITED, ilPRGProgress\STATUS_COMPLETED, and txt().

54  : string
55  {
56  //array ilStudyProgrammeUserTableRow[]
57  $this->user_table->disablePermissionCheck(true);
58  $rows = $this->user_table->fetchSingleUserRootAssignments($this->usr_id);
59  $items = [];
60  foreach ($rows as $row) {
61  $prg = ilObjStudyProgramme::getInstanceByObjId($row->getNodeId());
62  if (! $this->isReadable($prg)) {
63  continue;
64  }
65 
66  $min = $row->getPointsRequired();
67  $max = $row->getPointsReachable();
68  $cur = $row->getPointsCurrent();
69  $required_string = $min;
70  if ((float)$max < (float)$min) {
71  $required_string .= ' ' . $this->txt('prg_dash_label_unreachable') . ' (' . $max . ')';
72  }
73 
74  $properties = [
75  [$this->txt('prg_dash_label_minimum') => $required_string],
76  [$this->txt('prg_dash_label_gain') => $cur],
77  [$this->txt('prg_dash_label_status') => $row->getStatus()],
78  ];
79 
80  if (in_array($row->getStatusRaw(), [ilPRGProgress::STATUS_COMPLETED, ilPRGProgress::STATUS_ACCREDITED])) {
81  $validity = $row->getExpiryDate() ? $row->getExpiryDate() : $row->getValidity();
82  $properties[] = [$this->txt('prg_dash_label_valid') => $validity];
83  } else {
84  $properties[] = [$this->txt('prg_dash_label_finish_until') =>$row->getDeadline()];
85  }
86 
87  $validator = new ilCertificateDownloadValidator();
88  if ($validator->isCertificateDownloadable($row->getUsrId(), $row->getNodeId())) {
89  $cert_url = "ilias.php?baseClass=ilRepositoryGUI&ref_id=" . $prg->getRefId() . "&cmd=deliverCertificate";
90  $cert_link = $this->factory->link()->standard($this->txt('download_certificate'), $cert_url);
91  $properties[] = [$this->txt('certificate') => $this->renderer->render($cert_link)];
92  }
93 
94  $items[] = $this->buildItem($prg, $properties);
95  }
96 
97  if (count($items) === 0) {
98  return '';
99  }
100  $group[] = $this->factory->item()->group("", $items);
101  $panel = $this->factory->panel()->listing()->standard($this->lng->txt("dash_studyprogramme"), $group);
102 
103  return $this->renderer->render($panel);
104  }
if(isset($_FILES['img_file']) &&is_array($_FILES['img_file'])) $panel
Definition: imgupload.php:198
Validates if an active certificate is stored in the database and can be downloaded by the user...
$rows
Definition: xhr_table.php:10
static getInstanceByObjId(int $obj_id)
buildItem(ilObjStudyProgramme $prg, array $properties)
+ Here is the call graph for this function:

◆ getVisibleOnPDMode()

ilStudyProgrammeDashboardViewGUI::getVisibleOnPDMode ( )
protected

Definition at line 106 of file class.ilStudyProgrammeDashboardViewGUI.php.

References $visible_on_pd_mode, ilObjStudyProgrammeAdmin\SETTING_VISIBLE_ON_PD, and ilObjStudyProgrammeAdmin\SETTING_VISIBLE_ON_PD_READ.

Referenced by isReadable().

106  : string
107  {
108  if (is_null($this->visible_on_pd_mode)) {
109  $this->visible_on_pd_mode =
110  $this->setting->get(
113  );
114  }
116  }
+ Here is the caller graph for this function:

◆ isReadable()

ilStudyProgrammeDashboardViewGUI::isReadable ( ilObjStudyProgramme  $prg)
protected

Definition at line 118 of file class.ilStudyProgrammeDashboardViewGUI.php.

References ILIAS\Repository\access(), ilObject\getId(), ilObject\getRefId(), getVisibleOnPDMode(), and ilObjStudyProgrammeAdmin\SETTING_VISIBLE_ON_PD_ALLWAYS.

Referenced by getHTML().

118  : bool
119  {
121  return true;
122  }
123  return $this->access->checkAccess('read', "", $prg->getRefId(), "prg", $prg->getId());
124  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ txt()

ilStudyProgrammeDashboardViewGUI::txt ( string  $code)
protected

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

References ILIAS\Repository\lng().

Referenced by getHTML().

126  : string
127  {
128  return $this->lng->txt($code);
129  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilStudyProgrammeDashboardViewGUI::$access
protected

Definition at line 24 of file class.ilStudyProgrammeDashboardViewGUI.php.

Referenced by __construct().

◆ $ctrl

ilCtrl ilStudyProgrammeDashboardViewGUI::$ctrl
protected

Definition at line 28 of file class.ilStudyProgrammeDashboardViewGUI.php.

Referenced by __construct().

◆ $factory

ILIAS UI Factory ilStudyProgrammeDashboardViewGUI::$factory
protected

Definition at line 26 of file class.ilStudyProgrammeDashboardViewGUI.php.

Referenced by __construct().

◆ $lng

ilLanguage ilStudyProgrammeDashboardViewGUI::$lng
protected

Definition at line 23 of file class.ilStudyProgrammeDashboardViewGUI.php.

Referenced by __construct().

◆ $renderer

ILIAS UI Renderer ilStudyProgrammeDashboardViewGUI::$renderer
protected

Definition at line 27 of file class.ilStudyProgrammeDashboardViewGUI.php.

Referenced by __construct().

◆ $setting

ilSetting ilStudyProgrammeDashboardViewGUI::$setting
protected

Definition at line 25 of file class.ilStudyProgrammeDashboardViewGUI.php.

Referenced by __construct().

◆ $user_table

ilStudyProgrammeUserTable ilStudyProgrammeDashboardViewGUI::$user_table
protected

Definition at line 29 of file class.ilStudyProgrammeDashboardViewGUI.php.

Referenced by __construct().

◆ $usr_id

int ilStudyProgrammeDashboardViewGUI::$usr_id
protected

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

Referenced by __construct().

◆ $visible_on_pd_mode

string ilStudyProgrammeDashboardViewGUI::$visible_on_pd_mode = null
protected

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

Referenced by getVisibleOnPDMode().


The documentation for this class was generated from the following file: