Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 include_once("classes/class.ilObjectAccess.php");
00025
00035 class ilObjSAHSLearningModuleAccess extends ilObjectAccess
00036 {
00049 function _checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id = "")
00050 {
00051 global $ilUser, $lng, $rbacsystem, $ilAccess;
00052
00053 if ($a_user_id == "")
00054 {
00055 $a_user_id = $ilUser->getId();
00056 }
00057
00058 switch ($a_cmd)
00059 {
00060 case "view":
00061
00062 if(!ilObjSAHSLearningModuleAccess::_lookupOnline($a_obj_id)
00063 && !$rbacsystem->checkAccessOfUser($a_user_id,'write',$a_ref_id))
00064 {
00065 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
00066 return false;
00067 }
00068 break;
00069 }
00070
00071 switch ($a_permission)
00072 {
00073 case "visible":
00074 if (!ilObjSAHSLearningModuleAccess::_lookupOnline($a_obj_id) &&
00075 (!$rbacsystem->checkAccessOfUser($a_user_id,'write', $a_ref_id)))
00076 {
00077 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
00078 return false;
00079 }
00080 break;
00081 }
00082
00083
00084 return true;
00085 }
00086
00099 function _getCommands()
00100 {
00101 $commands = array
00102 (
00103 array("permission" => "read", "cmd" => "view", "lang_var" => "show",
00104 "default" => true),
00105 array("permission" => "write", "cmd" => "edit", "lang_var" => "edit"),
00106 );
00107
00108 return $commands;
00109 }
00110
00111
00112
00113
00114
00118 function _lookupOnline($a_id)
00119 {
00120 global $ilDB;
00121
00122 $q = "SELECT * FROM sahs_lm WHERE id = '".$a_id."'";
00123 $set = $ilDB->query($q);
00124 $rec = $set->fetchRow(DB_FETCHMODE_ASSOC);
00125
00126 return ilUtil::yn2tf($rec["online"]);
00127 }
00128
00132 function _checkGoto($a_target)
00133 {
00134 global $ilAccess;
00135
00136 $t_arr = explode("_", $a_target);
00137
00138 if ($t_arr[0] != "sahs" || ((int) $t_arr[1]) <= 0)
00139 {
00140 return false;
00141 }
00142
00143 if ($ilAccess->checkAccess("visible", "", $t_arr[1]))
00144 {
00145 return true;
00146 }
00147 return false;
00148 }
00149
00150
00151 }
00152
00153 ?>