ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
class.SettingsGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24{
25 protected int $lm_id;
26 protected \ilLanguage $lng;
28
29 public function __construct(int $lm_id)
30 {
31 global $DIC;
32
33 $this->manager = new ReadingTimeManager();
34 $this->lng = $DIC->language();
35 $this->lm_id = $lm_id;
36 }
37
38 public function addSettingToForm(\ilPropertyFormGUI $form): void
39 {
40 if ($this->manager->isGloballyActivated()) {
41 $cb = new \ilCheckboxInputGUI($this->lng->txt("lm_est_reading_time"), "est_reading_time");
42 $cb->setChecked($this->manager->isActivated($this->lm_id));
43 $form->addItem($cb);
44 }
45 }
46
47 public function saveSettingFromForm(\ilPropertyFormGUI $form): void
48 {
49 if ($this->manager->isGloballyActivated()) {
50 $this->manager->activate(
51 $this->lm_id,
52 (bool) $form->getInput("est_reading_time")
53 );
54 }
55 }
56}
This class represents a property form user interface.
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: shib_login.php:26