3declare(strict_types=1);
73 $this->page_renderer = $renderer;
82 $items = $this->ls_items->getItems();
84 if (count($items) === 0) {
90 while ($current_item->getAvailability() !== Step::AVAILABLE) {
91 $prev_item = $this->
getNextItem($items, $current_item, -1);
92 if ($prev_item === $current_item) {
93 throw new \Exception(
"Cannot view first LSO-item", 1);
95 $current_item = $prev_item;
98 $view = $this->view_factory->getViewFor($current_item);
99 $state = $this->ls_items->getStateFor($current_item, $view);
102 $items = $this->ls_items->getItems();
104 $current_item_ref_id = $current_item->getRefId();
107 if ($get->
has(self::PARAM_LSO_COMMAND)) {
108 $command = $get->
retrieve(self::PARAM_LSO_COMMAND, $this->
refinery->kindlyTo()->string());
111 if ($get->
has(self::PARAM_LSO_PARAMETER)) {
118 $this->ls_items->storeState($state, $current_item_ref_id, $current_item_ref_id);
119 return 'EXIT::' . $command;
122 if ($next_item->getAvailability() !== Step::AVAILABLE) {
123 $next_item = $current_item;
130 $next_item = $current_item;
133 $this->ls_items->storeState($state, $current_item_ref_id, $next_item->getRefId());
136 if ($next_item != $current_item) {
137 $view = $this->view_factory->getViewFor($next_item);
138 $state = $this->ls_items->getStateFor($next_item, $view);
142 $obj_title = $next_item->getTitle();
143 $icon = $this->ui_factory->symbol()->icon()->standard(
144 $next_item->getType(),
145 $next_item->getType(),
151 $panel = $this->ui_factory->panel()->standard(
157 $items = $this->ls_items->getItems();
160 list($item_position, $item) = $this->
findItemByRefId($items, $next_item->getRefId());
169 $rendered_body = $this->page_renderer->render(
176 $metabar_controls = [
180 $curriculum_slate = $this->page_renderer->buildCurriculumSlate(
181 $this->curriculum_builder
182 ->getLearnerCurriculum(
true)
183 ->withActive($item_position)
185 $mainbar_controls = [
186 'curriculum' => $curriculum_slate
191 $toc_slate = $this->page_renderer->buildToCSlate($toc, $icon);
192 $mainbar_controls[
'toc'] = $toc_slate;
197 $cc->addAdditionalData(self::GS_DATA_LS_METABARCONTROLS, $metabar_controls);
198 $cc->addAdditionalData(self::GS_DATA_LS_MAINBARCONTROLS, $mainbar_controls);
199 $cc->addAdditionalData(self::GS_DATA_LS_CONTENT, $rendered_body);
209 $current_item = $items[0];
210 $current_item_ref_id = $this->ls_items->getCurrentItemRefId();
211 if ($current_item_ref_id !== 0) {
212 $valid_ref_ids = array_map(
213 fn ($item) => $item->getRefId(),
214 array_values($this->ls_items->getItems())
216 if (in_array($current_item_ref_id, $valid_ref_ids)) {
217 list(, $current_item) = $this->
findItemByRefId($items, $current_item_ref_id);
220 return $current_item;
224 ILIAS\KioskMode\State $state,
225 ILIAS\KioskMode\View $view,
227 ):
ILIAS\KioskMode\State {
229 $command = $get->
retrieve(self::PARAM_LSO_COMMAND, $this->
refinery->kindlyTo()->string());
231 $state = $view->updateGet($state, $command,
$param);
241 list($position) = $this->findItemByRefId($items, $current_item->
getRefId());
242 $next = $position + $direction;
243 if ($next >= 0 && $next < count($items)) {
244 return $items[$next];
246 return $current_item;
254 foreach ($items as
$index => $item) {
255 if ($item->getRefId() ===
$ref_id) {
259 throw new \Exception(
"This is not a valid item.", 1);
268 $is_first = $item_position === 0;
269 $is_last = $item_position === count($items) - 1;
272 $cmd = self::LSO_CMD_SUSPEND;
274 $cmd = self::LSO_CMD_FINISH;
276 $control_builder = $control_builder->
exit($cmd);
280 $direction_prev = -1;
284 $available = $this->getNextItem($items, $item, $direction_prev)
285 ->getAvailability() === Step::AVAILABLE;
288 $cmd = self::LSO_CMD_NEXT;
292 $control_builder = $control_builder
300 $available = $this->getNextItem($items, $item, $direction_next)
301 ->getAvailability() === Step::AVAILABLE;
304 $cmd = self::LSO_CMD_NEXT;
308 $control_builder = $control_builder
309 ->
next($cmd, $direction_next);
312 return $control_builder;
317 return $view->render(
328 $item = $this->getCurrentItem($this->ls_items->getItems());
previous(string $command, int $parameter=null)
A previous control allows the user to go back to the previous item in the object.
exit(string $command)
An exit control allows the user to gracefully leave the object providing the kiosk mode.
next(string $command, int $parameter=null)
A next control allows the user to progress to the next item in the object.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getLearningProgressStatus()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This combines calls to ProgressDB and StateDB to handle learner-items in the context of a specific LS...
Implementation of KioskMode Player.
ilLSViewFactory $view_factory
findItemByRefId(array $items, int $ref_id)
ilLSLearnerItemsQueries $ls_items
renderComponentView($state, ILIAS\KioskMode\View $view)
ilLSCurriculumBuilder $curriculum_builder
Refinery Factory $refinery
play(RequestWrapper $get)
LSUrlBuilder $url_builder
const GS_DATA_LS_KIOSK_MODE
getNextItem(array $items, LSLearnerItem $current_item, int $direction)
$direction is either -1 or 1;
const GS_DATA_LS_MAINBARCONTROLS
__construct(ilLSLearnerItemsQueries $ls_items, LSControlBuilder $control_builder, LSUrlBuilder $url_builder, ilLSCurriculumBuilder $curriculum_builder, ilLSViewFactory $view_factory, ilKioskPageRenderer $renderer, Factory $ui_factory, ScreenContext $current_context, Refinery\Factory $refinery)
getCurrentItemLearningProgress()
ScreenContext $current_context
const PARAM_LSO_PARAMETER
updateViewState(ILIAS\KioskMode\State $state, ILIAS\KioskMode\View $view, RequestWrapper $get)
LSControlBuilder $control_builder
ilKioskPageRenderer $page_renderer
buildDefaultControls(LSControlBuilder $control_builder, LSLearnerItem $item, int $item_position, array $items)
getCurrentItem(array $items)
const GS_DATA_LS_METABARCONTROLS
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if(isset($_FILES['img_file']) &&is_array($_FILES['img_file'])) $panel
addAdditionalData(string $key, $value)
Interface RequestWrapper.
retrieve(string $key, Transformation $transformation)
Build controls for the view.
A component is the most general form of an entity in the UI.
This describes a Workflow Step.
This is how the factory for UI elements looks.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider \MainMenu\Provider.