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

content/classes/class.ilObjSAHSLearningModuleAccess.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 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 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         // access relevant methods
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 
00129 
00130 
00131 }
00132 
00133 ?>

Generated on Fri Dec 13 2013 10:18:29 for ILIAS Release_3_5_x_branch .rev 46805 by  doxygen 1.7.1