ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilLSCurriculumBuilder.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
11{
12 public function __construct(
14 ILIAS\UI\Factory $ui_factory,
15 ilLanguage $language,
16 string $goto_command,
17 LSUrlBuilder $url_builder = null
18 ) {
19 $this->ls_items = $ls_items;
20 $this->ui_factory = $ui_factory;
21 $this->lng = $language;
22 $this->goto_command = $goto_command;
23 $this->url_builder = $url_builder;
24 }
25
26 public function getLearnerCurriculum(bool $with_action = false)//: ILIAS\UI\Component\Listing\Workflow
27 {
28 $steps = [];
29 foreach ($this->ls_items->getItems() as $item) {
30 $action = '#';
31 if ($with_action) {
32 $action = $this->query . $item->getRefId();
33 $action = $this->url_builder->getHref($this->goto_command, $item->getRefId());
34 }
35
36 $steps[] = $this->ui_factory->listing()->workflow()->step(
37 $item->getTitle(),
38 $item->getDescription(),
39 $action
40 )
41 ->withAvailability($item->getAvailability())
42 ->withStatus(
43 $this->translateLPStatus(
44 $item->getLearningProgressStatus()
45 )
46 );
47 }
48
49 $workflow = $this->ui_factory->listing()->workflow()->linear(
50 $this->lng->txt('curriculum'),
51 $steps
52 );
53
54 if (count($steps) > 0) {
55 $current_position = max(0, $this->ls_items->getCurrentItemPosition());
56 $workflow = $workflow->withActive($current_position);
57 }
58
59 return $workflow;
60 }
61
62 /*
63 ILIAS\UI\Component\Listing\Workflow\Step
64 const NOT_STARTED = 1;
65 const IN_PROGRESS = 2;
66 const SUCCESSFULLY = 3;
67 const UNSUCCESSFULLY= 4;
68
69 Services/Tracking/class.ilLPStatus.php
70 const LP_STATUS_NOT_ATTEMPTED_NUM = 0;
71 const LP_STATUS_IN_PROGRESS_NUM = 1;
72 const LP_STATUS_COMPLETED_NUM = 2;
73 const LP_STATUS_FAILED_NUM = 3;
74 */
75 protected function translateLPStatus(int $il_lp_status) : int
76 {
77 switch ($il_lp_status) {
78 case \ilLPStatus::LP_STATUS_IN_PROGRESS_NUM:
80 break;
81 case \ilLPStatus::LP_STATUS_COMPLETED_NUM:
83 break;
84 case \ilLPStatus::LP_STATUS_FAILED_NUM:
86 break;
87 case \ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM:
88 default:
90 }
91 }
92}
An exception for terminatinating execution or to throw for unit testing.
Class LSUrlBuilder.
Builds the overview (curriculum) of a LearningSequence.
__construct(ilLSLearnerItemsQueries $ls_items, ILIAS\UI\Factory $ui_factory, ilLanguage $language, string $goto_command, LSUrlBuilder $url_builder=null)
getLearnerCurriculum(bool $with_action=false)
This combines calls to ProgressDB and StateDB to handle learner-items in the context of a specific LS...
language handling
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.
$steps
Definition: latex.php:3