ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilDclReferenceRecordRepresentation Class Reference
+ Inheritance diagram for ilDclReferenceRecordRepresentation:
+ Collaboration diagram for ilDclReferenceRecordRepresentation:

Public Member Functions

 getHTML (bool $link=true, array $options=[])
 Outputs html of a certain field. More...
 
 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
ILIAS UI Factory $factory
 
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

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

Member Function Documentation

◆ getHTML()

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

Outputs html of a certain field.

Reimplemented from ilDclBaseRecordRepresentation.

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

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

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

+ Here is the call graph for this function:

◆ getLinkHTML()

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

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

66 : string
67 {
68 $this->ctrl->setParameterByClass(ilDclDetailedViewGUI::class, "table_id", $record->getTableId());
69 $this->ctrl->setParameterByClass(ilDclDetailedViewGUI::class, "record_id", $record->getId());
70 $this->ctrl->setParameterByClass(ilDclDetailedViewGUI::class, "tableview_id", $view);
71 $html = $this->factory->link()->standard(
72 $record->getRecordFieldHTML($this->getField()->getProperty(ilDclBaseFieldModel::PROP_REFERENCE)),
73 $this->ctrl->getLinkTargetByClass(
74 ilDclDetailedViewGUI::class,
75 "renderRecord"
76 )
77 );
78
79 return $this->renderer->render($html);
80 }
renderer()
factory()
getRecordFieldHTML($field_id, array $options=[])

References ILIAS\Repository\ctrl(), factory(), ilDclBaseRecordModel\getId(), ilDclBaseRecordModel\getRecordFieldHTML(), ilDclBaseRecordModel\getTableId(), ilDclBaseFieldModel\PROP_REFERENCE, and renderer().

Referenced by getHTML().

+ 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

Reimplemented from ilDclBaseRecordRepresentation.

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

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

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