ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
4include_once("./Services/Table/classes/class.ilTable2GUI.php");
5require_once('./Services/Repository/classes/class.ilObjectPlugin.php');
6
16{
20 protected $ctrl;
21
25 protected $access;
26
30 protected $rbacsystem;
31
35 protected $obj_definition;
36
40 protected $tree;
41
45 protected $editable = false;
46
47
51 public function __construct(
52 $a_parent_obj,
53 $a_parent_cmd,
54 $a_ref_id,
55 $editable = false
56 ) {
57 global $DIC;
58
59 $this->editable = $editable;
60 $this->ctrl = $DIC->ctrl();
61 $this->lng = $DIC->language();
62 $this->access = $DIC->access();
63 $this->rbacsystem = $DIC->rbac()->system();
64 $this->obj_definition = $DIC["objDefinition"];
65 $this->tree = $DIC->repositoryTree();
66 $ilCtrl = $DIC->ctrl();
67 $lng = $DIC->language();
68 $ilAccess = $DIC->access();
69 $lng = $DIC->language();
70
71 $this->ref_id = $a_ref_id;
72
73 $this->setId('recf_' . $a_ref_id);
74 parent::__construct($a_parent_obj, $a_parent_cmd);
75 // $this->setTitle($lng->txt("items"));
76 $this->setSelectAllCheckbox("id[]");
77
78 $this->addColumn("", "", "1", 1);
79 $this->addColumn($this->lng->txt("type"), "", "1");
80 $this->addColumn($this->lng->txt("title"), "title");
81 $this->addColumn($this->lng->txt("last_change"), "last_update", "25%");
82
83 $this->setEnableHeader(true);
84 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
85 $this->setRowTemplate("tpl.admin_sub_items_row.html", "Services/Repository");
86 //$this->disable("footer");
87 $this->setEnableTitle(true);
88 $this->setDefaultOrderField("title");
89 $this->setDefaultOrderDirection("asc");
90
91 // TODO: Needs other solution
92 if (ilObject::_lookupType((int) $_GET['ref_id'], true) == 'chac') {
93 $this->getItems();
94 return true;
95 }
96
97
98 if (ilObject::_lookupType($_GET["ref_id"], true) != "recf") {
99 if ($_SESSION["clipboard"]) {
100 if ($this->isEditable()) {
101 $this->addCommandButton("paste", $lng->txt("paste"));
102 $this->addCommandButton("clear", $lng->txt("clear"));
103 }
104 } else {
105 if ($this->isEditable()) {
106 $this->addMultiCommand("cut", $lng->txt("cut"));
107 $this->addMultiCommand("delete", $lng->txt("delete"));
108 $this->addMultiCommand("link", $lng->txt("link"));
109 }
110 }
111 } else {
112 if ($_SESSION["clipboard"]) {
113 if ($this->isEditable()) {
114 $this->addCommandButton("clear", $lng->txt("clear"));
115 }
116 } else {
117 if ($this->isEditable()) {
118 $this->addMultiCommand("cut", $lng->txt("cut"));
119 $this->addMultiCommand("removeFromSystem", $lng->txt("btn_remove_system"));
120 }
121 }
122 }
123 $this->getItems();
124 }
125
130 public function isEditable()
131 {
132 return $this->editable;
133 }
134
138 public function getItems()
139 {
141 $objDefinition = $this->obj_definition;
143
144 $items = array();
145 $childs = $tree->getChilds($this->ref_id);
146 foreach ($childs as $key => $val) {
147 // visible
148 if (!$rbacsystem->checkAccess("visible", $val["ref_id"])) {
149 continue;
150 }
151
152 // hide object types in devmode
153 if ($objDefinition->getDevMode($val["type"])) {
154 continue;
155 }
156
157 // don't show administration in root node list
158 if ($val["type"] == "adm") {
159 continue;
160 }
161 if (!$this->parent_obj->isVisible($val["ref_id"], $val["type"])) {
162 continue;
163 }
164 $items[] = $val;
165 }
166 $this->setData($items);
167 }
168
169
173 protected function fillRow($a_set)
174 {
176 $objDefinition = $this->obj_definition;
178
179 // $this->tpl->setVariable("", );
180
181 // surpress checkbox for particular object types AND the system role
182 if (!$objDefinition->hasCheckbox($a_set["type"]) ||
183 $a_set["obj_id"] == SYSTEM_ROLE_ID ||
184 $a_set["obj_id"] == SYSTEM_USER_ID ||
185 $a_set["obj_id"] == ANONYMOUS_ROLE_ID) {
186 $this->tpl->touchBlock("no_checkbox");
187 } else {
188 $this->tpl->setCurrentBlock("checkbox");
189 $this->tpl->setVariable("ID", $a_set["ref_id"]);
190 $this->tpl->parseCurrentBlock();
191 }
192
193 //build link
194 $class_name = $objDefinition->getClassName($a_set["type"]);
195 $class = strtolower("ilObj" . $class_name . "GUI");
196 $ilCtrl->setParameterByClass($class, "ref_id", $a_set["ref_id"]);
197 $this->tpl->setVariable("HREF_TITLE", $ilCtrl->getLinkTargetByClass($class, "view"));
198 $ilCtrl->setParameterByClass($class, "ref_id", $_GET["ref_id"]);
199
200 // TODO: broken! fix me
201 $title = $a_set["title"];
202 if (is_array($_SESSION["clipboard"]["ref_ids"])) {
203 if (in_array($a_set["ref_id"], $_SESSION["clipboard"]["ref_ids"])) {
204 switch ($_SESSION["clipboard"]["cmd"]) {
205 case "cut":
206 $title = "<del>" . $title . "</del>";
207 break;
208
209 case "copy":
210 $title = "<font color=\"green\">+</font> " . $title;
211 break;
212
213 case "link":
214 $title = "<font color=\"black\"><</font> " . $title;
215 break;
216 }
217 }
218 }
219 $this->tpl->setVariable("VAL_TITLE", $title);
220 $this->tpl->setVariable("VAL_DESC", ilUtil::shortenText($a_set["desc"], ilObject::DESC_LENGTH, true));
221 $this->tpl->setVariable("VAL_LAST_CHANGE", ilDatePresentation::formatDate(new ilDateTime($a_set["last_update"], IL_CAL_DATETIME)));
222 $alt = ($objDefinition->isPlugin($a_set["type"]))
223 ? $lng->txt("icon") . " " . ilObjectPlugin::lookupTxtById($a_set["type"], "obj_" . $a_set["type"])
224 : $lng->txt("icon") . " " . $lng->txt("obj_" . $a_set["type"]);
225 $this->tpl->setVariable("IMG_TYPE", ilUtil::img(ilObject::_getIcon($a_set["obj_id"], "small"), $alt));
226 //$this->tpl->setVariable("IMG_TYPE", ilObject::_getIcon($a_set["obj_id"], "small", $this->getIconImageType()),
227 // $lng->txt("icon")." ".$lng->txt("obj_".$a_set["type"])));
228 }
229}
$_GET["client_id"]
$_SESSION["AccountId"]
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_DATETIME
TableGUI class for sub items listed in repository administration.
isEditable()
Check if table is editable (write permission granted)
__construct( $a_parent_obj, $a_parent_cmd, $a_ref_id, $editable=false)
Constructor.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date @access public.
@classDescription Date and time handling
static lookupTxtById($plugin_id, $lang_var)
static _getIcon( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
const DESC_LENGTH
static _lookupType($a_id, $a_reference=false)
lookup object type
Class ilTable2GUI.
setEnableHeader($a_enableheader)
Set Enable Header.
setData($a_data)
set table data @access public
setEnableTitle($a_enabletitle)
Set Enable Title.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
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.
setId($a_val)
Set id.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
static shortenText( $a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
$key
Definition: croninfo.php:18
global $ilCtrl
Definition: ilias.php:18
global $DIC
Definition: saml.php:7