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
00034 class ilObjCourseAccess extends ilObjectAccess
00035 {
00048 function _checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id = "")
00049 {
00050 global $ilUser, $lng, $rbacsystem, $ilAccess, $ilias;
00051
00052 if ($a_user_id == "")
00053 {
00054 $a_user_id = $ilUser->getId();
00055 }
00056
00057 switch ($a_cmd)
00058 {
00059 case "view":
00060 include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
00061 if(ilCourseParticipants::_isBlocked($a_obj_id,$a_user_id) and ilCourseParticipants::_isParticipant($a_ref_id,$a_user_id))
00062 {
00063 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("crs_status_blocked"));
00064 return false;
00065 }
00066
00067
00068
00069
00070
00071
00072
00073 break;
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089 case 'join':
00090
00091 include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
00092 if(ilCourseParticipants::_isParticipant($a_ref_id,$a_user_id))
00093 {
00094 return false;
00095 }
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105 break;
00106 }
00107
00108 switch ($a_permission)
00109 {
00110 case "visible":
00111 include_once './Modules/Course/classes/class.ilObjCourse.php';
00112 $active = ilObjCourse::_isActivated($a_obj_id);
00113 $registration = ilObjCourse::_registrationEnabled($a_obj_id);
00114 $tutor = $rbacsystem->checkAccessOfUser($a_user_id,'write',$a_ref_id);
00115
00116 if(!$active)
00117 {
00118 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
00119 }
00120 if(!$tutor and !$active)
00121 {
00122 return false;
00123 }
00124 break;
00125
00126 case 'read':
00127 $tutor = $rbacsystem->checkAccessOfUser($a_user_id,'write',$a_ref_id);
00128 if($tutor)
00129 {
00130 return true;
00131 }
00132 include_once 'Modules/Course/classes/class.ilObjCourse.php';
00133 $active = ilObjCourse::_isActivated($a_obj_id);
00134
00135 if(!$active)
00136 {
00137 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
00138 return false;
00139 }
00140
00141 include_once('Modules/Course/classes/class.ilCourseParticipants.php');
00142 if(ilCourseParticipants::_isBlocked($a_obj_id,$a_user_id) and ilCourseParticipants::_isParticipant($a_ref_id,$a_user_id))
00143 {
00144 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("crs_status_blocked"));
00145 return false;
00146 }
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156 break;
00157 }
00158 return true;
00159 }
00160
00173 function _getCommands()
00174 {
00175 $commands = array
00176 (
00177 array("permission" => "read", "cmd" => "", "lang_var" => "view",
00178 "default" => true),
00179 array("permission" => "join", "cmd" => "join", "lang_var" => "join"),
00180 array("permission" => "write", "cmd" => "edit", "lang_var" => "edit")
00181 );
00182
00183 return $commands;
00184 }
00185
00189 function _checkGoto($a_target)
00190 {
00191 global $ilAccess;
00192
00193 $t_arr = explode("_", $a_target);
00194
00195 if ($t_arr[0] != "crs" || ((int) $t_arr[1]) <= 0)
00196 {
00197 return false;
00198 }
00199
00200 if ($ilAccess->checkAccess("read", "", $t_arr[1]) ||
00201 $ilAccess->checkAccess("visible", "", $t_arr[1]))
00202 {
00203 return true;
00204 }
00205 return false;
00206 }
00207
00208 }
00209
00210 ?>