ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.SettingsGUI.php
Go to the documentation of this file.
1<?php
2
20
25{
29 protected $lm_id;
30
34 protected $lng;
35
39 protected $manager;
40
41 public function __construct(int $lm_id)
42 {
44 global $DIC;
45
46 $this->manager = new ReadingTimeManager();
47 $this->lng = $DIC->language();
48 $this->lm_id = $lm_id;
49 }
50
51 public function addSettingToForm(\ilPropertyFormGUI $form): void
52 {
53 if ($this->manager->isGloballyActivated()) {
54 $cb = new \ilCheckboxInputGUI($this->lng->txt("lm_est_reading_time"), "est_reading_time");
55 $cb->setChecked($this->manager->isActivated($this->lm_id));
56 $form->addItem($cb);
57 }
58 }
59
60 public function saveSettingFromForm(\ilPropertyFormGUI $form): void
61 {
62 if ($this->manager->isGloballyActivated()) {
63 $this->manager->activate(
64 $this->lm_id,
65 (bool) $form->getInput("est_reading_time")
66 );
67 }
68 }
69}
__construct()
Constructor setup ILIAS global object @access public.
Definition: class.ilias.php:76
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