ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
5 include_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::__construct();
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 ?>
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
__construct(ilAdvancedMDRecord $a_record, $a_decorator_callback=null)
Constructor.
$cmd
Definition: sahs_server.php:35
static setUseRelativeDates($a_status)
set use relative dates
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
static getInstance()
Get singleton.
static useRelativeDates()
check if relative dates are used
global $ilCtrl
Definition: ilias.php:18
static isRepositoryObject()
Is this a repository object.
setTitle($a_title)
Set Title.
setBlockId($a_block_id=0)
Set Block Id.
special template class to simplify handling of ITX/PEAR
static getScreenMode()
Get Screen Mode for current command.
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
setValues(ilAdvancedMDValues $a_values)
This class represents a block method of a block.
const IL_SCREEN_SIDE
getTitle()
Get Title.