ILIAS  trunk Revision v12.0_alpha-1329-g1094ddb0c33
ilSharedResourceGUI Class Reference

Workspace deep link handler GUI. More...

+ Inheritance diagram for ilSharedResourceGUI:
+ Collaboration diagram for ilSharedResourceGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 

Static Public Member Functions

static hasAccess (int $a_node_id, bool $a_is_portfolio=false)
 

Protected Member Functions

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

Protected Attributes

ilCtrl $ctrl
 
ilGlobalTemplateInterface $tpl
 
ilLocatorGUI $locator
 
ilObjUser $user
 
ilLanguage $lng
 
ilObjectDefinition $obj_definition
 
ilTabsGUI $tabs
 
int $node_id
 
int $portfolio_id
 
StandardGUIRequest $request
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilSharedResourceGUI::__construct ( )

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

43 {
44 global $DIC;
45
46 $this->ctrl = $DIC->ctrl();
47 $this->tpl = $DIC->ui()->mainTemplate();
48 $this->locator = $DIC["ilLocator"];
49 $this->user = $DIC->user();
50 $this->lng = $DIC->language();
51 $this->obj_definition = $DIC["objDefinition"];
52 $this->tabs = $DIC->tabs();
53 $ilCtrl = $DIC->ctrl();
54
55 $this->request = new StandardGUIRequest(
56 $DIC->http(),
57 $DIC->refinery()
58 );
59
60 $ilCtrl->saveParameter($this, "wsp_id");
61 $ilCtrl->saveParameter($this, "prt_id");
62 $this->node_id = $this->request->getWspId();
63 $this->portfolio_id = $this->request->getPrtId();
64 }
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\locator(), ILIAS\Repository\tabs(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ cancelPassword()

ilSharedResourceGUI::cancelPassword ( )
protected

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

333 : void
334 {
335 $ilUser = $this->user;
336
337 if ($ilUser->getId() && $ilUser->getId() != ANONYMOUS_USER_ID) {
338 if ($this->node_id) {
339 $tree = new ilWorkspaceTree($ilUser->getId());
340 $owner = $tree->lookupOwner($this->node_id);
341 ilUtil::redirect("ilias.php?baseClass=ilDashboardGUI&cmd=jumpToWorkspace&dsh=" . $owner);
342 } else {
343 $prtf = new ilObjPortfolio($this->portfolio_id, false);
344 $owner = $prtf->getOwner();
345 ilUtil::redirect("ilias.php?baseClass=ilDashboardGUI&cmd=jumpToPortfolio&dsh=" . $owner);
346 }
347 }
348 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static redirect(string $a_script)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const ANONYMOUS_USER_ID
Definition: constants.php:27

References ANONYMOUS_USER_ID, and ilUtil\redirect().

+ Here is the call graph for this function:

◆ checkPassword()

ilSharedResourceGUI::checkPassword ( )
protected

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

350 : void
351 {
353
354 $lng->loadLanguageModule("wsp");
355
356 $form = $this->initPasswordForm();
357 if ($form->checkInput()) {
358 $input = md5($form->getInput("password"));
359 if ($this->node_id) {
360 $password = ilWorkspaceAccessHandler::getSharedNodePassword($this->node_id);
361 } else {
362 $password = ilPortfolioAccessHandler::getSharedNodePassword($this->portfolio_id);
363 }
364 if ($input == $password) {
365 if ($this->node_id) {
367 $this->redirectToResource($this->node_id);
368 } else {
369 ilPortfolioAccessHandler::keepSharedSessionPassword($this->portfolio_id, $input);
370 $this->redirectToResource($this->portfolio_id, true);
371 }
372 } else {
373 $item = $form->getItemByPostVar("password");
374 $item->setAlert($lng->txt("wsp_invalid_password"));
375 $this->tpl->setOnScreenMessage('failure', $lng->txt("form_input_not_valid"));
376 }
377 }
378
379 $form->setValuesByPost();
380 $this->passwordForm($form);
381 }
loadLanguageModule(string $a_module)
Load language module.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static keepSharedSessionPassword(int $a_node_id, string $a_password)
static getSharedNodePassword(int $a_node_id)
redirectToResource(int $a_node_id, bool $a_is_portfolio=false)
passwordForm(?ilPropertyFormGUI $form=null)
static getSharedNodePassword(int $a_node_id)
static keepSharedSessionPassword(int $a_node_id, string $a_password)

References $lng, ilWorkspaceAccessHandler\getSharedNodePassword(), ilPortfolioAccessHandler\getSharedNodePassword(), ilWorkspaceAccessHandler\keepSharedSessionPassword(), and ilPortfolioAccessHandler\keepSharedSessionPassword().

+ Here is the call graph for this function:

◆ executeCommand()

ilSharedResourceGUI::executeCommand ( )

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

66 : void
67 {
68 $ilCtrl = $this->ctrl;
70 $ilLocator = $this->locator;
71 $ilUser = $this->user;
73
74 $next_class = $ilCtrl->getNextClass($this);
75 $cmd = $ilCtrl->getCmd();
76
78
79 // #12096
80 if ($ilUser->getId() != ANONYMOUS_USER_ID &&
81 $next_class &&
82 !in_array($next_class, array("ilobjbloggui", "ilobjportfoliogui"))) {
83 $tree = new ilWorkspaceTree($ilUser->getId());
84 $access_handler = new ilWorkspaceAccessHandler($tree);
85 $owner_id = $tree->lookupOwner($this->node_id);
86 $obj_id = $tree->lookupObjectId($this->node_id);
87
89
90 // see ilPersonalWorkspaceGUI
91 if ($owner_id != $ilUser->getId()) {
92 $ilCtrl->setParameterByClass("ildashboardgui", "dsh", $owner_id);
93 $link = $ilCtrl->getLinkTargetByClass("ildashboardgui", "jumptoworkspace");
94 $ilLocator->addItem($lng->txt("wsp_tab_shared"), $link);
95
96 $ilLocator->addItem(ilUserUtil::getNamePresentation($owner_id), $link);
97 } else {
98 $link = $ilCtrl->getLinkTargetByClass("ildashboardgui", "jumptoworkspace");
99 $ilLocator->addItem($lng->txt("wsp_tab_personal"), $link);
100 }
101
102 $link = $access_handler->getGotoLink($this->node_id, $obj_id);
103 $ilLocator->addItem(ilObject::_lookupTitle($obj_id), $link);
104 $tpl->setLocator();
105 }
106
107 switch ($next_class) {
108 case "ilobjbloggui":
109 $bgui = new ilObjBlogGUI($this->node_id, ilObject2GUI::WORKSPACE_NODE_ID);
110 $ilCtrl->forwardCommand($bgui);
111 break;
112
113 case "ilobjfilegui":
114 $fgui = new ilObjFileGUI($this->node_id, ilObject2GUI::WORKSPACE_NODE_ID);
115 $ilCtrl->forwardCommand($fgui);
116 break;
117
118 case "ilobjtestverificationgui":
120 $ilCtrl->forwardCommand($tgui);
121 break;
122
123 case "ilobjexerciseverificationgui":
125 $ilCtrl->forwardCommand($egui);
126 break;
127
128 case "ilobjlinkresourcegui":
129 $lgui = new ilObjLinkResourceGUI($this->node_id, ilObject2GUI::WORKSPACE_NODE_ID);
130 $ilCtrl->forwardCommand($lgui);
131 break;
132
133 case "ilobjportfoliogui":
134 $pgui = new ilObjPortfolioGUI($this->portfolio_id);
135 $ilCtrl->forwardCommand($pgui);
136 break;
137
138 default:
139 if (!$cmd) {
140 $cmd = "process";
141 }
142 $this->$cmd();
143 }
144
146 }
@ilCtrl_Calls ilObjBlogGUI: ilBlogPostingGUI, ilWorkspaceAccessGUI @ilCtrl_Calls ilObjBlogGUI: ilInfo...
GUI class for exercise verification.
GUI class for file objects.
Class ilObjLinkResourceGUI.
@ilCtrl_Calls ilObjPortfolioGUI: ilPortfolioPageGUI, ilPageObjectGUI @ilCtrl_Calls ilObjPortfolioGUI:...
GUI class for test verification.
static _lookupTitle(int $obj_id)
ilGlobalTemplateInterface $tpl
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path=null)
Default behaviour is:
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setLocator()
Insert locator.
loadStandardTemplate()
This loads the standard template "tpl.adm_content.html" and "tpl.statusline.html" the CONTENT and STA...
printToStdout(string $part=self::DEFAULT_BLOCK, bool $has_tabs=true, bool $skip_main_menu=false)

References $ctrl, $lng, $locator, $tpl, $user, ilObject\_lookupTitle(), ANONYMOUS_USER_ID, ilUserUtil\getNamePresentation(), ilLanguage\loadLanguageModule(), ILIAS\UICore\GlobalTemplate\loadStandardTemplate(), ILIAS\UICore\GlobalTemplate\printToStdout(), ILIAS\UICore\GlobalTemplate\setLocator(), ilLanguage\txt(), and ilObject2GUI\WORKSPACE_NODE_ID.

+ Here is the call graph for this function:

◆ hasAccess()

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

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

171 : bool {
172 global $DIC;
173 $ilUser = $DIC->user();
174 $ilSetting = $DIC->settings();
175
176 // if we have current user - check with normal access handler
177 if ($ilUser->getId() != ANONYMOUS_USER_ID) {
178 if (!$a_is_portfolio) {
179 $tree = new ilWorkspaceTree($ilUser->getId());
180 $access_handler = new ilWorkspaceAccessHandler($tree);
181 } else {
182 $access_handler = new ilPortfolioAccessHandler();
183 }
184 if ($access_handler->checkAccess("read", "", $a_node_id)) {
185 return true;
186 }
187 }
188
189 if (!$a_is_portfolio) {
190 $shared = ilWorkspaceAccessHandler::_getPermissions($a_node_id);
191 } else {
192 // #12059
193 if (!$ilSetting->get('user_portfolios')) {
194 return false;
195 }
196
197 // #12039
198 if (ilObject::lookupOfflineStatus((int) $a_node_id)) {
199 return false;
200 }
201
202 $shared = ilPortfolioAccessHandler::_getPermissions($a_node_id);
203 }
204
205 // object is "public"
206 if (in_array(ilWorkspaceAccessGUI::PERMISSION_ALL, $shared)) {
207 return true;
208 }
209
210 // password protected
211 if (in_array(ilWorkspaceAccessGUI::PERMISSION_ALL_PASSWORD, $shared)) {
212 if (!$a_is_portfolio) {
213 ilUtil::redirect("ilias.php?baseClass=ilSharedResourceGUI&cmd=passwordForm&wsp_id=" . $a_node_id);
214 } else {
215 ilUtil::redirect("ilias.php?baseClass=ilSharedResourceGUI&cmd=passwordForm&prt_id=" . $a_node_id);
216 }
217 }
218
219 return false;
220 }
static lookupOfflineStatus(int $obj_id)
Lookup offline status using objectDataCache.
Access handler for portfolio NOTE: This file needs to stay in the classes directory,...
static _getPermissions(int $a_node_id)
Get all permissions to node.
static _getPermissions(int $a_node_id)
Get all permissions to node.
global $ilSetting
Definition: privfeed.php:26

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

+ Here is the caller graph for this function:

◆ initPasswordForm()

ilSharedResourceGUI::initPasswordForm ( )
protected

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

301 {
302 $ilCtrl = $this->ctrl;
304 $ilUser = $this->user;
305 $ilTabs = $this->tabs;
306
307 if ($this->node_id) {
308 $object_data = ilWorkspaceAccessHandler::getObjectDataFromNode($this->node_id);
309 } else {
310 $object_data["title"] = ilObject::_lookupTitle($this->portfolio_id);
311 }
312
313 $form = new ilPropertyFormGUI();
314 $form->setFormAction($ilCtrl->getFormAction($this, "checkPassword"));
315 $form->setTitle($lng->txt("wsp_password_for") . ": " . $object_data["title"]);
316
317 $password = new ilPasswordInputGUI($lng->txt("password"), "password");
318 $password->setRetype(false);
319 $password->setRequired(true);
320 $password->setSkipSyntaxCheck(true); // #17757
321 $form->addItem($password);
322
323 $form->addCommandButton("checkPassword", $lng->txt("submit"));
324
325 if ($ilUser->getId() && $ilUser->getId() != ANONYMOUS_USER_ID) {
326 $ilTabs->setBackTarget($lng->txt("back"), $ilCtrl->getLinkTarget($this, "cancelPassword"));
327 $form->addCommandButton("cancelPassword", $lng->txt("cancel"));
328 }
329
330 return $form;
331 }
This class represents a password property in a property form.
This class represents a property form user interface.
static getObjectDataFromNode(int $a_node_id)

References $lng, ilObject\_lookupTitle(), ANONYMOUS_USER_ID, and ilWorkspaceAccessHandler\getObjectDataFromNode().

+ Here is the call graph for this function:

◆ passwordForm()

ilSharedResourceGUI::passwordForm ( ?ilPropertyFormGUI  $form = null)
protected

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

283 : void
284 {
287
288 $lng->loadLanguageModule("wsp");
289
290 $tpl->setTitle($lng->txt("wsp_password_protected_resource"));
291 $tpl->setDescription($lng->txt("wsp_password_protected_resource_info"));
292
293 if (!$form) {
294 $form = $this->initPasswordForm();
295 }
296
297 $tpl->setContent($form->getHTML());
298 }
setDescription(string $a_descr)
Sets description below title in standard template.
setTitle(string $a_title, bool $hidden=false)
Sets title in standard template.
setContent(string $a_html)
Sets content for standard template.

References $lng, ILIAS\UICore\GlobalTemplate\setContent(), ILIAS\UICore\GlobalTemplate\setDescription(), and ILIAS\UICore\GlobalTemplate\setTitle().

+ Here is the call graph for this function:

◆ process()

ilSharedResourceGUI::process ( )
protected

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

148 : void
149 {
150 if (!$this->node_id && !$this->portfolio_id) {
151 throw new ilPermissionException("invalid call");
152 }
153
154 // if already logged in, we need to re-check for public password
155 if ($this->node_id) {
156 if (!self::hasAccess($this->node_id)) {
157 throw new ilPermissionException("no permission");
158 }
159 $this->redirectToResource($this->node_id);
160 } else {
161 if (!self::hasAccess($this->portfolio_id, true)) {
162 throw new ilPermissionException("no permission");
163 }
164 $this->redirectToResource($this->portfolio_id, true);
165 }
166 }

References redirectToResource().

+ Here is the call graph for this function:

◆ redirectToResource()

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

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

225 : void {
226 $ilCtrl = $this->ctrl;
227 $objDefinition = $this->obj_definition;
228
229 if (!$a_is_portfolio) {
230 $object_data = ilWorkspaceAccessHandler::getObjectDataFromNode($a_node_id);
231 if (!$object_data["obj_id"]) {
232 throw new ilPermissionException("invalid object");
233 }
234 } else {
235 if (!ilObject::_lookupType($a_node_id, false)) {
236 throw new ilPermissionException("invalid object");
237 }
238 $object_data["obj_id"] = $a_node_id;
239 $object_data["type"] = "prtf";
240 }
241
242 $class = $objDefinition->getClassName($object_data["type"]);
243 $gui = "ilobj" . $class . "gui";
244
245 switch ($object_data["type"]) {
246 case "blog":
247 $ilCtrl->setParameterByClass($gui, "wsp_id", $a_node_id);
248 $ilCtrl->setParameterByClass($gui, "gtp", $this->request->getBlogGtp());
249 $ilCtrl->setParameterByClass($gui, "edt", $this->request->getBlogEdt());
250 $ilCtrl->redirectByClass($gui, "preview");
251 break;
252
253 case "tstv":
254 case "excv":
255 case "crsv":
256 case "scov":
257 case "cmxv":
258 case "ltiv":
259 $ilCtrl->setParameterByClass($gui, "wsp_id", $a_node_id);
260 $ilCtrl->redirectByClass($gui, "deliver");
261 break;
262
263 case "file":
264 case "webr":
265 $ilCtrl->setParameterByClass($gui, "wsp_id", $a_node_id);
266 $ilCtrl->redirectByClass($gui);
267 break;
268
269 case "prtf":
270 $ilCtrl->setParameterByClass($gui, "prt_id", $a_node_id);
271 $ilCtrl->setParameterByClass($gui, "gtp", $this->request->getBlogGtp());
272 if ($this->request->getBackUrl()) {
273 $ilCtrl->setParameterByClass($gui, "back_url", rawurlencode($this->request->getBackUrl()));
274 }
275 $ilCtrl->redirectByClass($gui, "preview");
276 break;
277
278 default:
279 exit("invalid object type");
280 }
281 }
static _lookupType(int $id, bool $reference=false)
ilObjectDefinition $obj_definition
exit

References ilWorkspaceAccessHandler\getObjectDataFromNode().

Referenced by process().

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

Field Documentation

◆ $ctrl

ilCtrl ilSharedResourceGUI::$ctrl
protected

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

Referenced by executeCommand().

◆ $lng

ilLanguage ilSharedResourceGUI::$lng
protected

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

Referenced by executeCommand().

◆ $locator

ilLocatorGUI ilSharedResourceGUI::$locator
protected

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

Referenced by executeCommand().

◆ $node_id

int ilSharedResourceGUI::$node_id
protected

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

◆ $obj_definition

ilObjectDefinition ilSharedResourceGUI::$obj_definition
protected

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

◆ $portfolio_id

int ilSharedResourceGUI::$portfolio_id
protected

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

◆ $request

StandardGUIRequest ilSharedResourceGUI::$request
protected

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

◆ $tabs

ilTabsGUI ilSharedResourceGUI::$tabs
protected

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

◆ $tpl

ilGlobalTemplateInterface ilSharedResourceGUI::$tpl
protected

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

Referenced by executeCommand().

◆ $user

ilObjUser ilSharedResourceGUI::$user
protected

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

Referenced by executeCommand().


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