ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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();
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->allow_moving = false;
45  }
46 
50  public function getBlockType() : string
51  {
52  return self::$block_type;
53  }
54 
58  protected function isRepositoryObject() : bool
59  {
60  return false;
61  }
62 
66  public static function getScreenMode()
67  {
68  return IL_SCREEN_SIDE;
69  }
70 
71  public function setValues(ilAdvancedMDValues $a_values)
72  {
73  $this->values = $a_values;
74  }
75 
79  public function executeCommand()
80  {
82 
83  $next_class = $ilCtrl->getNextClass();
84  $cmd = $ilCtrl->getCmd("getHTML");
85 
86  switch ($next_class) {
87  default:
88  return $this->$cmd();
89  }
90  }
91 
95  public function fillDataSection()
96  {
97  $this->setDataSection($this->getLegacyContent());
98  }
99 
100  //
101  // New rendering
102  //
103 
104  protected $new_rendering = true;
105 
106 
110  protected function getLegacyContent() : string
111  {
112  $btpl = new ilTemplate("tpl.advmd_block.html", true, true, "Services/Object");
113 
114  // see ilAdvancedMDRecordGUI::parseInfoPage()
115 
118 
119  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
120  include_once('Services/ADT/classes/class.ilADTFactory.php');
121 
122  // this correctly binds group and definitions
123  $this->values->read();
124 
125  $defs = $this->values->getDefinitions();
126  foreach ($this->values->getADTGroup()->getElements() as $element_id => $element) {
127  $btpl->setCurrentBlock("item");
128  $btpl->setVariable("CAPTION", $defs[$element_id]->getTitle());
129  if ($element->isNull()) {
130  $value = "-";
131  } else {
132  $value = ilADTFactory::getInstance()->getPresentationBridgeForInstance($element);
133 
134  if ($element instanceof ilADTLocation) {
135  $value->setSize("100%", "200px");
136  }
137 
138  if (in_array($element->getType(), array("MultiEnum", "Enum", "Text"))) {
139  $value->setDecoratorCallBack($this->callback);
140  }
141 
142  $value = $value->getHTML();
143  }
144  $btpl->setVariable("VALUE", $value);
145  $btpl->parseCurrentBlock();
146  }
147 
148  $html = $btpl->get();
149 
151 
152  return $html;
153  }
154 }
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.
static getScreenMode()
Get Screen Mode for current command.
__construct(Container $dic, ilPlugin $plugin)
$DIC
Definition: xapitoken.php:46
setValues(ilAdvancedMDValues $a_values)
This class represents a block method of a block.
const IL_SCREEN_SIDE
getTitle()
Get Title.