ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilStudyProgrammeDashboardViewGUI Class Reference
+ Inheritance diagram for ilStudyProgrammeDashboardViewGUI:
+ Collaboration diagram for ilStudyProgrammeDashboardViewGUI:

Public Member Functions

 __construct (ilLanguage $lng, ilObjUser $user, ilAccess $access, ilSetting $setting, ILIAS\UI\Factory $factory, ILIAS\UI\Renderer $renderer, ilCtrl $ctrl, ilLogger $log)
 

Protected Member Functions

 isCompleted (int $current_status)
 
 isInProgress (int $current_status)
 
 fillValidUntil (DateTime $value=null)
 
 fillNotValid ()
 
 fillValid ()
 
 fillMinimumCompletion (float $value)
 
 fillCurrentCompletion (float $value)
 
 fillStatus (string $status)
 
 fillFinishUntil (DateTime $value=null)
 
 fillRestartFrom (DateTime $value=null)
 
 getVisibleOnPDMode ()
 
 hasPermission (ilStudyProgrammeUserAssignment $assignment, string $permission)
 
 isReadable (ilStudyProgrammeUserAssignment $assignment)
 
 txt (string $code)
 
 calculatePercent (ilObjStudyProgramme $prg, int $current_points)
 
 findValidationValues (array $assignments)
 
 buildItem (ilObjStudyProgramme $prg, array $properties)
 
 getDefaultTargetUrl (int $prg_ref_id)
 

Protected Attributes

 $lng
 
 $user
 
 $access
 
 $setting
 
 $visible_on_pd_mode
 
 $log
 
 $factory
 
 $renderer
 
 $ctrl
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilStudyProgrammeDashboardViewGUI::__construct ( ilLanguage  $lng,
ilObjUser  $user,
ilAccess  $access,
ilSetting  $setting,
ILIAS\UI\Factory  $factory,
ILIAS\UI\Renderer  $renderer,
ilCtrl  $ctrl,
ilLogger  $log 
)

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

References $access, $ctrl, Vendor\Package\$e, $factory, $lng, $log, $renderer, $setting, $user, $valid, buildItem(), calculatePercent(), fillCurrentCompletion(), fillFinishUntil(), fillMinimumCompletion(), fillNotValid(), fillRestartFrom(), fillStatus(), fillValid(), fillValidUntil(), findValidationValues(), isCompleted(), isInProgress(), isReadable(), and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildItem()

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

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

References getDefaultTargetUrl(), ilObject\getLongDescription(), ilObject\getRefId(), ilObject\getTitle(), and ilUtil\shortenText().

Referenced by __construct().

368  $title = $prg->getTitle();
369  $link = $this->getDefaultTargetUrl((int) $prg->getRefId());
370  $title_btn = $this->factory->button()->shy($title, $link);
371  $description = $prg->getLongDescription() ?? "";
372  $max = $this->setting->get("rep_shorten_description_length");
373  if ($this->setting->get("rep_shorten_description") && $max) {
374  $description = ilUtil::shortenText($description, $max, true);
375  }
376 
377  $icon = $this->factory->symbol()->icon()->standard('prg', $title, 'medium');
378  return $this->factory->item()->standard($title_btn)
379  ->withProperties(array_merge(...$properties))
380  ->withDescription($description)
381  ->withLeadIcon($icon)
382  ;
383  }
static shortenText( $a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
Common interface to all items.
Definition: Item.php:10
getTitle()
get object title public
getLongDescription()
get object long description (stored in object_description)
getRefId()
get reference id public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculatePercent()

ilStudyProgrammeDashboardViewGUI::calculatePercent ( ilObjStudyProgramme  $prg,
int  $current_points 
)
protected

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

References ilObjStudyProgramme\getAllPrgChildren(), ilObjStudyProgramme\getPoints(), and ilObjStudyProgramme\hasLPChildren().

Referenced by __construct(), and mockSPRGDashGUI\mockCalculatePercent().

295  : array
296  {
297  $minimum_percents = 0;
298  $current_percents = 0;
299 
300  if ($prg->hasLPChildren()) {
301  $minimum_percents = 100;
302  if ($current_points > 0) {
303  $current_percents = 100;
304  }
305  }
306 
307  $children = $prg->getAllPrgChildren();
308  if (count($children) > 0) {
309  $max_points = 0;
310  foreach ($children as $child) {
311  $max_points += $child->getPoints();
312  }
313 
314  if ($max_points > 0) {
315  $prg_points = $prg->getPoints();
316  $minimum_percents = round((100 * $prg_points / $max_points), 2);
317  }
318  if ($current_points > 0) {
319  $current_percents = round((100 * $current_points / $max_points), 2);
320  }
321  }
322 
323  return [
324  $minimum_percents,
325  $current_percents
326  ];
327  }
hasLPChildren()
Does this StudyProgramme has leafs?
getPoints()
Get the amount of points.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fillCurrentCompletion()

ilStudyProgrammeDashboardViewGUI::fillCurrentCompletion ( float  $value)
protected

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

References txt().

Referenced by __construct().

202  : array
203  {
204  $title = $value . " " . $this->txt('percentage');
205  return [
206  $this->txt('prg_dash_label_gain') => $title
207  ];
208  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fillFinishUntil()

ilStudyProgrammeDashboardViewGUI::fillFinishUntil ( DateTime  $value = null)
protected

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

References $ret, ilDatePresentation\formatDate(), IL_CAL_DATE, and txt().

Referenced by __construct().

217  : array
218  {
219  $ret = [];
220  if (!is_null($value)) {
221  $date = new ilDate(
222  $value->format('Y-m-d'),
224  );
225  $date_string = ilDatePresentation::formatDate($date);
226  $ret[$this->txt('prg_dash_label_finish_until')] = $date_string;
227  }
228  return $ret;
229  }
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
Class for single dates.
const IL_CAL_DATE
$ret
Definition: parser.php:6
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fillMinimumCompletion()

ilStudyProgrammeDashboardViewGUI::fillMinimumCompletion ( float  $value)
protected

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

References txt().

Referenced by __construct().

194  : array
195  {
196  $title = $value . " " . $this->txt('percentage');
197  return [
198  $this->txt('prg_dash_label_minimum') => $title
199  ];
200  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fillNotValid()

ilStudyProgrammeDashboardViewGUI::fillNotValid ( )
protected

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

References txt().

Referenced by __construct().

180  : array
181  {
182  return [
183  $this->txt('prg_dash_label_valid') => $this->txt('no')
184  ];
185  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fillRestartFrom()

ilStudyProgrammeDashboardViewGUI::fillRestartFrom ( DateTime  $value = null)
protected

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

References $ret, ilDatePresentation\formatDate(), IL_CAL_DATE, and txt().

Referenced by __construct().

231  : array
232  {
233  $ret = [];
234  if (!is_null($value)) {
235  $date = new ilDate(
236  $value->format('Y-m-d'),
238  );
239  $date_string = ilDatePresentation::formatDate($date);
240  $ret[$this->txt('prg_dash_label_restart_from')] = $date_string;
241  }
242  return $ret;
243  }
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
Class for single dates.
const IL_CAL_DATE
$ret
Definition: parser.php:6
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fillStatus()

ilStudyProgrammeDashboardViewGUI::fillStatus ( string  $status)
protected

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

References txt().

Referenced by __construct().

210  : array
211  {
212  return [
213  $this->txt('prg_dash_label_status') => $this->txt('prg_status_' . $status)
214  ];
215  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fillValid()

ilStudyProgrammeDashboardViewGUI::fillValid ( )
protected

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

References txt().

Referenced by __construct().

187  : array
188  {
189  return [
190  $this->txt('prg_dash_label_valid') => $this->txt('yes')
191  ];
192  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fillValidUntil()

ilStudyProgrammeDashboardViewGUI::fillValidUntil ( DateTime  $value = null)
protected

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

References ilDatePresentation\formatDate(), IL_CAL_DATE, and txt().

Referenced by __construct().

165  : array
166  {
167  $date_string = "";
168  if (!is_null($value)) {
169  $date = new ilDate(
170  $value->format('Y-m-d'),
172  );
173  $date_string = ilDatePresentation::formatDate($date);
174  }
175  return [
176  $this->txt('prg_dash_label_valid') => $date_string
177  ];
178  }
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
Class for single dates.
const IL_CAL_DATE
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findValidationValues()

ilStudyProgrammeDashboardViewGUI::findValidationValues ( array  $assignments)
protected
Exceptions
ilException

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

References ilStudyProgrammeProgress\STATUS_ACCREDITED, and ilStudyProgrammeProgress\STATUS_COMPLETED.

Referenced by __construct().

333  : array
334  {
335  $validation_date = $this->findValid($assignments);
336 
337  return [
338  !is_null($validation_date) && $validation_date->format("Y-m-d") > date("Y-m-d"),
339  $validation_date
340  ];
341  }
+ Here is the caller graph for this function:

◆ getDefaultTargetUrl()

ilStudyProgrammeDashboardViewGUI::getDefaultTargetUrl ( int  $prg_ref_id)
protected

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

Referenced by buildItem().

385  : string
386  {
387  $this->ctrl->setParameterByClass(
388  ilObjStudyProgrammeGUI::class,
389  'ref_id',
390  $prg_ref_id
391  );
392  $link = $this->ctrl->getLinkTargetByClass(
393  [
394  ilRepositoryGUI::class,
395  ilObjStudyProgrammeGUI::class,
396  ]
397  );
398  $this->ctrl->setParameterByClass(
399  ilObjStudyProgrammeGUI::class,
400  'ref_id',
401  null
402  );
403  return $link;
404  }
+ Here is the caller graph for this function:

◆ getVisibleOnPDMode()

ilStudyProgrammeDashboardViewGUI::getVisibleOnPDMode ( )
protected

Definition at line 245 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().

245  : string
246  {
247  if (is_null($this->visible_on_pd_mode)) {
248  $this->visible_on_pd_mode =
249  $this->setting->get(
252  );
253  }
255  }
+ Here is the caller graph for this function:

◆ hasPermission()

ilStudyProgrammeDashboardViewGUI::hasPermission ( ilStudyProgrammeUserAssignment  $assignment,
string  $permission 
)
protected
Exceptions
ilException

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

References ilStudyProgrammeUserAssignment\getStudyProgramme().

Referenced by isReadable().

263  : bool {
264  $prg = $assignment->getStudyProgramme();
265  return $this->access->checkAccess($permission, "", $prg->getRefId(), "prg", $prg->getId());
266  }
getStudyProgramme()
Get the program node where this assignment was made.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isCompleted()

ilStudyProgrammeDashboardViewGUI::isCompleted ( int  $current_status)
protected

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

References ilStudyProgrammeProgress\STATUS_ACCREDITED, and ilStudyProgrammeProgress\STATUS_COMPLETED.

Referenced by __construct().

148  : bool
149  {
150  $status = [
153  ];
154  return in_array($current_status, $status);
155  }
+ Here is the caller graph for this function:

◆ isInProgress()

ilStudyProgrammeDashboardViewGUI::isInProgress ( int  $current_status)
protected

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

References ilStudyProgrammeProgress\STATUS_IN_PROGRESS.

Referenced by __construct().

157  : bool
158  {
159  $status = [
161  ];
162  return in_array($current_status, $status);
163  }
+ Here is the caller graph for this function:

◆ isReadable()

ilStudyProgrammeDashboardViewGUI::isReadable ( ilStudyProgrammeUserAssignment  $assignment)
protected
Exceptions
ilException

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

References ilStudyProgrammeDIC\dic(), getVisibleOnPDMode(), hasPermission(), ilObjStudyProgrammeAdmin\SETTING_VISIBLE_ON_PD_ALLWAYS, and user().

Referenced by __construct().

271  : bool
272  {
274  return true;
275  }
276 
277  return $this->hasPermission($assignment, "read");
278  }
hasPermission(ilStudyProgrammeUserAssignment $assignment, string $permission)
+ 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 290 of file class.ilStudyProgrammeDashboardViewGUI.php.

Referenced by fillCurrentCompletion(), fillFinishUntil(), fillMinimumCompletion(), fillNotValid(), fillRestartFrom(), fillStatus(), fillValid(), and fillValidUntil().

290  : string
291  {
292  return $this->lng->txt($code);
293  }
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilStudyProgrammeDashboardViewGUI::$access
protected

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

Referenced by __construct().

◆ $ctrl

ilStudyProgrammeDashboardViewGUI::$ctrl
protected

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

Referenced by __construct().

◆ $factory

ilStudyProgrammeDashboardViewGUI::$factory
protected

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

Referenced by __construct().

◆ $lng

ilStudyProgrammeDashboardViewGUI::$lng
protected

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

Referenced by __construct().

◆ $log

ilStudyProgrammeDashboardViewGUI::$log
protected

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

Referenced by __construct().

◆ $renderer

ilStudyProgrammeDashboardViewGUI::$renderer
protected

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

Referenced by __construct().

◆ $setting

ilStudyProgrammeDashboardViewGUI::$setting
protected

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

Referenced by __construct().

◆ $user

ilStudyProgrammeDashboardViewGUI::$user
protected

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

Referenced by __construct().

◆ $visible_on_pd_mode

ilStudyProgrammeDashboardViewGUI::$visible_on_pd_mode
protected

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

Referenced by getVisibleOnPDMode().


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