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

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

Generated on Fri Dec 13 2013 11:57:54 for ILIAS Release_3_6_x_branch .rev 46809 by  doxygen 1.7.1