ILIAS  release_8 Revision v8.24
class.ilObjectMetaDataBlockGUI.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
28{
29 public static string $block_type = "advmd";
30 protected static array $records = [];
31
34 protected ?array $callback;
35
43 public function __construct(ilAdvancedMDRecord $record, ?array $decorator_callback = null)
44 {
45 global $DIC;
46
47 $this->ctrl = $DIC->ctrl();
48 $this->lng = $DIC->language();
49
50
52
53 $this->record = $record;
54 $this->callback = $decorator_callback;
55
56 $translations = ilAdvancedMDRecordTranslations::getInstanceByRecordId($this->record->getRecordId());
57 $this->setTitle($translations->getTitleForLanguage($this->lng->getLangKey()));
58 $this->setBlockId("advmd_" . $this->record->getRecordId());
59 $this->setEnableNumInfo(false);
60 $this->allow_moving = false;
61 }
62
66 public function getBlockType(): string
67 {
68 return self::$block_type;
69 }
70
74 protected function isRepositoryObject(): bool
75 {
76 return false;
77 }
78
82 public static function getScreenMode(): string
83 {
84 return IL_SCREEN_SIDE;
85 }
86
87 public function setValues(ilAdvancedMDValues $a_values): void
88 {
89 $this->values = $a_values;
90 }
91
95 public function executeCommand(): void
96 {
97 $this->ctrl->getNextClass();
98 $cmd = $this->ctrl->getCmd("getHTML");
99 $this->$cmd();
100 }
101
105 public function fillDataSection(): void
106 {
107 $this->setDataSection($this->getLegacyContent());
108 }
109
110 //
111 // New rendering
112 //
113
114 protected bool $new_rendering = true;
115
116
120 protected function getLegacyContent(): string
121 {
122 $btpl = new ilTemplate("tpl.advmd_block.html", true, true, "Services/Object");
123
124 // see ilAdvancedMDRecordGUI::parseInfoPage()
125
128
129 // this correctly binds group and definitions
130 $this->values->read();
131
132 $defs = $this->values->getDefinitions();
133 foreach ($this->values->getADTGroup()->getElements() as $element_id => $element) {
134 $field_translations = ilAdvancedMDFieldTranslations::getInstanceByRecordId($defs[$element_id]->getRecordId());
135
136 $btpl->setCurrentBlock("item");
137 $btpl->setVariable("CAPTION", $field_translations->getTitleForLanguage($element_id, $this->lng->getLangKey()));
138 if ($element->isNull()) {
139 $value = "-";
140 } else {
141 $value = ilADTFactory::getInstance()->getPresentationBridgeForInstance($element);
142
143 if (in_array($element->getType(), array("MultiEnum", "Enum", "Text"))) {
144 $value->setDecoratorCallBack($this->callback);
145 }
146
147 $value = $value->getHTML();
148 }
149 $btpl->setVariable("VALUE", $value);
150 $btpl->parseCurrentBlock();
151 }
152
153 $html = $btpl->get();
154
156
157 return $html;
158 }
159}
const IL_SCREEN_SIDE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a block method of a block.
setDataSection(string $a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
setTitle(string $a_title)
setBlockId(string $a_block_id="0")
setEnableNumInfo(bool $a_enablenuminfo)
static setUseRelativeDates(bool $a_status)
set use relative dates
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getLegacyContent()
Get legacy content.string
setValues(ilAdvancedMDValues $a_values)
isRepositoryObject()
Returns whether block has a corresponding repository object.
static getScreenMode()
Get Screen Mode for current command.
__construct(ilAdvancedMDRecord $record, ?array $decorator_callback=null)
Takes as an optional second input an array consisting of the object that the method that should be ca...
special template class to simplify handling of ITX/PEAR
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
getRecordId()
Get the system record ID.
Definition: System.php:214