ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilAdvancedMDFieldDefinitionGroupTableGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
27{
29
30 public function __construct($a_parent_obj, $a_parent_cmd, ilAdvancedMDFieldDefinition $a_def)
31 {
32 $this->def = $a_def;
33
34 parent::__construct($a_parent_obj, $a_parent_cmd);
35
36 $this->addColumn($this->lng->txt("option"), "option");
37
38 foreach ($this->def->getTitles() as $element => $title) {
39 $this->addColumn($title, $element);
40 }
41
42 $this->addColumn($this->lng->txt("action"), "");
43
44 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
45 $this->setRowTemplate("tpl.edit_complex_row.html", "components/ILIAS/AdvancedMetaData");
46 $this->setDefaultOrderField("option");
47 $this->initItems($a_def);
48 }
49
50 protected function initItems(ilAdvancedMDFieldDefinition $a_def): void
51 {
52 $data = array();
53
54 foreach ($a_def->getOptions() as $option) {
55 $item = array("option" => $option);
56
57 $a_def->exportOptionToTableGUI($option, $item);
58
59 $data[] = $item;
60 }
61
62 $this->setData($data);
63 }
64
65 protected function fillRow(array $a_set): void
66 {
67 $this->tpl->setVariable("OPTION", $a_set["option"]);
68
69 $this->tpl->setCurrentBlock("field_bl");
70 foreach (array_keys($this->def->getTitles()) as $element) {
71 $this->tpl->setVariable("FIELD", trim($a_set[$element]));
72 $this->tpl->parseCurrentBlock();
73 }
74
75 // action
76 $this->ctrl->setParameter($this->getParentObject(), "oid", md5($a_set["option"]));
77 $url = $this->ctrl->getLinkTarget($this->getParentObject(), "editComplexOption");
78 $this->ctrl->setParameter($this->getParentObject(), "oid", "");
79
80 $this->tpl->setVariable("ACTION_URL", $url);
81 $this->tpl->setVariable("ACTION_TXT", $this->lng->txt("edit"));
82 }
83}
__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
Definition: shib_logout.php:68