ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.BlogSettingsGUI.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
22 
27 {
28  protected int $blog_id;
29  protected \ilLanguage $lng;
31 
32  public function __construct(int $blog_id)
33  {
34  global $DIC;
35 
36  $this->manager = new ReadingTimeManager();
37  $this->lng = $DIC->language();
38  $this->blog_id = $blog_id;
39  }
40 
41  public function addSettingToForm(\ilPropertyFormGUI $form): void
42  {
43  if ($this->manager->isGloballyActivated()) {
44  $cb = new \ilCheckboxInputGUI($this->lng->txt("blog_est_reading_time"), "est_reading_time");
45  $cb->setChecked($this->manager->isActivated($this->blog_id));
46  $form->addItem($cb);
47  }
48  }
49 
50  public function addValueToArray(array $values): array
51  {
52  $values["est_reading_time"] = $this->manager->isActivated($this->blog_id);
53  return $values;
54  }
55 
56  public function saveSettingFromForm(\ilPropertyFormGUI $form): void
57  {
58  if ($this->manager->isGloballyActivated()) {
59  $this->manager->activate(
60  $this->blog_id,
61  (bool) $form->getInput("est_reading_time")
62  );
63  }
64  }
65 }
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...