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

content/classes/class.ilObjGlossaryAccess.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 ilObjGlossaryAccess extends ilObjectAccess
00036 {
00050         function _checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id = "")
00051         {
00052                 global $ilUser, $lng, $rbacsystem, $ilAccess;
00053 
00054                 if ($a_user_id == "")
00055                 {
00056                         $a_user_id = $ilUser->getId();
00057                 }
00058 
00059                 switch ($a_cmd)
00060                 {
00061                         case "view":
00062 
00063                                 if(!ilObjGlossaryAccess::_lookupOnline($a_obj_id)
00064                                         && !$rbacsystem->checkAccessOfUser($a_user_id,'write',$a_ref_id))
00065                                 {
00066                                         $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
00067                                         return false;
00068                                 }
00069                                 break;
00070                 }
00071 
00072                 switch ($a_permission)
00073                 {
00074                         case "visible":
00075                                 if (!ilObjGlossaryAccess::_lookupOnline($a_obj_id) &&
00076                                         (!$rbacsystem->checkAccessOfUser($a_user_id,'write', $a_ref_id)))
00077                                 {
00078                                         $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
00079                                         return false;
00080                                 }
00081                                 break;
00082                 }
00083 
00084 
00085                 return true;
00086         }
00087         
00100         function _getCommands()
00101         {
00102                 $commands = array
00103                 (
00104                         array("permission" => "read", "cmd" => "view", "lang_var" => "show",
00105                                 "default" => true),
00106                         array("permission" => "write", "cmd" => "edit", "lang_var" => "edit"),
00107                 );
00108                 
00109                 return $commands;
00110         }
00111 
00112         //
00113         // access relevant methods
00114         //
00115 
00119         function _lookupOnline($a_id)
00120         {
00121                 global $ilDB;
00122 
00123                 $q = "SELECT * FROM glossary WHERE id = '".$a_id."'";
00124                 $lm_set = $ilDB->query($q);
00125                 $lm_rec = $lm_set->fetchRow(DB_FETCHMODE_ASSOC);
00126 
00127                 return ilUtil::yn2tf($lm_rec["online"]);
00128         }
00129 
00130 
00131 
00132 }
00133 
00134 ?>

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