• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

Modules/MediaCast/classes/class.ilObjMediaCastAccess.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2006 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00024 include_once("classes/class.ilObjectAccess.php");
00025 
00035 class ilObjMediaCastAccess extends ilObjectAccess
00036 {
00037 
00050         function _getCommands()
00051         {
00052                 $commands = array
00053                 (
00054                         array("permission" => "read", "cmd" => "listItems", "lang_var" => "show",
00055                                 "default" => true),
00056                         array("permission" => "write", "cmd" => "editSettings", "lang_var" => "edit")
00057                 );
00058                 
00059                 return $commands;
00060         }
00061         
00074         function _checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id = "")
00075         {
00076                 global $ilUser, $lng, $rbacsystem, $ilAccess;
00077 
00078                 if ($a_user_id == "")
00079                 {
00080                         $a_user_id = $ilUser->getId();
00081                 }
00082 
00083                 switch ($a_cmd)
00084                 {
00085                         case "listItems":
00086 
00087                                 if(!ilObjMediaCastAccess::_lookupOnline($a_obj_id)
00088                                         && !$rbacsystem->checkAccessOfUser($a_user_id,'write',$a_ref_id))
00089                                 {
00090                                         $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
00091                                         return false;
00092                                 }
00093                                 break;
00094                                 
00095                         // for permission query feature
00096                         case "infoScreen":
00097                                 if(!ilObjMediaCastAccess::_lookupOnline($a_obj_id))
00098                                 {
00099                                         $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
00100                                 }
00101                                 else
00102                                 {
00103                                         $ilAccess->addInfoItem(IL_STATUS_MESSAGE, $lng->txt("online"));
00104                                 }
00105                                 break;
00106 
00107                 }
00108                 switch ($a_permission)
00109                 {
00110                         case "read":
00111                         case "visible":
00112                                 if (!ilObjMediaCastAccess::_lookupOnline($a_obj_id) &&
00113                                         (!$rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id)))
00114                                 {
00115                                         $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
00116                                         return false;
00117                                 }
00118                                 break;
00119                 }
00120 
00121                 return true;
00122         }
00123 
00127         function _checkGoto($a_target)
00128         {
00129                 global $ilAccess;
00130                 
00131                 $t_arr = explode("_", $a_target);
00132 
00133                 if ($t_arr[0] != "mcst" || ((int) $t_arr[1]) <= 0)
00134                 {
00135                         return false;
00136                 }
00137 
00138                 if ($ilAccess->checkAccess("read", "", $t_arr[1]))
00139                 {
00140                         return true;
00141                 }
00142                 return false;
00143         }
00144         
00150         function _lookupOnline($a_id)
00151         {
00152                 global $ilDB;
00153 
00154                 $q = "SELECT * FROM il_media_cast_data WHERE id = ".$ilDB->quote($a_id);
00155                 $mc_set = $ilDB->query($q);
00156                 $mc_rec = $mc_set->fetchRow(DB_FETCHMODE_ASSOC);
00157 
00158                 return $mc_rec["online"];
00159         }
00160 
00166         function _lookupPublicFiles($a_id)
00167         {
00168                 global $ilDB;
00169 
00170                 $q = "SELECT * FROM il_media_cast_data WHERE id = ".$ilDB->quote($a_id);
00171                 $mc_set = $ilDB->query($q);
00172                 $mc_rec = $mc_set->fetchRow(DB_FETCHMODE_ASSOC);
00173 
00174                 return $mc_rec["public_files"];
00175         }
00176 
00177 }
00178 
00179 ?>

Generated on Fri Dec 13 2013 17:56:52 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1