ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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 23 of file class.ilDclTextRecordFieldModel.php.

Member Function Documentation

◆ addHiddenItemsToConfirmation()

ilDclTextRecordFieldModel::addHiddenItemsToConfirmation ( ilConfirmationGUI  $confirmation)

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

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

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

◆ deserializeData()

ilDclTextRecordFieldModel::deserializeData (   $value)

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

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

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

◆ fillExcelExport()

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

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

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

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

◆ getExportValue()

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

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

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

Referenced by fillExcelExport().

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

◆ getPlainText()

ilDclTextRecordFieldModel::getPlainText ( )

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

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

72  : string
73  {
74  $value = $this->getValue();
75 
76  if (is_array($value)) {
77  if ($value['title']) {
78  return $value['title'];
79  }
80 
81  return $value['link'] ?? '';
82  } else {
83  if ($value) {
84  return $value;
85  }
86  }
87  return '';
88  }
+ 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 111 of file class.ilDclTextRecordFieldModel.php.

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

112  {
113  $value = parent::getValueFromExcel($excel, $row, $col);
114  if ($this->getField()->hasProperty(ilDclBaseFieldModel::PROP_URL)) {
115  $title = '';
116  if ($excel->getCell(1, $col + 1) == $this->getField()->getTitle() . '_title') {
117  $title = $excel->getCell($row, $col + 1);
118  }
119  $value = ['link' => $value, 'title' => $title];
120  }
121 
122  if ($value) {
123  return $value;
124  }
125  return "";
126  }
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 146 of file class.ilDclTextRecordFieldModel.php.

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

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

◆ parseValue()

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

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

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

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

◆ setValueFromForm()

ilDclTextRecordFieldModel::setValueFromForm ( ilPropertyFormGUI  $form)

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

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

25  : void
26  {
27  if ($this->getField()->hasProperty(ilDclBaseFieldModel::PROP_URL)) {
28  $value = [
29  "link" => $form->getInput("field_" . $this->getField()->getId()),
30  "title" => $form->getInput("field_" . $this->getField()->getId() . '_title'),
31  ];
32  } else {
33  $value = $form->getInput("field_" . $this->getField()->getId());
34  }
35  $this->setValue($value);
36  }
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: