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