ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilDclTextRecordFieldModel Class Reference
+ Inheritance diagram for ilDclTextRecordFieldModel:
+ Collaboration diagram for ilDclTextRecordFieldModel:

Public Member Functions

 setValueFromForm (ilPropertyFormGUI $form)
 
 fillExcelExport (ilExcel $worksheet, int &$row, int &$col)
 
 addHiddenItemsToConfirmation (ilConfirmationGUI $confirmation)
 
 getPlainText ()
 
 getExportValue ()
 
 getValueFromExcel (ilExcel $excel, int $row, int $col)
 
 parseValue ($value)
 
 parseSortingValue ($value, bool $link=true)
 Returns sortable value for the specific field-types. More...
 
 deserializeData ($value)
 
- Public Member Functions inherited from ilDclBaseRecordFieldModel
 __construct (ilDclBaseRecordModel $record, ilDclBaseFieldModel $field)
 
 doCreate ()
 Creates an Id and a database entry. More...
 
 doUpdate ()
 Update object in database. More...
 
 delete ()
 Delete record field in database. More...
 
 getValue ()
 
 getValueForRepresentation ()
 
 serializeData ($value)
 Serialize data before storing to db. More...
 
 deserializeData ($value)
 Deserialize data before applying to field. More...
 
 setValue ($value, bool $omit_parsing=false)
 Set value for record field. More...
 
 setValueFromForm (ilPropertyFormGUI $form)
 
 getFormulaValue ()
 
 parseExportValue ($value)
 Function to parse incoming data from form input value $value. More...
 
 getValueFromExcel (ilExcel $excel, int $row, int $col)
 
 parseValue ($value)
 Function to parse incoming data from form input value $value. More...
 
 getExportValue ()
 
 fillExcelExport (ilExcel $worksheet, int &$row, int &$col)
 
 getPlainText ()
 
 getSortingValue (bool $link=true)
 
 addHiddenItemsToConfirmation (ilConfirmationGUI $confirmation)
 
 parseSortingValue ($value, bool $link=true)
 Returns sortable value for the specific field-types. More...
 
 cloneStructure (ilDclBaseRecordFieldModel $old_record_field)
 
 afterClone ()
 
 getField ()
 
 getId ()
 
 getRecord ()
 
 getRecordRepresentation ()
 
 setRecordRepresentation (ilDclBaseRecordRepresentation $record_representation)
 
 getFieldRepresentation ()
 
 setFieldRepresentation (ilDclBaseFieldRepresentation $field_representation)
 

Additional Inherited Members

- Protected Member Functions inherited from ilDclBaseRecordFieldModel
 doRead ()
 Read object data from database. More...
 
 loadValue ()
 Load the value. More...
 
- Protected Attributes inherited from ilDclBaseRecordFieldModel
int $id = null
 
ilDclBaseFieldModel $field
 
ilDclBaseRecordModel $record
 
ilDclBaseRecordRepresentation $record_representation = null
 
ilDclBaseFieldRepresentation $field_representation = null
 
 $value
 
ilObjUser $user
 
ilCtrl $ctrl
 
ilDBInterface $db
 
ilLanguage $lng
 
ILIAS HTTP Services $http
 
ILIAS Refinery Factory $refinery
 

Detailed Description

Definition at line 21 of file class.ilDclTextRecordFieldModel.php.

Member Function Documentation

◆ addHiddenItemsToConfirmation()

ilDclTextRecordFieldModel::addHiddenItemsToConfirmation ( ilConfirmationGUI  $confirmation)

Definition at line 56 of file class.ilDclTextRecordFieldModel.php.

References ilDclBaseRecordFieldModel\$value, ilConfirmationGUI\addHiddenItem(), ilDclBaseRecordFieldModel\getValue(), and ilDclBaseFieldModel\PROP_URL.

56  : void
57  {
58  if ($this->field->hasProperty(ilDclBaseFieldModel::PROP_URL)) {
59  $value = $this->getValue();
60  if (is_array($value)) {
61  $confirmation->addHiddenItem('field_' . $this->field->getId(), $value['link']);
62  $confirmation->addHiddenItem('field_' . $this->field->getId() . '_title', $value['title']);
63  }
64 
65  return;
66  }
67  parent::addHiddenItemsToConfirmation($confirmation);
68  }
addHiddenItem(string $a_post_var, string $a_value)
+ Here is the call graph for this function:

◆ deserializeData()

ilDclTextRecordFieldModel::deserializeData (   $value)

Definition at line 157 of file class.ilDclTextRecordFieldModel.php.

References ilDclBaseRecordFieldModel\$value, ilDclBaseRecordFieldModel\getField(), and ilDclBaseFieldModel\PROP_URL.

158  {
159  $value = (string) $value;
160  if ($this->getField()->getProperty(ilDclBaseFieldModel::PROP_URL)) {
161  $deserialize = json_decode($value, true);
162  return [
163  'title' => $deserialize['title'] ?? '',
164  'link' => $deserialize['link'] ?? '',
165  ];
166  }
167 
168  return $value;
169  }
+ Here is the call graph for this function:

◆ fillExcelExport()

ilDclTextRecordFieldModel::fillExcelExport ( ilExcel  $worksheet,
int &  $row,
int &  $col 
)

Definition at line 36 of file class.ilDclTextRecordFieldModel.php.

References ilDclBaseRecordFieldModel\$value, getExportValue(), ilDclBaseRecordFieldModel\getField(), ilDclBaseFieldModel\PROP_URL, and ilExcel\setCell().

36  : void
37  {
38  $value = $this->getExportValue();
39 
40  if ($this->getField()->getProperty(ilDclBaseFieldModel::PROP_URL)) {
41  if (is_array($value)) {
42  $worksheet->setCell($row, $col, $value['link']);
43  $col++;
44  $worksheet->setCell($row, $col, $value['title']);
45  $col++;
46  } else {
47  $worksheet->setCell($row, $col, $value);
48  $col += 2;
49  }
50  } else {
51  $worksheet->setCell($row, $col, $value, DataType::TYPE_STRING);
52  $col++;
53  }
54  }
setCell(int $a_row, int $a_col, $a_value, ?string $a_datatype=null)
Set cell value.
+ Here is the call graph for this function:

◆ getExportValue()

ilDclTextRecordFieldModel::getExportValue ( )
Returns
array|float|int|mixed|string|null

Definition at line 91 of file class.ilDclTextRecordFieldModel.php.

References ilDclBaseRecordFieldModel\$value, ilDclBaseRecordFieldModel\getField(), ilDclBaseRecordFieldModel\getValue(), and ilDclBaseFieldModel\PROP_URL.

Referenced by fillExcelExport().

92  {
93  $value = $this->getValue();
94 
95  // TODO: Handle line-breaks for excel
96  if (is_array($value) && !$this->getField()->getProperty(ilDclBaseFieldModel::PROP_URL)) {
97  return $value['link'];
98  } else {
99  return $value;
100  }
101  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPlainText()

ilDclTextRecordFieldModel::getPlainText ( )

Definition at line 70 of file class.ilDclTextRecordFieldModel.php.

References ilDclBaseRecordFieldModel\$value, and ilDclBaseRecordFieldModel\getValue().

70  : string
71  {
72  $value = $this->getValue();
73 
74  if (is_array($value)) {
75  if ($value['title']) {
76  return $value['title'];
77  }
78 
79  return $value['link'] ?? '';
80  } else {
81  if ($value) {
82  return $value;
83  }
84  }
85  return '';
86  }
+ Here is the call graph for this function:

◆ getValueFromExcel()

ilDclTextRecordFieldModel::getValueFromExcel ( ilExcel  $excel,
int  $row,
int  $col 
)
Parameters
ilExcel$excel
int$row
int$col
Returns
array|int|string

Definition at line 109 of file class.ilDclTextRecordFieldModel.php.

References ilDclBaseRecordFieldModel\$value, ilExcel\getCell(), ilDclBaseRecordFieldModel\getField(), and ilDclBaseFieldModel\PROP_URL.

110  {
111  $value = parent::getValueFromExcel($excel, $row, $col);
112  if ($this->getField()->hasProperty(ilDclBaseFieldModel::PROP_URL)) {
113  $title = '';
114  if ($excel->getCell(1, $col + 1) == $this->getField()->getTitle() . '_title') {
115  $title = $excel->getCell($row, $col + 1);
116  }
117  $value = ['link' => $value, 'title' => $title];
118  }
119 
120  if ($value) {
121  return $value;
122  }
123  return "";
124  }
getCell(int $a_row, int $a_col)
Returns the value of a cell.
+ Here is the call graph for this function:

◆ parseSortingValue()

ilDclTextRecordFieldModel::parseSortingValue (   $value,
bool  $link = true 
)

Returns sortable value for the specific field-types.

Parameters
int | string$value

Definition at line 144 of file class.ilDclTextRecordFieldModel.php.

References ilDclBaseRecordFieldModel\$value, ilDclBaseRecordFieldModel\getField(), and ilDclBaseFieldModel\PROP_URL.

144  : string
145  {
146  if ($this->getField()->getProperty(ilDclBaseFieldModel::PROP_URL)) {
147  if (is_array($value)) {
148  return $value['title'] ?? $value['link'];
149  } else {
150  return $value;
151  }
152  } else {
153  return $value;
154  }
155  }
+ Here is the call graph for this function:

◆ parseValue()

ilDclTextRecordFieldModel::parseValue (   $value)
Parameters
int | string | array$value

Definition at line 129 of file class.ilDclTextRecordFieldModel.php.

References ilDclBaseRecordFieldModel\$value, ilDclBaseRecordFieldModel\getField(), ilDclBaseFieldModel\PROP_TEXTAREA, and ilDclBaseFieldModel\PROP_URL.

130  {
131  if ($this->getField()->getProperty(ilDclBaseFieldModel::PROP_TEXTAREA)
132  && !$this->getField()->getProperty(ilDclBaseFieldModel::PROP_URL)
133  ) {
134  return $value;
135  }
136 
137  return $value;
138  }
+ Here is the call graph for this function:

◆ setValueFromForm()

ilDclTextRecordFieldModel::setValueFromForm ( ilPropertyFormGUI  $form)

Definition at line 23 of file class.ilDclTextRecordFieldModel.php.

References ilDclBaseRecordFieldModel\$value, ilDclBaseRecordFieldModel\getField(), ilDclBaseRecordFieldModel\getId(), ilPropertyFormGUI\getInput(), ilDclBaseFieldModel\PROP_URL, and ilDclBaseRecordFieldModel\setValue().

23  : void
24  {
25  if ($this->getField()->hasProperty(ilDclBaseFieldModel::PROP_URL)) {
26  $value = array(
27  "link" => $form->getInput("field_" . $this->getField()->getId()),
28  "title" => $form->getInput("field_" . $this->getField()->getId() . '_title'),
29  );
30  } else {
31  $value = $form->getInput("field_" . $this->getField()->getId());
32  }
33  $this->setValue($value);
34  }
setValue($value, bool $omit_parsing=false)
Set value for record field.
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-...
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: