ILIAS  release_8 Revision v8.24
class.ilAdvancedMDFieldDefinitionGroupTableGUI.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
5
13{
15
16 public function __construct($a_parent_obj, $a_parent_cmd, ilAdvancedMDFieldDefinition $a_def)
17 {
18 $this->def = $a_def;
19
20 parent::__construct($a_parent_obj, $a_parent_cmd);
21
22 $this->addColumn($this->lng->txt("option"), "option");
23
24 foreach ($this->def->getTitles() as $element => $title) {
25 $this->addColumn($title, $element);
26 }
27
28 $this->addColumn($this->lng->txt("action"), "");
29
30 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
31 $this->setRowTemplate("tpl.edit_complex_row.html", "Services/AdvancedMetaData");
32 $this->setDefaultOrderField("option");
33 $this->initItems($a_def);
34 }
35
36 protected function initItems(ilAdvancedMDFieldDefinition $a_def): void
37 {
38 $data = array();
39
40 foreach ($a_def->getOptions() as $option) {
41 $item = array("option" => $option);
42
43 $a_def->exportOptionToTableGUI($option, $item);
44
45 $data[] = $item;
46 }
47
48 $this->setData($data);
49 }
50
51 protected function fillRow(array $a_set): void
52 {
53 $this->tpl->setVariable("OPTION", $a_set["option"]);
54
55 $this->tpl->setCurrentBlock("field_bl");
56 foreach (array_keys($this->def->getTitles()) as $element) {
57 $this->tpl->setVariable("FIELD", trim($a_set[$element]));
58 $this->tpl->parseCurrentBlock();
59 }
60
61 // action
62 $this->ctrl->setParameter($this->getParentObject(), "oid", md5($a_set["option"]));
63 $url = $this->ctrl->getLinkTarget($this->getParentObject(), "editComplexOption");
64 $this->ctrl->setParameter($this->getParentObject(), "oid", "");
65
66 $this->tpl->setVariable("ACTION_URL", $url);
67 $this->tpl->setVariable("ACTION_TXT", $this->lng->txt("edit"));
68 }
69}
__construct($a_parent_obj, $a_parent_cmd, ilAdvancedMDFieldDefinition $a_def)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setData(array $a_data)
Set table data.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$url