ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
ilDataCollectionTextField Class Reference

Class ilDataCollectionTextField. More...

+ Inheritance diagram for ilDataCollectionTextField:
+ Collaboration diagram for ilDataCollectionTextField:

Public Member Functions

 fillFormInput (&$form)
 
 setValueFromForm (&$form)
 
 fillExcelExport ($worksheet, &$row, &$col)
 
 getExportValue ()
 
 getValueFromExcel ($excel, $row, $col)
 
- Public Member Functions inherited from ilDataCollectionRecordField
 __construct (ilDataCollectionRecord $record, ilDataCollectionField $field)
 
 doUpdate ()
 Update object in database. More...
 
 delete ()
 Delete record field in database. More...
 
 getValue ()
 
 setValue ($value, $omit_parsing=false)
 Set value for record field. More...
 
 setValueFromForm (&$form)
 
 getValueFromExcel ($excel, $row, $col)
 
 fillFormInput (&$form)
 
 getExportValue ()
 
 fillExcelExport ($worksheet, &$row, &$col)
 
 getPlainText ()
 
 getHTML ($link=true)
 
 getSortingValue ($link=true)
 
 getSingleHTML ()
 
 getField ()
 
 getId ()
 
 getRecord ()
 

Protected Member Functions

 hasProperty ($prop_id)
 
- Protected Member Functions inherited from ilDataCollectionRecordField
 doRead ()
 Read object data from database. More...
 
 doCreate ()
 Creates an Id and a database entry. More...
 
 getFormInput ()
 
 loadValue ()
 Load the value. More...
 

Additional Inherited Members

- Protected Attributes inherited from ilDataCollectionRecordField
 $id
 
 $field
 
 $record
 
 $value
 
 $user
 
 $ctrl
 
 $db
 
 $lng
 

Detailed Description

Member Function Documentation

◆ fillExcelExport()

ilDataCollectionTextField::fillExcelExport (   $worksheet,
$row,
$col 
)
Parameters
$worksheet
$row
$col

Definition at line 52 of file class.ilDataCollectionTextField.php.

References $row, ilDataCollectionRecordField\$value, getExportValue(), hasProperty(), and ilDataCollectionField\PROPERTYID_URL.

52  {
53  $value = $this->getExportValue();
55  if ($value instanceof stdClass) {
56  $worksheet->writeString($row, $col, $value->link);
57  $col++;
58  $worksheet->writeString($row, $col, $value->title);
59  $col++;
60  } else {
61  $worksheet->writeString($row, $col, $value);
62  $col++;
63  $col++;
64  }
65  } else {
66  $worksheet->writeString($row, $col, $value);
67  $col++;
68  }
69  }
const PROPERTYID_URL
LINK OR EMAIL!
+ Here is the call graph for this function:

◆ fillFormInput()

ilDataCollectionTextField::fillFormInput ( $form)
Parameters
$formilPropertyFormGUI

Definition at line 14 of file class.ilDataCollectionTextField.php.

References ilDataCollectionRecordField\$value, ilDataCollectionRecordField\getValue(), hasProperty(), ilDataCollectionField\PROPERTYID_TEXTAREA, ilDataCollectionField\PROPERTYID_URL, and ilDataCollectionRecordField\setValue().

15  {
16  $value = $this->getValue();
17  $input = $value;
18 
19  if ($this->hasProperty(ilDataCollectionField::PROPERTYID_URL) && $json = json_decode($value)) {
20  $input = $json->link;
21  $input_title = $json->title;
22  $form->getItemByPostVar('field_' . $this->field->getId() . '_title')->setValue($input_title);
23  }
24 
26  $breaks = array( "<br />" );
27  $input = str_ireplace($breaks, "", $input);
28  }
29 
30  $form->getItemByPostVar('field_' . $this->field->getId())->setValue($input);
31  }
const PROPERTYID_URL
LINK OR EMAIL!
setValue($value, $omit_parsing=false)
Set value for record field.
+ Here is the call graph for this function:

◆ getExportValue()

ilDataCollectionTextField::getExportValue ( )
Returns
mixed|string

Definition at line 74 of file class.ilDataCollectionTextField.php.

References ilDataCollectionRecordField\getValue().

Referenced by fillExcelExport().

74  {
75  if (json_decode($this->getValue()) instanceof stdClass) {
76  $json = json_decode($this->getValue());
77  return $json->link;
78  } else {
79  return $this->getValue();
80  }
81  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getValueFromExcel()

ilDataCollectionTextField::getValueFromExcel (   $excel,
  $row,
  $col 
)

Definition at line 83 of file class.ilDataCollectionTextField.php.

References $row, ilDataCollectionRecordField\$value, hasProperty(), and ilDataCollectionField\PROPERTYID_URL.

83  {
84  $value = $excel->val($row, $col);
86  $title = '';
87  if ($excel->val(1, $col+1) == $this->field->getTitle().'_title') {
88  $title = $excel->val($row, $col + 1);
89  }
90  $value = json_encode(array('link' => $value, 'title' => $title));
91  }
92  return $value;
93  }
const PROPERTYID_URL
LINK OR EMAIL!
+ Here is the call graph for this function:

◆ hasProperty()

ilDataCollectionTextField::hasProperty (   $prop_id)
protected
Parameters
$prop_id
Returns
mixed

Definition at line 99 of file class.ilDataCollectionTextField.php.

References ilDataCollectionRecordField\getField().

Referenced by fillExcelExport(), fillFormInput(), getValueFromExcel(), and setValueFromForm().

99  {
100  $properties = $this->getField()->getProperties();
101  return $properties[$prop_id];
102  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setValueFromForm()

ilDataCollectionTextField::setValueFromForm ( $form)
Parameters
$formilPropertyFormGUI

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

References ilDataCollectionRecordField\$value, hasProperty(), ilDataCollectionField\PROPERTYID_URL, and ilDataCollectionRecordField\setValue().

36  {
38  $value = json_encode(array(
39  "link" => $form->getInput("field_" . $this->field->getId()),
40  "title" => $form->getInput("field_" . $this->field->getId() . '_title')));
41  } else {
42  $value = $form->getInput("field_" . $this->field->getId());
43  }
44  $this->setValue($value);
45  }
const PROPERTYID_URL
LINK OR EMAIL!
setValue($value, $omit_parsing=false)
Set value for record field.
+ Here is the call graph for this function:

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