phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] tts/index.php, 1.48


From: nomail
Subject: [Phpgroupware-cvs] tts/index.php, 1.48
Date: Mon, 11 Oct 2004 11:43:14 +0200

Update of /tts
Modified Files:
        Branch: 
          index.php

date: 2004/10/11 09:43:14;  author: fipsfuchs;  state: Exp;  lines: +241 -85

Log Message:
replaced with 0.9.16 branche
=====================================================================
Index: tts/index.php
diff -u tts/index.php:1.47 tts/index.php:1.48
--- tts/index.php:1.47  Thu Jun 19 20:55:27 2003
+++ tts/index.php       Mon Oct 11 09:43:14 2004
@@ -17,13 +17,19 @@
        ** select distinct group_ticket_id, phpgw_tts_groups.group_ticket_id, 
phpgw_tts_tickets.*
        ** from phpgw_tts_tickets, phpgw_tts_groups where ticket_id = 
group_ticket_id and group_id in (14,15);
        */
- 
+
+       /* ACL levels
+       ** 1 - Read ticket within your group only
+       ** 2 - Close ticket
+       ** 4 - Allow to make changes to priority, billing hours, billing rate, 
category, and assigned to
+       */
+
        $GLOBALS['phpgw_info']['flags']['currentapp'] = 'tts';
        $GLOBALS['phpgw_info']['flags']['enable_contacts_class'] = True;
        $GLOBALS['phpgw_info']['flags']['enable_categories_class'] = True;
        $GLOBALS['phpgw_info']['flags']['enable_nextmatchs_class'] = True;
        include('../header.inc.php');
-
+       
        $GLOBALS['phpgw']->historylog = 
createobject('phpgwapi.historylog','tts');
 
        $GLOBALS['phpgw']->template->set_file('index','index.tpl');
@@ -33,7 +39,6 @@
        $GLOBALS['phpgw']->template->set_block('index', 'tts_list', 'tts_list');
        $GLOBALS['phpgw']->template->set_block('index', 'tts_row', 'tts_row');
        $GLOBALS['phpgw']->template->set_block('index', 'tts_col_ifviewall', 
'tts_col_ifviewall');
-       $GLOBALS['phpgw']->template->set_block('index', 'tts_head_ifviewall', 
'tts_head_ifviewall');
        $GLOBALS['phpgw']->template->set_block('index', 'tts_ticket_id_read', 
'tts_ticket_id_read');
        $GLOBALS['phpgw']->template->set_block('index', 'tts_ticket_id_unread', 
'tts_ticket_id_unread');
 
@@ -44,48 +49,74 @@
        $GLOBALS['phpgw']->template->set_var('lang_preferences', 
lang('Preferences'));
        $GLOBALS['phpgw']->template->set_var('lang_search', lang('search'));
        $GLOBALS['phpgw']->template->set_var('tts_newticket', lang('New 
ticket'));
-       $GLOBALS['phpgw']->template->set_var('tts_head_status','');
        $GLOBALS['phpgw']->template->set_var('tts_notickets','');
        $GLOBALS['phpgw']->template->set_var('lang_category',lang('Category'));
-
+       $GLOBALS['phpgw']->template->set_var('tts_autofilter_link', 
$GLOBALS['phpgw']->link('/tts/index.php'));
+       $GLOBALS['phpgw']->template->set_var('lang_filter', lang('filter'));
+       
+       
        // select what tickets to view
-       $filter = $HTTP_GET_VARS['filter'];
-       $start  = $HTTP_GET_VARS['start'];
-       $sort   = $HTTP_GET_VARS['sort'];
-       $order  = $HTTP_GET_VARS['order'];
+       $start  = $_GET['start'];
+       $sort   = $_GET['sort'];  // security hole
+       $order  = $_GET['order']; // security hole
+       $_REQUEST['ticket']['filter_status'] = 
!strlen($_REQUEST['ticket']['filter_status']) ? 'open' : 
$_REQUEST['ticket']['filter_status']; 
+                       
+       $GLOBALS['phpgw']->preferences->read_repository();
+       if 
($GLOBALS['phpgw_info']['user']['preferences']['tts']['refreshinterval'])
+       {
+               $GLOBALS['phpgw']->template->set_var('autorefresh','<META 
HTTP-EQUIV="Refresh" 
CONTENT="'.$GLOBALS['phpgw_info']['user']['preferences']['tts']['refreshinterval'].';
 URL='.$GLOBALS['phpgw']->link('/tts/index.php').'">');
+       }
+       else
+       {
+               $GLOBALS['phpgw']->template->set_var('autorefresh','');
+       }
 
-       if (!$filter)
+       $filterstring = '';
+       if($_REQUEST['ticket']['filter_prio'] != '')
        {
-               $filter='viewopen';
+               $filterstring .= 'ticket_priority LIKE 
'.$_POST['ticket']['filter_prio'].' AND '; //security hole
        }
-       if ($filter == 'viewopen') 
+
+       if($_REQUEST['ticket']['filter_owner'] != '')
        {
-               $filtermethod = "where ticket_status='O'";
+               $filterstring .= 'ticket_owner LIKE 
"'.$GLOBALS['phpgw']->accounts->name2id($_POST['ticket']['filter_owner']).'" 
AND ';
+       }
 
-               $GLOBALS['phpgw']->preferences->read_repository();
-               if 
($GLOBALS['phpgw_info']['user']['preferences']['tts']['refreshinterval'])
-               {
-                       
$GLOBALS['phpgw']->template->set_var('autorefresh','<META HTTP-EQUIV="Refresh" 
CONTENT="'.$GLOBALS['phpgw_info']['user']['preferences']['tts']['refreshinterval'].';
 URL='.$GLOBALS['phpgw']->link('/tts/index.php').'">');
-               }
-               else
-               {
-                       $GLOBALS['phpgw']->template->set_var('autorefresh','');
-               }
+       if($_REQUEST['ticket']['filter_assignedto'] != '')
+       {
+               $filterstring .= 'ticket_assignedto LIKE 
"'.$GLOBALS['phpgw']->accounts->name2id($_POST['ticket']['filter_assignedto']).'"
 AND ';
+       }
+
+       if((int) $_REQUEST['fcat_id'])
+       {
+               $cat_id = (int)$_REQUEST['fcat_id'];
+               // not working - probably wrong order in program logic
+               $_REQUEST['ticket']['filter_category'] = 
$GLOBALS['phpgw']->categories->id2name($cat_id);
        }
-       if ($filter == 'search') 
+       elseif($_REQUEST['ticket']['filter_category'])
        {
-               $filtermethod = "where ticket_details like 
'%".addslashes($searchfilter)."%'";
-               
$GLOBALS['phpgw']->template->set_var('tts_searchfilter',addslashes($searchfilter));
+               $cat_id = 
$GLOBALS['phpgw']->categories->name2id($_REQUEST['ticket']['filter_category']);
        }
 
-       if (!$sort)
+       if((int)$cat_id)
        {
-               $sortmethod = 'order by ticket_priority desc';
+               $filterstring .= 'ticket_category = "'.$cat_id.'" AND ';
        }
-       else
+       
+       if($_REQUEST['ticket']['filter_status'] != 'none')
        {
-               $sortmethod = "order by $order $sort";
+               $sqlvalue = $_REQUEST['ticket']['filter_status'] == 'open' ? 
'O' : 'X'; // lol, nice value for sql
+               $filterstring .= 'ticket_status="'.$sqlvalue.'" AND ';
+       }
+       if ($_REQUEST['searchfilter'] != '') 
+       {               
+               $filterstring .= '(ticket_details LIKE 
"%'.addslashes($_REQUEST['searchfilter']).'%" OR '.
+                                ' ticket_subject LIKE 
"%'.addslashes($_REQUEST['searchfilter']).'%") AND ';
+               $GLOBALS['phpgw']->template->set_var('tts_searchfilter', 
addslashes($_REQUEST['searchfilter'])); //doesn't work
        }
+       $filterstring .= '1 ';
+
+       $sortmethod = $sort ? "order by $order $sort" : 'order by 
ticket_priority desc';
 
        $GLOBALS['phpgw']->db->query("select count(*) from 
phpgw_tts_tickets",__LINE__,__FILE__);
        $GLOBALS['phpgw']->db->next_record();
@@ -96,54 +127,36 @@
        $numopen = $GLOBALS['phpgw']->db->f('0') ;
 
        $GLOBALS['phpgw']->template->set_var('tts_numtotal',lang('Tickets total 
%1',$numtotal));
-       $GLOBALS['phpgw']->template->set_var('tts_numopen',lang('Tickets open 
%1',$numopen));
-
-
-       $db2 = $phpgw->db;
-       $GLOBALS['phpgw']->db->query("select * from phpgw_tts_tickets 
$filtermethod $sortmethod",__LINE__,__FILE__);
+       $GLOBALS['phpgw']->template->set_var('tts_numopen', lang('Tickets open 
%1',$numopen));
+       
+       $db2 = $GLOBALS['phpgw']->db;
+       $sql = 'SELECT * FROM phpgw_tts_tickets WHERE 
'.$filterstring.$sortmethod;
+       //echo $sql;
+       $GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__); 
        $numfound = $GLOBALS['phpgw']->db->num_rows();
 
-       if ($filter == 'search')
-       {
-               $filtermethod = "where ticket_details like 
'%".addslashes($searchfilter)."%'";
-               
$GLOBALS['phpgw']->template->set_var('tts_searchfilter',addslashes($searchfilter));
-               
$GLOBALS['phpgw']->template->set_var('tts_numfound',lang('Tickets found 
%1',$numfound));
-       }
-       else
-       {
-               $GLOBALS['phpgw']->template->set_var('tts_searchfilter','');
-               $GLOBALS['phpgw']->template->set_var('tts_numfound','');
-       }
-
-       if ($filter != 'viewopen')
-       {
-               $GLOBALS['phpgw']->template->set_var('tts_changeview_link', 
$GLOBALS['phpgw']->link('/tts/index.php'));
-               $GLOBALS['phpgw']->template->set_var('tts_changeview', 
lang('View only open tickets'));
-       }
-       else
-       {
-               $GLOBALS['phpgw']->template->set_var('tts_changeview_link', 
$GLOBALS['phpgw']->link('/tts/index.php','filter=viewall'));
-               $GLOBALS['phpgw']->template->set_var('tts_changeview', 
lang('View all tickets'));
-       }
+       
$GLOBALS['phpgw']->template->set_var('tts_searchfilter',addslashes($_REQUEST['searchfilter']));
+       $GLOBALS['phpgw']->template->set_var('tts_numfound',lang('Tickets found 
%1',$numfound));
 
        $GLOBALS['phpgw']->template->set_var('tts_ticketstotal', lang('Tickets 
total %1',$numtotal));
        $GLOBALS['phpgw']->template->set_var('tts_ticketsopen', lang('Tickets 
open %1',$numopen));
        
        // fill header
        
$GLOBALS['phpgw']->template->set_var('tts_head_bgcolor',$GLOBALS['phpgw_info']['theme']['th_bg']
 );
-       $GLOBALS['phpgw']->template->set_var('tts_head_ticket', 
$GLOBALS['phpgw']->nextmatchs->show_sort_order($sort,'ticket_id',$order,'/tts/index.php',lang('Ticket').'
 #'));
+       
$GLOBALS['phpgw']->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']
 );
+       $GLOBALS['phpgw']->template->set_var('tts_head_ticket', 
$GLOBALS['phpgw']->nextmatchs->show_sort_order($sort,'ticket_id',$order,'/tts/index.php','#'));
        $GLOBALS['phpgw']->template->set_var('tts_head_prio', 
$GLOBALS['phpgw']->nextmatchs->show_sort_order($sort,'ticket_priority',$order,'/tts/index.php',lang('Prio')));
-       
$GLOBALS['phpgw']->template->set_var('tts_head_group',$GLOBALS['phpgw']->nextmatchs->show_sort_order($sort,'ticket_category',$order,'/tts/index.php',lang('Group'))
 );
+       
$GLOBALS['phpgw']->template->set_var('tts_head_group',$GLOBALS['phpgw']->nextmatchs->show_sort_order($sort,'ticket_group',$order,'/tts/index.php',lang('Group')));
+       
$GLOBALS['phpgw']->template->set_var('tts_head_category',$GLOBALS['phpgw']->nextmatchs->show_sort_order($sort,'ticket_category',$order,'/tts/index.php',lang('Category')));
        $GLOBALS['phpgw']->template->set_var('tts_head_assignedto', 
$GLOBALS['phpgw']->nextmatchs->show_sort_order($sort,'ticket_assignedto',$order,'/tts/index.php',lang('Assigned
 to')));
        $GLOBALS['phpgw']->template->set_var('tts_head_openedby', 
$GLOBALS['phpgw']->nextmatchs->show_sort_order($sort,'ticket_owner',$order,'/tts/index.php',lang('Opened
 by')));
 
        // I am not sure how the sorting will work for this, if at all. (jengo)
        $GLOBALS['phpgw']->template->set_var('tts_head_dateopened',lang('Date 
opened'));
 //     $GLOBALS['phpgw']->template->set_var('tts_head_dateopened', 
$GLOBALS['phpgw']->nextmatchs->show_sort_order($sort,'',$order,'/tts/index.php',lang('Date
 opened')));
-       if ($filter != 'viewopen')
+       //if ($filter != 'viewopen' && $filter != 'search')
        {
-               $GLOBALS['phpgw']->template->set_var('tts_head_dateclosed', 
$GLOBALS['phpgw']->nextmatchs->show_sort_order($sort,'ticket_status',$order,'/tts/index.php',lang('Status/Date
 closed')));
-               
$GLOBALS['phpgw']->template->parse('tts_head_status','tts_head_ifviewall',false);
+               $GLOBALS['phpgw']->template->set_var('tts_head_dateclosed', 
$GLOBALS['phpgw']->nextmatchs->show_sort_order($sort,'ticket_status',$order,'/tts/index.php',lang('Status')));
        }
        $GLOBALS['phpgw']->template->set_var('tts_head_subject', 
$GLOBALS['phpgw']->nextmatchs->show_sort_order($sort,'ticket_subject',$order,'/tts/index.php',lang('Subject')));
 
@@ -155,21 +168,20 @@
        {
                while ($GLOBALS['phpgw']->db->next_record())
                {
-                       
$GLOBALS['phpgw']->template->set_var('tts_col_status','');
                        $priority = $GLOBALS['phpgw']->db->f('ticket_priority');
                        switch ($priority)
                        {
-                               case 1:  $tr_color = 
$GLOBALS['phpgw_info']['theme']['bg01']; break;
-                               case 2:  $tr_color = 
$GLOBALS['phpgw_info']['theme']['bg02']; break;
-                               case 3:  $tr_color = 
$GLOBALS['phpgw_info']['theme']['bg03']; break;
-                               case 4:  $tr_color = 
$GLOBALS['phpgw_info']['theme']['bg04']; break;
-                               case 5:  $tr_color = 
$GLOBALS['phpgw_info']['theme']['bg05']; break;
-                               case 6:  $tr_color = 
$GLOBALS['phpgw_info']['theme']['bg06']; break;
-                               case 7:  $tr_color = 
$GLOBALS['phpgw_info']['theme']['bg07']; break;
-                               case 8:  $tr_color = 
$GLOBALS['phpgw_info']['theme']['bg08']; break;
-                               case 9:  $tr_color = 
$GLOBALS['phpgw_info']['theme']['bg09']; break;
-                               case 10: $tr_color = 
$GLOBALS['phpgw_info']['theme']['bg10']; break;
-                               default: $tr_color = 
$GLOBALS['phpgw_info']['theme']['bg_color'];
+                               case 1:  $tr_color = 
$GLOBALS['phpgw_info']['theme']['bg01']; $prio = '1'; break;
+                               case 2:  $tr_color = 
$GLOBALS['phpgw_info']['theme']['bg02']; $prio = '2'; break;
+                               case 3:  $tr_color = 
$GLOBALS['phpgw_info']['theme']['bg03']; $prio = '3'; break;
+                               case 4:  $tr_color = 
$GLOBALS['phpgw_info']['theme']['bg04']; $prio = '4'; break;
+                               case 5:  $tr_color = 
$GLOBALS['phpgw_info']['theme']['bg05']; $prio = '5'; break;
+                               case 6:  $tr_color = 
$GLOBALS['phpgw_info']['theme']['bg06']; $prio = '6'; break;
+                               case 7:  $tr_color = 
$GLOBALS['phpgw_info']['theme']['bg07']; $prio = '7'; break;
+                               case 8:  $tr_color = 
$GLOBALS['phpgw_info']['theme']['bg08']; $prio = '8'; break;
+                               case 9:  $tr_color = 
$GLOBALS['phpgw_info']['theme']['bg09']; $prio = '9'; break;
+                               case 10: $tr_color = 
$GLOBALS['phpgw_info']['theme']['bg10']; $prio = '10'; break;
+                               default: $tr_color = 
$GLOBALS['phpgw_info']['theme']['bg_color']; $prio = '-';
                        }
 
                        if ($filter!="viewopen" && 
$GLOBALS['phpgw']->db->f('t_timestamp_closed'))
@@ -193,37 +205,50 @@
                        $GLOBALS['phpgw']->template->set_var('tts_row_color', 
$tr_color );
                        
$GLOBALS['phpgw']->template->set_var('tts_ticketdetails_link', 
$GLOBALS['phpgw']->link('/tts/viewticket_details.php','ticket_id=' . 
$GLOBALS['phpgw']->db->f('ticket_id')));
 
-                       
$GLOBALS['phpgw']->template->set_var('tts_t_id',$GLOBALS['phpgw']->db->f('ticket_id')
 );
+                       $GLOBALS['phpgw']->template->set_var('row_ticket_id', 
$GLOBALS['phpgw']->db->f('ticket_id'));
+                       $GLOBALS['phpgw']->template->set_var('ticket_link', 
$GLOBALS['phpgw']->link('/tts/viewticket_details.php','ticket_id=' . 
$GLOBALS['phpgw']->db->f('ticket_id')));
 
                        if (! $ticket_read)
                        {
-                               
$GLOBALS['phpgw']->template->parse('tts_ticket_id','tts_ticket_id_unread');
+                               
$GLOBALS['phpgw']->template->set_var('row_status','<img 
src="'.$GLOBALS['phpgw']->common->image('tts','updated').'">');
                        }
                        else
                        {
-                               
$GLOBALS['phpgw']->template->parse('tts_ticket_id','tts_ticket_id_read');
+                               
$GLOBALS['phpgw']->template->set_var('row_status','&nbsp;');
                        }
 
                        $priostr = '';
-                       while ($priority > 0) { $priostr=$priostr . "||"; 
$priority--; }
-                       
$GLOBALS['phpgw']->template->set_var('tts_t_priostr',$priostr );
 
-                       $cat_name = 
$phpgw->categories->id2name($GLOBALS['phpgw']->db->f('ticket_category'));
+                       while ($priority > 0)
+                       {
+                               $priostr = $priostr . "||";
+                               $priority--;
+                       }
+                       
$GLOBALS['phpgw']->template->set_var('tts_t_priostr',$priostr);
+
+                       $cat_name   = 
$GLOBALS['phpgw']->categories->id2name($GLOBALS['phpgw']->db->f('ticket_category'));
                        
$GLOBALS['phpgw']->template->set_var('row_category',$cat_name);
 
+                       $group_name = 
$GLOBALS['phpgw']->accounts->id2name($GLOBALS['phpgw']->db->f('ticket_group'));
+                       $group_name = ($group_name ? $group_name : '--');
+                       
$GLOBALS['phpgw']->template->set_var('row_group',$group_name);
+
                        
$GLOBALS['phpgw']->template->set_var('tts_t_assignedto', 
$GLOBALS['phpgw']->db->f('ticket_assignedto')?$GLOBALS['phpgw']->accounts->id2name($GLOBALS['phpgw']->db->f('ticket_assignedto')):lang('None'));
                        
$GLOBALS['phpgw']->template->set_var('tts_t_user',$GLOBALS['phpgw']->accounts->id2name($GLOBALS['phpgw']->db->f('ticket_owner')));
 
                        $history_values = 
$GLOBALS['phpgw']->historylog->return_array(array(),array('O'),'history_timestamp','ASC',$GLOBALS['phpgw']->db->f('ticket_id'));
-                       
$GLOBALS['phpgw']->template->set_var('tts_t_timestampopened',$GLOBALS['phpgw']->common->show_date($history_values[0]['datetime']));
+                       
$GLOBALS['phpgw']->template->set_var('tts_t_timestampopened',$GLOBALS['phpgw']->common->show_date($history_values[0]['datetime']
 - ((60*60) * 
$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']),
+                                                                               
                                          
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']
+                                                                               
                                         ));
 
                        if ($GLOBALS['phpgw']->db->f('ticket_status') == 'X')
                        {
                                $history_values = 
$GLOBALS['phpgw']->historylog->return_array(array(),array('X'),'history_timestamp','DESC',$GLOBALS['phpgw']->db->f('ticket_id'));
-                               
$GLOBALS['phpgw']->template->set_var('tts_t_timestampclosed',$GLOBALS['phpgw']->common->show_date($history_values[0]['datetime']));
-                               
$GLOBALS['phpgw']->template->parse('tts_col_status','tts_col_ifviewall',False);
+                               
$GLOBALS['phpgw']->template->set_var('tts_t_timestampclosed',$GLOBALS['phpgw']->common->show_date($history_values[0]['datetime']
 - ((60*60) * 
$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']),
+                                                                               
                                                  
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']
+                                                                               
                                                 ));
                        }
-                       elseif ($filter != 'viewopen')
+                       elseif ($filter != 'viewopen' && $filter != 'search')
                        {
 //                             if 
($GLOBALS['phpgw']->db->f('ticket_assignedto') != -1)
 //                             {
@@ -235,9 +260,9 @@
 //                             }
 //                             
$GLOBALS['phpgw']->template->set_var('tts_t_timestampclosed',$assigned_to);
                                
$GLOBALS['phpgw']->template->set_var('tts_t_timestampclosed',lang('Open'));
-                               
$GLOBALS['phpgw']->template->parse('tts_col_status','tts_col_ifviewall',False);
                        }
                        $GLOBALS['phpgw']->template->set_var('tts_t_subject', 
$GLOBALS['phpgw']->db->f('ticket_subject'));
+                       $GLOBALS['phpgw']->template->set_var('tts_t_prio', 
$prio);
 
                        
$GLOBALS['phpgw']->template->parse('rows','tts_row',True);
                }
@@ -250,6 +275,137 @@
        $GLOBALS['phpgw']->template->set_var('tts_ticket_id_read','');
        $GLOBALS['phpgw']->template->set_var('tts_ticket_id_unread','');
 
+       //Create Autofilters
+       $GLOBALS['phpgw']->db->query("select count(*) from phpgw_tts_tickets");
+       $GLOBALS['phpgw']->db->next_record();
+       $exists = $GLOBALS['phpgw']->db->f('0');
+       if ($exists != 0)
+       {
+               $GLOBALS['phpgw']->db->query("select distinct ticket_priority 
from phpgw_tts_tickets order by ticket_priority desc");
+               $y=0;
+               while ($GLOBALS['phpgw']->db->next_record() != 0)
+               {
+                       $dbvalue[$y] = $GLOBALS['phpgw']->db->f('0') ;
+                       ++$y;
+               }
+               
+               unset($sel);
+               for($y-=1;$y>=0;--$y)
+               {
+                       if($dbvalue[$y] == $_POST['ticket']['filter_prio'])
+                       {
+                               $selected = " selected";
+                       }
+                       else
+                       {
+                               $selected = "";
+                       }
+                       $sel .= 
'<option'.$selected.'>'.$dbvalue[$y].'</option>' ;
+               }
+               $GLOBALS['phpgw']->template->set_var('filter_prio','<select 
name=ticket[filter_prio] onChange="document.search.submit()"><option> 
</option>'.$sel.'</select>');
+               
+
+               $GLOBALS['phpgw']->db->query("select distinct ticket_owner from 
phpgw_tts_tickets order by ticket_owner desc");
+               $y=0;
+               while ($GLOBALS['phpgw']->db->next_record() != 0)
+               {
+                       $dbvalue[$y] = $GLOBALS['phpgw']->db->f('0') ;
+                       $db2name[$y] = 
$GLOBALS['phpgw']->accounts->id2name($dbvalue[$y]);
+                       ++$y;
+               }
+               
+               unset($sel);
+               natsort($db2name);
+               reset($db2name);
+               while(list($dummy,$entry) = each($db2name))
+               {
+                       if($entry == $_POST['ticket']['filter_owner'])
+                       {
+                               $selected = " selected";
+                       }
+                       else
+                       {
+                               $selected = "";
+                       }
+                       $sel .= '<option'.$selected.'>'.$entry.'</option>' ;
+               }
+               $GLOBALS['phpgw']->template->set_var('filter_owner','<select 
name=ticket[filter_owner] onChange="document.search.submit()"><option> 
</option>'.$sel.'</select>');
+       
+       
+               $GLOBALS['phpgw']->db->query("select distinct ticket_assignedto 
from phpgw_tts_tickets order by ticket_assignedto desc");
+               $y=0;
+               while ($GLOBALS['phpgw']->db->next_record() != 0)
+               {
+                       $dbvalue[$y] = $GLOBALS['phpgw']->db->f('0') ;
+                       $db2name[$y] = 
$GLOBALS['phpgw']->accounts->id2name($dbvalue[$y]);
+                       ++$y;
+               }
+
+               unset($sel);
+               natsort($db2name);
+               reset($db2name);
+               while(list($dummy,$entry) = each($db2name))
+               {
+                       if($entry == $_POST['ticket']['filter_assignedto'])
+                       {
+                               $selected = " selected";
+                       }
+                       else
+                       {
+                               $selected = "";
+                       }
+                       $sel .= '<option'.$selected.'>'.$entry.'</option>' ;
+               }
+
+               
$GLOBALS['phpgw']->template->set_var('filter_assignedto','<select 
name=ticket[filter_assignedto] onChange="document.search.submit()"><option> 
</option>'.$sel.'</select>');
+       
+               
+               $GLOBALS['phpgw']->db->query("select distinct ticket_category 
from phpgw_tts_tickets order by ticket_category");
+               $y=0;
+               unset($db2name);
+               while ($GLOBALS['phpgw']->db->next_record() != 0)
+               {
+                       $dbvalue[$y] = $GLOBALS['phpgw']->db->f('0');
+                       $db2name[$y] = 
$GLOBALS['phpgw']->categories->id2name($dbvalue[$y]);
+                       ++$y;
+               }
+               
+               unset($sel);
+               natsort($db2name);
+               reset($db2name);
+               while(list($dummy,$entry) = each($db2name))
+               {
+                       if($entry == $_POST['ticket']['filter_category'])
+                       {
+                               $selected = " selected";                        
        
+                       }
+                       else
+                       {
+                               $selected = "";
+                       }                       
+                       $sel .= '<option'.$selected.'>'.$entry.'</option>' ;
+               }
+       
+               $GLOBALS['phpgw']->template->set_var('filter_category','<select 
name=ticket[filter_category] 
onChange="document.search.submit()"><option></option>'.$sel.'</select>');
+               
+               $filter_status_options = array('none'   => '',
+                                              'open'   => lang('open'),
+                                              'closed' => lang('closed')
+                                             );
+               unset($options);
+               foreach($filter_status_options AS $key => $value)
+               {
+                       unset($selected);
+                       if($_REQUEST['ticket']['filter_status'] == $key)
+                       {
+                               $selected = 'selected="seleceted"';
+                       }
+                       $options .= '<option value="'.$key.'" 
'.$selected.'>'.$value.'</option>'; 
+               }
+               $GLOBALS['phpgw']->template->set_var('filter_status_options', 
$options);
+               
+       }
+       
        $GLOBALS['phpgw']->template->pfp('out','index');
 
        $GLOBALS['phpgw']->common->phpgw_footer();




reply via email to

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