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_shared.inc.php,1.48


From: Bettina Gille <address@hidden>
Subject: [Phpgroupware-cvs] CVS: phpgwapi/inc class.accounts_shared.inc.php,1.48.2.2.2.1,1.48.2.2.2.2
Date: Wed, 30 Apr 2003 22:58:19 -0400

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

Modified Files:
      Tag: Version-0_9_16-branch
        class.accounts_shared.inc.php 
Log Message:
added function for accounts popup

Index: class.accounts_shared.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.accounts_shared.inc.php,v
retrieving revision 1.48.2.2.2.1
retrieving revision 1.48.2.2.2.2
diff -C2 -r1.48.2.2.2.1 -r1.48.2.2.2.2
*** class.accounts_shared.inc.php       1 Apr 2003 01:37:33 -0000       
1.48.2.2.2.1
--- class.accounts_shared.inc.php       1 May 2003 02:58:17 -0000       
1.48.2.2.2.2
***************
*** 4,8 ****
        * This file written by Joseph Engo <address@hidden>                *
        * shared functions for other account repository managers                
   *
!       * Copyright (C) 2000, 2001 Joseph Engo                                  
   *
        * 
-------------------------------------------------------------------------*
        * This library is part of the phpGroupWare API                          
   *
--- 4,8 ----
        * This file written by Joseph Engo <address@hidden>                *
        * shared functions for other account repository managers                
   *
!       * Copyright (C) 2000 - 2003 Joseph Engo                                 
   *
        * 
-------------------------------------------------------------------------*
        * This library is part of the phpGroupWare API                          
   *
***************
*** 21,25 ****
        * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA         
   *
        
\**************************************************************************/
- 
        /* $Id$ */
  
--- 21,24 ----
***************
*** 247,250 ****
--- 246,444 ----
                        /* echo '<br>using'.$nextid;exit; */
                        return $nextid;
+               }
+ 
+               function accounts_popup($app)
+               {
+                       $start  = get_var('start',array('POST','GET'));
+                       $sort   = get_var('sort',array('POST','GET'));
+                       $order  = get_var('order',array('POST','GET'));
+                       $query  = get_var('query',array('POST','GET'));
+                       $group_id       = 
get_var('group_id',array('POST','GET'));
+ 
+                       $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','group_list','bla');
+                       
$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']);
+                       
$GLOBALS['phpgw']->template->set_var('lang_search',lang('search'));
+ 
+                       if (! $start) { $start = 0; }
+                       if (! isset($query)) { $query = ''; }
+ 
+                       switch($app)
+                       {
+                               case 'calendar':
+                                       $action = 
'calendar.uicalendar.accounts_popup';
+                                       
$GLOBALS['phpgw']->template->set_var('select_name','participants[]');
+                                       break;
+                               case 'admin':
+                                       $action = 
'admin.uiaccounts.accounts_popup';
+                                       
$GLOBALS['phpgw']->template->set_var('select_name','account_user[]');
+                                       break;
+                       }
+ 
+                       $link_data = array
+                       (
+                               'menuaction'    => $action,
+                               'start'                 => $start
+                       );
+ 
+                       $user_groups = 
$GLOBALS['phpgw']->accounts->membership($this->account);
+ 
+                       switch($app)
+                       {
+                               case 'calendar':
+                                       $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')
+                                               {
+                                                       $cal_groups[] = 
$cal_user[$i];
+                                                       $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);
+                                       break;
+                       }
+ 
+                       while (is_array($user_groups) && list(,$group) = 
each($user_groups))
+                       {
+                               $link_data['group_id'] = $group['account_id'];
+                               if (($app == 'calendar') && 
in_array($group['account_id'],$cal_groups))
+                               {
+                                       
$GLOBALS['phpgw']->template->set_var('link_user_group',$GLOBALS['phpgw']->link('/index.php',$link_data));
+                                       
$GLOBALS['phpgw']->template->set_var('lang_user_group',$group['account_name']);
+ 
+                               }
+                               else
+                               {
+                                       
$GLOBALS['phpgw']->template->set_var('link_user_group',$GLOBALS['phpgw']->link('/index.php',$link_data));
+                                       
$GLOBALS['phpgw']->template->set_var('lang_user_group',$group['account_name']);
+                               }
+                               
$GLOBALS['phpgw']->template->fp('bla','group_list');
+                       }
+ 
+                       if (!$query)
+                       {
+                               if ($group_id)
+                               {
+                                       //echo 'GROUP_ID: ' . $group_id;
+ 
+                                       $users = 
$GLOBALS['phpgw']->acl->get_ids_for_location($group_id,1,'phpgw_group');
+ 
+                                       //_debug_array($users);
+ 
+                                       for($i=0;$i<count($users);$i++)
+                                       {
+                                               
$GLOBALS['phpgw']->accounts->account_id = $users[$i];
+                                               
$GLOBALS['phpgw']->accounts->read_repository();
+ 
+                                               $val_users[] = array
+                                               (
+                                                       'account_id'            
=> $GLOBALS['phpgw']->accounts->data['account_id'],
+                                                       'account_lid'           
=> $GLOBALS['phpgw']->accounts->data['account_lid'],
+                                                       'account_firstname'     
=> $GLOBALS['phpgw']->accounts->data['firstname'],
+                                                       'account_lastname'      
=> $GLOBALS['phpgw']->accounts->data['lastname']
+                                               );
+                                       }
+                               }
+                       }
+                       else
+                       {
+                               $entries = 
$GLOBALS['phpgw']->accounts->get_list('both',$start,$sort,$order,$query);
+ 
+                               for ($i=0;$i<count($entries);$i++)
+                               {
+                                       if (($app == 'calendar') && 
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']
+                                               );
+                                       }
+                               }
+                       }
+ 
+                       if (is_array($val_users) && !empty($val_users))
+                       {
+                               $total = count($val_users);
+                       }
+                       else
+                       {
+                               $total = 0;
+                       }
+ // --------------------------------- 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->fp('list','accounts_list',True);
+                       }
+ 
+                       
$GLOBALS['phpgw']->template->set_var('lang_done',lang('done'));
+                       
$GLOBALS['phpgw']->template->pfp('out','accounts_list_t',True);
+                       $GLOBALS['phpgw']->common->phpgw_exit();
                }
        }





reply via email to

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