ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
class.ilOrgUnitAuthorityFormGUI.php
Go to the documentation of this file.
1 <?php
2 
20 declare(strict_types=1);
22 
27 class ilOrgUnitAuthorityFormGUI extends BaseForm // TODO: still in use?
28 {
29  protected \ActiveRecord $object;
30  private const F_TITLE = 'title';
31  private const F_DESCRIPTION = 'description';
32 
33  public function initFormElements(): void
34  {
35  $te = new ilTextInputGUI($this->lng->txt(self::F_TITLE), self::F_TITLE);
36  $te->setRequired(true);
37  $this->addItem($te);
38 
39  $te = new ilTextAreaInputGUI($this->lng->txt(self::F_DESCRIPTION), self::F_DESCRIPTION);
40  $this->addItem($te);
41 
42  $c = new ilCustomInputGUI($this->lng->txt('authorities'));
43  $f = $this->parent_gui->dic()->ui()->factory();
44  $r = $this->parent_gui->dic()->ui()->renderer();
45  $modal = $f->modal()->roundtrip("Modal", $f->legacy(''))->withCloseWithKeyboard(false);
46  $button = $f->button()
47  ->shy($this->lng->txt("open_authorities_modal"), '#')
48  ->withOnClick($modal->getShowSignal());
49 
50  $c->setHtml($r->render([$button, $modal]));
51  $this->addItem($c);
52  }
53 
54  public function fillForm(): void
55  {
56  $array = array(
57  self::F_TITLE => $this->object->getTitle(),
58  self::F_DESCRIPTION => $this->object->getDescription(),
59  );
60 
61  $this->setValuesByArray($array);
62  }
63 
64  public function fillObject(): bool
65  {
66  if (!$this->checkInput()) {
67  return false;
68  }
69 
70  $this->object->setTitle($this->getInput(self::F_TITLE));
71  $this->object->setDescription($this->getInput(self::F_DESCRIPTION));
72 
73 
74  return true;
75  }
76 }
$c
Definition: deliver.php:9
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-...
setValuesByArray(array $a_values, bool $a_restrict_to_value_keys=false)
This class represents a text area property in a property form.
Class ilOrgUnitAuthorityFormGUI.
$r