[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10400] Logistic: pagination of hierarchy
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [10400] Logistic: pagination of hierarchy |
Date: |
Wed, 31 Oct 2012 14:43:00 +0000 |
Revision: 10400
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10400
Author: sigurdne
Date: 2012-10-31 14:42:59 +0000 (Wed, 31 Oct 2012)
Log Message:
-----------
Logistic: pagination of hierarchy
Modified Paths:
--------------
trunk/logistic/inc/class.soactivity.inc.php
trunk/logistic/inc/class.uiactivity.inc.php
Modified: trunk/logistic/inc/class.soactivity.inc.php
===================================================================
--- trunk/logistic/inc/class.soactivity.inc.php 2012-10-31 14:01:59 UTC (rev
10399)
+++ trunk/logistic/inc/class.soactivity.inc.php 2012-10-31 14:42:59 UTC (rev
10400)
@@ -32,6 +32,7 @@
class logistic_soactivity extends logistic_socommon
{
+ public $total_records = 0;
protected static $so;
protected $activity_tree = array();
@@ -340,16 +341,42 @@
$this->get_children($activity['id'], 1);
}
+
$result = array();
- foreach($this->activity_tree as $_activity)
+
+//------ Start pagination
+ $this->total_records = count($this->activity_tree);
+
+ if($this->total_records == 0)
{
+ return $result;
+ }
+
+ if(!$allrows)
+ {
+ $num_rows =
isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) ?
(int) $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']:15;
+
+ $page = ceil( ( $start / $this->total_records )
* ($this->total_records/ $num_rows) );
+
+ $activity_tree =
array_chunk($this->activity_tree, $num_rows);
+
+ $out = $activity_tree[$page];
+ }
+ else
+ {
+ $out = $this->activity_tree;
+ }
+
+//------ End pagination
+
+ foreach($out as $_activity)
+ {
$this->db->query("SELECT * FROM lg_activity
WHERE id ={$_activity['id']}",__LINE__,__FILE__);
$this->db->next_record();
$activity_obj =
$this->populate($_activity['id']);
$activity_obj->set_name($_activity['name']);
$result[] = $activity_obj;
}
-
return $result;
}
Modified: trunk/logistic/inc/class.uiactivity.inc.php
===================================================================
--- trunk/logistic/inc/class.uiactivity.inc.php 2012-10-31 14:01:59 UTC (rev
10399)
+++ trunk/logistic/inc/class.uiactivity.inc.php 2012-10-31 14:42:59 UTC (rev
10400)
@@ -252,7 +252,7 @@
phpgwapi_cache::session_set('logistic',
'activity_query', $search_for);
$filters = array('project' =>
phpgw::get_var('project'), 'user' => phpgw::get_var('user'), 'activity' =>
phpgw::get_var('filter', 'int'));
$result_objects =
$this->so->get($start_index, $num_of_objects, $sort_field, $sort_ascending,
$search_for, $search_type, $filters);
- $object_count =
$this->so->get_count($search_for, $search_type, $filters);
+ $object_count =
$this->so->total_records;
break;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10400] Logistic: pagination of hierarchy,
Sigurd Nes <=