fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10576] property: More on condition survey


From: Sigurd Nes
Subject: [Fmsystem-commits] [10576] property: More on condition survey
Date: Thu, 06 Dec 2012 18:25:37 +0000

Revision: 10576
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10576
Author:   sigurdne
Date:     2012-12-06 18:25:36 +0000 (Thu, 06 Dec 2012)
Log Message:
-----------
property: More on condition survey

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

Modified: trunk/property/inc/class.uicondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.uicondition_survey.inc.php 2012-12-06 14:50:41 UTC 
(rev 10575)
+++ trunk/property/inc/class.uicondition_survey.inc.php 2012-12-06 18:25:36 UTC 
(rev 10576)
@@ -537,6 +537,7 @@
                        $interlink      = CreateObject('property.interlink');
                        $target = $interlink->get_relation('property', 
$this->acl_location, $id, 'target');
 
+
                        $values = array();
                        if($target)
                        {
@@ -556,7 +557,40 @@
                                        }
                                }
                        }
-                       return array('ResultSet'=> array('Result'=>$values), 
'totalResultsAvailable' => count($values));
+
+//------ Start pagination
+
+                       $start = phpgw::get_var('startIndex', 'REQUEST', 'int', 
0);
+                       $total_records = count($values);
+
+                       $num_rows = 
isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) && 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] ? (int) 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] : 15;      
                
+
+                       if($allrows)
+                       {
+                               $out = $values;
+                       }
+                       else
+                       {
+                               $page = ceil( ( $start / $total_records ) * 
($total_records/ $num_rows) );
+                               $values_part = array_chunk($values, $num_rows);
+                               $out = $values_part[$page];
+                       }
+
+//------ End pagination
+
+
+                       $data = array(
+                                'ResultSet' => array(
+                                       'totalResultsAvailable' => 
$total_records,
+                                       'startIndex' => $start,
+                                       'sortKey' => 'type', 
+                                       'sortDir' => "ASC", 
+                                       'Result' => $out,
+                                       'pageSize' => $num_rows,
+                                       'activePage' => floor($start / 
$num_rows) + 1
+                               )
+                       );
+                       return $data;
                }
 
 




reply via email to

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