phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: phpgwapi/inc class.nextmatchs.inc.php,1.43.2.6,


From: Bettina Gille <address@hidden>
Subject: [Phpgroupware-cvs] CVS: phpgwapi/inc class.nextmatchs.inc.php,1.43.2.6,1.43.2.6.2.1
Date: Fri, 25 Apr 2003 21:33:08 -0400

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

Modified Files:
      Tag: Version-0_9_16-branch
        class.nextmatchs.inc.php 
Log Message:
added extra function for filter plus update reg. globals off class.nextmatchs

Index: class.nextmatchs.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.nextmatchs.inc.php,v
retrieving revision 1.43.2.6
retrieving revision 1.43.2.6.2.1
diff -C2 -r1.43.2.6 -r1.43.2.6.2.1
*** class.nextmatchs.inc.php    5 Mar 2003 00:11:58 -0000       1.43.2.6
--- class.nextmatchs.inc.php    26 Apr 2003 01:33:05 -0000      1.43.2.6.2.1
***************
*** 72,75 ****
--- 72,91 ----
  
                /*!
+               @function get_var
+               @abstract Fetch commonly-used GP(C) vars
+               @discussion This calls get_var() from functions.inc.php
+               */
+               function get_var()
+               {
+                       return array(
+                               get_var('filter',array('GLOBAL','POST','GET')),
+                               get_var('qfield',array('GLOBAL','POST','GET')),
+                               get_var('start',array('GLOBAL','POST','GET')),
+                               get_var('order',array('GLOBAL','POST','GET')),
+                               get_var('sort',array('GLOBAL','POST','GET'))
+                       );
+               }
+ 
+               /*!
                @function set_icon
                @abstract ?
***************
*** 182,186 ****
                function show_tpl($sn,$localstart,$total,$extra, $twidth, 
$bgtheme,$search_obj=0,$filter_obj=1,$showsearch=1,$yours=0,$cat_id=0,$cat_field='fcat_id')
                {
!                       global $filter, $qfield, $start, $order, $sort;
                        $start = $localstart;
  
--- 198,204 ----
                function show_tpl($sn,$localstart,$total,$extra, $twidth, 
$bgtheme,$search_obj=0,$filter_obj=1,$showsearch=1,$yours=0,$cat_id=0,$cat_field='fcat_id')
                {
!                       list($filter,$qfield,$start,$order,$sort) = 
$this->get_var();
! 
! 
                        $start = $localstart;
  
***************
*** 282,286 ****
                function left($scriptname,$start,$total,$extradata = '')
                {
!                       global $filter, $qfield, $order, $sort;
  
                        $extravars = Array(
--- 300,304 ----
                function left($scriptname,$start,$total,$extradata = '')
                {
!                       list($filter,$qfield,$NULL,$order,$sort) = 
$this->get_var();
  
                        $extravars = Array(
***************
*** 336,340 ****
                function right($scriptname,$start,$total,$extradata = '')
                {
!                       global $filter, $qfield, $order, $sort;
  
                        $extravars = Array(
--- 354,358 ----
                function right($scriptname,$start,$total,$extradata = '')
                {
!                       list($filter,$qfield,$NULL,$order,$sort) = 
$this->get_var();
  
                        $extravars = Array(
***************
*** 381,385 ****
                function 
search_filter($search_obj=0,$filter_obj=1,$yours=0,$link='',$extra='')
                {
!                       global $filter, $qfield, $start, $order, $sort;
  
                        $start = $localstart;
--- 399,403 ----
                function 
search_filter($search_obj=0,$filter_obj=1,$yours=0,$link='',$extra='')
                {
!                       list($filter,$qfield,$start,$order,$sort) = 
$this->get_var();
  
                        $start = $localstart;
***************
*** 407,411 ****
                function 
cats_search_filter($search_obj=0,$filter_obj=1,$yours=0,$cat_id=0,$cat_field='fcat_id',$link='',$extra='')
                {
!                       global $filter, $qfield, $start, $order, $sort;
  
                        $start = $localstart;
--- 425,429 ----
                function 
cats_search_filter($search_obj=0,$filter_obj=1,$yours=0,$cat_id=0,$cat_field='fcat_id',$link='',$extra='')
                {
!                       list($filter,$qfield,$start,$order,$sort) = 
$this->get_var();
  
                        $start = $localstart;
***************
*** 450,454 ****
                        }
  
!                       // If the place a " in there search, it will mess 
everything up
                        // Our only option is to remove it
                        if (ereg('"',$_query))
--- 468,472 ----
                        }
  
!                       // If the place a '"' in there search, it will mess 
everything up
                        // Our only option is to remove it
                        if (ereg('"',$_query))
***************
*** 456,464 ****
                                $_query = ereg_replace('"','',$_query);
                        }
!                       $var = array(
                                'query_value' => stripslashes($_query),
-                               'searchby'    => $this->searchby($search_obj),
                                'lang_search' => lang('Search')
                        );
                        $this->template->set_var($var);
                        return $this->template->fp('out','search');
--- 474,488 ----
                                $_query = ereg_replace('"','',$_query);
                        }
!                       $var = array
!                       (
                                'query_value' => stripslashes($_query),
                                'lang_search' => lang('Search')
                        );
+ 
+                       if (is_array($search_obj))
+                       {
+                               $var['searchby'] = $this->searchby($search_obj);
+                       }
+ 
                        $this->template->set_var($var);
                        return $this->template->fp('out','search');
***************
*** 495,499 ****
                function searchby($search_obj)
                {
!                       global $qfield;
  
                        $str = '';
--- 519,523 ----
                function searchby($search_obj)
                {
!                       $qfield = get_var('qfield',Array('GET','POST'));
  
                        $str = '';
***************
*** 592,595 ****
--- 616,678 ----
                } /* filter() */
  
+               /* replacement for function filter */
+               function new_filter($data=0)
+               {
+                       if(is_array($data))
+                       {
+                               $filter = 
(isset($data['filter'])?$data['filter']:'');
+                               $format = 
(isset($data['format'])?$data['format']:'all');
+                       }
+                       else
+                       {
+                               //$filter = 
get_var('filter',Array('GET','POST'));
+                               $filter = $data;
+                               $format = 'all';
+                       }
+ 
+                       switch($format)
+                       {
+                               case 'yours':
+                                       $filter_obj = array
+                                       (
+                                               array('none',lang('show all')),
+                                               array('yours',lang('only 
yours'))
+                                       );
+                                       break;
+                               case 'private':
+                                       $filter_obj = array
+                                       (
+                                               array('none',lang('show all')),
+                                               array('private',lang('only 
private'))
+                                       );
+                                       break;
+                               default:
+                                       $filter_obj = array
+                                       (
+                                               array('none',lang('show all')),
+                                               array('yours',lang('only 
yours')),
+                                               array('private',lang('only 
private'))
+                                       );
+                       }
+ 
+                       $str = '';
+                       $indexlimit = count($filter_obj);
+ 
+                       for($index=0; $index<$indexlimit; $index++)
+                       {
+                               if($filter == '')
+                               {
+                                       $filter = $filter_obj[$index][0];
+                               }
+                               $str .= '         <option value="' . 
$filter_obj[$index][0] . '"'.($filter == $filter_obj[$index][0]?' selected':'') 
. '>' . $filter_obj[$index][1] . '</option>'."\n";
+                       }
+ 
+                       $str = '        <select name="filter" 
onChange="this.form.submit()">'."\n" . $str . '        </select>';
+                       $this->template->set_var('select',$str);
+                       $this->template->set_var('lang_filter',lang('Filter'));
+ 
+                       return $this->template->fp('out','filter');
+               } /* filter() */
+ 
                /*!
                @function alternate_row_color
***************
*** 601,606 ****
                        if (! $currentcolor)
                        {
!                               global $tr_color;
!                               $currentcolor = $tr_color;
                        }
  
--- 684,688 ----
                        if (! $currentcolor)
                        {
!                               $currentcolor = $GLOBALS['tr_color'];
                        }
  
***************
*** 641,645 ****
                function 
show_sort_order($sort,$var,$order,$program,$text,$extra='',$build_a_href=True)
                {
!                       global $filter, $qfield, $start;
  
                        if (($order == $var) && ($sort == 'ASC'))
--- 723,727 ----
                function 
show_sort_order($sort,$var,$order,$program,$text,$extra='',$build_a_href=True)
                {
!                       list($filter,$qfield,$start,$NULL1,$NULL) = 
$this->get_var();
  
                        if (($order == $var) && ($sort == 'ASC'))





reply via email to

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