ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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)
 
 parseSortingValue ($value, bool $link=true)
 Returns sortable value for the specific field-types. More...
 
 deserializeData ($value)
 Deserialize data before applying to field. More...
 
- 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 ()
 
 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)
Parameters
ilConfirmationGUI$confirmation

Reimplemented from ilDclBaseRecordFieldModel.

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

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)

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

+ Here is the call graph for this function:

◆ deserializeData()

ilDclTextRecordFieldModel::deserializeData (   $value)

Deserialize data before applying to field.

Parameters
mixed$value
Returns
mixed

Reimplemented from ilDclBaseRecordFieldModel.

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

146 {
147 $value = (string) $value;
148 if ($this->getField()->getProperty(ilDclBaseFieldModel::PROP_URL)) {
149 $deserialize = json_decode($value, true);
150 return [
151 'title' => $deserialize['title'] ?? '',
152 'link' => $deserialize['link'] ?? '',
153 ];
154 }
155
156 return $value;
157 }

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

+ Here is the call graph for this function:

◆ fillExcelExport()

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

Reimplemented from ilDclBaseRecordFieldModel.

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

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.

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

+ Here is the call graph for this function:

◆ getExportValue()

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

Reimplemented from ilDclBaseRecordFieldModel.

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

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 }

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

Referenced by fillExcelExport().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPlainText()

ilDclTextRecordFieldModel::getPlainText ( )
Returns
int|string

Reimplemented from ilDclBaseRecordFieldModel.

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

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 }

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

+ 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

Reimplemented from ilDclBaseRecordFieldModel.

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

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.

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

+ 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

Reimplemented from ilDclBaseRecordFieldModel.

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

132 : string
133 {
134 if ($this->getField()->getProperty(ilDclBaseFieldModel::PROP_URL)) {
135 if (is_array($value)) {
136 return $value['title'] ?? $value['link'];
137 } else {
138 return $value;
139 }
140 } else {
141 return $value;
142 }
143 }

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

+ Here is the call graph for this function:

◆ setValueFromForm()

ilDclTextRecordFieldModel::setValueFromForm ( ilPropertyFormGUI  $form)

Reimplemented from ilDclBaseRecordFieldModel.

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

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-...

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

+ Here is the call graph for this function:

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