ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilAdminSubItemsTableGUI.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 
15 {
16 
20  function __construct($a_parent_obj, $a_parent_cmd, $a_ref_id)
21  {
22  global $ilCtrl, $lng, $ilAccess, $lng;
23 
24  $this->ref_id = $a_ref_id;
25 
26  parent::__construct($a_parent_obj, $a_parent_cmd);
27 // $this->setTitle($lng->txt("items"));
28  $this->setSelectAllCheckbox("id[]");
29 
30  $this->addColumn("", "", "1", 1);
31  $this->addColumn($this->lng->txt("type"), "", "1");
32  $this->addColumn($this->lng->txt("title"), "title");
33  $this->addColumn($this->lng->txt("last_change"), "last_update", "25%");
34 
35  $this->setEnableHeader(true);
36  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
37  $this->setRowTemplate("tpl.admin_sub_items_row.html", "Services/Repository");
38  //$this->disable("footer");
39  $this->setEnableTitle(true);
40  $this->setDefaultOrderField("title");
41  $this->setDefaultOrderDirection("asc");
42 
43  // TODO: Needs other solution
44  if(ilObject::_lookupType((int) $_GET['ref_id'],true) == 'chac')
45  {
46  $this->getItems();
47  return true;
48  }
49 
50 
51  if (ilObject::_lookupType($_GET["ref_id"], true) != "recf")
52  {
53  if ($_SESSION["clipboard"])
54  {
55  $this->addCommandButton("paste", $lng->txt("paste"));
56  $this->addCommandButton("clear", $lng->txt("clear"));
57  }
58  else
59  {
60  $this->addMultiCommand("cut", $lng->txt("cut"));
61  $this->addMultiCommand("delete", $lng->txt("delete"));
62  $this->addMultiCommand("link", $lng->txt("link"));
63  }
64  }
65  else
66  {
67  if ($_SESSION["clipboard"])
68  {
69  $this->addCommandButton("clear", $lng->txt("clear"));
70  }
71  else
72  {
73  $this->addMultiCommand("cut", $lng->txt("cut"));
74  $this->addMultiCommand("removeFromSystem", $lng->txt("btn_remove_system"));
75  }
76  }
77  $this->getItems();
78  }
79 
83  function getItems()
84  {
85  global $rbacsystem, $objDefinition, $tree;
86 
87  $items = array();
88  $childs = $tree->getChilds($this->ref_id);
89  foreach ($childs as $key => $val)
90  {
91  // visible
92  if (!$rbacsystem->checkAccess("visible",$val["ref_id"]))
93  {
94  continue;
95  }
96 
97  // hide object types in devmode
98  if ($objDefinition->getDevMode($val["type"]))
99  {
100  continue;
101  }
102 
103  // don't show administration in root node list
104  if ($val["type"] == "adm")
105  {
106  continue;
107  }
108  if (!$this->parent_obj->isVisible($val["ref_id"], $val["type"]))
109  {
110  continue;
111  }
112  $items[] = $val;
113  }
114  $this->setData($items);
115  }
116 
117 
121  protected function fillRow($a_set)
122  {
123  global $lng, $objDefinition, $ilCtrl;
124 
125 // $this->tpl->setVariable("", );
126 
127  // surpress checkbox for particular object types AND the system role
128  if (!$objDefinition->hasCheckbox($a_set["type"]) ||
129  $a_set["obj_id"] == SYSTEM_ROLE_ID ||
130  $a_set["obj_id"] == SYSTEM_USER_ID ||
131  $a_set["obj_id"] == ANONYMOUS_ROLE_ID)
132  {
133  $this->tpl->touchBlock("no_checkbox");
134  }
135  else
136  {
137  $this->tpl->setCurrentBlock("checkbox");
138  $this->tpl->setVariable("ID", $a_set["ref_id"]);
139  $this->tpl->parseCurrentBlock();
140  }
141 
142  //build link
143  $class_name = $objDefinition->getClassName($a_set["type"]);
144  $class = strtolower("ilObj".$class_name."GUI");
145  $ilCtrl->setParameterByClass($class, "ref_id", $a_set["ref_id"]);
146  $this->tpl->setVariable("HREF_TITLE", $ilCtrl->getLinkTargetByClass($class, "view"));
147  $ilCtrl->setParameterByClass($class, "ref_id", $_GET["ref_id"]);
148 
149  // TODO: broken! fix me
150  $title = $a_set["title"];
151  if (is_array($_SESSION["clipboard"]["ref_ids"]))
152  {
153  if (in_array($a_set["ref_id"], $_SESSION["clipboard"]["ref_ids"]))
154  {
155  switch($_SESSION["clipboard"]["cmd"])
156  {
157  case "cut":
158  $title = "<del>".$title."</del>";
159  break;
160 
161  case "copy":
162  $title = "<font color=\"green\">+</font> ".$title;
163  break;
164 
165  case "link":
166  $title = "<font color=\"black\"><</font> ".$title;
167  break;
168  }
169  }
170  }
171  $this->tpl->setVariable("VAL_TITLE", $title);
172  $this->tpl->setVariable("VAL_DESC", ilUtil::shortenText($a_set["desc"] ,MAXLENGTH_OBJ_DESC, true));
173  $this->tpl->setVariable("VAL_LAST_CHANGE", $a_set["last_update"]);
174  $alt = ($objDefinition->isPlugin($a_set["type"]))
175  ? $lng->txt("icon")." ".ilPlugin::lookupTxt("rep_robj", $a_set["type"], "obj_".$a_set["type"])
176  : $lng->txt("icon")." ".$lng->txt("obj_".$a_set["type"]);
177  $this->tpl->setVariable("IMG_TYPE", ilUtil::img(ilObject::_getIcon($a_set["obj_id"], "small"), $alt));
178  //$this->tpl->setVariable("IMG_TYPE", ilObject::_getIcon($a_set["obj_id"], "small", $this->getIconImageType()),
179  // $lng->txt("icon")." ".$lng->txt("obj_".$a_set["type"])));
180  }
181 
182 }
183 ?>