26use Psr\Http\Message\ServerRequestInterface;
54 return \ilObjLearningModule::class;
63 $this->
ctrl = $DIC->ctrl();
65 $this->uiFactory =
$DIC->ui()->factory();
66 $this->uiRenderer =
$DIC->ui()->renderer();
67 $this->httpRequest =
$DIC->http()->request();
68 $this->
tabs = $DIC->tabs();
69 $this->
user = $DIC->user();
75 ?
int $parameter =
null
80 $this->current_page_id = $parameter;
81 $state = $state->
withValueFor(
"current_page", (
string) $this->current_page_id);
97 if (is_object($this->lm_pres)) {
105 [
"ref_id" => $this->lm->getRefId(),
106 "obj_id" => (
int) $current_page],
110 $this->lm_pres_service = $this->lm_pres->getService();
115 return $this->
access->checkAccess(
'read',
'', $this->lm->getRefId());
129 $main_tpl =
$DIC->ui()->mainTemplate();
134 $this->initLMService((
int) $state->
getValueFor(
"current_page"));
135 $nav_stat = $this->lm_pres_service->getNavigationStatus();
138 $succ_id = $nav_stat->getSuccessorPageId();
140 $builder->
next(
"layout", $succ_id);
144 $prev_id = $nav_stat->getPredecessorPageId();
146 $builder->
previous(
"layout", $prev_id);
149 $toc = $builder->
tableOfContent($this->lm->getTitle(),
'layout', 0);
151 $lm_toc_renderer->renderLSToc($toc);
154 $builder = $this->maybeBuildLearningProgressToggleControl($builder);
157 foreach ($this->getMenuEntries() as $entry) {
158 if (is_object($entry[
"signal"])) {
164 if ($entry[
"on_load"] !=
"") {
165 $main_tpl->addOnLoadCode($entry[
"on_load"]);
176 if (is_null($this->menu_entries)) {
177 $menu = new \ILIAS\LearningModule\Menu\ilLMMenuGUI($this->lm_pres_service);
178 $this->menu_entries = $menu->getEntries();
180 return $this->menu_entries;
190 $this->
lng->loadLanguageModule(
'lm');
191 $learningProgressToggleCtrlLabel = $this->
lng->txt(
'lm_btn_lp_toggle_state_completed');
193 $learningProgressToggleCtrlLabel = $this->
lng->txt(
'lm_btn_lp_toggle_state_not_completed');
196 $learningProgressToggleCtrlLabel,
197 self::CMD_TOGGLE_LEARNING_PROGRESS,
207 if (self::CMD_TOGGLE_LEARNING_PROGRESS === $command) {
210 $marks = new \ilLPMarks($this->lm->getId(), $this->user->getId());
211 $marks->setCompleted(!$marks->getCompleted());
216 $this->
lng->loadLanguageModule(
'trac');
217 $this->messages[] = $this->uiFactory->messageBox()->success(
218 $this->
lng->txt(
'trac_updated_status')
238 $this->initLMService((
int) $state->getValueFor(
"current_page"));
240 $additional_content = [];
241 foreach ($this->getMenuEntries() as $entry) {
242 if (is_object($entry[
"modal"])) {
243 $additional_content[] = $entry[
"modal"];
247 $this->
ctrl->setParameterByClass(
"illmpresentationgui",
'ref_id', $this->lm->getRefId());
248 $content = $this->uiRenderer->render($this->messages);
249 $content .= $this->
ctrl->getHTML($this->lm_pres, [
"cmd" =>
"layout"], [
"illmpresentationgui"]);
250 $content .= $this->uiRenderer->render($additional_content);
251 return $factory->
legacy()->content($content);
Builds a Color from either hex- or rgb values.
Keeps the state of a view in a simple stringly type key-value store.
withValueFor(string $key, string $value)
Set a value for a key of the state.
getValueFor(string $key)
Get the value for the given key.
Base class to be implemented and put in class-directory of module with the name il$MODULEKioskModeVie...
setObject(ilObject $object)
Set the object for this view.
Class ilLMPresentationGUI GUI class for learning module presentation.
Main service init and factory.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _hasCompleted(int $a_usr_id, int $a_obj_id)
static _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)
Class ilLearningModuleKioskModeView.
render(State $state, Factory $factory, URLBuilder $url_builder, ?array $post=null)
ilLMPresentationGUI $lm_pres
ServerRequestInterface $httpRequest
initLMService(?int $current_page)
getObjectClass()
Get the class of objects this view displays.
const CMD_TOGGLE_LEARNING_PROGRESS
maybeBuildLearningProgressToggleControl(ControlBuilder $builder)
ilLMPresentationService $lm_pres_service
ilPageObject $contentPageObject
array $additional_content
toggleLearningProgress(string $command)
updatePost(State $state, string $command, array $post)
Update the state and the object based on the provided command and post-data.
hasPermissionToAccessKioskMode()
Check if the global user has permission to access the kiosk mode of the supplied object.
buildControls(State $state, ControlBuilder $builder)
Construct the controls for the view based on the current state.
updateGet(State $state, string $command, ?int $parameter=null)
Update the state based on the provided command.
buildInitialState(State $empty_state)
Build an initial state based on the Provided empty state.
ilGlobalTemplateInterface $mainTemplate
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Base class for object lp connectors.
static getInstance(int $obj_id)
Class ilObject Basic functions for all objects.
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Build controls for the view.
generic(string $label, string $command, ?int $parameter=null)
A generic control needs to have a label that tells what it does.
tableOfContent(string $label, string $command, ?int $parameter=null, $state=null)
A table of content allows the user to get an overview over the generally available content in the obj...
next(string $command, ?int $parameter=null)
A next control allows the user to progress to the next item in the object.
genericWithSignal(string $label, UI\Component\Signal $signal)
A genericWithSignal will trigger the Signal rather than refreshing the View.
previous(string $command, ?int $parameter=null)
A previous control allows the user to go back to the previous item in the object.
The URLBuilder allows views to get links that are used somewhere inline in the content.
A component is the most general form of an entity in the UI.
This is how the factory for UI elements looks.
An entity that renders components to a string output.
if(!file_exists('../ilias.ini.php'))