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

Services/Language/classes/class.ilObjLanguageAccess.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 
00037 class ilObjLanguageAccess
00038 {
00048         function _checkTranslate()
00049         {
00050                 global $ilUser, $rbacsystem;
00051 
00052                 if ($ilUser->getId())
00053                 {
00054                         $ref_id = ilObjLanguageAccess::_lookupLangFolderRefId();
00055                         return $rbacsystem->checkAccess("write", (int) $ref_id);
00056                 }
00057                 return false;
00058         }
00059 
00060 
00069         function _checkMaintenance()
00070         {
00071                 global $ilUser, $rbacsystem;
00072 
00073                 if (!$ilUser->getId())
00074                 {
00075                         return false;
00076                 }
00077                 else
00078                 {
00079                         $ref_id = ilObjLanguageAccess::_lookupLangFolderRefId();
00080                         return $rbacsystem->checkAccess("read,visible", (int) $ref_id);
00081                 }
00082         }
00083 
00084 
00091         function _lookupLangFolderRefId()
00092         {
00093                 global $ilDB;
00094                 
00095                 $q = "SELECT ref_id FROM object_reference r, object_data d".
00096                 " WHERE r.obj_id = d.obj_id AND d.type='lngf'";
00097                 $set = $ilDB->query($q);
00098                 $row = $set->fetchRow(DB_FETCHMODE_ASSOC);
00099                 return $row['ref_id'];
00100         }
00101         
00102 
00103 
00111         function _lookupId($a_key)
00112         {
00113                 global $ilDB;
00114 
00115                 $q = "SELECT obj_id FROM object_data ".
00116                 " WHERE type = 'lng' ".
00117                 " AND title = ".$ilDB->quote($a_key);
00118                 $set = $ilDB->query($q);
00119                 $row = $set->fetchRow(DB_FETCHMODE_ASSOC);
00120                 return $row['obj_id'];
00121         }
00122 }
00123 
00124 ?>

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