fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7128] hrm: fix paging


From: Sigurd Nes
Subject: [Fmsystem-commits] [7128] hrm: fix paging
Date: Thu, 17 Mar 2011 12:28:41 +0000

Revision: 7128
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7128
Author:   sigurdne
Date:     2011-03-17 12:28:40 +0000 (Thu, 17 Mar 2011)
Log Message:
-----------
hrm: fix paging

Modified Paths:
--------------
    trunk/hrm/inc/class.bojob.inc.php
    trunk/hrm/inc/class.sojob.inc.php
    trunk/hrm/inc/class.uijob.inc.php

Modified: trunk/hrm/inc/class.bojob.inc.php
===================================================================
--- trunk/hrm/inc/class.bojob.inc.php   2011-03-17 09:30:56 UTC (rev 7127)
+++ trunk/hrm/inc/class.bojob.inc.php   2011-03-17 12:28:40 UTC (rev 7128)
@@ -18,7 +18,7 @@
 
        class hrm_bojob
        {
-               var $start;
+               var $start = 0;
                var $query;
                var $filter;
                var $sort;
@@ -70,7 +70,7 @@
                                $this->use_session = true;
                        }
 
-                       $this->start    = phpgw::get_var('start', 'int');
+                       $this->start    = (int)phpgw::get_var('start', 'int');
                        $this->query    = phpgw::get_var('query');
                        $this->sort             = phpgw::get_var('sort');
                        $this->order    = phpgw::get_var('order');

Modified: trunk/hrm/inc/class.sojob.inc.php
===================================================================
--- trunk/hrm/inc/class.sojob.inc.php   2011-03-17 09:30:56 UTC (rev 7127)
+++ trunk/hrm/inc/class.sojob.inc.php   2011-03-17 12:28:40 UTC (rev 7128)
@@ -18,12 +18,14 @@
 
        class hrm_sojob
        {
+               var $total_records = 0;
+               
                /**
                * @var array $move_child the children to be moved
                * @internal I don't think this is really needed - skwashd nov07
                */
                private $move_child = array();
-
+               
                public function __construct()
                {
                        $this->account  = 
$GLOBALS['phpgw_info']['user']['account_id'];
@@ -138,23 +140,12 @@
 
                        }
 
-                       if (!$allrows)
+                       if(!$allrows)
                        {
-                               $max = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
-                               $max = $max + $start;
-
-                               $sjobs = array();
-                               foreach ( $jobs as $job )
-                               {
-                                       if ( isset($job) && is_array($job) )
-                                       {
-                                               $sjobs[] = $job;
-                                       }
-                               }
-                               if ( count($sjobs) )
-                               {
-                                       $jobs = $sjobs;
-                               }
+                               $num_rows = 
isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'])?intval($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']):15;
+                               $page = ceil( ( $start / $this->total_records ) 
* ($this->total_records/ $num_rows) );
+                               $out = array_chunk($jobs, $num_rows);
+                               $jobs = $out[$page];
                        }
 
                        $sql = "SELECT count(*) as quali_count,job_id FROM 
phpgw_hrm_quali GROUP BY job_id";
@@ -177,8 +168,8 @@
                        {
                                foreach ( $jobs as &$job )
                                {
-                                       $job['quali_count'] = (int) 
isset($quali[$job['id']]) ? $quali[$job['id']] : null;
-                                       $job['task_count']  = (int) 
isset($task[$job['id']]) ? $task[$job['id']] : null;
+                                       $job['quali_count'] =  
isset($quali[$job['id']]) ? $quali[$job['id']] : 0;
+                                       $job['task_count']  =  
isset($task[$job['id']]) ? $task[$job['id']] : 0;
                                }
 
                        }

Modified: trunk/hrm/inc/class.uijob.inc.php
===================================================================
--- trunk/hrm/inc/class.uijob.inc.php   2011-03-17 09:30:56 UTC (rev 7127)
+++ trunk/hrm/inc/class.uijob.inc.php   2011-03-17 12:28:40 UTC (rev 7128)
@@ -70,7 +70,7 @@
 
                        $this->start                            = 
$this->bo->start;
                        $this->query                            = 
$this->bo->query;
-                       $this->sort                             = 
$this->bo->sort;
+                       $this->sort                                     = 
$this->bo->sort;
                        $this->order                            = 
$this->bo->order;
                        $this->allrows                          = 
$this->bo->allrows;
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'hrm::job';




reply via email to

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