ILIAS  release_8 Revision v8.24
class.BlogSettingsGUI.php
Go to the documentation of this file.
1<?php
2
20
25{
29 protected $blog_id;
30
34 protected $lng;
35
39 protected $manager;
40
41 public function __construct(int $blog_id)
42 {
44 global $DIC;
45
46 $this->manager = new ReadingTimeManager();
47 $this->lng = $DIC->language();
48 $this->blog_id = $blog_id;
49 }
50
51 public function addSettingToForm(\ilPropertyFormGUI $form): void
52 {
53 if ($this->manager->isGloballyActivated()) {
54 $cb = new \ilCheckboxInputGUI($this->lng->txt("blog_est_reading_time"), "est_reading_time");
55 $cb->setChecked($this->manager->isActivated($this->blog_id));
56 $form->addItem($cb);
57 }
58 }
59
60 public function addValueToArray(array $values): array
61 {
62 $values["est_reading_time"] = $this->manager->isActivated($this->blog_id);
63 return $values;
64 }
65
66 public function saveSettingFromForm(\ilPropertyFormGUI $form): void
67 {
68 if ($this->manager->isGloballyActivated()) {
69 $this->manager->activate(
70 $this->blog_id,
71 (bool) $form->getInput("est_reading_time")
72 );
73 }
74 }
75}
__construct()
Constructor setup ILIAS global object @access public.
Definition: class.ilias.php:62
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-...
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...