ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilObjectPropertyIsOnline.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
24 
29 {
30  private const DEFAULT_IS_ONLINE = false;
31  private const INPUT_LABEL = 'online';
32  private const INPUT_BYLINE = 'online_input_byline';
33 
34  public function __construct(
35  private bool $is_online = self::DEFAULT_IS_ONLINE
36  ) {
37  }
38 
39  public function getIsOnline(): bool
40  {
41  return $this->is_online;
42  }
43 
44  public function withOnline(): self
45  {
46  $clone = clone $this;
47  $clone->is_online = true;
48  return $clone;
49  }
50 
51  public function withOffline(): self
52  {
53  $clone = clone $this;
54  $clone->is_online = false;
55  return $clone;
56  }
57 
58  public function toForm(
59  \ilLanguage $language,
60  FieldFactory $field_factory,
62  ): Checkbox {
63  $trafo = $refinery->custom()->transformation(
64  function ($v): ilObjectProperty {
65  return new ilObjectPropertyIsOnline($v);
66  }
67  );
68  return $field_factory->checkbox($language->txt(self::INPUT_LABEL))
69  ->withByline($language->txt(self::INPUT_BYLINE))
71  ->withValue($this->getIsOnline());
72  }
73 }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This describes checkbox inputs.
Definition: Checkbox.php:28
toForm(\ilLanguage $language, FieldFactory $field_factory, Refinery $refinery)
__construct(private bool $is_online=self::DEFAULT_IS_ONLINE)