ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilProfileChecklistGUI.php
Go to the documentation of this file.
1 <?php
2 
20 
25 {
26  protected \ILIAS\DI\UIServices $ui;
28  protected ilLanguage $lng;
29 
30  public function __construct()
31  {
32  global $DIC;
33 
34  $this->ui = $DIC->ui();
35  $this->status = new ilProfileChecklistStatus();
36  $this->lng = $DIC->language();
37  }
38 
39  public function render(int $active_step): string
40  {
41  $ui = $this->ui;
42  $lng = $this->lng;
43  $active_step_nr = 0;
44  $workflow_factory = $ui->factory()->listing()->workflow();
45  $status = $this->status;
46 
47  //setup steps
48  $steps = [];
49  $cnt = 0;
50  foreach ($this->status->getSteps() as $step => $txt) {
51  if ($step == $active_step) {
52  $active_step_nr = $cnt;
53  }
54  $cnt++;
55  $s = $workflow_factory->step($txt, $status->getStatusDetails($step))
56  ->withStatus($this->getUIChecklistStatus($status->getStatus($step)));
57  $steps[] = $s;
58  }
59 
60  //setup linear workflow
61  $wf = $workflow_factory->linear($lng->txt("user_privacy_checklist"), $steps)
62  ->withActive($active_step_nr);
63 
64  //render
65  return $ui->renderer()->render($wf);
66  }
67 
71  protected function getUIChecklistStatus(int $check_list_status): int
72  {
73  switch ($check_list_status) {
74  case ilProfileChecklistStatus::STATUS_NOT_STARTED: return Step::NOT_STARTED;
75  case ilProfileChecklistStatus::STATUS_IN_PROGRESS: return Step::IN_PROGRESS;
76  case ilProfileChecklistStatus::STATUS_SUCCESSFUL: return Step::SUCCESSFULLY;
77  }
78  return 0;
79  }
80 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
getUIChecklistStatus(int $check_list_status)
Get ui checklist status.
global $DIC
Definition: feed.php:28
getStatusDetails(int $step)
Get status details.
$txt
Definition: error.php:13
ilProfileChecklistStatus $status
$steps
Definition: latex.php:3
getStatus(int $step)
Get status of step.