ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilRatingCategoryTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/Table/classes/class.ilTable2GUI.php");
5 
15 {
22  function __construct($a_parent_obj, $a_parent_cmd, $a_parent_id)
23  {
24  global $ilCtrl, $lng;
25 
26  $this->setId("rtgcat");
27 
28  parent::__construct($a_parent_obj, $a_parent_cmd);
29 
30  $this->addColumn($this->lng->txt("position"));
31  $this->addColumn($this->lng->txt("title"), "title");
32  $this->addColumn($this->lng->txt("description"), "description");
33  $this->addColumn($this->lng->txt("actions"));
34 
35  $this->setEnableHeader(true);
36  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
37  $this->setRowTemplate("tpl.rating_category_row.html", "Services/Rating");
38 
39  $this->addCommandButton("updateorder", $lng->txt("rating_update_positions"));
40 
41  $this->getItems($a_parent_id);
42  }
43 
49  function getItems($a_parent_obj_id)
50  {
51  include_once "Services/Rating/classes/class.ilRatingCategory.php";
52  $data = ilRatingCategory::getAllForObject($a_parent_obj_id);
53 
54  $this->setMaxCount(sizeof($data));
55  $this->setData($data);
56  }
57 
62  protected function fillRow($a_set)
63  {
64  global $lng, $ilCtrl;
65 
66  $this->tpl->setVariable("VAL_ID", $a_set["id"]);
67  $this->tpl->setVariable("VAL_POS", $a_set["pos"]);
68  $this->tpl->setVariable("TXT_TITLE", $a_set["title"]);
69  $this->tpl->setVariable("TXT_DESCRIPTION", nl2br($a_set["description"]));
70 
71  $ilCtrl->setParameter($this->parent_obj, "cat_id", $a_set["id"]);
72 
73  $items = array();
74  $items["edit"] = array($lng->txt("edit"), $ilCtrl->getLinkTarget($this->parent_obj, "edit"));
75  $items["delete"] = array($lng->txt("delete"), $ilCtrl->getLinkTarget($this->parent_obj, "confirmDelete"));
76 
77  $this->tpl->setCurrentBlock("actions");
78  foreach($items as $item)
79  {
80  $this->tpl->setVariable("ACTION_CAPTION", $item[0]);
81  $this->tpl->setVariable("ACTION_LINK", $item[1]);
82  $this->tpl->parseCurrentBlock();
83  }
84  }
85 }
86 
87 ?>