ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilWorkspaceContentGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
12{
16 protected $current_node;
17
21 protected $admin;
22
26 protected $access_handler;
27
31 protected $ui;
32
36 protected $lng;
37
41 protected $user;
42
46 protected $obj_definition;
47
51 protected $ctrl;
52
56 protected $folder_sorting;
57
61 public function __construct(
62 $object_gui,
63 int $node_id,
64 bool $admin,
66 \ILIAS\DI\UIServices $ui,
71 ilWorkspaceFolderUserSettings $user_folder_settings
72 ) {
73 $this->current_node = $node_id;
74 $this->admin = $admin;
75 $this->access_handler = $access_handler;
76 $this->object_gui = $object_gui;
77 $this->ui = $ui;
78 $this->lng = $lng;
79 $this->user = $user;
80 $this->obj_definition = $obj_definition;
81 $this->ctrl = $ctrl;
82 $this->user_folder_settings = $user_folder_settings;
83
84 $this->folder_sorting = new ilWorkspaceFolderSorting();
85 }
86
90 public function render()
91 {
92 $html = "";
93 $first = true;
94 foreach ($this->getItems() as $i) {
95 if ($first) {
96 $first = false;
97 } else {
98 $html .= $this->ui->renderer()->render($this->ui->factory()->divider()->horizontal());
99 }
100 $html .= $this->getItemHTML($i);
101 }
102
103 if ($this->admin) {
104 $tpl = new ilTemplate("tpl.admin_container.html", true, true, "Modules/WorkspaceFolder");
105 $tpl->setVariable("ITEMS", $html);
106 $tpl->setVariable("TXT_SELECT_ALL", $this->lng->txt("select_all"));
107 $html = $tpl->get();
108 }
109
110
111 // output sortation
112 $tree = new ilWorkspaceTree($this->user->getId());
113 $parent_id = $tree->getParentId($this->object_gui->ref_id);
114 $parent_effective = ($parent_id > 0)
115 ? $this->user_folder_settings->getEffectiveSortation($parent_id)
116 : 0;
117 $selected = $this->user_folder_settings->getSortation($this->object_gui->object->getId());
118 $sort_options = $this->folder_sorting->getOptionsByType($this->object_gui->object->getType(), $selected, $parent_effective);
119 $sortation = $this->ui->factory()->viewControl()->sortation($sort_options)
120 ->withTargetURL($this->ctrl->getLinkTarget($this->object_gui, "setSortation"), 'sortation')
121 ->withLabel($this->lng->txt("wfld_sortation"));
122
123
124 if ($first) {
125 return "";
126 }
127
128 $leg = $this->ui->factory()->legacy($html);
129
130 $panel = $this->ui->factory()->panel()->standard($this->lng->txt("content"), [$leg]);
131
132 if (method_exists($panel, "withViewControls")) {
133 $panel = $panel->withViewControls(array($sortation));
134 }
135
136
137
138 return $this->ui->renderer()->render($panel);
139 }
140
144 protected function getItems()
145 {
147
148 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
149 $tree = new ilWorkspaceTree($user->getId());
150 $nodes = $tree->getChilds($this->current_node, "title");
151
152 if (sizeof($nodes)) {
153 include_once("./Services/Object/classes/class.ilObjectListGUIPreloader.php");
155 foreach ($nodes as $node) {
156 $preloader->addItem($node["obj_id"], $node["type"]);
157 }
158 $preloader->preload();
159 unset($preloader);
160 }
161
162 $this->shared_objects = $this->access_handler->getObjectsIShare();
163
164 $nodes = $this->folder_sorting->sortNodes($nodes, $this->user_folder_settings->getEffectiveSortation($this->object_gui->ref_id));
165
166 return $nodes;
167 }
168
175 protected function getItemHTML($node)
176 {
177 $objDefinition = $this->obj_definition;
178 $ilCtrl = $this->ctrl;
179 //bug ilCertificateVerificationClassMap in 6 beta was cmiv instead of cmxv
180 if ($node["type"] == "cmiv") {
181 return "";
182 }
183
184 $class = $objDefinition->getClassName($node["type"]);
185 $location = $objDefinition->getLocation($node["type"]);
186 $full_class = "ilObj" . $class . "ListGUI";
187
188 include_once($location . "/class." . $full_class . ".php");
189 $item_list_gui = new $full_class(ilObjectListGUI::CONTEXT_WORKSPACE);
190
191 $item_list_gui->setDetailsLevel(ilObjectListGUI::DETAILS_ALL);
192 $item_list_gui->enableDelete(true);
193 $item_list_gui->enableCut(true);
194 $item_list_gui->enableSubscribe(false);
195 $item_list_gui->enableLink(false);
196 $item_list_gui->enablePath(false);
197 $item_list_gui->enableLinkedPath(false);
198 $item_list_gui->enableSearchFragments(true);
199 $item_list_gui->enableRelevance(false);
200 $item_list_gui->enableIcon(true);
201 $item_list_gui->enableTimings(false);
202 $item_list_gui->enableCheckbox($this->admin);
203 // $item_list_gui->setSeparateCommands(true);
204
205 $item_list_gui->enableNotes(true);
206 $item_list_gui->enableCopy($objDefinition->allowCopy($node["type"]));
207
208 if ($node["type"] == "file") {
209 $item_list_gui->enableRepositoryTransfer(true);
210 }
211
212 $item_list_gui->setContainerObject($this->object_gui);
213
214 if (in_array($node["type"], array("file", "blog"))) {
215 // add "share" link
216 $ilCtrl->setParameterByClass("ilworkspaceaccessgui", "wsp_id", $node["wsp_id"]);
217 $share_link = $ilCtrl->getLinkTargetByClass(array("ilObj" . $class . "GUI", "ilworkspaceaccessgui"), "share");
218 $item_list_gui->addCustomCommand($share_link, "wsp_permissions");
219
220 // show "shared" status
221 if (in_array($node["obj_id"], $this->shared_objects)) {
222 $item_list_gui->addCustomProperty($this->lng->txt("status"), $this->lng->txt("wsp_status_shared"), true, true);
223 }
224 }
225
226 $html = $item_list_gui->getListItemHTML(
227 $node["wsp_id"],
228 $node["obj_id"],
229 $node["title"],
230 $node["description"]
231 );
232
233 return $html;
234 }
235}
user()
Definition: user.php:4
$location
Definition: buildRTE.php:44
An exception for terminatinating execution or to throw for unit testing.
This class provides processing control methods.
language handling
parses the objects.xml it handles the xml-description of all ilias objects
Preloader for object list GUIs.
special template class to simplify handling of ITX/PEAR
Workspace content renderer.
__construct( $object_gui, int $node_id, bool $admin, $access_handler, \ILIAS\DI\UIServices $ui, ilLanguage $lng, ilObjUser $user, ilObjectDefinition $obj_definition, ilCtrl $ctrl, ilWorkspaceFolderUserSettings $user_folder_settings)
Constructor.
User settings for workspace folders.
Tree handler for personal workspace.
if(isset($_FILES['img_file']) &&is_array($_FILES['img_file'])) $panel
Definition: imgupload.php:138
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
$i
Definition: metadata.php:24
Class HTTPServicesTest.
Class ChatMainBarProvider \MainMenu\Provider.
ui()
Definition: ui.php:5