phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] property/class.solookup.php, 1.1.1.2


From: nomail
Subject: [Phpgroupware-cvs] property/class.solookup.php, 1.1.1.2
Date: Sun, 20 Jun 2004 14:02:25 +0200

Update of /property
Modified Files:
        Branch: 
          class.solookup.php

date: 2004/06/20 12:02:25;  author: sigurdne;  state: Exp;  lines: +69 -1

Log Message:
no message
=====================================================================
Index: property/class.solookup.php
diff -u property/class.solookup.php:1.1.1.1 property/class.solookup.php:1.1.1.2
--- property/class.solookup.php:1.1.1.1 Wed Jun  2 20:07:05 2004
+++ property/class.solookup.php Sun Jun 20 12:02:25 2004
@@ -87,6 +87,74 @@
 
                        while (!$dbresult->EOF)
                        {
+                               $contact[] = array
+                               (
+                                       'id'    => $dbresult->fields['id'],
+                                       'org_name'      => 
$dbresult->fields['org_name'],
+                                       );
+                               $dbresult->MoveNext();
+                       }
+//html_print_r($contact);
+
+                       return $contact;
+               }
+
+               function read_vendor($data)
+               {
+                       if(is_array($data))
+                       {
+                               if ($data['start'])
+                               {
+                                       $start=$data['start'];
+                               }
+                               else
+                               {
+                                       $start=0;
+                               }
+                               $filter = 
(isset($data['filter'])?$data['filter']:'none');
+                               $query = 
(isset($data['query'])?$data['query']:'');
+                               $sort = 
(isset($data['sort'])?$data['sort']:'DESC');
+                               $order = 
(isset($data['order'])?$data['order']:'');
+                               $cat_id = 
(isset($data['cat_id'])?$data['cat_id']:0);
+                       }
+
+
+                       if ($order)
+                       {
+                               $ordermethod = " order by $order $sort";
+                       }
+                       else
+                       {
+                               $ordermethod = ' order by org_name DESC';
+                       }
+
+
+                       $where= 'WHERE';
+
+                       if ($cat_id > 0)
+                       {
+                               $filtermethod .= " $where member_of LIKE 
'%,$cat_id,%' ";
+                               $where= 'AND';
+                       }
+
+                       if($query)
+                       {
+                               $query = ereg_replace("'",'',$query);
+                               $query = ereg_replace('"','',$query);
+
+                               $querymethod = " $where (id LIKE '%$query%' or 
org_name LIKE '%$query%')";
+                       }
+
+                       $sql = "SELECT id,org_name FROM fm_vendor $filtermethod 
$querymethod";
+
+                       $dbresult2 = $GLOBALS['phpgw']->db->Execute($sql);
+                       $this->total_records = $dbresult2->_numOfRows;
+                       $maxmatchs = 15;
+                       $dbresult = $GLOBALS['phpgw']->db->SelectLimit($sql . 
$ordermethod,$maxmatchs,$start);
+
+
+                       while (!$dbresult->EOF)
+                       {
                                $vendor[] = array
                                (
                                        'id'    => $dbresult->fields['id'],
@@ -94,7 +162,7 @@
                                        );
                                $dbresult->MoveNext();
                        }
-//html_print_r($vendor);
+//_debug_array($vendor);
 
                        return $vendor;
                }




reply via email to

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