ILIAS  release_8 Revision v8.24
class.ilWorkspaceContentGUI.php
Go to the documentation of this file.
1<?php
2
25{
26 private object $object_gui;
28 private array $shared_objects;
29 protected int $current_node;
30 protected bool $admin;
32 protected \ILIAS\DI\UIServices $ui;
33 protected ilLanguage $lng;
34 protected ilObjUser $user;
36 protected ilCtrl $ctrl;
38
39 public function __construct(
40 object $object_gui,
41 int $node_id,
42 bool $admin,
44 \ILIAS\DI\UIServices $ui,
50 ) {
51 $this->current_node = $node_id;
52 $this->admin = $admin;
53 $this->access_handler = $access_handler;
54 $this->object_gui = $object_gui;
55 $this->ui = $ui;
56 $this->lng = $lng;
57 $this->user = $user;
58 $this->obj_definition = $obj_definition;
59 $this->ctrl = $ctrl;
60 $this->user_folder_settings = $user_folder_settings;
61
62 $this->folder_sorting = new ilWorkspaceFolderSorting();
63 }
64
65 public function render(): string
66 {
67 $html = "";
68 $first = true;
69 foreach ($this->getItems() as $i) {
70 if ($first) {
71 $first = false;
72 } else {
73 $html .= $this->ui->renderer()->render($this->ui->factory()->divider()->horizontal());
74 }
75 $html .= $this->getItemHTML($i);
76 }
77
78 if ($this->admin) {
79 $tpl = new ilTemplate("tpl.admin_container.html", true, true, "Modules/WorkspaceFolder");
80 $tpl->setVariable("ITEMS", $html);
81 $tpl->setVariable("TXT_SELECT_ALL", $this->lng->txt("select_all"));
82 $html = $tpl->get();
83 }
84
85
86 // output sortation
87 $tree = new ilWorkspaceTree($this->user->getId());
88 $parent_id = $tree->getParentId($this->object_gui->getRefId());
89 $parent_effective = ($parent_id > 0)
90 ? $this->user_folder_settings->getEffectiveSortation($parent_id)
91 : 0;
92 $selected = $this->user_folder_settings->getSortation($this->object_gui->getObject()->getId());
93 $sort_options = $this->folder_sorting->getOptionsByType($this->object_gui->getObject()->getType(), $selected, $parent_effective);
94 $sortation = $this->ui->factory()->viewControl()->sortation($sort_options)
95 ->withTargetURL($this->ctrl->getLinkTarget($this->object_gui, "setSortation"), 'sortation')
96 ->withLabel($this->lng->txt("wfld_sortation"));
97
98
99 if ($first) {
100 return "";
101 }
102
103 $leg = $this->ui->factory()->legacy($html);
104
105 $panel = $this->ui->factory()->panel()->standard($this->lng->txt("content"), [$leg]);
106
107 if (method_exists($panel, "withViewControls")) {
108 $panel = $panel->withViewControls(array($sortation));
109 }
110
111
112
113 return $this->ui->renderer()->render($panel);
114 }
115
116 protected function getItems(): array
117 {
119
120 $tree = new ilWorkspaceTree($user->getId());
121 $nodes = $tree->getChilds($this->current_node, "title");
122
123 if (sizeof($nodes)) {
125 foreach ($nodes as $node) {
126 $preloader->addItem($node["obj_id"], $node["type"]);
127 }
128 $preloader->preload();
129 unset($preloader);
130 }
131
132 $this->shared_objects = $this->access_handler->getObjectsIShare();
133
134 $nodes = $this->folder_sorting->sortNodes($nodes, $this->user_folder_settings->getEffectiveSortation($this->object_gui->getRefId()));
135
136 return $nodes;
137 }
138
139 protected function getItemHTML(array $node): string
140 {
141 $objDefinition = $this->obj_definition;
142 $ilCtrl = $this->ctrl;
143 //bug ilCertificateVerificationClassMap in 6 beta was cmiv instead of cmxv
144 if ($node["type"] == "cmiv") {
145 return "";
146 }
147
148 $class = $objDefinition->getClassName($node["type"]);
149 $full_class = "ilObj" . $class . "ListGUI";
150
151 $item_list_gui = new $full_class(ilObjectListGUI::CONTEXT_WORKSPACE);
152
153 $item_list_gui->setDetailsLevel(ilObjectListGUI::DETAILS_ALL);
154 $item_list_gui->enableDelete(true);
155 $item_list_gui->enableCut(true);
156 $item_list_gui->enableSubscribe(false);
157 $item_list_gui->enableLink(false);
158 $item_list_gui->enablePath(false);
159 $item_list_gui->enableLinkedPath(false);
160 $item_list_gui->enableSearchFragments(true);
161 $item_list_gui->enableRelevance(false);
162 $item_list_gui->enableIcon(true);
163 $item_list_gui->enableTimings(false);
164 $item_list_gui->enableCheckbox($this->admin);
165
166 $item_list_gui->enableNotes(true);
167 $item_list_gui->enableCopy($objDefinition->allowCopy($node["type"]));
168
169 if ($node["type"] == "file") {
170 $item_list_gui->enableRepositoryTransfer(true);
171 }
172
173 $item_list_gui->setContainerObject($this->object_gui);
174
175 if (in_array($node["type"], array("file", "blog"))) {
176 // add "share" link
177 $ilCtrl->setParameterByClass("ilworkspaceaccessgui", "wsp_id", $node["wsp_id"]);
178 $share_link = $ilCtrl->getLinkTargetByClass(array("ilObj" . $class . "GUI", "ilworkspaceaccessgui"), "share");
179 $item_list_gui->addCustomCommand($share_link, "wsp_permissions");
180
181 // show "shared" status
182 if (in_array($node["obj_id"], $this->shared_objects)) {
183 $item_list_gui->addCustomProperty($this->lng->txt("status"), $this->lng->txt("wsp_status_shared"), true, true);
184 }
185 }
186
187 $html = $item_list_gui->getListItemHTML(
188 $node["wsp_id"],
189 $node["obj_id"],
190 (string) $node["title"],
191 (string) $node["description"]
192 );
193
194 return $html;
195 }
196}
Class ilCtrl provides processing control methods.
language handling
User class.
parses the objects.xml it handles the xml-description of all ilias objects
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
special template class to simplify handling of ITX/PEAR
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(object $object_gui, int $node_id, bool $admin, ilWorkspaceAccessHandler $access_handler, \ILIAS\DI\UIServices $ui, ilLanguage $lng, ilObjUser $user, ilObjectDefinition $obj_definition, ilCtrl $ctrl, ilWorkspaceFolderUserSettings $user_folder_settings)
ilWorkspaceFolderSorting $folder_sorting
ilWorkspaceFolderUserSettings $user_folder_settings
ilWorkspaceAccessHandler $access_handler
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if(isset($_FILES['img_file']) &&is_array($_FILES['img_file'])) $panel
Definition: imgupload.php:198
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
$i
Definition: metadata.php:41
Class HTTPServicesTest.
Class ChatMainBarProvider \MainMenu\Provider.