ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilSharedResourceGUI Class Reference

Workspace deep link handler GUI. More...

+ Collaboration diagram for ilSharedResourceGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 

Static Public Member Functions

static hasAccess ($a_node_id, $a_is_portfolio=false)
 

Protected Member Functions

 process ()
 
 redirectToResource ($a_node_id, $a_is_portfolio=false)
 
 passwordForm ($form=null)
 
 initPasswordForm ()
 
 cancelPassword ()
 
 checkPassword ()
 

Protected Attributes

 $ctrl
 
 $tpl
 
 $main_menu
 
 $locator
 
 $user
 
 $lng
 
 $obj_definition
 
 $tabs
 
 $db
 
 $node_id
 
 $portfolio_id
 
 $access_handler
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilSharedResourceGUI::__construct ( )

Definition at line 67 of file class.ilSharedResourceGUI.php.

References $_GET, $DIC, $ilCtrl, and user().

68  {
69  global $DIC;
70 
71  $this->ctrl = $DIC->ctrl();
72  $this->tpl = $DIC["tpl"];
73  $this->main_menu = $DIC["ilMainMenu"];
74  $this->locator = $DIC["ilLocator"];
75  $this->user = $DIC->user();
76  $this->lng = $DIC->language();
77  $this->obj_definition = $DIC["objDefinition"];
78  $this->tabs = $DIC->tabs();
79  $this->db = $DIC->database();
80  $ilCtrl = $DIC->ctrl();
81 
82  $ilCtrl->saveParameter($this, "wsp_id");
83  $ilCtrl->saveParameter($this, "prt_id");
84  $this->node_id = (int) $_GET["wsp_id"];
85  $this->portfolio_id = (int) $_GET["prt_id"];
86  }
global $DIC
Definition: saml.php:7
$_GET["client_id"]
user()
Definition: user.php:4
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:

Member Function Documentation

◆ cancelPassword()

ilSharedResourceGUI::cancelPassword ( )
protected

Definition at line 375 of file class.ilSharedResourceGUI.php.

References $ilUser, $user, ilWorkspaceTree\lookupOwner(), and ilUtil\redirect().

376  {
378 
379  if ($ilUser->getId() && $ilUser->getId() != ANONYMOUS_USER_ID) {
380  if ($this->node_id) {
381  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
382  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
383  $tree = new ilWorkspaceTree($ilUser->getId());
384  $owner = $tree->lookupOwner($this->node_id);
385  ilUtil::redirect("ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToWorkspace&dsh=" . $owner);
386  } else {
387  include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
388  $prtf = new ilObjPortfolio($this->portfolio_id, false);
389  $owner = $prtf->getOwner();
390  ilUtil::redirect("ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToPortfolio&dsh=" . $owner);
391  }
392  }
393  }
Tree handler for personal workspace.
$ilUser
Definition: imgupload.php:18
static redirect($a_script)
lookupOwner($a_node_id)
Get owner for node id.
+ Here is the call graph for this function:

◆ checkPassword()

ilSharedResourceGUI::checkPassword ( )
protected

Definition at line 395 of file class.ilSharedResourceGUI.php.

References $db, $form, $ilDB, $lng, $password, ilWorkspaceAccessHandler\getSharedNodePassword(), ilPortfolioAccessHandler\getSharedNodePassword(), initPasswordForm(), ilWorkspaceAccessHandler\keepSharedSessionPassword(), ilPortfolioAccessHandler\keepSharedSessionPassword(), passwordForm(), redirectToResource(), and ilUtil\sendFailure().

396  {
397  $ilDB = $this->db;
398  $lng = $this->lng;
399 
400  $lng->loadLanguageModule("wsp");
401 
402  $form = $this->initPasswordForm();
403  if ($form->checkInput()) {
404  $input = md5($form->getInput("password"));
405  if ($this->node_id) {
406  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
408  } else {
409  include_once "Modules/Portfolio/classes/class.ilPortfolioAccessHandler.php";
411  }
412  if ($input == $password) {
413  if ($this->node_id) {
415  $this->redirectToResource($this->node_id);
416  } else {
417  ilPortfolioAccessHandler::keepSharedSessionPassword($this->portfolio_id, $input);
418  $this->redirectToResource($this->portfolio_id, true);
419  }
420  } else {
421  $item = $form->getItemByPostVar("password");
422  $item->setAlert($lng->txt("wsp_invalid_password"));
423  ilUtil::sendFailure($lng->txt("form_input_not_valid"));
424  }
425  }
426 
427  $form->setValuesByPost();
428  $this->passwordForm($form);
429  }
$password
Definition: pwgen.php:17
static keepSharedSessionPassword($a_node_id, $a_password)
if(isset($_POST['submit'])) $form
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static keepSharedSessionPassword($a_node_id, $a_password)
global $ilDB
redirectToResource($a_node_id, $a_is_portfolio=false)
+ Here is the call graph for this function:

◆ executeCommand()

ilSharedResourceGUI::executeCommand ( )

Definition at line 88 of file class.ilSharedResourceGUI.php.

References $access_handler, $ctrl, $ilCtrl, $ilUser, $lng, $locator, $main_menu, $tpl, $user, ilObject\_lookupTitle(), array, ilUserUtil\getNamePresentation(), ilObject2GUI\PORTFOLIO_OBJECT_ID, and ilObject2GUI\WORKSPACE_NODE_ID.

89  {
91  $tpl = $this->tpl;
92  $ilMainMenu = $this->main_menu;
93  $ilLocator = $this->locator;
95  $lng = $this->lng;
96 
97  $next_class = $ilCtrl->getNextClass($this);
98  $cmd = $ilCtrl->getCmd();
99 
100  $tpl->getStandardTemplate();
101 
102  // #8509
103  $ilMainMenu->setActive("desktop");
104 
105  // #12096
106  if ($ilUser->getId() != ANONYMOUS_USER_ID &&
107  $next_class &&
108  !in_array($next_class, array("ilobjbloggui", "ilobjportfoliogui"))) {
109  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
110  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
111  $tree = new ilWorkspaceTree($ilUser->getId());
113  $owner_id = $tree->lookupOwner($this->node_id);
114  $obj_id = $tree->lookupObjectId($this->node_id);
115 
116  $lng->loadLanguageModule("wsp");
117 
118  // see ilPersonalWorkspaceGUI
119  if ($owner_id != $ilUser->getId()) {
120  $ilCtrl->setParameterByClass("ilpersonaldesktopgui", "dsh", $owner_id);
121  $link = $ilCtrl->getLinkTargetByClass("ilpersonaldesktopgui", "jumptoworkspace");
122  $ilLocator->addItem($lng->txt("wsp_tab_shared"), $link);
123 
124  include_once "Services/User/classes/class.ilUserUtil.php";
125  $ilLocator->addItem(ilUserUtil::getNamePresentation($owner_id), $link);
126  } else {
127  $link = $ilCtrl->getLinkTargetByClass("ilpersonaldesktopgui", "jumptoworkspace");
128  $ilLocator->addItem($lng->txt("wsp_tab_personal"), $link);
129  }
130 
131  $link = $access_handler->getGotoLink($this->node_id, $obj_id);
132  $ilLocator->addItem(ilObject::_lookupTitle($obj_id), $link);
133  $tpl->setLocator($ilLocator);
134  }
135 
136  switch ($next_class) {
137  case "ilobjbloggui":
138  include_once "Modules/Blog/classes/class.ilObjBlogGUI.php";
139  $bgui = new ilObjBlogGUI($this->node_id, ilObject2GUI::WORKSPACE_NODE_ID);
140  $ilCtrl->forwardCommand($bgui);
141  break;
142 
143  case "ilobjfilegui":
144  include_once "Modules/File/classes/class.ilObjFileGUI.php";
145  $fgui = new ilObjFileGUI($this->node_id, ilObject2GUI::WORKSPACE_NODE_ID);
146  $ilCtrl->forwardCommand($fgui);
147  break;
148 
149  case "ilobjtestverificationgui":
150  include_once "Modules/Test/classes/class.ilObjTestVerificationGUI.php";
151  $tgui = new ilObjTestVerificationGUI($this->node_id, ilObject2GUI::WORKSPACE_NODE_ID);
152  $ilCtrl->forwardCommand($tgui);
153  break;
154 
155  case "ilobjexerciseverificationgui":
156  include_once "Modules/Exercise/classes/class.ilObjExerciseVerificationGUI.php";
158  $ilCtrl->forwardCommand($egui);
159  break;
160 
161  case "ilobjlinkresourcegui":
162  include_once "Modules/WebResource/classes/class.ilObjLinkResourceGUI.php";
163  $lgui = new ilObjLinkResourceGUI($this->node_id, ilObject2GUI::WORKSPACE_NODE_ID);
164  $ilCtrl->forwardCommand($lgui);
165  break;
166 
167  case "ilobjportfoliogui":
168  include_once "Modules/Portfolio/classes/class.ilObjPortfolioGUI.php";
169  $pgui = new ilObjPortfolioGUI($this->portfolio_id, ilObject2GUI::PORTFOLIO_OBJECT_ID);
170  $ilCtrl->forwardCommand($pgui);
171  break;
172 
173  default:
174  if (!$cmd) {
175  $cmd = "process";
176  }
177  $this->$cmd();
178  }
179 
180  $tpl->show();
181  }
Class ilObjLinkResourceGUI.
Access handler for personal workspace.
static _lookupTitle($a_id)
lookup object title
Tree handler for personal workspace.
global $ilCtrl
Definition: ilias.php:18
Portfolio view gui class.
Class ilObjBlogGUI.
GUI class for exercise verification.
$ilUser
Definition: imgupload.php:18
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
Create styles array
The data for the language used.
GUI class for test verification.
GUI class for file objects.
+ Here is the call graph for this function:

◆ hasAccess()

static ilSharedResourceGUI::hasAccess (   $a_node_id,
  $a_is_portfolio = false 
)
static

Definition at line 203 of file class.ilSharedResourceGUI.php.

References $access_handler, $DIC, $ilSetting, $ilUser, ilWorkspaceAccessHandler\_getPermissions(), ilPortfolioAccessHandler\_getPermissions(), ilWorkspaceAccessGUI\PERMISSION_ALL, ilWorkspaceAccessGUI\PERMISSION_ALL_PASSWORD, and ilUtil\redirect().

Referenced by ilObjPortfolioAccess\_checkGoto(), ilObjTestVerificationAccess\_checkGoto(), ilObjCourseVerificationAccess\_checkGoto(), ilObjSCORMVerificationAccess\_checkGoto(), ilObjExerciseVerificationAccess\_checkGoto(), ilObjBlogAccess\_checkGoto(), and ilObjFileAccess\_checkGoto().

204  {
205  global $DIC;
206 
207  $ilUser = $DIC->user();
208  $ilSetting = $DIC->settings();
209 
210  // if we have current user - check with normal access handler
211  if ($ilUser->getId() != ANONYMOUS_USER_ID) {
212  if (!$a_is_portfolio) {
213  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
214  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
215  $tree = new ilWorkspaceTree($ilUser->getId());
217  } else {
218  include_once "Modules/Portfolio/classes/class.ilPortfolioAccessHandler.php";
220  }
221  if ($access_handler->checkAccess("read", "", $a_node_id)) {
222  return true;
223  }
224  }
225 
226  // not logged in yet or no read access
227  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessGUI.php";
228 
229  if (!$a_is_portfolio) {
230  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
231  $shared = ilWorkspaceAccessHandler::_getPermissions($a_node_id);
232  } else {
233  // #12059
234  if (!$ilSetting->get('user_portfolios')) {
235  return false;
236  }
237 
238  // #12039
239  include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
240  $prtf = new ilObjPortfolio($a_node_id, false);
241  if (!$prtf->isOnline()) {
242  return false;
243  }
244 
245  include_once "Modules/Portfolio/classes/class.ilPortfolioAccessHandler.php";
246  $shared = ilPortfolioAccessHandler::_getPermissions($a_node_id);
247  }
248 
249  // object is "public"
250  if (in_array(ilWorkspaceAccessGUI::PERMISSION_ALL, $shared)) {
251  return true;
252  }
253 
254  // password protected
255  if (in_array(ilWorkspaceAccessGUI::PERMISSION_ALL_PASSWORD, $shared)) {
256  if (!$a_is_portfolio) {
257  ilUtil::redirect("ilias.php?baseClass=ilSharedResourceGUI&cmd=passwordForm&wsp_id=" . $a_node_id);
258  } else {
259  ilUtil::redirect("ilias.php?baseClass=ilSharedResourceGUI&cmd=passwordForm&prt_id=" . $a_node_id);
260  }
261  }
262 
263  return false;
264  }
global $DIC
Definition: saml.php:7
Access handler for personal workspace.
Tree handler for personal workspace.
static _getPermissions($a_node_id)
Get all permissions to node.
$ilUser
Definition: imgupload.php:18
global $ilSetting
Definition: privfeed.php:17
Access handler for portfolio.
static _getPermissions($a_node_id)
Get all permissions to node.
static redirect($a_script)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initPasswordForm()

ilSharedResourceGUI::initPasswordForm ( )
protected

Definition at line 340 of file class.ilSharedResourceGUI.php.

References $ctrl, $form, $ilCtrl, $ilUser, $lng, $password, $tabs, $user, ilObject\_lookupTitle(), and ilWorkspaceAccessHandler\getObjectDataFromNode().

Referenced by checkPassword(), and passwordForm().

341  {
343  $lng = $this->lng;
345  $ilTabs = $this->tabs;
346 
347  if ($this->node_id) {
348  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
349  $object_data = ilWorkspaceAccessHandler::getObjectDataFromNode($this->node_id);
350  } else {
351  $object_data["title"] = ilObject::_lookupTitle($this->portfolio_id);
352  }
353 
354  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
355  $form = new ilPropertyFormGUI();
356  $form->setFormAction($ilCtrl->getFormAction($this, "checkPassword"));
357  $form->setTitle($lng->txt("wsp_password_for") . ": " . $object_data["title"]);
358 
359  $password = new ilPasswordInputGUI($lng->txt("password"), "password");
360  $password->setRetype(false);
361  $password->setRequired(true);
362  $password->setSkipSyntaxCheck(true); // #17757
363  $form->addItem($password);
364 
365  $form->addCommandButton("checkPassword", $lng->txt("submit"));
366 
367  if ($ilUser->getId() && $ilUser->getId() != ANONYMOUS_USER_ID) {
368  $ilTabs->setBackTarget($lng->txt("back"), $ilCtrl->getLinkTarget($this, "cancelPassword"));
369  $form->addCommandButton("cancelPassword", $lng->txt("cancel"));
370  }
371 
372  return $form;
373  }
This class represents a property form user interface.
static _lookupTitle($a_id)
lookup object title
global $ilCtrl
Definition: ilias.php:18
$password
Definition: pwgen.php:17
if(isset($_POST['submit'])) $form
This class represents a password property in a property form.
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ passwordForm()

ilSharedResourceGUI::passwordForm (   $form = null)
protected

Definition at line 323 of file class.ilSharedResourceGUI.php.

References $form, $lng, $tpl, and initPasswordForm().

Referenced by checkPassword().

324  {
325  $tpl = $this->tpl;
326  $lng = $this->lng;
327 
328  $lng->loadLanguageModule("wsp");
329 
330  $tpl->setTitle($lng->txt("wsp_password_protected_resource"));
331  $tpl->setDescription($lng->txt("wsp_password_protected_resource_info"));
332 
333  if (!$form) {
334  $form = $this->initPasswordForm();
335  }
336 
337  $tpl->setContent($form->getHTML());
338  }
if(isset($_POST['submit'])) $form
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ process()

ilSharedResourceGUI::process ( )
protected

Definition at line 183 of file class.ilSharedResourceGUI.php.

References exit, and redirectToResource().

184  {
185  if (!$this->node_id && !$this->portfolio_id) {
186  exit("invalid call");
187  }
188 
189  // if already logged in, we need to re-check for public password
190  if ($this->node_id) {
191  if (!self::hasAccess($this->node_id)) {
192  exit("no permission");
193  }
194  $this->redirectToResource($this->node_id);
195  } else {
196  if (!self::hasAccess($this->portfolio_id, true)) {
197  exit("no permission");
198  }
199  $this->redirectToResource($this->portfolio_id, true);
200  }
201  }
redirectToResource($a_node_id, $a_is_portfolio=false)
+ Here is the call graph for this function:

◆ redirectToResource()

ilSharedResourceGUI::redirectToResource (   $a_node_id,
  $a_is_portfolio = false 
)
protected

Definition at line 266 of file class.ilSharedResourceGUI.php.

References $_GET, $ctrl, $ilCtrl, $obj_definition, ilObject\_lookupType(), exit, and ilWorkspaceAccessHandler\getObjectDataFromNode().

Referenced by checkPassword(), and process().

267  {
269  $objDefinition = $this->obj_definition;
270 
271  if (!$a_is_portfolio) {
272  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
273  $object_data = ilWorkspaceAccessHandler::getObjectDataFromNode($a_node_id);
274  if (!$object_data["obj_id"]) {
275  exit("invalid object");
276  }
277  } else {
278  if (!ilObject::_lookupType($a_node_id, false)) {
279  exit("invalid object");
280  }
281  $object_data["obj_id"] = $a_node_id;
282  $object_data["type"] = "prtf";
283  }
284 
285  $class = $objDefinition->getClassName($object_data["type"]);
286  $gui = "ilobj" . $class . "gui";
287 
288  switch ($object_data["type"]) {
289  case "blog":
290  $ilCtrl->setParameterByClass($gui, "wsp_id", $a_node_id);
291  $ilCtrl->setParameterByClass($gui, "gtp", (int) $_GET["gtp"]);
292  $ilCtrl->redirectByClass($gui, "preview");
293 
294  // no break
295  case "tstv":
296  case "excv":
297  case "crsv":
298  case "scov":
299  $ilCtrl->setParameterByClass($gui, "wsp_id", $a_node_id);
300  $ilCtrl->redirectByClass($gui, "deliver");
301 
302  // no break
303  case "file":
304  case "webr":
305  $ilCtrl->setParameterByClass($gui, "wsp_id", $a_node_id);
306  $ilCtrl->redirectByClass($gui);
307 
308  // no break
309  case "prtf":
310  $ilCtrl->setParameterByClass($gui, "prt_id", $a_node_id);
311  $ilCtrl->setParameterByClass($gui, "gtp", (int) $_GET["gtp"]);
312  if ($_GET["back_url"]) {
313  $ilCtrl->setParameterByClass($gui, "back_url", rawurlencode($_GET["back_url"]));
314  }
315  $ilCtrl->redirectByClass($gui, "preview");
316 
317  // no break
318  default:
319  exit("invalid object type");
320  }
321  }
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access_handler

ilSharedResourceGUI::$access_handler
protected

Definition at line 65 of file class.ilSharedResourceGUI.php.

Referenced by executeCommand(), and hasAccess().

◆ $ctrl

ilSharedResourceGUI::$ctrl
protected

◆ $db

ilSharedResourceGUI::$db
protected

Definition at line 61 of file class.ilSharedResourceGUI.php.

Referenced by checkPassword().

◆ $lng

ilSharedResourceGUI::$lng
protected

◆ $locator

ilSharedResourceGUI::$locator
protected

Definition at line 36 of file class.ilSharedResourceGUI.php.

Referenced by executeCommand().

◆ $main_menu

ilSharedResourceGUI::$main_menu
protected

Definition at line 31 of file class.ilSharedResourceGUI.php.

Referenced by executeCommand().

◆ $node_id

ilSharedResourceGUI::$node_id
protected

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

◆ $obj_definition

ilSharedResourceGUI::$obj_definition
protected

Definition at line 51 of file class.ilSharedResourceGUI.php.

Referenced by redirectToResource().

◆ $portfolio_id

ilSharedResourceGUI::$portfolio_id
protected

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

◆ $tabs

ilSharedResourceGUI::$tabs
protected

Definition at line 56 of file class.ilSharedResourceGUI.php.

Referenced by initPasswordForm().

◆ $tpl

ilSharedResourceGUI::$tpl
protected

Definition at line 26 of file class.ilSharedResourceGUI.php.

Referenced by executeCommand(), and passwordForm().

◆ $user

ilSharedResourceGUI::$user
protected

Definition at line 41 of file class.ilSharedResourceGUI.php.

Referenced by cancelPassword(), executeCommand(), and initPasswordForm().


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