ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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

 $tree
 
 $node_id
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilPersonalWorkspaceGUI::__construct ( )

constructor

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

28 {
29 global $ilCtrl, $lng, $ilHelp;
30
31 $lng->loadLanguageModule("wsp");
32
33 $this->initTree();
34
35 $ilCtrl->saveParameter($this, "wsp_id");
36
37 $this->node_id = (int) $_REQUEST["wsp_id"];
38 if(!$this->node_id)
39 {
40 $this->node_id = $this->tree->getRootId();
41 }
42 }
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7

References $_REQUEST, $ilCtrl, $lng, and initTree().

+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilPersonalWorkspaceGUI::executeCommand ( )

execute command

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

48 {
49 global $ilCtrl, $objDefinition, $tpl, $ilMainMenu;
50
51 $ilCtrl->setReturn($this, "render");
52 $cmd = $ilCtrl->getCmd();
53
54 // new type
55 if($_REQUEST["new_type"])
56 {
57 $class_name = $objDefinition->getClassName($_REQUEST["new_type"]);
58
59 // Only set the fixed cmdClass if the next class is different to
60 // the GUI class of the new object.
61 // An example:
62 // ilObjLinkResourceGUI tries to forward to ilLinkInputGUI (adding an internal link
63 // when creating a link resource)
64 // Without this fix, the cmdClass ilObjectCopyGUI would never be reached
65 if (strtolower($ilCtrl->getNextClass($this)) != strtolower("ilObj".$class_name."GUI"))
66 {
67 $ilCtrl->setCmdClass("ilObj".$class_name."GUI");
68 }
69 }
70
71 // root node
72 $next_class = $ilCtrl->getNextClass();
73 if(!$next_class)
74 {
75 $node = $this->tree->getNodeData($this->node_id);
76 $next_class = "ilObj".$objDefinition->getClassName($node["type"])."GUI";
77 $ilCtrl->setCmdClass($next_class);
78 }
79
80 // if we do this here the object can still change the breadcrumb
81 $this->renderLocator();
82
83 // current node
84 $class_path = $ilCtrl->lookupClassPath($next_class);
85 include_once($class_path);
86 $class_name = $ilCtrl->getClassForClasspath($class_path);
87 if($_REQUEST["new_type"])
88 {
89 $gui = new $class_name(null, ilObject2GUI::WORKSPACE_NODE_ID, $this->node_id);
90 $gui->setCreationMode();
91 }
92 else
93 {
94 $gui = new $class_name($this->node_id, ilObject2GUI::WORKSPACE_NODE_ID, false);
95 }
96 $ilCtrl->forwardCommand($gui);
97
98 if($ilMainMenu->getMode() == ilMainMenuGUI::MODE_FULL)
99 {
100 $this->renderBack();
101 }
102
103 $tpl->setLocator();
104 }
global $tpl
Definition: ilias.php:8
renderLocator()
Build locator for current node.
$cmd
Definition: sahs_server.php:35

References $_REQUEST, $cmd, $ilCtrl, $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 109 of file class.ilPersonalWorkspaceGUI.php.

110 {
111 global $ilUser;
112
113 $user_id = $ilUser->getId();
114
115 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
116 $this->tree = new ilWorkspaceTree($user_id);
117 if(!$this->tree->getRootId())
118 {
119 $this->tree->createTreeForUser($user_id);
120 }
121 }
Tree handler for personal workspace.
global $ilUser
Definition: imgupload.php:15

References $ilUser.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ renderBack()

ilPersonalWorkspaceGUI::renderBack ( )
protected

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

124 {
125 global $lng, $ilTabs, $ilCtrl, $ilUser;
126
127 $root = $this->tree->getNodeData($this->node_id);
128 if($root["type"] != "wfld" && $root["type"] != "wsrt")
129 {
130 // do not override existing back targets, e.g. public user profile gui
131 if(!$ilTabs->back_target)
132 {
133 $owner = $this->tree->lookupOwner($this->node_id);
134 // workspace
135 if($owner == $ilUser->getId())
136 {
137 $parent = $this->tree->getParentNodeData($this->node_id);
138 if($parent["wsp_id"])
139 {
140 if($parent["type"] == "wsrt")
141 {
142 $class = "ilobjworkspacerootfoldergui";
143 }
144 else
145 {
146 $class = "ilobjworkspacefoldergui";
147 }
148 $ilCtrl->setParameterByClass($class, "wsp_id", $parent["wsp_id"]);
149 $ilTabs->setBackTarget($lng->txt("back"),
150 $ilCtrl->getLinkTargetByClass($class, ""));
151 }
152 }
153 // "shared by others"
154 else
155 {
156 $ilCtrl->setParameterByClass("ilobjworkspacerootfoldergui", "wsp_id", "");
157 $ilCtrl->setParameterByClass("ilobjworkspacerootfoldergui", "user", $owner);
158 $ilTabs->setBackTarget($lng->txt("back"),
159 $ilCtrl->getLinkTargetByClass("ilobjworkspacerootfoldergui", "share"));
160 }
161 }
162 }
163 }

References $ilCtrl, $ilUser, and $lng.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ renderLocator()

ilPersonalWorkspaceGUI::renderLocator ( )
protected

Build locator for current node.

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

169 {
170 global $lng, $ilCtrl, $ilLocator, $tpl, $objDefinition;
171
172 $ilLocator->clearItems();
173
174 // we have no path if shared item
175 $path = $this->tree->getPathFull($this->node_id);
176 if($path)
177 {
178 foreach($path as $node)
179 {
180 $obj_class = "ilObj".$objDefinition->getClassName($node["type"])."GUI";
181
182 $ilCtrl->setParameter($this, "wsp_id", $node["wsp_id"]);
183
184 switch($node["type"])
185 {
186 case "wsrt":
187 $ilLocator->addItem($lng->txt("wsp_personal_workspace"), $ilCtrl->getLinkTargetByClass($obj_class, "render"));
188 break;
189
190 case "blog":
191 case $objDefinition->isContainer($node["type"]):
192 $ilLocator->addItem($node["title"], $ilCtrl->getLinkTargetByClass($obj_class, "render"));
193 break;
194
195 default:
196 $ilLocator->addItem($node["title"], $ilCtrl->getLinkTargetByClass($obj_class, "edit"));
197 break;
198 }
199 }
200 }
201
202 $ilCtrl->setParameter($this, "wsp_id", $this->node_id);
203 }
$path
Definition: index.php:22

References $ilCtrl, $lng, $path, and $tpl.

Referenced by executeCommand().

+ Here is the caller graph for this function:

Field Documentation

◆ $node_id

ilPersonalWorkspaceGUI::$node_id
protected

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

◆ $tree

ilPersonalWorkspaceGUI::$tree
protected

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


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