ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
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

 $node_id
 $portfolio_id
 $access_handler

Detailed Description

Constructor & Destructor Documentation

ilSharedResourceGUI::__construct ( )

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

References $_GET, and $ilCtrl.

{
global $ilCtrl;
$ilCtrl->saveParameter($this, "wsp_id");
$ilCtrl->saveParameter($this, "prt_id");
$this->node_id = $_GET["wsp_id"];
$this->portfolio_id = $_GET["prt_id"];
}

Member Function Documentation

ilSharedResourceGUI::cancelPassword ( )
protected

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

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

{
global $ilUser;
if($ilUser->getId() && $ilUser->getId() != ANONYMOUS_USER_ID)
{
if($this->node_id)
{
include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
$tree = new ilWorkspaceTree($ilUser->getId());
$owner = $tree->lookupOwner($this->node_id);
ilUtil::redirect("ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToWorkspace&dsh=".$owner);
}
else
{
include_once "Services/Portfolio/classes/class.ilObjPortfolio.php";
$prtf = new ilObjPortfolio($this->portfolio_id, false);
$owner = $prtf->getOwner();
ilUtil::redirect("ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToPortfolio&dsh=".$owner);
}
}
}

+ Here is the call graph for this function:

ilSharedResourceGUI::checkPassword ( )
protected

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

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

{
global $ilDB, $lng;
$lng->loadLanguageModule("wsp");
$form = $this->initPasswordForm();
if($form->checkInput())
{
$input = md5($form->getInput("password"));
if($this->node_id)
{
include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
}
else
{
include_once "Services/Portfolio/classes/class.ilPortfolioAccessHandler.php";
$password = ilPortfolioAccessHandler::getSharedNodePassword($this->portfolio_id);
}
if($input == $password)
{
if($this->node_id)
{
$this->redirectToResource($this->node_id);
}
else
{
$this->redirectToResource($this->portfolio_id, true);
}
}
else
{
$item = $form->getItemByPostVar("password");
$item->setAlert($lng->txt("wsp_invalid_password"));
ilUtil::sendFailure($lng->txt("form_input_not_valid"));
}
}
$form->setValuesByPost();
$this->passwordForm($form);
}

+ Here is the call graph for this function:

ilSharedResourceGUI::executeCommand ( )

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

References $access_handler, $cmd, $ilCtrl, $ilUser, $lng, $tpl, ilObject\_lookupTitle(), ilUserUtil\getNamePresentation(), and ilObject2GUI\WORKSPACE_NODE_ID.

{
global $ilCtrl, $tpl, $ilMainMenu, $ilLocator, $ilUser, $lng;
$next_class = $ilCtrl->getNextClass($this);
$cmd = $ilCtrl->getCmd();
$tpl->getStandardTemplate();
// #8509
$ilMainMenu->setActive("desktop");
// #12096
if($ilUser->getId() != ANONYMOUS_USER_ID &&
$next_class &&
!in_array($next_class, array("ilobjbloggui", "ilobjportfoliogui")))
{
include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
$tree = new ilWorkspaceTree($ilUser->getId());
$owner_id = $tree->lookupOwner($this->node_id);
$obj_id = $tree->lookupObjectId($this->node_id);
$lng->loadLanguageModule("wsp");
// see ilPersonalWorkspaceGUI
if($owner_id != $ilUser->getId())
{
$ilCtrl->setParameterByClass("ilpersonaldesktopgui", "dsh", $owner_id);
$link = $ilCtrl->getLinkTargetByClass("ilpersonaldesktopgui", "jumptoworkspace");
$ilLocator->addItem($lng->txt("wsp_tab_shared"), $link);
include_once "Services/User/classes/class.ilUserUtil.php";
$ilLocator->addItem(ilUserUtil::getNamePresentation($owner_id), $link);
}
else
{
$link = $ilCtrl->getLinkTargetByClass("ilpersonaldesktopgui", "jumptoworkspace");
$ilLocator->addItem($lng->txt("wsp_tab_personal"), $link);
}
$link = $access_handler->getGotoLink($this->node_id, $obj_id);
$ilLocator->addItem(ilObject::_lookupTitle($obj_id), $link);
$tpl->setLocator($ilLocator);
}
switch($next_class)
{
case "ilobjbloggui":
include_once "Modules/Blog/classes/class.ilObjBlogGUI.php";
$gui = new ilObjBlogGUI($this->node_id, ilObject2GUI::WORKSPACE_NODE_ID);
$ilCtrl->forwardCommand($gui);
break;
case "ilobjfilegui":
include_once "Modules/File/classes/class.ilObjFileGUI.php";
$gui = new ilObjFileGUI($this->node_id, ilObject2GUI::WORKSPACE_NODE_ID);
$ilCtrl->forwardCommand($gui);
break;
case "ilobjtestverificationgui":
include_once "Modules/Test/classes/class.ilObjTestVerificationGUI.php";
$ilCtrl->forwardCommand($gui);
break;
case "ilobjexerciseverificationgui":
include_once "Modules/Exercise/classes/class.ilObjExerciseVerificationGUI.php";
$ilCtrl->forwardCommand($gui);
break;
case "ilobjlinkresourcegui":
include_once "Modules/WebResource/classes/class.ilObjLinkResourceGUI.php";
$ilCtrl->forwardCommand($gui);
break;
case "ilobjportfoliogui":
include_once "Services/Portfolio/classes/class.ilObjPortfolioGUI.php";
$gui = new ilObjPortfolioGUI();
$ilCtrl->forwardCommand($gui);
break;
default:
if(!$cmd)
{
$cmd = "process";
}
$this->$cmd();
}
$tpl->show();
}

+ Here is the call graph for this function:

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

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

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

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

{
global $ilUser, $ilSetting;
// if we have current user - check with normal access handler
if($ilUser->getId() != ANONYMOUS_USER_ID)
{
if(!$a_is_portfolio)
{
include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
$tree = new ilWorkspaceTree($ilUser->getId());
}
else
{
include_once "Services/Portfolio/classes/class.ilPortfolioAccessHandler.php";
}
if($access_handler->checkAccess("read", "", $a_node_id))
{
return true;
}
}
// not logged in yet or no read access
include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessGUI.php";
if(!$a_is_portfolio)
{
include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
}
else
{
// #12059
if (!$ilSetting->get('user_portfolios'))
{
return false;
}
// #12039
include_once "Services/Portfolio/classes/class.ilObjPortfolio.php";
$prtf = new ilObjPortfolio($a_node_id, false);
if(!$prtf->isOnline())
{
return false;
}
include_once "Services/Portfolio/classes/class.ilPortfolioAccessHandler.php";
}
// object is "public"
if(in_array(ilWorkspaceAccessGUI::PERMISSION_ALL, $shared))
{
return true;
}
// password protected
{
if(!$a_is_portfolio)
{
ilUtil::redirect("ilias.php?baseClass=ilSharedResourceGUI&cmd=passwordForm&wsp_id=".$a_node_id);
}
else
{
ilUtil::redirect("ilias.php?baseClass=ilSharedResourceGUI&cmd=passwordForm&prt_id=".$a_node_id);
}
}
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSharedResourceGUI::initPasswordForm ( )
protected

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

References $ilCtrl, $ilUser, $lng, ilObject\_lookupTitle(), ilWorkspaceAccessHandler\getObjectDataFromNode(), and ilPasswordInputGUI\setRetype().

Referenced by checkPassword(), and passwordForm().

{
global $ilCtrl, $lng, $ilUser, $ilTabs;
if($this->node_id)
{
include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
$object_data = ilWorkspaceAccessHandler::getObjectDataFromNode($this->node_id);
}
else
{
$object_data["title"] = ilObject::_lookupTitle($this->portfolio_id);
}
include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($ilCtrl->getFormAction($this, "checkPassword"));
$form->setTitle($lng->txt("wsp_password_for").": ".$object_data["title"]);
$password = new ilPasswordInputGUI($lng->txt("password"), "password");
$password->setRetype(false);
$password->setRequired(true);
$form->addItem($password);
$form->addCommandButton("checkPassword", $lng->txt("submit"));
if($ilUser->getId() && $ilUser->getId() != ANONYMOUS_USER_ID)
{
$ilTabs->setBackTarget($lng->txt("back"), $ilCtrl->getLinkTarget($this, "cancelPassword"));
$form->addCommandButton("cancelPassword", $lng->txt("cancel"));
}
return $form;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSharedResourceGUI::passwordForm (   $form = null)
protected

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

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

Referenced by checkPassword().

{
global $tpl, $lng;
$lng->loadLanguageModule("wsp");
$tpl->setTitle($lng->txt("wsp_password_protected_resource"));
$tpl->setDescription($lng->txt("wsp_password_protected_resource_info"));
if(!$form)
{
$form = $this->initPasswordForm();
}
$tpl->setContent($form->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSharedResourceGUI::process ( )
protected

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

References exit, and redirectToResource().

{
if(!$this->node_id && !$this->portfolio_id)
{
exit("invalid call");
}
// if already logged in, we need to re-check for public password
if($this->node_id)
{
if(!self::hasAccess($this->node_id))
{
exit("no permission");
}
$this->redirectToResource($this->node_id);
}
else
{
if(!self::hasAccess($this->portfolio_id, true))
{
exit("no permission");
}
$this->redirectToResource($this->portfolio_id, true);
}
}

+ Here is the call graph for this function:

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

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

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

Referenced by checkPassword(), and process().

{
global $ilCtrl, $objDefinition;
if(!$a_is_portfolio)
{
include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
if(!$object_data["obj_id"])
{
exit("invalid object");
}
}
else
{
if(!ilObject::_lookupType($a_node_id, false))
{
exit("invalid object");
}
$object_data["obj_id"] = $a_node_id;
$object_data["type"] = "prtf";
}
$class = $objDefinition->getClassName($object_data["type"]);
$gui = "ilobj".$class."gui";
switch($object_data["type"])
{
case "blog":
$ilCtrl->setParameterByClass($gui, "wsp_id", $a_node_id);
$ilCtrl->setParameterByClass($gui, "gtp", $_GET["gtp"]);
$ilCtrl->redirectByClass($gui, "preview");
case "tstv":
case "excv":
$ilCtrl->setParameterByClass($gui, "wsp_id", $a_node_id);
$ilCtrl->redirectByClass($gui, "deliver");
case "file":
case "webr":
$ilCtrl->setParameterByClass($gui, "wsp_id", $a_node_id);
$ilCtrl->redirectByClass($gui);
case "prtf":
$ilCtrl->setParameterByClass($gui, "prt_id", $a_node_id);
$ilCtrl->redirectByClass($gui, "preview");
default:
exit("invalid object type");
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilSharedResourceGUI::$access_handler
protected

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

Referenced by executeCommand(), and hasAccess().

ilSharedResourceGUI::$node_id
protected

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

ilSharedResourceGUI::$portfolio_id
protected

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


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