ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilObjectMetaDataBlockGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5include_once("Services/Block/classes/class.ilBlockGUI.php");
6
18{
19 public static $block_type = "advmd";
20
21 protected $record; // [ilAdvancedMDRecord]
22 protected $values; // [ilAdvancedMDValues]
23 protected $callback; // [string]
24
25 protected static $records = array(); // [array]
26
30 public function __construct(ilAdvancedMDRecord $a_record, $a_decorator_callback = null)
31 {
32 global $DIC;
33
34 $this->ctrl = $DIC->ctrl();
35 $this->lng = $DIC->language();
36 parent::__construct();
37
38 $this->record = $a_record;
39 $this->callback = $a_decorator_callback;
40
41 $this->setTitle($this->record->getTitle());
42 $this->setBlockId("advmd_" . $this->record->getRecordId());
43 $this->setEnableNumInfo(false);
44 // $this->setAvailableDetailLevels(3);
45 $this->allow_moving = false;
46 }
47
53 public static function getBlockType()
54 {
55 return self::$block_type;
56 }
57
63 public static function isRepositoryObject()
64 {
65 return false;
66 }
67
71 public static function getScreenMode()
72 {
73 return IL_SCREEN_SIDE;
74 }
75
76 public function setValues(ilAdvancedMDValues $a_values)
77 {
78 $this->values = $a_values;
79 }
80
84 public function executeCommand()
85 {
87
88 $next_class = $ilCtrl->getNextClass();
89 $cmd = $ilCtrl->getCmd("getHTML");
90
91 switch ($next_class) {
92 default:
93 return $this->$cmd();
94 }
95 }
96
100 public function fillDataSection()
101 {
103
104 $btpl = new ilTemplate("tpl.advmd_block.html", true, true, "Services/Object");
105
106 // see ilAdvancedMDRecordGUI::parseInfoPage()
107
110
111 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
112 include_once('Services/ADT/classes/class.ilADTFactory.php');
113
114 // this correctly binds group and definitions
115 $this->values->read();
116
117 $defs = $this->values->getDefinitions();
118 foreach ($this->values->getADTGroup()->getElements() as $element_id => $element) {
119 $btpl->setCurrentBlock("item");
120 $btpl->setVariable("CAPTION", $defs[$element_id]->getTitle());
121 if ($element->isNull()) {
122 $value = "-";
123 } else {
124 $value = ilADTFactory::getInstance()->getPresentationBridgeForInstance($element);
125
126 if ($element instanceof ilADTLocation) {
127 $value->setSize("100%", "200px");
128 }
129
130 if (in_array($element->getType(), array("MultiEnum", "Enum", "Text"))) {
131 $value->setDecoratorCallBack($this->callback);
132 }
133
134 $value = $value->getHTML();
135 }
136 $btpl->setVariable("VALUE", $value);
137 $btpl->parseCurrentBlock();
138 }
139
140 $this->setDataSection($btpl->get());
141
143
144 return;
145 }
146}
An exception for terminatinating execution or to throw for unit testing.
const IL_SCREEN_SIDE
static getInstance()
Get singleton.
This class represents a block method of a block.
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
getTitle()
Get Title.
setTitle($a_title)
Set Title.
setBlockId($a_block_id=0)
Set Block Id.
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
static setUseRelativeDates($a_status)
set use relative dates
static useRelativeDates()
check if relative dates are used
__construct(ilAdvancedMDRecord $a_record, $a_decorator_callback=null)
Constructor.
setValues(ilAdvancedMDValues $a_values)
static getScreenMode()
Get Screen Mode for current command.
static isRepositoryObject()
Is this a repository object.
special template class to simplify handling of ITX/PEAR
global $ilCtrl
Definition: ilias.php:18
global $DIC
Definition: saml.php:7