ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilPersonalWorkspaceGUI Class Reference

GUI class for personal workspace. More...

+ Collaboration diagram for ilPersonalWorkspaceGUI:

Public Member Functions

 __construct ()
 constructor More...
 
 executeCommand ()
 execute command More...
 

Protected Member Functions

 initTree ()
 Init personal tree. More...
 
 renderBack ()
 
 renderLocator ()
 Build locator for current node. More...
 

Protected Attributes

 $ctrl
 
 $lng
 
 $help
 
 $obj_definition
 
 $tpl
 
 $main_menu
 
 $user
 
 $tabs
 
 $locator
 
 $tree
 
 $node_id
 
 $tool_context
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilPersonalWorkspaceGUI::__construct ( )

constructor

Definition at line 79 of file class.ilPersonalWorkspaceGUI.php.

80 {
81 global $DIC;
82
83 $this->ctrl = $DIC->ctrl();
84 $this->lng = $DIC->language();
85 $this->help = $DIC["ilHelp"];
86 $this->obj_definition = $DIC["objDefinition"];
87 $this->tpl = $DIC["tpl"];
88 $this->main_menu = $DIC["ilMainMenu"];
89 $this->user = $DIC->user();
90 $this->tabs = $DIC->tabs();
91 $this->locator = $DIC["ilLocator"];
92 $ilCtrl = $DIC->ctrl();
93 $lng = $DIC->language();
94 $ilHelp = $DIC["ilHelp"];
95 $this->settings = $DIC->settings();
96
97 $lng->loadLanguageModule("wsp");
98
99 $this->initTree();
100
101 $ilCtrl->saveParameter($this, "wsp_id");
102
103 $this->node_id = (int) $_REQUEST["wsp_id"];
104 if (!$this->node_id || !$this->tree->isInTree($this->node_id)) {
105 $this->node_id = $this->tree->getRootId();
106 }
107 $this->tool_context = $DIC->globalScreen()->tool()->context();
108 }
user()
Definition: user.php:4
help()
Definition: help.php:2
global $ilCtrl
Definition: ilias.php:18
settings()
Definition: settings.php:2
$DIC
Definition: xapitoken.php:46

References $DIC, $ilCtrl, $lng, help(), initTree(), settings(), and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilPersonalWorkspaceGUI::executeCommand ( )

execute command

Definition at line 113 of file class.ilPersonalWorkspaceGUI.php.

114 {
116 $objDefinition = $this->obj_definition;
118 $ilMainMenu = $this->main_menu;
119
120 if ($this->settings->get("disable_personal_workspace")) {
121 throw new ilException($this->lng->txt("no_permission"));
122 }
123
124 $ilCtrl->setReturn($this, "render");
125 $cmd = $ilCtrl->getCmd();
126
127 $this->tool_context->current()->addAdditionalData(ilWorkspaceGSToolProvider::SHOW_WS_TREE, true);
128
129 // new type
130 if ($_REQUEST["new_type"]) {
131 $class_name = $objDefinition->getClassName($_REQUEST["new_type"]);
132
133 // Only set the fixed cmdClass if the next class is different to
134 // the GUI class of the new object.
135 // An example:
136 // ilObjLinkResourceGUI tries to forward to ilLinkInputGUI (adding an internal link
137 // when creating a link resource)
138 // Without this fix, the cmdClass ilObjectCopyGUI would never be reached
139 if (strtolower($ilCtrl->getNextClass($this)) != strtolower("ilObj" . $class_name . "GUI")) {
140 $ilCtrl->setCmdClass("ilObj" . $class_name . "GUI");
141 }
142 }
143
144 // root node
145 $next_class = $ilCtrl->getNextClass();
146 if (!$next_class) {
147 $node = $this->tree->getNodeData($this->node_id);
148 $next_class = "ilObj" . $objDefinition->getClassName($node["type"]) . "GUI";
149 $ilCtrl->setCmdClass($next_class);
150 }
151
152 // if we do this here the object can still change the breadcrumb
153 $this->renderLocator();
154
155 // current node
156 $class_path = $ilCtrl->lookupClassPath($next_class);
157 include_once($class_path);
158 $class_name = $ilCtrl->getClassForClasspath($class_path);
159 if ($_REQUEST["new_type"]) {
160 $gui = new $class_name(null, ilObject2GUI::WORKSPACE_NODE_ID, $this->node_id);
161 $gui->setCreationMode();
162 } else {
163 $gui = new $class_name($this->node_id, ilObject2GUI::WORKSPACE_NODE_ID, false);
164 }
165 $ilCtrl->forwardCommand($gui);
166
167 if ($ilMainMenu->getMode() == ilMainMenuGUI::MODE_FULL) {
168 $this->renderBack();
169 }
170
171 $tpl->setLocator();
172 }
Base class for ILIAS Exception handling.
renderLocator()
Build locator for current node.

References $ctrl, $ilCtrl, $main_menu, $obj_definition, $tpl, ilMainMenuGUI\MODE_FULL, renderBack(), renderLocator(), settings(), ilWorkspaceGSToolProvider\SHOW_WS_TREE, and ilObject2GUI\WORKSPACE_NODE_ID.

+ Here is the call graph for this function:

◆ initTree()

ilPersonalWorkspaceGUI::initTree ( )
protected

Init personal tree.

Definition at line 177 of file class.ilPersonalWorkspaceGUI.php.

178 {
180
181 $user_id = $ilUser->getId();
182
183 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
184 $this->tree = new ilWorkspaceTree($user_id);
185 if (!$this->tree->getRootId()) {
186 $this->tree->createTreeForUser($user_id);
187 }
188 }
Tree handler for personal workspace.
$ilUser
Definition: imgupload.php:18

References $ilUser, and $user.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ renderBack()

ilPersonalWorkspaceGUI::renderBack ( )
protected

Definition at line 190 of file class.ilPersonalWorkspaceGUI.php.

191 {
193 $ilTabs = $this->tabs;
196
197 $root = $this->tree->getNodeData($this->node_id);
198 if ($root["type"] != "wfld" && $root["type"] != "wsrt") {
199 // do not override existing back targets, e.g. public user profile gui
200 if (!$ilTabs->back_target) {
201 $owner = $this->tree->lookupOwner($this->node_id);
202 // workspace
203 if ($owner == $ilUser->getId()) {
204 $parent = $this->tree->getParentNodeData($this->node_id);
205 if ($parent["wsp_id"]) {
206 if ($parent["type"] == "wsrt") {
207 $class = "ilobjworkspacerootfoldergui";
208 } else {
209 $class = "ilobjworkspacefoldergui";
210 }
211 $ilCtrl->setParameterByClass($class, "wsp_id", $parent["wsp_id"]);
212 $ilTabs->setBackTarget(
213 $lng->txt("back"),
214 $ilCtrl->getLinkTargetByClass($class, "")
215 );
216 }
217 }
218 // "shared by others"
219 else {
220 $ilCtrl->setParameterByClass("ilobjworkspacerootfoldergui", "wsp_id", "");
221 $ilCtrl->setParameterByClass("ilobjworkspacerootfoldergui", "user", $owner);
222 $ilTabs->setBackTarget(
223 $lng->txt("back"),
224 $ilCtrl->getLinkTargetByClass("ilobjworkspacerootfoldergui", "share")
225 );
226 }
227 }
228 }
229 }

References $ctrl, $ilCtrl, $ilUser, $lng, $tabs, and $user.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ renderLocator()

ilPersonalWorkspaceGUI::renderLocator ( )
protected

Build locator for current node.

Definition at line 234 of file class.ilPersonalWorkspaceGUI.php.

235 {
238 $ilLocator = $this->locator;
240 $objDefinition = $this->obj_definition;
241
242 $ilLocator->clearItems();
243
244 // we have no path if shared item
245 $path = $this->tree->getPathFull($this->node_id);
246 if ($path) {
247 foreach ($path as $node) {
248 $obj_class = "ilObj" . $objDefinition->getClassName($node["type"]) . "GUI";
249
250 $ilCtrl->setParameter($this, "wsp_id", $node["wsp_id"]);
251
252 switch ($node["type"]) {
253 case "wsrt":
254 $ilLocator->addItem($lng->txt("personal_resources"), $ilCtrl->getLinkTargetByClass($obj_class, "render"));
255 break;
256
257 case "blog":
258 case $objDefinition->isContainer($node["type"]):
259 $ilLocator->addItem($node["title"], $ilCtrl->getLinkTargetByClass($obj_class, "render"));
260 break;
261
262 default:
263 $ilLocator->addItem($node["title"], $ilCtrl->getLinkTargetByClass($obj_class, "edit"));
264 break;
265 }
266 }
267 }
268
269 $ilCtrl->setParameter($this, "wsp_id", $this->node_id);
270 }

References $ctrl, $ilCtrl, $lng, $locator, $obj_definition, and $tpl.

Referenced by executeCommand().

+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilPersonalWorkspaceGUI::$ctrl
protected

Definition at line 23 of file class.ilPersonalWorkspaceGUI.php.

Referenced by executeCommand(), renderBack(), and renderLocator().

◆ $help

ilPersonalWorkspaceGUI::$help
protected

Definition at line 33 of file class.ilPersonalWorkspaceGUI.php.

◆ $lng

ilPersonalWorkspaceGUI::$lng
protected

Definition at line 28 of file class.ilPersonalWorkspaceGUI.php.

Referenced by __construct(), renderBack(), and renderLocator().

◆ $locator

ilPersonalWorkspaceGUI::$locator
protected

Definition at line 63 of file class.ilPersonalWorkspaceGUI.php.

Referenced by renderLocator().

◆ $main_menu

ilPersonalWorkspaceGUI::$main_menu
protected

Definition at line 48 of file class.ilPersonalWorkspaceGUI.php.

Referenced by executeCommand().

◆ $node_id

ilPersonalWorkspaceGUI::$node_id
protected

Definition at line 69 of file class.ilPersonalWorkspaceGUI.php.

◆ $obj_definition

ilPersonalWorkspaceGUI::$obj_definition
protected

Definition at line 38 of file class.ilPersonalWorkspaceGUI.php.

Referenced by executeCommand(), and renderLocator().

◆ $tabs

ilPersonalWorkspaceGUI::$tabs
protected

Definition at line 58 of file class.ilPersonalWorkspaceGUI.php.

Referenced by renderBack().

◆ $tool_context

ilPersonalWorkspaceGUI::$tool_context
protected

Definition at line 74 of file class.ilPersonalWorkspaceGUI.php.

◆ $tpl

ilPersonalWorkspaceGUI::$tpl
protected

Definition at line 43 of file class.ilPersonalWorkspaceGUI.php.

Referenced by executeCommand(), and renderLocator().

◆ $tree

ilPersonalWorkspaceGUI::$tree
protected

Definition at line 68 of file class.ilPersonalWorkspaceGUI.php.

◆ $user

ilPersonalWorkspaceGUI::$user
protected

Definition at line 53 of file class.ilPersonalWorkspaceGUI.php.

Referenced by initTree(), and renderBack().


The documentation for this class was generated from the following file: