ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
5 include_once "Services/Table/classes/class.ilTable2GUI.php";
6 
14 {
15  protected $cat_id; // [int]
16 
17  public function __construct($a_parent_obj, $a_parent_cmd, $a_cat_id)
18  {
19  global $ilCtrl, $lng;
20 
21  $this->cat_id = $a_cat_id;
22  $this->setId("exccrit".$this->cat_id);
23 
24  parent::__construct($a_parent_obj, $a_parent_cmd);
25 
26  $this->setLimit(9999); // because of manual order
27 
28  $this->setTitle($lng->txt("exc_criterias"));
29 
30  $this->addColumn("", "", "1", true);
31  $this->addColumn($this->lng->txt("position"), "pos", "10%");
32  $this->addColumn($this->lng->txt("title"), "title");
33  $this->addColumn($this->lng->txt("type"), "type");
34  $this->addColumn($this->lng->txt("actions"));
35 
36  $this->setDefaultOrderField("pos");
37  $this->setDefaultOrderDirection("asc");
38 
39  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
40  $this->setRowTemplate("tpl.exc_crit_row.html", "Modules/Exercise");
41  $this->setSelectAllCheckbox("id");
42 
43  $this->addMultiCommand("confirmDeletion", $lng->txt("delete"));
44 
45  if($this->getItems())
46  {
47  $this->addCommandButton("saveOrder", $lng->txt("exc_save_order"));
48  }
49  }
50 
51  protected function getItems()
52  {
53  $data = array();
54 
55  $pos = 0;
56  foreach(ilExcCriteria::getInstancesByParentId($this->cat_id) as $item)
57  {
58  $pos += 10;
59 
60  $data[] = array(
61  "id" => $item->getId()
62  ,"type" => $item->getTranslatedType()
63  ,"pos" => $pos
64  ,"title" => $item->getTitle()
65  );
66  }
67 
68  $this->setData($data);
69 
70  return (bool)sizeof($data);
71  }
72 
73  public function numericOrdering($a_field)
74  {
75  return in_array($a_field, array("pos"));
76  }
77 
78  protected function fillRow($a_set)
79  {
80  global $lng, $ilCtrl;
81 
82  $this->tpl->setVariable("ID", $a_set["id"]);
83  $this->tpl->setVariable("POS", $a_set["pos"]);
84  $this->tpl->setVariable("TYPE", $a_set["type"]);
85  $this->tpl->setVariable("TITLE", $a_set["title"]);
86 
87  $ilCtrl->setParameter($this->getParentObject(), "crit_id", $a_set["id"]);
88  $url = $ilCtrl->getLinkTarget($this->getParentObject(), "edit");
89  $ilCtrl->setParameter($this->getParentObject(), "crit_id", "");
90 
91  $this->tpl->setCurrentBlock("action_bl");
92  $this->tpl->setVariable("ACTION_URL", $url);
93  $this->tpl->setVariable("ACTION_TXT", $lng->txt("edit"));
94  $this->tpl->parseCurrentBlock();
95  }
96 }
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
__construct($a_parent_obj, $a_parent_cmd, $a_cat_id)
$url
Definition: shib_logout.php:72
getParentObject()
Get parent object.
setId($a_val)
Set id.
global $ilCtrl
Definition: ilias.php:18
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
static getInstancesByParentId($a_parent_id)
addMultiCommand($a_cmd, $a_text)
Add Command button.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
global $lng
Definition: privfeed.php:17
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
Class ilExcCriteriaTableGUI.
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.
setLimit($a_limit=0, $a_default_limit=0)