phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: phpgwapi/inc class.accounts_ldap.inc.php,1.101.


From: Bettina Gille <address@hidden>
Subject: [Phpgroupware-cvs] CVS: phpgwapi/inc class.accounts_ldap.inc.php,1.101.2.8,1.101.2.9 class.accounts_shared.inc.php,1.48,1.48.2.1 class.arrayfunctions.inc.php,1.1.2.1,1.1.2.2 class.categories.inc.php,1.74.2.16,1.74.2.17
Date: Tue, 17 Dec 2002 19:20:48 -0500

Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv5721

Modified Files:
      Tag: Version-0_9_14-branch
        class.accounts_ldap.inc.php class.accounts_shared.inc.php 
        class.arrayfunctions.inc.php class.categories.inc.php 
Log Message:
update accounts_ldap

Index: class.accounts_ldap.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.accounts_ldap.inc.php,v
retrieving revision 1.101.2.8
retrieving revision 1.101.2.9
diff -C2 -r1.101.2.8 -r1.101.2.9
*** class.accounts_ldap.inc.php 21 Sep 2002 21:55:27 -0000      1.101.2.8
--- class.accounts_ldap.inc.php 18 Dec 2002 00:20:46 -0000      1.101.2.9
***************
*** 334,338 ****
                        }
  
!                       if ($_type == 'both' || $_type == 'accounts')
                        {
                                if(empty($query) || $query == "*")
--- 334,338 ----
                        }
  
!                       if ($_type == 'accounts')
                        {
                                if(empty($query) || $query == "*")
***************
*** 363,367 ****
                                }
                        }
!                       elseif ($_type == 'both' || $_type == 'groups')
                        {
                                if(empty($query) || $query == "*")
--- 363,367 ----
                                }
                        }
!                       elseif ($_type == 'groups')
                        {
                                if(empty($query) || $query == "*")
***************
*** 392,416 ****
                                }
                        }
!                       
!                       // sort the array
!                       $arrayFunctions = 
createObject('phpgwapi.arrayfunctions');
!                       if(empty($order)) $order="account_lid";
!                       $sortedAccounts = 
$arrayFunctions->arfsort($accounts,array($order));
!                       $this->total = count($accounts);
!                       
!                       // return only the wanted accounts
!                       reset($sortedAccounts);
!                       if(is_int($start) && is_int($offset))
                        {
!                               return array_slice($sortedAccounts, $start, 
$offset);
                        }
!                       elseif(is_int($start))
                        {
!                               return array_slice($sortedAccounts, $start, 
$GLOBALS['phpgw_info']["user"]["preferences"]["common"]["maxmatchs"]);
                        }
!                       else
                        {
!                               return $sortedAccounts;   
                        }
                }
  
--- 392,462 ----
                                }
                        }
!                       else
                        {
!                               if(empty($query) || $query == "*")
!                               {
!                                       $filter = 
"(&(gidnumber=*)(phpgwaccounttype=*))";
!                               }
!                               else
!                               {
!                                       $filter = 
"(&(gidnumber=*)(phpgwaccounttype=*)(|(uid=*$query*)(sn=*$query*)(cn=*$query*)(givenname=*$query*)))";
!                               }
!                               $sri = ldap_search($this->ds, 
$this->group_context, $filter);
!                               $allValues = ldap_get_entries($this->ds, $sri);
!                               while (list($null,$allVals) = @each($allValues))
!                               {
!                                       settype($allVals,'array');
! 
!                                       if($allVals['phpgwaccounttype'][0] == 
'u')
!                                       {
!                                               $_uid = @$allVals['uid'][0];
!                                       }
!                                       else
!                                       {
!                                               $_uid = $allVals['cn'][0];
!                                       }
! 
!                                       if 
(!$GLOBALS['phpgw_info']['server']['global_denied_groups'][$_uid] && $_uid)
!                                       {
!                                               $accounts[] = Array(
!                                                       'account_id'            
=> $allVals['gidnumber'][0],
!                                                       'account_lid'           
=> $_uid,
!                                                       'account_type'          
=> $allVals['phpgwaccounttype'][0],
!                                                       'account_firstname'     
=> $allVals['givenname'][0],
!                                                       'account_lastname'      
=> $allVals['sn'][0],
!                                                       'account_status'        
=> $allVals['phpgwaccountstatus'][0]
!                                               );
!                                       }
!                               }
                        }
! 
!                       // sort the array
!                       $arrayFunctions = 
CreateObject('phpgwapi.arrayfunctions');
!                       if(empty($order))
                        {
!                               $order = 'account_lid';
                        }
!                       $sortedAccounts = 
$arrayFunctions->arfsort($accounts,array($order));
!                       $this->total = count($accounts);
! 
!                       // return only the wanted accounts
! 
!                       if (is_array($sortedAccounts))
                        {
!                               reset($sortedAccounts);
!                               if(is_int($start) && is_int($offset))
!                               {
!                                       return array_slice($sortedAccounts, 
$start, $offset);
!                               }
!                               elseif(is_int($start))
!                               {
!                                       return array_slice($sortedAccounts, 
$start, $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']);
!                               }
!                               else
!                               {
!                                       return $sortedAccounts;
!                               }
                        }
+                       return False;
                }
  

Index: class.accounts_shared.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.accounts_shared.inc.php,v
retrieving revision 1.48
retrieving revision 1.48.2.1
diff -C2 -r1.48 -r1.48.2.1
*** class.accounts_shared.inc.php       25 Dec 2001 09:22:31 -0000      1.48
--- class.accounts_shared.inc.php       18 Dec 2002 00:20:46 -0000      1.48.2.1
***************
*** 234,237 ****
--- 234,368 ----
                        return $nextid;
                }
+ 
+               function accounts_popup()
+               {
+                       $start  = $GLOBALS['HTTP_POST_VARS']['start'] ? 
$GLOBALS['HTTP_POST_VARS']['start'] : $GLOBALS['HTTP_GET_VARS']['start'];
+                       $sort   = $GLOBALS['HTTP_POST_VARS']['sort'] ? 
$GLOBALS['HTTP_POST_VARS']['sort'] : $GLOBALS['HTTP_GET_VARS']['sort'];
+                       $order  = $GLOBALS['HTTP_POST_VARS']['order'] ? 
$GLOBALS['HTTP_POST_VARS']['order'] : $GLOBALS['HTTP_GET_VARS']['order'];
+                       $query  = $GLOBALS['HTTP_POST_VARS']['query'] ? 
$GLOBALS['HTTP_POST_VARS']['query'] : $GLOBALS['HTTP_GET_VARS']['query'];
+ 
+                       $this->nextmatchs = CreateObject('phpgwapi.nextmatchs');
+ 
+                       
$GLOBALS['phpgw']->template->set_root($GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi'));
+ 
+                       
$GLOBALS['phpgw']->template->set_file(array('accounts_list_t' => 
'accounts_popup.tpl'));
+                       
$GLOBALS['phpgw']->template->set_block('accounts_list_t','accounts_list','list');
+ 
+                       
$GLOBALS['phpgw']->template->set_var('title',$GLOBALS['phpgw_info']['site_title']);
+                       
$GLOBALS['phpgw']->template->set_var('lang_header',lang('Accounts & Groups'));
+                       
$GLOBALS['phpgw']->template->set_var('charset',$GLOBALS['phpgw']->translation->translate('charset'));
+                       
$GLOBALS['phpgw']->template->set_var('font',$GLOBALS['phpgw_info']['theme']['font']);
+ 
+                       if (! $start) { $start = 0; }
+                       if (! isset($query)) { $query = ''; }
+ 
+                       $link_data = array
+                       (
+                               'menuaction'    => 
'calendar.uicalendar.accounts_popup',
+                               'start'                 => $start
+                       );
+ 
+                       $cal_user = 
$GLOBALS['phpgw']->acl->get_ids_for_location('run',1,'calendar');
+ 
+                       for ($i = 0;$i<count($cal_user);$i++)
+                       {
+                               $type = 
$GLOBALS['phpgw']->accounts->get_type($cal_user[$i]);
+                               if ($type == 'g')
+                               {
+                                       $members[] = 
$GLOBALS['phpgw']->acl->get_ids_for_location($cal_user[$i],1,'phpgw_group');
+                               }
+                       }
+ 
+                       $i = count($cal_user);
+                       while(is_array($members) && list(,$mem) = 
each($members))
+                       {
+                               for($j=0;$j<count($mem);$j++)
+                               {
+                                       $cal_user[$i] = $mem[$j];
+                                       $i++;
+                               }
+                       }
+ 
+                       //_debug_array($cal_user);
+ 
+                       if (!$query)
+                       {
+                               $entries        = 0;
+                               $total          = 0;
+                       }
+                       else
+                       {
+                               $entries = 
$GLOBALS['phpgw']->accounts->get_list('both',$start,$sort,$order,$query);
+ 
+                               for ($i=0;$i<count($entries);$i++)
+                               {
+                                       if 
(in_array($entries[$i]['account_id'],$cal_user))
+                                       {
+                                               $val_users[] = array
+                                               (
+                                                       'account_id'            
=> $entries[$i]['account_id'],
+                                                       'account_lid'           
=> $entries[$i]['account_lid'],
+                                                       'account_firstname'     
=> $entries[$i]['account_firstname'],
+                                                       'account_lastname'      
=> $entries[$i]['account_lastname'],
+                                                       'account_type'          
=> $entries[$i]['account_type']
+                                               );
+                                       }
+                               }
+ 
+                               $total = count($val_users);
+                       }
+ 
+ // --------------------------------- nextmatch ---------------------------
+ 
+                       $left = 
$this->nextmatchs->left('/index.php',$start,$total,$link_data);
+                       $right = 
$this->nextmatchs->right('/index.php',$start,$total,$link_data);
+                       $GLOBALS['phpgw']->template->set_var('left',$left);
+                       $GLOBALS['phpgw']->template->set_var('right',$right);
+ 
+                       
$GLOBALS['phpgw']->template->set_var('lang_showing',$this->nextmatchs->show_hits($total,$start));
+ 
+ // -------------------------- end nextmatch 
------------------------------------
+ 
+                       
$GLOBALS['phpgw']->template->set_var('search_action',$GLOBALS['phpgw']->link('/index.php',$link_data));
+                       
$GLOBALS['phpgw']->template->set_var('search_list',$this->nextmatchs->search(array('query'
 => $query, 'search_obj' => 1)));
+ 
+ // ---------------- list header variable template-declarations 
--------------------------
+ 
+ // -------------- list header variable template-declaration 
------------------------
+                       
$GLOBALS['phpgw']->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
+                       
$GLOBALS['phpgw']->template->set_var('sort_lid',$this->nextmatchs->show_sort_order($sort,'account_lid',$order,'/index.php',lang('LoginID'),$link_data));
+                       
$GLOBALS['phpgw']->template->set_var('sort_firstname',$this->nextmatchs->show_sort_order($sort,'account_firstname',$order,'/index.php',lang('Firstname'),$link_data));
+                       
$GLOBALS['phpgw']->template->set_var('sort_lastname',$this->nextmatchs->show_sort_order($sort,'account_lastname',$order,'/index.php',lang('Lastname'),$link_data));
+                       
$GLOBALS['phpgw']->template->set_var('lang_select',lang('Select'));
+ 
+ // ------------------------- end header declaration 
--------------------------------
+ 
+                       for ($i=0;$i<count($val_users);$i++)
+                       {
+                               
$GLOBALS['phpgw']->template->set_var('tr_color',$this->nextmatchs->alternate_row_color($tr_color));
+                               $firstname = 
$val_users[$i]['account_firstname'];
+                               if (!$firstname) { $firstname = '&nbsp;'; }
+                               $lastname = $val_users[$i]['account_lastname'];
+                               if (!$lastname) { $lastname = '&nbsp;'; }
+ 
+ // ---------------- template declaration for list records 
-------------------------- 
+ 
+                               $GLOBALS['phpgw']->template->set_var(array
+                               (
+                                       'lid'                   => 
$val_users[$i]['account_lid'],
+                                       'firstname'             => $firstname,
+                                       'lastname'              => $lastname,
+                                       'accountid'             => 
$val_users[$i]['account_id'],
+                                       'accounttype'   => 
$val_users[$i]['account_type'])
+                               );
+ 
+                               
$GLOBALS['phpgw']->template->parse('list','accounts_list',True);
+                       }
+ 
+                       
$GLOBALS['phpgw']->template->set_var('lang_done',lang('done'));
+                       
$GLOBALS['phpgw']->template->parse('out','accounts_list_t',True);
+                       $GLOBALS['phpgw']->template->p('out');
+                       $GLOBALS['phpgw']->common->phpgw_exit();
+               }
        }
        /*!

Index: class.arrayfunctions.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.arrayfunctions.inc.php,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** class.arrayfunctions.inc.php        26 Jun 2002 22:32:00 -0000      1.1.2.1
--- class.arrayfunctions.inc.php        18 Dec 2002 00:20:46 -0000      1.1.2.2
***************
*** 2,10 ****
        
/**************************************************************************\
        * phpGroupWare API - Arrayfunctions                                     
   *
!       * This file written by Lars Kneschke <address@hidden>             *
        * Copyright (C) 2002 Lars Kneschke                                      
   *
!       * 
-------------------------------------------------------------------------*
        * This library is part of the phpGroupWare API                          
   *
!       * 
-------------------------------------------------------------------------*
        * This library is free software; you can redistribute it and/or modify 
it  *
        * under the terms of the GNU Lesser General Public License as published 
by *
--- 2,10 ----
        
/**************************************************************************\
        * phpGroupWare API - Arrayfunctions                                     
   *
!       * This file written by Lars Kneschke <address@hidden>                  *
        * Copyright (C) 2002 Lars Kneschke                                      
   *
!       * 
------------------------------------------------------------------------ *
        * This library is part of the phpGroupWare API                          
   *
!       * 
------------------------------------------------------------------------ *
        * This library is free software; you can redistribute it and/or modify 
it  *
        * under the terms of the GNU Lesser General Public License as published 
by *
***************
*** 27,31 ****
                }
  
!               /**
                * arfsort() - (AR)ray (F)ield Sort.
                * Sort a multi-dimensional array according
--- 27,31 ----
                }
  
!               /*
                * arfsort() - (AR)ray (F)ield Sort.
                * Sort a multi-dimensional array according
***************
*** 38,46 ****
                {
                        $GLOBALS['__ARFSORT_LIST__'] = $fl;
!                       usort( $a, array($this,'arfsort_func') );
!                       return $a;
                }
!               
!               /**
                * Internal sorting function for arfsort()
                */
--- 38,51 ----
                {
                        $GLOBALS['__ARFSORT_LIST__'] = $fl;
! 
!                       if (is_array($a))
!                       {
!                               usort( $a, array($this,'arfsort_func') );
!                               return $a;
!                       }
!                       return False;
                }
! 
!               /*
                * Internal sorting function for arfsort()
                */

Index: class.categories.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.categories.inc.php,v
retrieving revision 1.74.2.16
retrieving revision 1.74.2.17
diff -C2 -r1.74.2.16 -r1.74.2.17
*** class.categories.inc.php    15 Oct 2002 21:40:34 -0000      1.74.2.16
--- class.categories.inc.php    18 Dec 2002 00:20:46 -0000      1.74.2.17
***************
*** 267,271 ****
  
                        $this->db2->query($sql . 
$parent_select,__LINE__,__FILE__);
!                       $total_mains = $this->db2->num_rows();
  
                        if ($limit)
--- 267,272 ----
  
                        $this->db2->query($sql . 
$parent_select,__LINE__,__FILE__);
!                       //$total_mains = $this->db2->num_rows();
!                       $this->total_records = $this->db2->num_rows();
  
                        if ($limit)
***************
*** 299,306 ****
                                $sub_select = " AND cat_parent='" . 
$cats[$i]['id'] . "' AND cat_level='" . ($cats[$i]['level']+1) . "'";
  
!                               $this->db2->query($sql . 
$sub_select,__LINE__,__FILE__);
                                $total_subs += $this->db2->num_rows();
  
!                               /*if ($limit)
                                {
                                        $this->db->limit_query($sql . 
$sub_select . $ordermethod,$start,__LINE__,__FILE__);
--- 300,307 ----
                                $sub_select = " AND cat_parent='" . 
$cats[$i]['id'] . "' AND cat_level='" . ($cats[$i]['level']+1) . "'";
  
!                               /*$this->db2->query($sql . 
$sub_select,__LINE__,__FILE__);
                                $total_subs += $this->db2->num_rows();
  
!                               if ($limit)
                                {
                                        $this->db->limit_query($sql . 
$sub_select . $ordermethod,$start,__LINE__,__FILE__);
***************
*** 348,352 ****
                                }
                        }
!                       $this->total_records = $total_mains + $total_subs;
                        return $cats;
                }
--- 349,353 ----
                                }
                        }
!                       //$this->total_records = $total_mains + $total_subs;
                        return $cats;
                }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]