ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 require_once('./Services/Repository/classes/class.ilObjectPlugin.php');
6 
16 {
17 
21  function __construct($a_parent_obj, $a_parent_cmd, $a_ref_id)
22  {
23  global $ilCtrl, $lng, $ilAccess, $lng;
24 
25  $this->ref_id = $a_ref_id;
26 
27  $this->setId('recf_'. $a_ref_id);
28  parent::__construct($a_parent_obj, $a_parent_cmd);
29 // $this->setTitle($lng->txt("items"));
30  $this->setSelectAllCheckbox("id[]");
31 
32  $this->addColumn("", "", "1", 1);
33  $this->addColumn($this->lng->txt("type"), "", "1");
34  $this->addColumn($this->lng->txt("title"), "title");
35  $this->addColumn($this->lng->txt("last_change"), "last_update", "25%");
36 
37  $this->setEnableHeader(true);
38  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
39  $this->setRowTemplate("tpl.admin_sub_items_row.html", "Services/Repository");
40  //$this->disable("footer");
41  $this->setEnableTitle(true);
42  $this->setDefaultOrderField("title");
43  $this->setDefaultOrderDirection("asc");
44 
45  // TODO: Needs other solution
46  if(ilObject::_lookupType((int) $_GET['ref_id'],true) == 'chac')
47  {
48  $this->getItems();
49  return true;
50  }
51 
52 
53  if (ilObject::_lookupType($_GET["ref_id"], true) != "recf")
54  {
55  if ($_SESSION["clipboard"])
56  {
57  $this->addCommandButton("paste", $lng->txt("paste"));
58  $this->addCommandButton("clear", $lng->txt("clear"));
59  }
60  else
61  {
62  $this->addMultiCommand("cut", $lng->txt("cut"));
63  $this->addMultiCommand("delete", $lng->txt("delete"));
64  $this->addMultiCommand("link", $lng->txt("link"));
65  }
66  }
67  else
68  {
69  if ($_SESSION["clipboard"])
70  {
71  $this->addCommandButton("clear", $lng->txt("clear"));
72  }
73  else
74  {
75  $this->addMultiCommand("cut", $lng->txt("cut"));
76  $this->addMultiCommand("removeFromSystem", $lng->txt("btn_remove_system"));
77  }
78  }
79  $this->getItems();
80  }
81 
85  function getItems()
86  {
87  global $rbacsystem, $objDefinition, $tree;
88 
89  $items = array();
90  $childs = $tree->getChilds($this->ref_id);
91  foreach ($childs as $key => $val)
92  {
93  // visible
94  if (!$rbacsystem->checkAccess("visible",$val["ref_id"]))
95  {
96  continue;
97  }
98 
99  // hide object types in devmode
100  if ($objDefinition->getDevMode($val["type"]))
101  {
102  continue;
103  }
104 
105  // don't show administration in root node list
106  if ($val["type"] == "adm")
107  {
108  continue;
109  }
110  if (!$this->parent_obj->isVisible($val["ref_id"], $val["type"]))
111  {
112  continue;
113  }
114  $items[] = $val;
115  }
116  $this->setData($items);
117  }
118 
119 
123  protected function fillRow($a_set)
124  {
125  global $lng, $objDefinition, $ilCtrl;
126 
127 // $this->tpl->setVariable("", );
128 
129  // surpress checkbox for particular object types AND the system role
130  if (!$objDefinition->hasCheckbox($a_set["type"]) ||
131  $a_set["obj_id"] == SYSTEM_ROLE_ID ||
132  $a_set["obj_id"] == SYSTEM_USER_ID ||
133  $a_set["obj_id"] == ANONYMOUS_ROLE_ID)
134  {
135  $this->tpl->touchBlock("no_checkbox");
136  }
137  else
138  {
139  $this->tpl->setCurrentBlock("checkbox");
140  $this->tpl->setVariable("ID", $a_set["ref_id"]);
141  $this->tpl->parseCurrentBlock();
142  }
143 
144  //build link
145  $class_name = $objDefinition->getClassName($a_set["type"]);
146  $class = strtolower("ilObj".$class_name."GUI");
147  $ilCtrl->setParameterByClass($class, "ref_id", $a_set["ref_id"]);
148  $this->tpl->setVariable("HREF_TITLE", $ilCtrl->getLinkTargetByClass($class, "view"));
149  $ilCtrl->setParameterByClass($class, "ref_id", $_GET["ref_id"]);
150 
151  // TODO: broken! fix me
152  $title = $a_set["title"];
153  if (is_array($_SESSION["clipboard"]["ref_ids"]))
154  {
155  if (in_array($a_set["ref_id"], $_SESSION["clipboard"]["ref_ids"]))
156  {
157  switch($_SESSION["clipboard"]["cmd"])
158  {
159  case "cut":
160  $title = "<del>".$title."</del>";
161  break;
162 
163  case "copy":
164  $title = "<font color=\"green\">+</font> ".$title;
165  break;
166 
167  case "link":
168  $title = "<font color=\"black\"><</font> ".$title;
169  break;
170  }
171  }
172  }
173  $this->tpl->setVariable("VAL_TITLE", $title);
174  $this->tpl->setVariable("VAL_DESC", ilUtil::shortenText($a_set["desc"] ,ilObject::DESC_LENGTH, true));
175  $this->tpl->setVariable("VAL_LAST_CHANGE", ilDatePresentation::formatDate(new ilDateTime($a_set["last_update"],IL_CAL_DATETIME)));
176  $alt = ($objDefinition->isPlugin($a_set["type"]))
177  ? $lng->txt("icon")." ".ilObjectPlugin::lookupTxtById($a_set["type"], "obj_".$a_set["type"])
178  : $lng->txt("icon")." ".$lng->txt("obj_".$a_set["type"]);
179  $this->tpl->setVariable("IMG_TYPE", ilUtil::img(ilObject::_getIcon($a_set["obj_id"], "small"), $alt));
180  //$this->tpl->setVariable("IMG_TYPE", ilObject::_getIcon($a_set["obj_id"], "small", $this->getIconImageType()),
181  // $lng->txt("icon")." ".$lng->txt("obj_".$a_set["type"])));
182  }
183 
184 }
185 ?>
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
const IL_CAL_DATETIME
static lookupTxtById($plugin_id, $lang_var)
$_SESSION["AccountId"]
TableGUI class for sub items listed in repository administration.
$_GET["client_id"]
const DESC_LENGTH
static shortenText($a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
setId($a_val)
Set id.
global $ilCtrl
Definition: ilias.php:18
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
Class ilTable2GUI.
addMultiCommand($a_cmd, $a_text)
Add Command button.
static formatDate(ilDateTime $date)
Format a date public.
Date and time handling
__construct($a_parent_obj, $a_parent_cmd, $a_ref_id)
Constructor.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
global $lng
Definition: privfeed.php:17
setEnableHeader($a_enableheader)
Set Enable Header.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
setEnableTitle($a_enabletitle)
Set Enable Title.
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.