ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilAdvancedMDFieldDefinitionGroupTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once('Services/Table/classes/class.ilTable2GUI.php');
5 
15 {
16  protected $def; // [ilAdvancedMDFieldDefinition]
17 
18  public function __construct($a_parent_obj, $a_parent_cmd = "", ilAdvancedMDFieldDefinition $a_def)
19  {
20  global $lng,$ilCtrl;
21 
22  $this->def = $a_def;
23 
24  parent::__construct($a_parent_obj, $a_parent_cmd);
25 
26  $this->addColumn($lng->txt("option"), "option");
27 
28  foreach ($this->def->getTitles() as $element => $title) {
29  $this->addColumn($title, $element);
30  }
31 
32  $this->addColumn($lng->txt("action"), "");
33 
34  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
35  $this->setRowTemplate("tpl.edit_complex_row.html", "Services/AdvancedMetaData");
36  $this->setDefaultOrderField("option");
37 
38  $this->initItems($a_def);
39  }
40 
41  protected function initItems(ilAdvancedMDFieldDefinition $a_def)
42  {
43  $data = array();
44 
45  foreach ($a_def->getOptions() as $option) {
46  $item = array("option" => $option);
47 
48  $a_def->exportOptionToTableGUI($option, $item);
49 
50  $data[] = $item;
51  }
52 
53  $this->setData($data);
54  }
55 
56  public function fillRow($a_set)
57  {
58  global $lng, $ilCtrl;
59 
60  $this->tpl->setVariable("OPTION", $a_set["option"]);
61 
62  $this->tpl->setCurrentBlock("field_bl");
63  foreach (array_keys($this->def->getTitles()) as $element) {
64  $this->tpl->setVariable("FIELD", trim($a_set[$element]));
65  $this->tpl->parseCurrentBlock();
66  }
67 
68  // action
69  $ilCtrl->setParameter($this->getParentObject(), "oid", md5($a_set["option"]));
70  $url = $ilCtrl->getLinkTarget($this->getParentObject(), "editComplexOption");
71  $ilCtrl->setParameter($this->getParentObject(), "oid", "");
72 
73  $this->tpl->setVariable("ACTION_URL", $url);
74  $this->tpl->setVariable("ACTION_TXT", $lng->txt("edit"));
75  }
76 }
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
getParentObject()
Get parent object.
global $ilCtrl
Definition: ilias.php:18
__construct($a_parent_obj, $a_parent_cmd="", ilAdvancedMDFieldDefinition $a_def)
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
__construct(Container $dic, ilPlugin $plugin)
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
$url