ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
class.ilUnitCategoryTableGUI.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 require_once 'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
5 require_once 'Services/Table/classes/class.ilTable2GUI.php';
6 
11 abstract class ilUnitCategoryTableGUI extends ilTable2GUI
12 {
16  protected $parent_obj;
17 
22  public function __construct(ilUnitConfigurationGUI $controller, $cmd)
23  {
27  global $ilCtrl;
28 
29  $this->setId('ucats_' . $controller->getUniqueId());
30 
31  parent::__construct($controller, $cmd);
32 
33  $this->addColumn('', '', '1%', true);
34  $this->addColumn($this->lng->txt('title'), 'category', '99%');
35  $this->addColumn('', '', '1%', true);
36 
37  $this->setDefaultOrderDirection('category');
38  $this->setDefaultOrderDirection('ASC');
39 
40  if($this->getParentObject()->isCRUDContext())
41  {
42  $this->addMultiCommand('confirmDeleteCategories', $this->lng->txt('delete'));
43  }
44  else
45  {
46  $this->addMultiCommand('confirmImportGlobalCategories', $this->lng->txt('import'));
47  }
48 
49  $this->populateTitle();
50 
51  $this->setFormAction($ilCtrl->getFormAction($this->getParentObject(), $cmd));
52  $this->setSelectAllCheckbox('category_ids[]');
53  $this->setRowTemplate('tpl.unit_category_row.html', 'Modules/TestQuestionPool');
54  }
55 
59  protected abstract function populateTitle();
60 
64  public function fillRow(array $row)
65  {
69  global $ilCtrl;
70 
71  $row['chb'] = ilUtil::formCheckbox(false, 'category_ids[]', $row['category_id']);
72 
73  $action = new ilAdvancedSelectionListGUI();
74  $action->setId('asl_content_' . $row['category_id']);
75  $action->setAsynch(false);
76  $action->setListTitle($this->lng->txt('actions'));
77  $ilCtrl->setParameter($this->getParentObject(), 'category_id', $row['category_id']);
78  $action->addItem($this->lng->txt('un_show_units'), '', $ilCtrl->getLinkTarget($this->getParentObject(), 'showUnitsOfCategory'));
79  if($this->getParentObject()->isCRUDContext())
80  {
81  $action->addItem($this->lng->txt('edit'), '', $ilCtrl->getLinkTarget($this->getParentObject(), 'showUnitCategoryModificationForm'));
82  $action->addItem($this->lng->txt('delete'), '', $ilCtrl->getLinkTarget($this->getParentObject(), 'confirmDeleteCategory'));
83  }
84  else
85  {
86  $action->addItem($this->lng->txt('import'), '', $ilCtrl->getLinkTarget($this->getParentObject(), 'confirmImportGlobalCategory'));
87  }
88  $row['title_href'] = $ilCtrl->getLinkTarget($this->getParentObject(), 'showUnitsOfCategory');
89  $ilCtrl->setParameter($this->getParentObject(), 'category_id', '');
90  $row['actions'] = $action->getHtml();
91 
92  parent::fillRow($row);
93  }
94 }
__construct($a_parent_obj, $a_parent_cmd="", $a_template_context="")
Constructor.
$cmd
Definition: sahs_server.php:35
Class ilUnitConfigurationGUI .
getParentObject()
Get parent object.
setId($a_val)
Set id.
global $ilCtrl
Definition: ilias.php:18
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
Class ilTable2GUI.
addColumn($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="")
Add a column to the header.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
User interface class for advanced drop-down selection lists.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
Class ilUnitCategoryTableGUI .
fillRow($a_set)
Standard Version of Fill Row.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
static formCheckbox($checked, $varname, $value, $disabled=false)
??? public