ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 static $block_type = "advmd";
20
21 protected $record; // [ilAdvancedMDRecord]
22 protected $values; // [ilAdvancedMDValues]
23 protected $callback; // [string]
24
25 static protected $records = array(); // [array]
26
30 function __construct(ilAdvancedMDRecord $a_record, $a_decorator_callback = null)
31 {
32 parent::ilBlockGUI();
33
34 $this->record = $a_record;
35 $this->callback = $a_decorator_callback;
36
37 $this->setTitle($this->record->getTitle());
38 $this->setBlockId("advmd_".$this->record->getRecordId());
39 $this->setEnableNumInfo(false);
40 // $this->setAvailableDetailLevels(3);
41 $this->allow_moving = false;
42 }
43
49 static function getBlockType()
50 {
51 return self::$block_type;
52 }
53
59 static function isRepositoryObject()
60 {
61 return false;
62 }
63
67 static function getScreenMode()
68 {
69 return IL_SCREEN_SIDE;
70 }
71
72 public function setValues(ilAdvancedMDValues $a_values)
73 {
74 $this->values = $a_values;
75 }
76
80 function &executeCommand()
81 {
82 global $ilCtrl;
83
84 $next_class = $ilCtrl->getNextClass();
85 $cmd = $ilCtrl->getCmd("getHTML");
86
87 switch ($next_class)
88 {
89 default:
90 return $this->$cmd();
91 }
92 }
93
97 function fillDataSection()
98 {
99 global $lng;
100
101 $btpl = new ilTemplate("tpl.advmd_block.html", true, true, "Services/Object");
102
103 // see ilAdvancedMDRecordGUI::parseInfoPage()
104
107
108 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
109 include_once('Services/ADT/classes/class.ilADTFactory.php');
110
111 // this correctly binds group and definitions
112 $this->values->read();
113
114 $defs = $this->values->getDefinitions();
115 foreach($this->values->getADTGroup()->getElements() as $element_id => $element)
116 {
117 $btpl->setCurrentBlock("item");
118 $btpl->setVariable("CAPTION", $defs[$element_id]->getTitle());
119 if($element->isNull())
120 {
121 $value = "-";
122 }
123 else
124 {
125 $value = ilADTFactory::getInstance()->getPresentationBridgeForInstance($element);
126
127 if($element instanceof ilADTLocation)
128 {
129 $value->setSize("100%", "200px");
130 }
131
132 if(in_array($element->getType(), array("MultiEnum", "Enum", "Text")))
133 {
134 $value->setDecoratorCallBack($this->callback);
135 }
136
137 $value = $value->getHTML();
138 }
139 $btpl->setVariable("VALUE", $value);
140 $btpl->parseCurrentBlock();
141 }
142
143 $this->setDataSection($btpl->get());
144
146
147 return;
148 }
149}
150
151?>
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 $lng
Definition: privfeed.php:40
$cmd
Definition: sahs_server.php:35