ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilExcCriteriaTableGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4
12{
13 protected $cat_id; // [int]
14
15 public function __construct($a_parent_obj, $a_parent_cmd, $a_cat_id)
16 {
17 global $DIC;
18
19 $this->ctrl = $DIC->ctrl();
20 $this->lng = $DIC->language();
21 $ilCtrl = $DIC->ctrl();
22 $lng = $DIC->language();
23
24 $this->cat_id = $a_cat_id;
25 $this->setId("exccrit" . $this->cat_id);
26
27 parent::__construct($a_parent_obj, $a_parent_cmd);
28
29 $this->setLimit(9999); // because of manual order
30
31 $this->setTitle($lng->txt("exc_criterias"));
32
33 $this->addColumn("", "", "1", true);
34 $this->addColumn($this->lng->txt("position"), "pos", "10%");
35 $this->addColumn($this->lng->txt("title"), "title");
36 $this->addColumn($this->lng->txt("type"), "type");
37 $this->addColumn($this->lng->txt("actions"));
38
39 $this->setDefaultOrderField("pos");
40 $this->setDefaultOrderDirection("asc");
41
42 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
43 $this->setRowTemplate("tpl.exc_crit_row.html", "Modules/Exercise");
44 $this->setSelectAllCheckbox("id");
45
46 $this->addMultiCommand("confirmDeletion", $lng->txt("delete"));
47
48 if ($this->getItems()) {
49 $this->addCommandButton("saveOrder", $lng->txt("exc_save_order"));
50 }
51 }
52
53 protected function getItems()
54 {
55 $data = array();
56
57 $pos = 0;
58 foreach (ilExcCriteria::getInstancesByParentId($this->cat_id) as $item) {
59 $pos += 10;
60
61 $data[] = array(
62 "id" => $item->getId()
63 ,"type" => $item->getTranslatedType()
64 ,"pos" => $pos
65 ,"title" => $item->getTitle()
66 );
67 }
68
69 $this->setData($data);
70
71 return (bool) sizeof($data);
72 }
73
74 public function numericOrdering($a_field)
75 {
76 return in_array($a_field, array("pos"));
77 }
78
79 protected function fillRow($a_set)
80 {
83
84 $this->tpl->setVariable("ID", $a_set["id"]);
85 $this->tpl->setVariable("POS", $a_set["pos"]);
86 $this->tpl->setVariable("TYPE", $a_set["type"]);
87 $this->tpl->setVariable("TITLE", $a_set["title"]);
88
89 $ilCtrl->setParameter($this->getParentObject(), "crit_id", $a_set["id"]);
90 $url = $ilCtrl->getLinkTarget($this->getParentObject(), "edit");
91 $ilCtrl->setParameter($this->getParentObject(), "crit_id", "");
92
93 $this->tpl->setCurrentBlock("action_bl");
94 $this->tpl->setVariable("ACTION_URL", $url);
95 $this->tpl->setVariable("ACTION_TXT", $lng->txt("edit"));
96 $this->tpl->parseCurrentBlock();
97 }
98}
An exception for terminatinating execution or to throw for unit testing.
Class ilExcCriteriaTableGUI.
__construct($a_parent_obj, $a_parent_cmd, $a_cat_id)
ilTable2GUI constructor.
fillRow($a_set)
Standard Version of Fill Row.
numericOrdering($a_field)
Should this field be sorted numeric?
static getInstancesByParentId($a_parent_id)
Class ilTable2GUI.
getParentObject()
Get parent object.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
setData($a_data)
set table data @access public
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.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
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.
global $ilCtrl
Definition: ilias.php:18
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$url
$DIC
Definition: xapitoken.php:46