ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilObjPortfolioTemplateAccess.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once("./Services/Object/classes/class.ilObjectAccess.php");
5
14{
15 public function _getCommands()
16 {
17 $commands = array
18 (
19 array("permission" => "read", "cmd" => "preview", "lang_var" => "preview", "default" => true),
20 array("permission" => "write", "cmd" => "view", "lang_var" => "edit"),
21 array("permission" => "read", "cmd" => "createfromtemplate", "lang_var" => "prtf_create_portfolio_from_template"),
22 // array("permission" => "write", "cmd" => "export", "lang_var" => "export_html")
23 );
24
25 return $commands;
26 }
27
28 public function _checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id = "")
29 {
30 global $ilUser, $lng, $rbacsystem, $ilAccess;
31
32 if ($a_user_id == "")
33 {
34 $a_user_id = $ilUser->getId();
35 }
36
37 switch ($a_cmd)
38 {
39 case "view":
40 if(!self::_lookupOnline($a_obj_id)
41 && !$rbacsystem->checkAccessOfUser($a_user_id,'write',$a_ref_id))
42 {
43 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
44 return false;
45 }
46 break;
47
48 // for permission query feature
49 case "infoScreen":
50 if(!self::_lookupOnline($a_obj_id))
51 {
52 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
53 }
54 else
55 {
56 $ilAccess->addInfoItem(IL_STATUS_MESSAGE, $lng->txt("online"));
57 }
58 break;
59
60 }
61
62 switch($a_permission)
63 {
64 case "read":
65 case "visible":
66 if (!self::_lookupOnline($a_obj_id) &&
67 (!$rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id)))
68 {
69 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
70 return false;
71 }
72 break;
73 }
74
75 return true;
76 }
77
78 public function _lookupOnline($a_id)
79 {
80 include_once "Modules/Portfolio/classes/class.ilObjPortfolioTemplate.php";
82 }
83
87 public function _checkGoto($a_target)
88 {
89 global $ilAccess;
90
91 $t_arr = explode("_", $a_target);
92
93 if ($t_arr[0] != "prtt" || ((int) $t_arr[1]) <= 0)
94 {
95 return false;
96 }
97
98 if ($ilAccess->checkAccess("read", "", $t_arr[1]))
99 {
100 return true;
101 }
102 return false;
103 }
104}
105
106?>
const IL_NO_OBJECT_ACCESS
static lookupOnline($a_id)
Is online?
Class ilObjPortfolioTemplateAccess.
_checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id="")
Checks wether a user may invoke a command or not (this method is called by ilAccessHandler::checkAcce...
_checkGoto($a_target)
check whether goto script will succeed
Class ilObjectAccess.
global $lng
Definition: privfeed.php:40
global $ilUser
Definition: imgupload.php:15