ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilDclBaseRecordRepresentation.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 {
23  protected \ILIAS\UI\Factory $factory;
25  protected ilLanguage $lng;
26  protected ilAccess $access;
27  protected ilCtrl $ctrl;
30  protected \ILIAS\UI\Renderer $renderer;
31  protected ilObjUser $user;
32 
33  public function __construct(ilDclBaseRecordFieldModel $record_field)
34  {
35  global $DIC;
36 
37  $this->lng = $DIC->language();
38  $this->access = $DIC->access();
39  $this->ctrl = $DIC->ctrl();
40  $this->http = $DIC->http();
41  $this->refinery = $DIC->refinery();
42  $this->factory = $DIC->ui()->factory();
43  $this->renderer = $DIC->ui()->renderer();
44  $this->user = $DIC->user();
45 
46  $this->record_field = $record_field;
47  }
48 
49  public function getFormGUI(ilPropertyFormGUI $formGUI): void
50  {
51  // Apply form-elements to record-entry-gui
52  }
53 
59  public function parseFormInput($value)
60  {
61  return $value;
62  }
63 
67  public function fillFormInput(ilPropertyFormGUI $form): void
68  {
69  $input_field = $form->getItemByPostVar('field_' . $this->getRecordField()->getField()->getId());
70  if ($input_field) {
71  $value = $this->getFormInput();
72  if (!is_null($value)) {
73  $input_field->setValueByArray(["field_" . $this->getRecordField()->getField()->getId() => $value]);
74  }
75  }
76  }
77 
82  protected function getFormInput()
83  {
84  return $this->parseFormInput($this->getRecordField()->getValue());
85  }
86 
90  public function getHTML(bool $link = true, array $options = []): string
91  {
92  return (string) $this->getRecordField()->getValue();
93  }
94 
98  public function getSingleHTML(?array $options = null, bool $link = true): string
99  {
100  return $this->getHTML($link, $options);
101  }
102 
107  public function getConfirmationHTML(): string
108  {
109  return $this->getHTML();
110  }
111 
116  public function fillRow(ilTemplate $tpl): void
117  {
118  }
119 
124  {
125  return $this->record_field;
126  }
127 
131  public function getField(): ilDclBaseFieldModel
132  {
133  return $this->record_field->getField();
134  }
135 
139  public function getRecord(): ilDclBaseRecordModel
140  {
141  return $this->record_field->getRecord();
142  }
143 }
fillRow(ilTemplate $tpl)
Fills row with record data.
getItemByPostVar(string $a_post_var)
getValue()
Get the value that is displayed in the input client side.
Definition: Group.php:49
factory()
getHTML(bool $link=true, array $options=[])
Outputs html of a certain field.
renderer()
fillFormInput(ilPropertyFormGUI $form)
Fills the form with the value of a record.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
__construct(ilDclBaseRecordFieldModel $record_field)
static http()
Fetches the global http state from ILIAS.
getFormInput()
Gets the value from from the record field.
global $DIC
Definition: shib_login.php:22
getSingleHTML(?array $options=null, bool $link=true)
Returns data for single record view.
parseFormInput($value)
function parses stored value to the variable needed to fill into the form for editing.
getConfirmationHTML()
Returns data for confirmation list When returning false, attribute is ignored in list.