ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilPersonalWorkspaceGUI::__construct ( )

constructor

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

76 {
77 global $DIC;
78
79 $this->ctrl = $DIC->ctrl();
80 $this->lng = $DIC->language();
81 $this->help = $DIC["ilHelp"];
82 $this->obj_definition = $DIC["objDefinition"];
83 $this->tpl = $DIC["tpl"];
84 $this->main_menu = $DIC["ilMainMenu"];
85 $this->user = $DIC->user();
86 $this->tabs = $DIC->tabs();
87 $this->locator = $DIC["ilLocator"];
88 $ilCtrl = $DIC->ctrl();
89 $lng = $DIC->language();
90 $ilHelp = $DIC["ilHelp"];
91
92 $lng->loadLanguageModule("wsp");
93
94 $this->initTree();
95
96 $ilCtrl->saveParameter($this, "wsp_id");
97
98 $this->node_id = (int) $_REQUEST["wsp_id"];
99 if (!$this->node_id || !$this->tree->isInTree($this->node_id)) {
100 $this->node_id = $this->tree->getRootId();
101 }
102 }
user()
Definition: user.php:4
global $ilCtrl
Definition: ilias.php:18
global $DIC
Definition: saml.php:7

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

+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilPersonalWorkspaceGUI::executeCommand ( )

execute command

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

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

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

+ Here is the call graph for this function:

◆ initTree()

ilPersonalWorkspaceGUI::initTree ( )
protected

Init personal tree.

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

166 {
168
169 $user_id = $ilUser->getId();
170
171 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
172 $this->tree = new ilWorkspaceTree($user_id);
173 if (!$this->tree->getRootId()) {
174 $this->tree->createTreeForUser($user_id);
175 }
176 }
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 178 of file class.ilPersonalWorkspaceGUI.php.

179 {
181 $ilTabs = $this->tabs;
184
185 $root = $this->tree->getNodeData($this->node_id);
186 if ($root["type"] != "wfld" && $root["type"] != "wsrt") {
187 // do not override existing back targets, e.g. public user profile gui
188 if (!$ilTabs->back_target) {
189 $owner = $this->tree->lookupOwner($this->node_id);
190 // workspace
191 if ($owner == $ilUser->getId()) {
192 $parent = $this->tree->getParentNodeData($this->node_id);
193 if ($parent["wsp_id"]) {
194 if ($parent["type"] == "wsrt") {
195 $class = "ilobjworkspacerootfoldergui";
196 } else {
197 $class = "ilobjworkspacefoldergui";
198 }
199 $ilCtrl->setParameterByClass($class, "wsp_id", $parent["wsp_id"]);
200 $ilTabs->setBackTarget(
201 $lng->txt("back"),
202 $ilCtrl->getLinkTargetByClass($class, "")
203 );
204 }
205 }
206 // "shared by others"
207 else {
208 $ilCtrl->setParameterByClass("ilobjworkspacerootfoldergui", "wsp_id", "");
209 $ilCtrl->setParameterByClass("ilobjworkspacerootfoldergui", "user", $owner);
210 $ilTabs->setBackTarget(
211 $lng->txt("back"),
212 $ilCtrl->getLinkTargetByClass("ilobjworkspacerootfoldergui", "share")
213 );
214 }
215 }
216 }
217 }
$root
Definition: sabredav.php:45

References $ctrl, $ilCtrl, $ilUser, $lng, $root, $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 222 of file class.ilPersonalWorkspaceGUI.php.

223 {
226 $ilLocator = $this->locator;
228 $objDefinition = $this->obj_definition;
229
230 $ilLocator->clearItems();
231
232 // we have no path if shared item
233 $path = $this->tree->getPathFull($this->node_id);
234 if ($path) {
235 foreach ($path as $node) {
236 $obj_class = "ilObj" . $objDefinition->getClassName($node["type"]) . "GUI";
237
238 $ilCtrl->setParameter($this, "wsp_id", $node["wsp_id"]);
239
240 switch ($node["type"]) {
241 case "wsrt":
242 $ilLocator->addItem($lng->txt("wsp_personal_workspace"), $ilCtrl->getLinkTargetByClass($obj_class, "render"));
243 break;
244
245 case "blog":
246 case $objDefinition->isContainer($node["type"]):
247 $ilLocator->addItem($node["title"], $ilCtrl->getLinkTargetByClass($obj_class, "render"));
248 break;
249
250 default:
251 $ilLocator->addItem($node["title"], $ilCtrl->getLinkTargetByClass($obj_class, "edit"));
252 break;
253 }
254 }
255 }
256
257 $ilCtrl->setParameter($this, "wsp_id", $this->node_id);
258 }
$path
Definition: aliased.php:25

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

Referenced by executeCommand().

+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilPersonalWorkspaceGUI::$ctrl
protected

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

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

◆ $help

ilPersonalWorkspaceGUI::$help
protected

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

◆ $lng

ilPersonalWorkspaceGUI::$lng
protected

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

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

◆ $locator

ilPersonalWorkspaceGUI::$locator
protected

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

Referenced by renderLocator().

◆ $main_menu

ilPersonalWorkspaceGUI::$main_menu
protected

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

Referenced by executeCommand().

◆ $node_id

ilPersonalWorkspaceGUI::$node_id
protected

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

◆ $obj_definition

ilPersonalWorkspaceGUI::$obj_definition
protected

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

Referenced by executeCommand(), and renderLocator().

◆ $tabs

ilPersonalWorkspaceGUI::$tabs
protected

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

Referenced by renderBack().

◆ $tpl

ilPersonalWorkspaceGUI::$tpl
protected

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

Referenced by executeCommand(), and renderLocator().

◆ $tree

ilPersonalWorkspaceGUI::$tree
protected

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

◆ $user

ilPersonalWorkspaceGUI::$user
protected

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

Referenced by initTree(), and renderBack().


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