ILIAS  release_7 Revision v7.30-3-g800a261c036
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.

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 }
user()
Definition: user.php:4
$_GET["client_id"]
global $DIC
Definition: goto.php:24

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

+ Here is the call graph for this function:

Member Function Documentation

◆ cancelPassword()

ilSharedResourceGUI::cancelPassword ( )
protected

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

375 {
377
378 if ($ilUser->getId() && $ilUser->getId() != ANONYMOUS_USER_ID) {
379 if ($this->node_id) {
380 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
381 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
382 $tree = new ilWorkspaceTree($ilUser->getId());
383 $owner = $tree->lookupOwner($this->node_id);
384 ilUtil::redirect("ilias.php?baseClass=ilDashboardGUI&cmd=jumpToWorkspace&dsh=" . $owner);
385 } else {
386 include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
387 $prtf = new ilObjPortfolio($this->portfolio_id, false);
388 $owner = $prtf->getOwner();
389 ilUtil::redirect("ilias.php?baseClass=ilDashboardGUI&cmd=jumpToPortfolio&dsh=" . $owner);
390 }
391 }
392 }
static redirect($a_script)
Tree handler for personal workspace.
const ANONYMOUS_USER_ID
Definition: constants.php:25
$ilUser
Definition: imgupload.php:18

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

+ Here is the call graph for this function:

◆ checkPassword()

ilSharedResourceGUI::checkPassword ( )
protected

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

395 {
398
399 $lng->loadLanguageModule("wsp");
400
401 $form = $this->initPasswordForm();
402 if ($form->checkInput()) {
403 $input = md5($form->getInput("password"));
404 if ($this->node_id) {
405 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
407 } else {
408 include_once "Modules/Portfolio/classes/class.ilPortfolioAccessHandler.php";
410 }
411 if ($input == $password) {
412 if ($this->node_id) {
414 $this->redirectToResource($this->node_id);
415 } else {
416 ilPortfolioAccessHandler::keepSharedSessionPassword($this->portfolio_id, $input);
417 $this->redirectToResource($this->portfolio_id, true);
418 }
419 } else {
420 $item = $form->getItemByPostVar("password");
421 $item->setAlert($lng->txt("wsp_invalid_password"));
422 ilUtil::sendFailure($lng->txt("form_input_not_valid"));
423 }
424 }
425
426 $form->setValuesByPost();
427 $this->passwordForm($form);
428 }
static keepSharedSessionPassword($a_node_id, $a_password)
redirectToResource($a_node_id, $a_is_portfolio=false)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static keepSharedSessionPassword($a_node_id, $a_password)
$password
Definition: cron.php:14
global $ilDB

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

+ Here is the call graph for this function:

◆ executeCommand()

ilSharedResourceGUI::executeCommand ( )

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

89 {
90 $ilCtrl = $this->ctrl;
92 $ilMainMenu = $this->main_menu;
93 $ilLocator = $this->locator;
96
97 $next_class = $ilCtrl->getNextClass($this);
98 $cmd = $ilCtrl->getCmd();
99
100 $tpl->loadStandardTemplate();
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("ildashboardgui", "dsh", $owner_id);
121 $link = $ilCtrl->getLinkTargetByClass("ildashboardgui", "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("ildashboardgui", "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 $bgui = new ilObjBlogGUI($this->node_id, ilObject2GUI::WORKSPACE_NODE_ID);
139 $ilCtrl->forwardCommand($bgui);
140 break;
141
142 case "ilobjfilegui":
143 $fgui = new ilObjFileGUI($this->node_id, ilObject2GUI::WORKSPACE_NODE_ID);
144 $ilCtrl->forwardCommand($fgui);
145 break;
146
147 case "ilobjtestverificationgui":
149 $ilCtrl->forwardCommand($tgui);
150 break;
151
152 case "ilobjexerciseverificationgui":
154 $ilCtrl->forwardCommand($egui);
155 break;
156
157 case "ilobjlinkresourcegui":
158 include_once "Modules/WebResource/classes/class.ilObjLinkResourceGUI.php";
159 $lgui = new ilObjLinkResourceGUI($this->node_id, ilObject2GUI::WORKSPACE_NODE_ID);
160 $ilCtrl->forwardCommand($lgui);
161 break;
162
163 case "ilobjportfoliogui":
164 include_once "Modules/Portfolio/classes/class.ilObjPortfolioGUI.php";
165 $pgui = new ilObjPortfolioGUI($this->portfolio_id, ilObject2GUI::PORTFOLIO_OBJECT_ID);
166 $ilCtrl->forwardCommand($pgui);
167 break;
168
169 default:
170 if (!$cmd) {
171 $cmd = "process";
172 }
173 $this->$cmd();
174 }
175
176 $tpl->printToStdout();
177 }
Class ilObjBlogGUI.
GUI class for exercise verification.
GUI class for file objects.
Class ilObjLinkResourceGUI.
Portfolio view gui class.
GUI class for test verification.
static _lookupTitle($a_id)
lookup object title
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:
Access handler for personal workspace.

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

+ Here is the call graph for this function:

◆ hasAccess()

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

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

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

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

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initPasswordForm()

ilSharedResourceGUI::initPasswordForm ( )
protected

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

340 {
341 $ilCtrl = $this->ctrl;
344 $ilTabs = $this->tabs;
345
346 if ($this->node_id) {
347 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
348 $object_data = ilWorkspaceAccessHandler::getObjectDataFromNode($this->node_id);
349 } else {
350 $object_data["title"] = ilObject::_lookupTitle($this->portfolio_id);
351 }
352
353 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
354 $form = new ilPropertyFormGUI();
355 $form->setFormAction($ilCtrl->getFormAction($this, "checkPassword"));
356 $form->setTitle($lng->txt("wsp_password_for") . ": " . $object_data["title"]);
357
358 $password = new ilPasswordInputGUI($lng->txt("password"), "password");
359 $password->setRetype(false);
360 $password->setRequired(true);
361 $password->setSkipSyntaxCheck(true); // #17757
362 $form->addItem($password);
363
364 $form->addCommandButton("checkPassword", $lng->txt("submit"));
365
366 if ($ilUser->getId() && $ilUser->getId() != ANONYMOUS_USER_ID) {
367 $ilTabs->setBackTarget($lng->txt("back"), $ilCtrl->getLinkTarget($this, "cancelPassword"));
368 $form->addCommandButton("cancelPassword", $lng->txt("cancel"));
369 }
370
371 return $form;
372 }
This class represents a password property in a property form.
This class represents a property form user interface.

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

Referenced by checkPassword(), and passwordForm().

+ 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 322 of file class.ilSharedResourceGUI.php.

323 {
326
327 $lng->loadLanguageModule("wsp");
328
329 $tpl->setTitle($lng->txt("wsp_password_protected_resource"));
330 $tpl->setDescription($lng->txt("wsp_password_protected_resource_info"));
331
332 if (!$form) {
333 $form = $this->initPasswordForm();
334 }
335
336 $tpl->setContent($form->getHTML());
337 }

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

Referenced by checkPassword().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ process()

ilSharedResourceGUI::process ( )
protected

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

180 {
181 if (!$this->node_id && !$this->portfolio_id) {
182 exit("invalid call");
183 }
184
185 // if already logged in, we need to re-check for public password
186 if ($this->node_id) {
187 if (!self::hasAccess($this->node_id)) {
188 exit("no permission");
189 }
190 $this->redirectToResource($this->node_id);
191 } else {
192 if (!self::hasAccess($this->portfolio_id, true)) {
193 exit("no permission");
194 }
195 $this->redirectToResource($this->portfolio_id, true);
196 }
197 }
exit
Definition: login.php:29

References exit, and redirectToResource().

+ Here is the call graph for this function:

◆ redirectToResource()

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

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

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

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

Referenced by checkPassword(), and process().

+ 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: