ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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  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 
51  public function getBlockType() : string
52  {
53  return self::$block_type;
54  }
55 
59  protected function isRepositoryObject() : bool
60  {
61  return false;
62  }
63 
67  public 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  public function executeCommand()
81  {
83 
84  $next_class = $ilCtrl->getNextClass();
85  $cmd = $ilCtrl->getCmd("getHTML");
86 
87  switch ($next_class) {
88  default:
89  return $this->$cmd();
90  }
91  }
92 
96  public function fillDataSection()
97  {
98  $lng = $this->lng;
99 
100  $btpl = new ilTemplate("tpl.advmd_block.html", true, true, "Services/Object");
101 
102  // see ilAdvancedMDRecordGUI::parseInfoPage()
103 
106 
107  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
108  include_once('Services/ADT/classes/class.ilADTFactory.php');
109 
110  // this correctly binds group and definitions
111  $this->values->read();
112 
113  $defs = $this->values->getDefinitions();
114  foreach ($this->values->getADTGroup()->getElements() as $element_id => $element) {
115  $btpl->setCurrentBlock("item");
116  $btpl->setVariable("CAPTION", $defs[$element_id]->getTitle());
117  if ($element->isNull()) {
118  $value = "-";
119  } else {
120  $value = ilADTFactory::getInstance()->getPresentationBridgeForInstance($element);
121 
122  if ($element instanceof ilADTLocation) {
123  $value->setSize("100%", "200px");
124  }
125 
126  if (in_array($element->getType(), array("MultiEnum", "Enum", "Text"))) {
127  $value->setDecoratorCallBack($this->callback);
128  }
129 
130  $value = $value->getHTML();
131  }
132  $btpl->setVariable("VALUE", $value);
133  $btpl->parseCurrentBlock();
134  }
135 
136  $this->setDataSection($btpl->get());
137 
139 
140  return;
141  }
142 }
global $DIC
Definition: saml.php:7
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.
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
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.
setValues(ilAdvancedMDValues $a_values)
This class represents a block method of a block.
const IL_SCREEN_SIDE
getTitle()
Get Title.