ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjiLincClassroomAccess.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 include_once("./classes/class.ilObjectAccess.php");
25 
36 {
37 
50  function _checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id = "")
51  {
52  global $ilUser, $lng, $rbacsystem, $ilAccess, $ilias;
53 
54  $user_id = $ilUser->getId();
55  $class_id = $a_ref_id;
56  $course_ref_id = $a_obj_id;
57  $class_arr = $a_user_id;
58 //var_dump($a_cmd,$a_permission,$a_ref_id,$a_obj_id,$a_user_id);
64  switch ($a_cmd)
65  {
66 
67  }
68 
69  switch ($a_permission)
70  {
71  case 'join':
72  // Cannot join closed classrooms
73  if (!$class_arr['alwaysopen'])
74  {
75  return false;
76  }
77 
78  // non members cannot join
79  include_once ('./Modules/ILinc/classes/class.ilObjiLincCourse.php');
80 
81  if (!ilObjiLincCourse::_isMember($user_id,$a_ref_id))
82  {
83  return false;
84  }
85  break;
86 
87  case "write":
88  case "delete":
89  if(!$rbacsystem->checkAccessOfUser($user_id,'write',$a_ref_id,"ilca"))
90  {
91  return false;
92  }
93  break;
94  }
95 
96  return true;
97  }
98 
111  function _getCommands()
112  {
113  $commands = array
114  (
115  array("permission" => "join", "cmd" => "joinClassroom", "lang_var" => "join", "frame" => "_blank"),
116  array("permission" => "write", "cmd" => "editClassroom", "lang_var" => "edit"),
117  array("permission" => "delete", "cmd" => "removeClassroom", "lang_var" => "delete")
118  );
119 
120  return $commands;
121  }
122 }
123 
124 ?>