ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilDclFileuploadRecordFieldModel Class Reference

Class ilDclBaseFieldModel. More...

+ Inheritance diagram for ilDclFileuploadRecordFieldModel:
+ Collaboration diagram for ilDclFileuploadRecordFieldModel:

Public Member Functions

 addHiddenItemsToConfirmation (ilConfirmationGUI &$confirmation)
 
 setValue ($value, $omit_parsing=false)
 Set value for record field. More...
 
 parseExportValue ($value)
 
 parseSortingValue ($value, $link=true)
 Returns sortable value for the specific field-types. More...
 
 setValueFromForm ($form)
 
 afterClone ()
 
- 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, $omit_parsing=false)
 Set value for record field. More...
 
 setValueFromForm ($form)
 
 getFormulaValue ()
 
 parseExportValue ($value)
 Function to parse incoming data from form input value $value. More...
 
 getValueFromExcel ($excel, $row, $col)
 
 parseValue ($value)
 Function to parse incoming data from form input value $value. More...
 
 getExportValue ()
 
 fillExcelExport (ilExcel $worksheet, &$row, &$col)
 
 getPlainText ()
 
 getSortingValue ($link=true)
 
 addHiddenItemsToConfirmation (ilConfirmationGUI &$confirmation)
 
 parseSortingValue ($value, $link=true)
 Returns sortable value for the specific field-types. More...
 
 cloneStructure (ilDclBaseRecordFieldModel $old_record_field)
 
 afterClone ()
 
 getField ()
 
 getId ()
 
 getRecord ()
 
 getRecordRepresentation ()
 
 setRecordRepresentation ($record_representation)
 
 getFieldRepresentation ()
 
 setFieldRepresentation ($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
 $id
 
 $field
 
 $record
 
 $record_representation
 
 $field_representation
 
 $value
 
 $user
 
 $ctrl
 
 $db
 
 $lng
 

Detailed Description

Member Function Documentation

◆ addHiddenItemsToConfirmation()

ilDclFileuploadRecordFieldModel::addHiddenItemsToConfirmation ( ilConfirmationGUI $confirmation)
Parameters
ilConfirmationGUI$confirmation

Definition at line 77 of file class.ilDclFileuploadRecordFieldModel.php.

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

78  {
79  if (is_array($this->getValue())) {
80  foreach ($this->getValue() as $key => $value) {
81  $confirmation->addHiddenItem('field_' . $this->field->getId() . '[' . $key . ']', $value);
82  }
83  }
84  }
addHiddenItem($a_post_var, $a_value)
Add hidden item.
$key
Definition: croninfo.php:18
+ Here is the call graph for this function:

◆ afterClone()

ilDclFileuploadRecordFieldModel::afterClone ( )

Definition at line 171 of file class.ilDclFileuploadRecordFieldModel.php.

References ilDclBaseRecordFieldModel\$field, ilDclBaseRecordFieldModel\$record, ilDclBaseRecordFieldModel\doUpdate(), ilDclCache\getCloneOf(), ilDclBaseRecordFieldModel\getField(), ilObject2\getId(), ilDclBaseRecordFieldModel\getId(), ilDclBaseRecordFieldModel\getRecord(), ilDclCache\getRecordFieldCache(), setValue(), ilDclCache\TYPE_FIELD, and ilDclCache\TYPE_RECORD.

172  {
176 
177  if (!$record_field || !$record_field->getValue()) {
178  return;
179  }
180 
181  $file_old = new ilObjFile($record_field->getValue(), false);
182  $file_new = $file_old->cloneObject(null, null, true);
183 
184  $this->setValue($file_new->getId(), true);
185  $this->doUpdate();
186  }
static getCloneOf($id, $type)
setValue($value, $omit_parsing=false)
Set value for record field.
doUpdate()
Update object in database.
static getRecordFieldCache($record, $field)
+ Here is the call graph for this function:

◆ parseExportValue()

ilDclFileuploadRecordFieldModel::parseExportValue (   $value)

Definition at line 117 of file class.ilDclFileuploadRecordFieldModel.php.

References ilDclBaseRecordFieldModel\$value, ilObject2\_exists(), and ilObject2\_lookupType().

118  {
119  if (!ilObject2::_exists($value) || ilObject2::_lookupType($value, false) != "file") {
120  return;
121  }
122 
123  $file = $value;
124  if ($file != "-") {
125  $file_obj = new ilObjFile($file, false);
126  $file_name = $file_obj->getFileName();
127 
128  return $file_name;
129  }
130 
131  return $file;
132  }
static _lookupType($a_id, $a_reference=false)
static _exists($a_id, $a_reference=false, $a_type=null)
+ Here is the call graph for this function:

◆ parseSortingValue()

ilDclFileuploadRecordFieldModel::parseSortingValue (   $value,
  $link = true 
)

Returns sortable value for the specific field-types.

Parameters
$value
ilDclBaseRecordFieldModel$record_field
bool | true$link
Returns
int|string

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

References ilDclBaseRecordFieldModel\$value, ilObject2\_exists(), and ilObject2\_lookupType().

145  {
146  if (!ilObject2::_exists($value) || ilObject2::_lookupType($value, false) != "file") {
147  return '';
148  }
149  $file_obj = new ilObjFile($value, false);
150 
151  return $file_obj->getTitle();
152  }
static _lookupType($a_id, $a_reference=false)
static _exists($a_id, $a_reference=false, $a_type=null)
+ Here is the call graph for this function:

◆ setValue()

ilDclFileuploadRecordFieldModel::setValue (   $value,
  $omit_parsing = false 
)

Set value for record field.

Parameters
mixed$value
bool$omit_parsingIf true, does not parse the value and stores it in the given format

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

References ilDclBaseRecordFieldModel\$value, ilDclBaseRecordFieldModel\getRecord(), ilDclBaseRecordFieldModel\loadValue(), and ilDclBaseRecordFieldModel\parseValue().

Referenced by afterClone(), and setValueFromForm().

94  {
95  $this->loadValue();
96 
97  if (!$omit_parsing) {
98  $tmp = $this->parseValue($value, $this);
99  $old = $this->value;
100  //if parse value fails keep the old value
101  if ($tmp !== false) {
102  $this->value = $tmp;
103  //delete old file from filesystem
104  if ($old && $old != $tmp) {
105  $this->getRecord()->deleteFile($old);
106  }
107  }
108  } else {
109  $this->value = $value;
110  }
111  }
parseValue($value)
Function to parse incoming data from form input value $value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setValueFromForm()

ilDclFileuploadRecordFieldModel::setValueFromForm (   $form)

Definition at line 158 of file class.ilDclFileuploadRecordFieldModel.php.

References $form, ilDclBaseRecordFieldModel\$value, ilDclBaseRecordFieldModel\getField(), ilDclBaseRecordFieldModel\getId(), and setValue().

159  {
160  $value = $form->getInput("field_" . $this->getField()->getId());
161  if ($form->getItemByPostVar("field_" . $this->getField()->getId())->getDeletionFlag()) {
162  $value = -1;
163  }
164  $this->setValue($value);
165  }
setValue($value, $omit_parsing=false)
Set value for record field.
if(isset($_POST['submit'])) $form
+ Here is the call graph for this function:

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