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

Services/User/classes/class.ilLocalUser.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 /*
00025 * Helper class for local user accounts (in categories)
00026 *
00027 * @author Stefan Meyer <smeyer@databay.de>
00028 * @version $Id: class.ilLocalUser.php 14577 2007-08-23 11:29:47Z smeyer $
00029 *
00030 */
00031 
00032 class ilLocalUser
00033 {
00034         var $db;
00035         
00036         var $parent_id;
00037                 
00044         function ilLocalUser($a_parent_id)
00045         {
00046                 global $ilDB;
00047 
00048                 $this->db =& $ilDB;
00049                 $this->parent_id = $a_parent_id;
00050                 
00051         }
00052 
00053         function setParentId($a_parent_id)
00054         {
00055                 $this->parent_id = $a_parent_id;
00056         }
00057         function getParentId()
00058         {
00059                 return $this->parent_id;
00060         }
00061 
00062         // STATIC
00063         function _getUserData($a_filter)
00064         {
00065                 include_once './Services/User/classes/class.ilObjUser.php';
00066 
00067                 $users_data = ilObjUser::_getAllUserData(array("login","firstname","lastname","time_limit_owner"),-1);
00068 
00069                 foreach($users_data as $usr_data)
00070                 {
00071                         if(!$a_filter or $a_filter == $usr_data['time_limit_owner'])
00072                         {
00073                                 $users[] = $usr_data;
00074                         }
00075                 }
00076                 return $users ? $users : array();
00077         }
00078 
00079         function _getFolderIds()
00080         {
00081                 global $ilDB,$rbacsystem;
00082 
00083                 $query = "SELECT DISTINCT(time_limit_owner) as parent_id FROM usr_data ";
00084 
00085                 $res = $ilDB->query($query);
00086                 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00087                 {
00088                         if($rbacsystem->checkAccess('read_users',$row->parent_id) or $rbacsystem->checkAccess('cat_administrate_users',$row->parent_id))
00089                         {
00090                                 if($row->parent_id)
00091                                 {
00092                                         $parent[] = $row->parent_id;
00093                                 }
00094                         }
00095                 }
00096                 return $parent ? $parent : array();
00097         }
00098         function _getAllUserIds($a_filter = 0)
00099         {
00100                 global $ilDB;
00101                 switch($a_filter)
00102                 {
00103                         case 0:
00104                                 if(ilLocalUser::_getFolderIds())
00105                                 {
00106                                         $where = "WHERE time_limit_owner IN ";
00107                                         $where .= '(';
00108                                         $where .= implode(",",ilUtil::quoteArray(ilLocalUser::_getFolderIds()));
00109                                         $where .= ')';
00110 
00111                                 }
00112                                 else
00113                                 {
00114                                         $where = "WHERE time_limit_owner IN ('')";
00115                                 }
00116 
00117                                 break;
00118 
00119                         default:
00120                                 $where = "WHERE time_limit_owner = ".$ilDB->quote($a_filter)." ";
00121 
00122                                 break;
00123                 }
00124                 
00125                 $query = "SELECT usr_id FROM usr_data ".$where;
00126                 $res = $ilDB->query($query);
00127 
00128                 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00129                 {
00130                         $users[] = $row->usr_id;
00131                 }
00132 
00133                 return $users ? $users : array();
00134         }
00135 
00136         function _getUserFolderId()
00137         {
00138                 return 7;
00139         }
00140                 
00141                         
00142 
00143                 
00144 
00145 } // CLASS ilLocalUser
00146 ?>

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