ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilLSCurriculumBuilder.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
25 {
28  protected ilLanguage $lng;
29  protected string $goto_command;
31 
32  public function __construct(
33  ilLSLearnerItemsQueries $ls_items,
34  ILIAS\UI\Factory $ui_factory,
35  ilLanguage $language,
36  string $goto_command,
37  LSUrlBuilder $url_builder = null
38  ) {
39  $this->ls_items = $ls_items;
40  $this->ui_factory = $ui_factory;
41  $this->lng = $language;
42  $this->goto_command = $goto_command;
43  $this->url_builder = $url_builder;
44  }
45 
46  public function getLearnerCurriculum(bool $with_action = false): ILIAS\UI\Component\Listing\Workflow\Linear
47  {
48  $steps = [];
49  foreach ($this->ls_items->getItems() as $item) {
50  $action = '#';
51  if ($with_action) {
52  $action = $this->url_builder->getHref($this->goto_command, $item->getRefId());
53  }
54 
55  $steps[] = $this->ui_factory->listing()->workflow()->step(
56  $item->getTitle(),
57  $item->getDescription(),
58  $action
59  )
60  ->withAvailability($item->getAvailability())
61  ->withStatus(
62  $this->translateLPStatus(
63  $item->getLearningProgressStatus()
64  )
65  );
66  }
67 
68  $workflow = $this->ui_factory->listing()->workflow()->linear(
69  $this->lng->txt('curriculum'),
70  $steps
71  );
72 
73  if ($steps !== []) {
74  $current_position = max(0, $this->ls_items->getCurrentItemPosition());
75  $workflow = $workflow->withActive($current_position);
76  }
77 
78  return $workflow;
79  }
80 
81  /*
82  ILIAS\UI\Component\Listing\Workflow\Step
83  const NOT_STARTED = 1;
84  const IN_PROGRESS = 2;
85  const SUCCESSFULLY = 3;
86  const UNSUCCESSFULLY= 4;
87 
88  Services/Tracking/class.ilLPStatus.php
89  const LP_STATUS_NOT_ATTEMPTED_NUM = 0;
90  const LP_STATUS_IN_PROGRESS_NUM = 1;
91  const LP_STATUS_COMPLETED_NUM = 2;
92  const LP_STATUS_FAILED_NUM = 3;
93  */
94  protected function translateLPStatus(int $il_lp_status): int
95  {
96  switch ($il_lp_status) {
97  case \ilLPStatus::LP_STATUS_IN_PROGRESS_NUM:
99  case \ilLPStatus::LP_STATUS_COMPLETED_NUM:
101  case \ilLPStatus::LP_STATUS_FAILED_NUM:
103  case \ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM:
104  default:
106  }
107  }
108 }
Class Factory.
Class ChatMainBarProvider .
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(ilLSLearnerItemsQueries $ls_items, ILIAS\UI\Factory $ui_factory, ilLanguage $language, string $goto_command, LSUrlBuilder $url_builder=null)
$steps
Definition: latex.php:3
This combines calls to ProgressDB and StateDB to handle learner-items in the context of a specific LS...
ilLSLearnerItemsQueries $ls_items
getLearnerCurriculum(bool $with_action=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...