ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilUnitTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once 'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
5require_once 'Services/Form/classes/class.ilNumberInputGUI.php';
6require_once 'Services/Table/classes/class.ilTable2GUI.php';
7
12{
16 private $position = 1;
17
23 public function __construct(ilUnitConfigurationGUI $controller, $default_cmd, assFormulaQuestionUnitCategory $category)
24 {
29 global $ilCtrl, $lng;
30
31 $this->setId('units_' . $controller->getUniqueId());
32
33 parent::__construct($controller, $default_cmd);
34
35 if ($this->getParentObject()->isCRUDContext()) {
36 $this->addColumn('', '', '1%', true);
37 $this->setSelectAllCheckbox('unit_ids[]');
38 $this->addMultiCommand('confirmDeleteUnits', $this->lng->txt('delete'));
39 $this->addCommandButton('saveOrder', $this->lng->txt('un_save_order'));
40 }
41
42 $this->setTitle(sprintf($this->lng->txt('un_units_of_category_x'), $category->getDisplayString()));
43
44 $this->addColumn($this->lng->txt('un_sequence'), '');
45 $this->addColumn($this->lng->txt('unit'), '');
46 $this->addColumn($this->lng->txt('baseunit'), '');
47 $this->addColumn($this->lng->txt('factor'), '');
48 $this->addColumn('', '', '1%', true);
49
50 // Show all units because of sorting
51 $this->setLimit(PHP_INT_MAX);
52
53 $this->setFormAction($ilCtrl->getFormAction($this->getParentObject(), 'showUnitsOfCategory'));
54
55 $this->setDefaultOrderDirection('sequence');
56 $this->setDefaultOrderDirection('ASC');
57
58 $this->setRowTemplate('tpl.unit_row_html', 'Modules/TestQuestionPool');
59 }
60
64 public function fillRow($row)
65 {
69 global $ilCtrl;
70
71 if ($this->getParentObject()->isCRUDContext()) {
72 $row['chb'] = ilUtil::formCheckbox(false, 'unit_ids[]', $row['unit_id']);
73
74 $sequence = new ilNumberInputGUI('', 'sequence[' . $row['unit_id'] . ']');
75 $sequence->setValue($this->position++ * 10);
76 $sequence->setMinValue(0);
77 $sequence->setSize(3);
78 $row['sequence'] = $sequence->render();
79
81 $action->setId('asl_content_' . $row['unit_id']);
82 $action->setAsynch(false);
83 $action->setListTitle($this->lng->txt('actions'));
84 $ilCtrl->setParameter($this->getParentObject(), 'unit_id', $row['unit_id']);
85 $action->addItem($this->lng->txt('edit'), '', $ilCtrl->getLinkTarget($this->getParentObject(), 'showUnitModificationForm'));
86 $action->addItem($this->lng->txt('delete'), '', $ilCtrl->getLinkTarget($this->getParentObject(), 'confirmDeleteUnit'));
87 $ilCtrl->setParameter($this->getParentObject(), 'unit_id', '');
88 $row['actions'] = $action->getHtml();
89 }
90 if ($row['unit_id'] == $row['baseunit_id']) {
91 $row['baseunit'] = '';
92 }
93 parent::fillRow($row);
94 }
95}
sprintf('%.4f', $callTime)
An exception for terminatinating execution or to throw for unit testing.
User interface class for advanced drop-down selection lists.
This class represents a number property in a property form.
Class ilTable2GUI.
getParentObject()
Get parent object.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
fillRow($a_set)
Standard Version of Fill Row.
__construct($a_parent_obj, $a_parent_cmd="", $a_template_context="")
ilTable2GUI constructor.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setLimit($a_limit=0, $a_default_limit=0)
set max.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
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.
setId($a_val)
Set id.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
Class ilUnitConfigurationGUI @abstract.
Class ilUnitTableGUI.
static formCheckbox($checked, $varname, $value, $disabled=false)
??? @access public
$action
global $ilCtrl
Definition: ilias.php:18