ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilUnitTableGUI.php
Go to the documentation of this file.
1 <?php
2 
23 {
27  private $position = 1;
28 
34  public function __construct(ilUnitConfigurationGUI $controller, $default_cmd, assFormulaQuestionUnitCategory $category)
35  {
40  global $DIC;
41  $ilCtrl = $DIC['ilCtrl'];
42  $lng = $DIC['lng'];
43 
44  $this->setId('units_' . $controller->getUniqueId());
45 
46  parent::__construct($controller, $default_cmd);
47 
48  $ilCtrl->setParameter($this->getParentObject(), 'category_id', $category->getId());
49 
50  if ($this->getParentObject()->isCRUDContext()) {
51  $this->addColumn('', '', '1%', true);
52  $this->setSelectAllCheckbox('unit_ids[]');
53  $this->addMultiCommand('confirmDeleteUnits', $this->lng->txt('delete'));
54  $this->addCommandButton('saveOrder', $this->lng->txt('un_save_order'));
55  }
56 
57  $this->setTitle(sprintf($this->lng->txt('un_units_of_category_x'), $category->getDisplayString()));
58 
59  $this->addColumn($this->lng->txt('un_sequence'), '');
60  $this->addColumn($this->lng->txt('unit'), '');
61  $this->addColumn($this->lng->txt('baseunit'), '');
62  $this->addColumn($this->lng->txt('factor'), '');
63  $this->addColumn('', '', '1%', true);
64 
65  // Show all units because of sorting
66  $this->setLimit(PHP_INT_MAX);
67 
68  $this->setFormAction($ilCtrl->getFormAction($this->getParentObject(), 'showUnitsOfCategory'));
69 
70  $this->setDefaultOrderDirection('sequence');
71  $this->setDefaultOrderDirection('ASC');
72 
73  $this->setRowTemplate('tpl.unit_row_html', 'Modules/TestQuestionPool');
74  }
75 
79  public function fillRow(array $a_set): void
80  {
84  global $DIC;
85  $ilCtrl = $DIC['ilCtrl'];
86 
87  if ($this->getParentObject()->isCRUDContext()) {
88  $a_set['chb'] = ilLegacyFormElementsUtil::formCheckbox(false, 'unit_ids[]', $a_set['unit_id']);
89 
90  $sequence = new ilNumberInputGUI('', 'sequence[' . $a_set['unit_id'] . ']');
91  $sequence->setValue($this->position++ * 10);
92  $sequence->setMinValue(0);
93  $sequence->setSize(3);
94  $a_set['sequence'] = $sequence->render();
95 
96  $action = new ilAdvancedSelectionListGUI();
97  $action->setId('asl_content_' . $a_set['unit_id']);
98  $action->setAsynch(false);
99  $action->setListTitle($this->lng->txt('actions'));
100  $ilCtrl->setParameter($this->getParentObject(), 'unit_id', $a_set['unit_id']);
101  $action->addItem($this->lng->txt('edit'), '', $ilCtrl->getLinkTarget($this->getParentObject(), 'showUnitModificationForm'));
102  $action->addItem($this->lng->txt('delete'), '', $ilCtrl->getLinkTarget($this->getParentObject(), 'confirmDeleteUnit'));
103  $ilCtrl->setParameter($this->getParentObject(), 'unit_id', '');
104  $a_set['actions'] = $action->getHtml();
105  }
106  if ($a_set['unit_id'] == $a_set['baseunit_id']) {
107  $a_set['baseunit'] = '';
108  }
109  parent::fillRow($a_set);
110  }
111 }
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)
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilLanguage $lng
setId(string $a_val)
global $DIC
Definition: feed.php:28
fillRow(array $a_set)
Standard Version of Fill Row.
This class represents a number property in a property form.
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setDefaultOrderDirection(string $a_defaultorderdirection)
static formCheckbox(bool $checked, string $varname, string $value, bool $disabled=false)
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
__construct(Container $dic, ilPlugin $plugin)
setLimit(int $a_limit=0, int $a_default_limit=0)
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)
__construct(?object $a_parent_obj, string $a_parent_cmd="", string $a_template_context="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addMultiCommand(string $a_cmd, string $a_text)