ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilNewItemGroupTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("Services/Table/classes/class.ilTable2GUI.php");
5 include_once("Services/Repository/classes/class.ilObjRepositorySettings.php");
6 
16 {
17  function __construct($a_parent_obj, $a_parent_cmd = "")
18  {
19  global $ilCtrl, $lng;
20 
21  parent::__construct($a_parent_obj, $a_parent_cmd);
22 
23  $this->setId("repnwitgrptbl");
24 
25  $this->setTitle($lng->txt("rep_new_item_groups"));
26 
27  $this->addColumn("", "", 1);
28  $this->addColumn($lng->txt("cmps_add_new_rank"), "");
29  $this->addColumn($lng->txt("title"), "");
30  $this->addColumn($lng->txt("rep_new_item_group_nr_subitems"), "");
31  $this->addColumn($lng->txt("action"), "");
32 
33  $this->addCommandButton("saveNewItemGroupOrder", $lng->txt("cmps_save_options"));
34  $this->addMultiCommand("confirmDeleteNewItemGroup", $lng->txt("delete"));
35 
36 
37  $this->setEnableHeader(true);
38  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
39  $this->setRowTemplate("tpl.table_row_new_item_group.html", "Services/Repository");
40  $this->setLimit(10000);
41 
42  $this->setExternalSorting(true);
43  $this->getGroups();
44  }
45 
49  function getGroups()
50  {
51  global $lng;
52 
53  $data = array();
54 
56 
57  if($subitems[0])
58  {
59  ilUtil::sendInfo(sprintf($lng->txt("rep_new_item_group_unassigned_subitems"), sizeof($subitems[0])));
60  unset($subitems[0]);
61  }
62 
64  {
65  $data[] = array(
66  "id" => $item["id"],
67  "pos" => $item["pos"],
68  "title" => $item["title"],
69  "type" => $item["type"],
70  "subitems" => sizeof($subitems[$item["id"]])
71  );
72  }
73 
74  $data = ilUtil::sortArray($data, "pos", "asc", true);
75 
76  $this->setData($data);
77  }
78 
79  protected function fillRow($a_set)
80  {
81  global $lng, $ilCtrl;
82 
83  $this->tpl->setVariable("VAR_MULTI", "grp_id[]");
84  $this->tpl->setVariable("VAL_MULTI", $a_set["id"]);
85 
86  $this->tpl->setVariable("VAR_POS", "grp_order[".$a_set["id"]."]");
87  $this->tpl->setVariable("VAL_POS", $a_set["pos"]);
88  $this->tpl->setVariable("TXT_TITLE", $a_set["title"]);
89 
91  {
92  $this->tpl->setVariable("VAL_ITEMS", $a_set["subitems"]);
93 
94  $ilCtrl->setParameter($this->parent_obj, "grp_id", $a_set["id"]);
95  $url = $ilCtrl->getLinkTarget($this->parent_obj, "editNewItemGroup");
96  $ilCtrl->setParameter($this->parent_obj, "grp_id", "");
97 
98  $this->tpl->setVariable("URL_EDIT", $url);
99  $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit"));
100  }
101  }
102 }
103 
104 ?>