ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilDclReferenceRecordRepresentation Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilDclReferenceRecordRepresentation:
+ Collaboration diagram for ilDclReferenceRecordRepresentation:

Public Member Functions

 getHTML (bool $link=true, array $options=[])
 
 parseFormInput ($value)
 function parses stored value to the variable needed to fill into the form for editing. More...
 
- Public Member Functions inherited from ilDclBaseRecordRepresentation
 __construct (ilDclBaseRecordFieldModel $record_field)
 
 getFormGUI (ilPropertyFormGUI $formGUI)
 
 parseFormInput ($value)
 function parses stored value to the variable needed to fill into the form for editing. More...
 
 fillFormInput (ilPropertyFormGUI $form)
 Fills the form with the value of a record. More...
 
 getHTML (bool $link=true, array $options=[])
 Outputs html of a certain field. More...
 
 getSingleHTML (?array $options=null, bool $link=true)
 Returns data for single record view. More...
 
 getConfirmationHTML ()
 Returns data for confirmation list When returning false, attribute is ignored in list. More...
 
 fillRow (ilTemplate $tpl)
 Fills row with record data. More...
 
 getRecordField ()
 Get Record Field. More...
 
 getField ()
 Getter shortcut for field. More...
 
 getRecord ()
 Getter shortcut for record. More...
 

Protected Member Functions

 getLinkHTML (ilDclBaseRecordModel $record, int $view)
 
- Protected Member Functions inherited from ilDclBaseRecordRepresentation
 getFormInput ()
 Gets the value from from the record field. More...
 

Additional Inherited Members

- Protected Attributes inherited from ilDclBaseRecordRepresentation
ilDclBaseRecordFieldModel $record_field
 
ilLanguage $lng
 
ilAccess $access
 
ilCtrl $ctrl
 
ILIAS HTTP Services $http
 
ILIAS Refinery Factory $refinery
 
ILIAS UI Renderer $renderer
 
ilObjUser $user
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Definition at line 19 of file class.ilDclReferenceRecordRepresentation.php.

Member Function Documentation

◆ getHTML()

ilDclReferenceRecordRepresentation::getHTML ( bool  $link = true,
array  $options = [] 
)

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

References ilDclBaseRecordRepresentation\$record_field, $ref_id, ilDclBaseRecordFieldModel\doUpdate(), ilDclBaseRecordFieldModel\getField(), getLinkHTML(), ilDclCache\getRecordCache(), ilDclBaseRecordRepresentation\getRecordField(), ILIAS\FileDelivery\http(), ilDclBaseFieldModel\PROP_REFERENCE, ilDclBaseFieldModel\PROP_REFERENCE_LINK, ILIAS\Repository\refinery(), ilDclBaseRecordFieldModel\setValue(), and ILIAS\Repository\user().

21  : string
22  {
23  $value = $this->getRecordField()->getValue();
24  $record_field = $this->getRecordField();
25 
26  if (!$value || $value == "-") {
27  return "";
28  }
29 
30  if (!is_array($value)) {
31  $value = [$value];
32  }
33 
34  $items = [];
35 
36  foreach ($value as $k => $v) {
37  $ref_record = ilDclCache::getRecordCache($v);
38  if (!$ref_record->getId() || !$ref_record->getTableId() || !$record_field->getField() || !$record_field->getField()->getTableId()) {
39  //the referenced record_field does not seem to exist.
40  unset($value[$k]);
41  $value = array_values($value); // resets the keys
42  $record_field->setValue($value);
44  continue;
45  } else {
46  $field = $this->getRecordField()->getField();
47  if ($field->getProperty(ilDclBaseFieldModel::PROP_REFERENCE_LINK)) {
48  $ref_table = $ref_record->getTable();
49  $ref_id = $this->http->wrapper()->query()->retrieve('ref_id', $this->refinery->kindlyTo()->int());
50  if ($v !== null && $v !== '' && $v !== '-') {
51  $view = $ref_record->getTable()->getFirstTableViewId($ref_id, $this->user->getId(), true);
52  if ($view) {
53  $items[] = $this->getLinkHTML($ref_record, $view);
54  continue;
55  }
56  }
57  }
58  $items[] = $ref_record->getRecordFieldHTML($field->getProperty(ilDclBaseFieldModel::PROP_REFERENCE));
59  }
60  }
61 
62  return implode('<br>', $items);
63  }
setValue($value, bool $omit_parsing=false)
Set value for record field.
static http()
Fetches the global http state from ILIAS.
$ref_id
Definition: ltiauth.php:67
doUpdate()
Update object in database.
static getRecordCache(?int $record_id)
getLinkHTML(ilDclBaseRecordModel $record, int $view)
+ Here is the call graph for this function:

◆ getLinkHTML()

ilDclReferenceRecordRepresentation::getLinkHTML ( ilDclBaseRecordModel  $record,
int  $view 
)
protected

Definition at line 65 of file class.ilDclReferenceRecordRepresentation.php.

References ILIAS\Repository\ctrl(), ilDclBaseRecordModel\getId(), ilDclBaseRecordModel\getRecordFieldValue(), ilDclBaseRecordModel\getTableId(), and ilDclBaseFieldModel\PROP_REFERENCE.

Referenced by getHTML().

65  : string
66  {
67  $this->ctrl->setParameterByClass(ilDclDetailedViewGUI::class, "table_id", $record->getTableId());
68  $this->ctrl->setParameterByClass(ilDclDetailedViewGUI::class, "record_id", $record->getId());
69  $this->ctrl->setParameterByClass(ilDclDetailedViewGUI::class, "tableview_id", $view);
70  $html = $this->factory->link()->standard(
71  $record->getRecordFieldValue($this->getField()->getProperty(ilDclBaseFieldModel::PROP_REFERENCE)),
72  $this->ctrl->getLinkTargetByClass(
73  ilDclDetailedViewGUI::class,
74  "renderRecord"
75  )
76  );
77 
78  return $this->renderer->render($html);
79  }
getRecordFieldValue(?int $field_id)
Get Field Value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseFormInput()

ilDclReferenceRecordRepresentation::parseFormInput (   $value)

function parses stored value to the variable needed to fill into the form for editing.

Parameters
string | array$value

Definition at line 85 of file class.ilDclReferenceRecordRepresentation.php.

86  {
87  if (!$value || $value == []) {
88  return null;
89  }
90 
91  return $value;
92  }

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