ILIAS  eassessment Revision 61809
 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  if (ilObject::_lookupType($_GET["ref_id"], true) != "recf")
44  {
45  if ($_SESSION["clipboard"])
46  {
47  $this->addCommandButton("paste", $lng->txt("paste"));
48  $this->addCommandButton("clear", $lng->txt("clear"));
49  }
50  else
51  {
52  $this->addMultiCommand("cut", $lng->txt("cut"));
53  $this->addMultiCommand("delete", $lng->txt("delete"));
54  $this->addMultiCommand("link", $lng->txt("link"));
55  }
56  }
57  else
58  {
59  if ($_SESSION["clipboard"])
60  {
61  $this->addCommandButton("clear", $lng->txt("clear"));
62  }
63  else
64  {
65  $this->addMultiCommand("cut", $lng->txt("cut"));
66  $this->addMultiCommand("removeFromSystem", $lng->txt("btn_remove_system"));
67  }
68  }
69  $this->getItems();
70  }
71 
75  function getItems()
76  {
77  global $rbacsystem, $objDefinition, $tree;
78 
79  $items = array();
80  $childs = $tree->getChilds($this->ref_id);
81  foreach ($childs as $key => $val)
82  {
83  // visible
84  if (!$rbacsystem->checkAccess("visible",$val["ref_id"]))
85  {
86  continue;
87  }
88 
89  // hide object types in devmode
90  if ($objDefinition->getDevMode($val["type"]))
91  {
92  continue;
93  }
94 
95  // don't show administration in root node list
96  if ($val["type"] == "adm")
97  {
98  continue;
99  }
100  if (!$this->parent_obj->isVisible($val["ref_id"], $val["type"]))
101  {
102  continue;
103  }
104  $items[] = $val;
105  }
106  $this->setData($items);
107  }
108 
109 
113  protected function fillRow($a_set)
114  {
115  global $lng, $objDefinition, $ilCtrl;
116 
117 // $this->tpl->setVariable("", );
118 
119  // surpress checkbox for particular object types AND the system role
120  if (!$objDefinition->hasCheckbox($a_set["type"]) ||
121  $a_set["obj_id"] == SYSTEM_ROLE_ID ||
122  $a_set["obj_id"] == SYSTEM_USER_ID ||
123  $a_set["obj_id"] == ANONYMOUS_ROLE_ID)
124  {
125  $this->tpl->touchBlock("no_checkbox");
126  }
127  else
128  {
129  $this->tpl->setCurrentBlock("checkbox");
130  $this->tpl->setVariable("ID", $a_set["ref_id"]);
131  $this->tpl->parseCurrentBlock();
132  }
133 
134  //build link
135  $class_name = $objDefinition->getClassName($a_set["type"]);
136  $class = strtolower("ilObj".$class_name."GUI");
137  $ilCtrl->setParameterByClass($class, "ref_id", $a_set["ref_id"]);
138  $this->tpl->setVariable("HREF_TITLE", $ilCtrl->getLinkTargetByClass($class, "view"));
139  $ilCtrl->setParameterByClass($class, "ref_id", $_GET["ref_id"]);
140 
141  // TODO: broken! fix me
142  $title = $a_set["title"];
143  if (is_array($_SESSION["clipboard"]["ref_ids"]))
144  {
145  if (in_array($a_set["ref_id"], $_SESSION["clipboard"]["ref_ids"]))
146  {
147  switch($_SESSION["clipboard"]["cmd"])
148  {
149  case "cut":
150  $title = "<del>".$title."</del>";
151  break;
152 
153  case "copy":
154  $title = "<font color=\"green\">+</font> ".$title;
155  break;
156 
157  case "link":
158  $title = "<font color=\"black\"><</font> ".$title;
159  break;
160  }
161  }
162  }
163  $this->tpl->setVariable("VAL_TITLE", $title);
164  $this->tpl->setVariable("VAL_DESC", ilUtil::shortenText($a_set["desc"] ,MAXLENGTH_OBJ_DESC, true));
165  $this->tpl->setVariable("VAL_LAST_CHANGE", $a_set["last_update"]);
166  $alt = ($objDefinition->isPlugin($a_set["type"]))
167  ? $lng->txt("icon")." ".ilPlugin::lookupTxt("rep_robj", $a_set["type"], "obj_".$a_set["type"])
168  : $lng->txt("icon")." ".$lng->txt("obj_".$a_set["type"]);
169  $this->tpl->setVariable("IMG_TYPE", ilUtil::img(ilObject::_getIcon($a_set["obj_id"], "small"), $alt));
170  //$this->tpl->setVariable("IMG_TYPE", ilObject::_getIcon($a_set["obj_id"], "small", $this->getIconImageType()),
171  // $lng->txt("icon")." ".$lng->txt("obj_".$a_set["type"])));
172  }
173 
174 }
175 ?>