fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10599] property: more on condition survey


From: Sigurd Nes
Subject: [Fmsystem-commits] [10599] property: more on condition survey
Date: Fri, 14 Dec 2012 14:23:41 +0000

Revision: 10599
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10599
Author:   sigurdne
Date:     2012-12-14 14:23:40 +0000 (Fri, 14 Dec 2012)
Log Message:
-----------
property: more on condition survey

Modified Paths:
--------------
    trunk/property/inc/class.socondition_survey.inc.php
    trunk/property/inc/class.uicondition_survey.inc.php

Modified: trunk/property/inc/class.socondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.socondition_survey.inc.php 2012-12-14 14:23:19 UTC 
(rev 10598)
+++ trunk/property/inc/class.socondition_survey.inc.php 2012-12-14 14:23:40 UTC 
(rev 10599)
@@ -49,31 +49,35 @@
                        $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'] : '' ;
+                       $dir            = isset($data['dir']) ? $data['dir'] : 
'' ;
                        $cat_id         = isset($data['cat_id']) ? 
(int)$data['cat_id'] : 0;
                        $allrows        = isset($data['allrows']) ? 
$data['allrows'] : '';
 
                        $table = 'fm_condition_survey';
-                       if ($order)
+                       if ($sort)
                        {
-                               $ordermethod = " order by $order $sort";
+                               $metadata = $this->_db->metadata($table);
+                               if(isset($metadata[$sort]))
+                               {
+                                       $ordermethod = " ORDER BY 
{$table}.$sort $dir";
+                               }
                        }
                        else
                        {
-                               $ordermethod = ' order by id DESC';
+                               $ordermethod = " ORDER BY {$table}.id DESC";
                        }
 
                        $where = 'WHERE';
                        if ($cat_id)
                        {
-                               $filtermethod .= " {$where} category = 
{$cat_id}";
+                               $filtermethod .= " {$where} {$table}.category = 
{$cat_id}";
                                $where = 'AND';
                        }
 
                        if($query)
                        {
                                $query                  = 
$this->_db->db_addslashes($query);
-                               $querymethod    = " {$where} title 
{$this->_like} '%{$query}%'";
+                               $querymethod    = " {$where} {$table}.title 
{$this->_like} '%{$query}%'";
                        }
 
                        $groupmethod = "GROUP BY 
$table.id,$table.title,$table.descr,$table.address,$table.entry_date,$table.user_id";

Modified: trunk/property/inc/class.uicondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.uicondition_survey.inc.php 2012-12-14 14:23:19 UTC 
(rev 10598)
+++ trunk/property/inc/class.uicondition_survey.inc.php 2012-12-14 14:23:40 UTC 
(rev 10599)
@@ -217,18 +217,10 @@
                                'query' => phpgw::get_var('query'),
                                'sort' => phpgw::get_var('sort'),
                                'dir' => phpgw::get_var('dir'),
-                               'cat_id' => phpgw::get_var('dir', 'int', 
'REQUEST', 0),
+                               'cat_id' => phpgw::get_var('cat_id', 'int', 
'REQUEST', 0),
                                'allrows' => phpgw::get_var('allrows', 'bool')
                        );
 
-                       if 
($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
-                       {
-                               $user_rows_per_page = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
-                       }
-                       else
-                       {
-                               $user_rows_per_page = 10;
-                       }
                        // Create an empty result set
                        $result_objects = array();
                        $result_count = 0;
@@ -237,7 +229,6 @@
 
                        $values = $this->bo->read($params);
 
-                       // ... add result data
                        $result_data = array('results' => $values);
 
                        $result_data['total_records'] = 
$this->bo->total_records;
@@ -246,9 +237,12 @@
                        $result_data['dir'] = $params['dir'];
 
 
-                       if (!$export)
+                       if ($export)
                        {
-                               //Add action column to each row in result table
+                               
+                       }
+                       else
+                       {
                                array_walk(     $result_data['results'], 
array($this, '_add_links'), "property.uicondition_survey.view" );
                        }
                        return $this->yui_results($result_data);




reply via email to

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