ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 72 of file class.ilPersonalWorkspaceGUI.php.

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

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

Member Function Documentation

◆ executeCommand()

ilPersonalWorkspaceGUI::executeCommand ( )

execute command

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

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

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

◆ initTree()

ilPersonalWorkspaceGUI::initTree ( )
protected

Init personal tree.

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

References $ilUser, and $user.

Referenced by __construct().

163  {
165 
166  $user_id = $ilUser->getId();
167 
168  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
169  $this->tree = new ilWorkspaceTree($user_id);
170  if (!$this->tree->getRootId()) {
171  $this->tree->createTreeForUser($user_id);
172  }
173  }
Tree handler for personal workspace.
$ilUser
Definition: imgupload.php:18
+ Here is the caller graph for this function:

◆ renderBack()

ilPersonalWorkspaceGUI::renderBack ( )
protected

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

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

Referenced by executeCommand().

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

◆ renderLocator()

ilPersonalWorkspaceGUI::renderLocator ( )
protected

Build locator for current node.

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

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

Referenced by executeCommand().

220  {
221  $lng = $this->lng;
223  $ilLocator = $this->locator;
224  $tpl = $this->tpl;
225  $objDefinition = $this->obj_definition;
226 
227  $ilLocator->clearItems();
228 
229  // we have no path if shared item
230  $path = $this->tree->getPathFull($this->node_id);
231  if ($path) {
232  foreach ($path as $node) {
233  $obj_class = "ilObj" . $objDefinition->getClassName($node["type"]) . "GUI";
234 
235  $ilCtrl->setParameter($this, "wsp_id", $node["wsp_id"]);
236 
237  switch ($node["type"]) {
238  case "wsrt":
239  $ilLocator->addItem($lng->txt("wsp_personal_workspace"), $ilCtrl->getLinkTargetByClass($obj_class, "render"));
240  break;
241 
242  case "blog":
243  case $objDefinition->isContainer($node["type"]):
244  $ilLocator->addItem($node["title"], $ilCtrl->getLinkTargetByClass($obj_class, "render"));
245  break;
246 
247  default:
248  $ilLocator->addItem($node["title"], $ilCtrl->getLinkTargetByClass($obj_class, "edit"));
249  break;
250  }
251  }
252  }
253 
254  $ilCtrl->setParameter($this, "wsp_id", $this->node_id);
255  }
global $ilCtrl
Definition: ilias.php:18
+ 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 67 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 66 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: