diff --git a/module/action/model.php b/module/action/model.php index 11977b6e6a..531b53149c 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -1064,7 +1064,7 @@ class actionModel extends model * @param string $account * @param string $period * @param string $orderBy - * @param object $pager + * @param int $limit * @param string|int $productID all|int(like 123)|notzero all => include zero, notzero, greater than 0 * @param string|int $projectID same as productID * @param string|int $executionID same as productID @@ -1073,7 +1073,7 @@ class actionModel extends model * @access public * @return array */ - public function getDynamic($account = 'all', $period = 'all', $orderBy = 'date_desc', $pager = null, $productID = 'all', $projectID = 'all', $executionID = 'all', $date = '', $direction = 'next') + public function getDynamic($account = 'all', $period = 'all', $orderBy = 'date_desc', $limit = 50, $productID = 'all', $projectID = 'all', $executionID = 'all', $date = '', $direction = 'next') { /* Computer the begin and end date of a period. */ $beginAndEnd = $this->computeBeginAndEnd($period); @@ -1185,7 +1185,7 @@ class actionModel extends model ->andWhere($condition) ->beginIF($actionCondition)->andWhere("($actionCondition)")->fi() ->orderBy($orderBy) - ->page($pager) + ->limit($limit) ->fetchAll(); if(!$actions) return array(); @@ -1226,13 +1226,13 @@ class actionModel extends model * @param array $executions * @param int $queryID * @param string $orderBy - * @param object $pager + * @param int $limit * @param string $date * @param string $direction * @access public * @return array */ - public function getDynamicBySearch($products, $projects, $executions, $queryID, $orderBy = 'date_desc', $pager = null, $date = '', $direction = 'next') + public function getDynamicBySearch($products, $projects, $executions, $queryID, $orderBy = 'date_desc', $limit = 50, $date = '', $direction = 'next') { $query = $queryID ? $this->loadModel('search')->getQuery($queryID) : ''; @@ -1281,7 +1281,7 @@ class actionModel extends model if($this->config->vision == 'lite') $actionQuery .= " AND objectType != 'product'"; $actionQuery .= " AND vision = '" . $this->config->vision . "'"; - $actions = $this->getBySQL($actionQuery, $orderBy, $pager); + $actions = $this->getBySQL($actionQuery, $orderBy, $limit); $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'action'); if(!$actions) return array(); @@ -1293,11 +1293,11 @@ class actionModel extends model * * @param string $sql * @param string $orderBy - * @param object $pager + * @param int $limit * @access public * @return array */ - public function getBySQL($sql, $orderBy, $pager = null) + public function getBySQL($sql, $orderBy, $limit = 50) { $actionCondition = $this->getActionCondition(); if(is_array($actionCondition)) return array(); @@ -1306,7 +1306,7 @@ class actionModel extends model ->where($sql) ->beginIF(!empty($actionCondition))->andWhere("($actionCondition)")->fi() ->orderBy($orderBy) - ->page($pager) + ->limit($limit) ->fetchAll(); } @@ -2174,11 +2174,12 @@ class actionModel extends model $condition = $this->session->actionQueryCondition; /* Remove date condition for direction. */ - $condition = preg_replace("/AND +date[\<\>]'\d{4}\-\d{2}\-\d{2}'/", '', $condition); - $count = $this->dao->select('count(*) as count')->from(TABLE_ACTION)->where($condition) + $condition = preg_replace("/AND +[`]?date[`]?[ ]*[\<\>][ |=]*'\d{4}\-\d{2}\-\d{2}'/", '', $condition); + $count = $this->dao->select('id')->from(TABLE_ACTION)->where($condition) ->andWhere('date' . ($direction == 'next' ? '<' : '>') . "'{$date}'") - ->fetch('count'); - return $count > 0; + ->limit(1) + ->fetch(); + return !empty($count); } /** diff --git a/module/block/control.php b/module/block/control.php index bcc73d15b8..47db7346c8 100755 --- a/module/block/control.php +++ b/module/block/control.php @@ -360,11 +360,7 @@ class block extends control */ public function dynamic() { - /* Load pager. */ - $this->app->loadClass('pager', $static = true); - $pager = new pager(0, 30, 1); - - $this->view->actions = $this->loadModel('action')->getDynamic('all', 'today', 'id_desc', $pager); + $this->view->actions = $this->loadModel('action')->getDynamic('all', 'today', 'id_desc', 30); $this->view->users = $this->loadModel('user')->getPairs('nodeleted|noletter|all', '', 0, array_unique(array_column($this->view->actions, 'actor'))); $this->display(); @@ -1563,11 +1559,7 @@ class block extends control { $projectID = $this->session->project; - /* Load pager. */ - $this->app->loadClass('pager', $static = true); - $pager = new pager(0, 30, 1); - - $this->view->actions = $this->loadModel('action')->getDynamic('all', 'all', 'id_desc', $pager, 'all', $projectID); + $this->view->actions = $this->loadModel('action')->getDynamic('all', 'all', 'id_desc', 30, 'all', $projectID); $this->view->users = $this->loadModel('user')->getPairs('noletter', '', 0, array_unique(array_column($this->view->actions, 'actor'))); } @@ -2103,11 +2095,7 @@ class block extends control */ public function printDocDynamicBlock() { - /* Load pager. */ - $this->app->loadClass('pager', $static = true); - $pager = new pager(0, 30, 1); - - $this->view->actions = $this->loadModel('doc')->getDynamic($pager); + $this->view->actions = $this->loadModel('doc')->getDynamic(30); $this->view->users = $this->loadModel('user')->getPairs('nodeleted|noletter|all', '', 0, array_unique(array_column($this->view->actions, 'actor'))); } diff --git a/module/company/control.php b/module/company/control.php index 6a84f863e0..80ddf5025e 100755 --- a/module/company/control.php +++ b/module/company/control.php @@ -201,10 +201,6 @@ class company extends control $this->session->set('meetingList', $uri, 'project'); $this->session->set('meetingroomList', $uri, 'admin'); - /* Set the pager. */ - $this->app->loadClass('pager', $static = true); - $pager = new pager($recTotal, $recPerPage = 50, $pageID = 1); - /* Append id for secend sort. */ if($direction == 'next') $orderBy = 'date_desc'; if($direction == 'pre') $orderBy = 'date_asc'; @@ -253,11 +249,11 @@ class company extends control if(!$productID) $productID = 'all'; if(!$projectID) $projectID = 'all'; if(!$executionID) $executionID = 'all'; - $actions = $this->action->getDynamic($account, $browseType, $orderBy, $pager, $productID, $projectID, $executionID, $date, $direction); + $actions = $this->action->getDynamic($account, $browseType, $orderBy, 50, $productID, $projectID, $executionID, $date, $direction); } else { - $actions = $this->action->getDynamicBySearch($products, $projects, $executions, $queryID, $orderBy, $pager, $date, $direction); + $actions = $this->action->getDynamicBySearch($products, $projects, $executions, $queryID, $orderBy, 50, $date, $direction); } /* Build search form. */ @@ -285,8 +281,10 @@ class company extends control $this->config->company->dynamic->search['params']['actor']['values'] = $accountPairs; $this->loadModel('search')->setSearchParams($this->config->company->dynamic->search); + $dateGroups = $this->action->buildDateGroup($actions, $direction, $browseType, $orderBy); + /* Assign. */ - $this->view->recTotal = $recTotal; + $this->view->recTotal = count($dateGroups, 1) - count($dateGroups); $this->view->browseType = $browseType; $this->view->account = $account; $this->view->accountPairs = $accountPairs; @@ -295,10 +293,9 @@ class company extends control $this->view->executionID = $executionID; $this->view->queryID = $queryID; $this->view->orderBy = $orderBy; - $this->view->pager = $pager; $this->view->userID = $userID; $this->view->param = $param; - $this->view->dateGroups = $this->action->buildDateGroup($actions, $direction, $browseType, $orderBy); + $this->view->dateGroups = $dateGroups; $this->view->direction = $direction; $this->display(); } diff --git a/module/company/view/dynamic.html.php b/module/company/view/dynamic.html.php index 0fe8952af1..f7748405da 100644 --- a/module/company/view/dynamic.html.php +++ b/module/company/view/dynamic.html.php @@ -21,8 +21,7 @@ if($period == $browseType) { $active = 'btn-active-text'; - $pager->recTotal = $recTotal ? $recTotal : $pager->recTotal; - $label .= " {$pager->recTotal}"; + $label .= " {$recTotal}"; } echo html::a(inlink('dynamic', "browseType=$period¶m=&recTotal=0&date=&direction=next&userID=$userID&productID=$productID&projectID=$projectID&executionID=$executionID&orderBy=$orderBy"), $label, '', "class='btn btn-link $active' id='{$period}'") ?> @@ -116,8 +115,8 @@ $firstDate = date('Y-m-d', strtotime($firstAction->originalDate) + 24 * 3600); $lastDate = substr($action->originalDate, 0, 10); $hasPre = $this->action->hasPreOrNext($firstDate, 'pre'); $hasNext = $this->action->hasPreOrNext($lastDate, 'next'); -$preLink = $hasPre ? inlink('dynamic', "browseType=$browseType¶m=$param&recTotal={$pager->recTotal}&date=" . strtotime($firstDate) . "&direction=pre&userID=$userID&productID=$productID&projectID=$projectID&executionID=$executionID&orderBy=$orderBy") : 'javascript:;'; -$nextLink = $hasNext ? inlink('dynamic', "browseType=$browseType¶m=$param&recTotal={$pager->recTotal}&date=" . strtotime($lastDate) . "&direction=next&userID=$userID&productID=$productID&projectID=$projectID&executionID=$executionID&orderBy=$orderBy") : 'javascript:;'; +$preLink = $hasPre ? inlink('dynamic', "browseType=$browseType¶m=$param&recTotal=0&date=" . strtotime($firstDate) . "&direction=pre&userID=$userID&productID=$productID&projectID=$projectID&executionID=$executionID&orderBy=$orderBy") : 'javascript:;'; +$nextLink = $hasNext ? inlink('dynamic', "browseType=$browseType¶m=$param&recTotal=0&date=" . strtotime($lastDate) . "&direction=next&userID=$userID&productID=$productID&projectID=$projectID&executionID=$executionID&orderBy=$orderBy") : 'javascript:;'; ?>
diff --git a/module/doc/model.php b/module/doc/model.php index 77d1813600..736888f57a 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -3445,11 +3445,11 @@ class docModel extends model /** * Get document dynamic. * - * @param object $pager + * @param int $limit * @access public * @return array */ - public function getDynamic($pager = null) + public function getDynamic($limit = 30) { $allLibs = $this->getLibs('hasApi'); $hasPrivDocIdList = $this->getPrivDocs('', 0, 'all'); @@ -3467,7 +3467,7 @@ class docModel extends model ->andWhere('objectID')->in(array_keys($apiList)) ->markRight(2) ->orderBy('date_desc') - ->page($pager) + ->limit($limit) ->fetchAll(); return $this->loadModel('action')->transformActions($actions); diff --git a/module/execution/control.php b/module/execution/control.php index 5cbc4e274f..0a493e9e40 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -2590,23 +2590,17 @@ class execution extends control $chartData = $this->execution->buildBurnData($executionID, $dateList, $type, 'left', $executionEnd); } - /* Load pager. */ - $this->app->loadClass('pager', $static = true); - $pager = new pager(0, 30, 1); - $this->executeHooks($executionID); if(!$execution->projectInfo->hasProduct) $this->lang->execution->PO = $this->lang->common->story . $this->lang->execution->owner; $this->view->title = $this->lang->execution->view; - $this->view->position[] = html::a($this->createLink('execution', 'browse', "executionID=$executionID"), $execution->name); - $this->view->position[] = $this->view->title; $this->view->execution = $execution; $this->view->products = $products; $this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($products), '', $linkedBranches); $this->view->planGroups = $this->execution->getPlans($products); $this->view->actions = $this->loadModel('action')->getList($this->objectType, $executionID); - $this->view->dynamics = $this->loadModel('action')->getDynamic('all', 'all', 'date_desc', $pager, 'all', 'all', $executionID); + $this->view->dynamics = $this->loadModel('action')->getDynamic('all', 'all', 'date_desc', 30, 'all', 'all', $executionID); $this->view->users = $this->loadModel('user')->getPairs('noletter'); $this->view->teamMembers = $this->execution->getTeamMembers($executionID); $this->view->docLibs = $this->loadModel('doc')->getLibsByObject('execution', $executionID); @@ -3723,10 +3717,6 @@ class execution extends control /* Set the menu. If the executionID = 0, use the indexMenu instead. */ $this->execution->setMenu($executionID); - /* Set the pager. */ - $this->app->loadClass('pager', $static = true); - $pager = new pager($recTotal, $recPerPage = 50, $pageID = 1); - /* Set the user and type. */ $account = 'all'; if($type == 'account') @@ -3734,30 +3724,25 @@ class execution extends control $user = $this->loadModel('user')->getById((int)$param, 'id'); if($user) $account = $user->account; } - $period = $type == 'account' ? 'all' : $type; - $date = empty($date) ? '' : date('Y-m-d', $date); - $actions = $this->loadModel('action')->getDynamic($account, $period, $orderBy, $pager, 'all', 'all', $executionID, $date, $direction); - if(empty($recTotal)) $recTotal = count($actions); + $period = $type == 'account' ? 'all' : $type; + $date = empty($date) ? '' : date('Y-m-d', $date); + $actions = $this->loadModel('action')->getDynamic($account, $period, $orderBy, 50, 'all', 'all', $executionID, $date, $direction); + $dateGroups = $this->action->buildDateGroup($actions, $direction, $type); - /* The header and position. */ $execution = $this->execution->getByID($executionID); - $this->view->title = $execution->name . $this->lang->colon . $this->lang->execution->dynamic; - $this->view->position[] = html::a($this->createLink('execution', 'browse', "executionID=$executionID"), $execution->name); - $this->view->position[] = $this->lang->execution->dynamic; - - $this->view->userIdPairs = $this->loadModel('user')->getTeamMemberPairs($executionID, 'execution', 'nodeleted|useid'); - $this->view->accountPairs = $this->loadModel('user')->getPairs('noletter|nodeleted'); /* Assign. */ - $this->view->executionID = $executionID; - $this->view->type = $type; - $this->view->orderBy = $orderBy; - $this->view->pager = $pager; - $this->view->account = $account; - $this->view->param = $param; - $this->view->dateGroups = $this->action->buildDateGroup($actions, $direction, $type); - $this->view->direction = $direction; - $this->view->recTotal = $recTotal; + $this->view->title = $execution->name . $this->lang->colon . $this->lang->execution->dynamic; + $this->view->userIdPairs = $this->loadModel('user')->getTeamMemberPairs($executionID, 'execution', 'nodeleted|useid'); + $this->view->accountPairs = $this->loadModel('user')->getPairs('noletter|nodeleted'); + $this->view->executionID = $executionID; + $this->view->type = $type; + $this->view->orderBy = $orderBy; + $this->view->account = $account; + $this->view->param = $param; + $this->view->dateGroups = $dateGroups; + $this->view->direction = $direction; + $this->view->recTotal = count($dateGroups, 1) - count($dateGroups); $this->display(); } diff --git a/module/execution/view/dynamic.html.php b/module/execution/view/dynamic.html.php index edd375b54a..da42a22efc 100755 --- a/module/execution/view/dynamic.html.php +++ b/module/execution/view/dynamic.html.php @@ -107,8 +107,8 @@ $firstDate = date('Y-m-d', strtotime($firstAction->originalDate) + 24 * 3600); $lastDate = substr($action->originalDate, 0, 10); $hasPre = $this->action->hasPreOrNext($firstDate, 'pre'); $hasNext = $this->action->hasPreOrNext($lastDate, 'next'); -$preLink = $hasPre ? inlink('dynamic', "executionID=$executionID&type=$type¶m=$param&recTotal={$pager->recTotal}&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;'; -$nextLink = $hasNext ? inlink('dynamic', "executionID=$executionID&type=$type¶m=$param&recTotal={$pager->recTotal}&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;'; +$preLink = $hasPre ? inlink('dynamic', "executionID=$executionID&type=$type¶m=$param&recTotal=0&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;'; +$nextLink = $hasNext ? inlink('dynamic', "executionID=$executionID&type=$type¶m=$param&recTotal=0&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;'; ?>
diff --git a/module/my/control.php b/module/my/control.php index 8315c9c1f8..77fc446418 100755 --- a/module/my/control.php +++ b/module/my/control.php @@ -1601,10 +1601,6 @@ EOF; $this->session->set('componentLibList', $uri, 'assetlib'); $this->session->set('opportunityList', $uri, 'project'); - /* Set the pager. */ - $this->app->loadClass('pager', $static = true); - $pager = new pager($recTotal, $recPerPage = 50, $pageID = 1); - /* Append id for secend sort. */ $orderBy = $direction == 'next' ? 'date_desc' : 'date_asc'; @@ -1613,16 +1609,15 @@ EOF; $this->view->position[] = $this->lang->my->dynamic; $date = empty($date) ? '' : date('Y-m-d', $date); - $actions = $this->loadModel('action')->getDynamic($this->app->user->account, $type, $orderBy, $pager, 'all', 'all', 'all', $date, $direction); - if(empty($originTotal)) $originTotal = $pager->recTotal; + $actions = $this->loadModel('action')->getDynamic($this->app->user->account, $type, $orderBy, 50, 'all', 'all', 'all', $date, $direction); + $dateGroups = $this->action->buildDateGroup($actions, $direction, $type); /* Assign. */ $this->view->type = $type; $this->view->orderBy = $orderBy; - $this->view->pager = $pager; - $this->view->dateGroups = $this->action->buildDateGroup($actions, $direction, $type); + $this->view->dateGroups = $dateGroups; $this->view->direction = $direction; - $this->view->originTotal = $originTotal; + $this->view->originTotal = count($dateGroups, 1) - count($dateGroups); $this->display(); } diff --git a/module/my/model.php b/module/my/model.php index db7be74f52..14d8e43fa0 100644 --- a/module/my/model.php +++ b/module/my/model.php @@ -286,10 +286,7 @@ class myModel extends model */ public function getActions() { - $this->app->loadClass('pager', $static = true); - $pager = new pager(0, 50, 1); - - $actions = $this->loadModel('action')->getDynamic('all', 'all', 'date_desc', $pager); + $actions = $this->loadModel('action')->getDynamic('all', 'all', 'date_desc', 50); $users = $this->loadModel('user')->getList(); $simplifyUsers = array(); diff --git a/module/my/view/dynamic.html.php b/module/my/view/dynamic.html.php index 70e884bbd0..1e17fa3a4d 100644 --- a/module/my/view/dynamic.html.php +++ b/module/my/view/dynamic.html.php @@ -102,8 +102,8 @@ $firstDate = date('Y-m-d', strtotime($firstAction->originalDate) + 24 * 3600); $lastDate = substr($action->originalDate, 0, 10); $hasPre = $this->action->hasPreOrNext($firstDate, 'pre'); $hasNext = $this->action->hasPreOrNext($lastDate, 'next'); -$preLink = $hasPre ? inlink('dynamic', "type=$type&recTotal={$pager->recTotal}&date=" . strtotime($firstDate) . '&direction=pre&originTotal=' . $originTotal) : 'javascript:;'; -$nextLink = $hasNext ? inlink('dynamic', "type=$type&recTotal={$pager->recTotal}&date=" . strtotime($lastDate) . '&direction=next&originTotal=' . $originTotal) : 'javascript:;'; +$preLink = $hasPre ? inlink('dynamic', "type=$type&recTotal=0&date=" . strtotime($firstDate) . '&direction=pre&originTotal=' . $originTotal) : 'javascript:;'; +$nextLink = $hasNext ? inlink('dynamic', "type=$type&recTotal=0&date=" . strtotime($lastDate) . '&direction=next&originTotal=' . $originTotal) : 'javascript:;'; ?>
diff --git a/module/product/control.php b/module/product/control.php index cf7c030482..bb9fd3f95a 100755 --- a/module/product/control.php +++ b/module/product/control.php @@ -866,10 +866,6 @@ class product extends control /* Append id for secend sort. */ $orderBy = $direction == 'next' ? 'date_desc' : 'date_asc'; - /* Load pager. */ - $this->app->loadClass('pager', $static = true); - $pager = new pager($recTotal, $recPerPage = 50, $pageID = 1); - /* Set the user and type. */ $account = 'all'; if($type == 'account') @@ -877,30 +873,24 @@ class product extends control $user = $this->loadModel('user')->getById((int)$param, 'id'); if($user) $account = $user->account; } - $period = $type == 'account' ? 'all' : $type; - $date = empty($date) ? '' : date('Y-m-d', $date); - $actions = $this->loadModel('action')->getDynamic($account, $period, $orderBy, $pager, $productID, 'all', 'all', $date, $direction); - if(empty($recTotal)) $recTotal = count($actions); - - /* The header and position. */ - $this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->product->dynamic; - $this->view->position[] = html::a($this->createLink($this->moduleName, 'browse'), $this->products[$productID]); - $this->view->position[] = $this->lang->product->dynamic; - - $this->view->userIdPairs = $this->loadModel('user')->getPairs('noletter|nodeleted|noclosed|useid'); - $this->view->accountPairs = $this->user->getPairs('noletter|nodeleted|noclosed'); + $period = $type == 'account' ? 'all' : $type; + $date = empty($date) ? '' : date('Y-m-d', $date); + $actions = $this->loadModel('action')->getDynamic($account, $period, $orderBy, 50, $productID, 'all', 'all', $date, $direction); + $dateGroups = $this->action->buildDateGroup($actions, $direction, $type); /* Assign. */ - $this->view->productID = $productID; - $this->view->type = $type; - $this->view->orderBy = $orderBy; - $this->view->account = $account; - $this->view->user = isset($user) ? $user : ''; - $this->view->param = $param; - $this->view->pager = $pager; - $this->view->dateGroups = $this->action->buildDateGroup($actions, $direction, $type); - $this->view->direction = $direction; - $this->view->recTotal = $recTotal; + $this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->product->dynamic; + $this->view->userIdPairs = $this->loadModel('user')->getPairs('noletter|nodeleted|noclosed|useid'); + $this->view->accountPairs = $this->user->getPairs('noletter|nodeleted|noclosed'); + $this->view->productID = $productID; + $this->view->type = $type; + $this->view->orderBy = $orderBy; + $this->view->account = $account; + $this->view->user = isset($user) ? $user : ''; + $this->view->param = $param; + $this->view->dateGroups = $dateGroups; + $this->view->direction = $direction; + $this->view->recTotal = count($dateGroups, 1) - count($dateGroups); $this->display(); } @@ -924,19 +914,12 @@ class product extends control $product->desc = $this->loadModel('file')->setImgSize($product->desc); $this->product->setMenu($productID); - /* Load pager. */ - $this->app->loadClass('pager', $static = true); - $pager = new pager(0, 30, 1); - - $this->view->title = $product->name . $this->lang->colon . $this->lang->product->view; - $this->view->position[] = html::a($this->createLink($this->moduleName, 'browse'), $product->name); - $this->view->position[] = $this->lang->product->view; - + $this->view->title = $product->name . $this->lang->colon . $this->lang->product->view; $this->view->product = $product; $this->view->actions = $this->loadModel('action')->getList('product', $productID); $this->view->users = $this->user->getPairs('noletter'); $this->view->lines = array('') + $this->product->getLinePairs(); - $this->view->dynamics = $this->action->getDynamic('all', 'all', 'date_desc', $pager, $productID); + $this->view->dynamics = $this->action->getDynamic('all', 'all', 'date_desc', 30, $productID); $this->view->roadmaps = $this->product->getRoadmap($productID, 0, 6); $this->display(); diff --git a/module/product/view/dynamic.html.php b/module/product/view/dynamic.html.php index 61948f0229..7c8df358d6 100755 --- a/module/product/view/dynamic.html.php +++ b/module/product/view/dynamic.html.php @@ -105,8 +105,8 @@ $firstDate = date('Y-m-d', strtotime($firstAction->originalDate) + 24 * 3600); $lastDate = substr($action->originalDate, 0, 10); $hasPre = $this->action->hasPreOrNext($firstDate, 'pre'); $hasNext = $this->action->hasPreOrNext($lastDate, 'next'); -$preLink = $hasPre ? inlink('dynamic', "productID=$productID&type=$type¶m=$param&recTotal={$pager->recTotal}&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;'; -$nextLink = $hasNext ? inlink('dynamic', "productID=$productID&type=$type¶m=$param&recTotal={$pager->recTotal}&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;'; +$preLink = $hasPre ? inlink('dynamic', "productID=$productID&type=$type¶m=$param&recTotal=0&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;'; +$nextLink = $hasNext ? inlink('dynamic', "productID=$productID&type=$type¶m=$param&recTotal=0&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;'; ?>
diff --git a/module/project/control.php b/module/project/control.php index 9f08b1f880..2a4cdf25eb 100755 --- a/module/project/control.php +++ b/module/project/control.php @@ -900,10 +900,6 @@ class project extends control } } - /* Load pager. */ - $this->app->loadClass('pager', $static = true); - $pager = new pager(0, 30, 1); - /* Check exist extend fields. */ $isExtended = false; if($this->config->edition != 'open') @@ -926,7 +922,7 @@ class project extends control $this->view->workhour = $this->project->getWorkhour($projectID); $this->view->planGroup = $this->loadModel('execution')->getPlans($products); $this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($products), '', $linkedBranches); - $this->view->dynamics = $this->loadModel('action')->getDynamic('all', 'all', 'date_desc', $pager, 'all', $projectID); + $this->view->dynamics = $this->loadModel('action')->getDynamic('all', 'all', 'date_desc', 30, 'all', $projectID); $this->view->isExtended = $isExtended; $this->display(); @@ -1028,10 +1024,6 @@ class project extends control /* Append id for secend sort. */ $orderBy = $direction == 'next' ? 'date_desc' : 'date_asc'; - /* Set the pager. */ - $this->app->loadClass('pager', $static = true); - $pager = new pager($recTotal, $recPerPage = 50, $pageID = 1); - /* Set the user and type. */ $account = 'all'; if($type == 'account') @@ -1039,30 +1031,25 @@ class project extends control $user = $this->loadModel('user')->getById($param, 'account'); if($user) $account = $user->account; } - $period = $type == 'account' ? 'all' : $type; - $date = empty($date) ? '' : date('Y-m-d', $date); - $actions = $this->loadModel('action')->getDynamic($account, $period, $orderBy, $pager, 'all', $projectID, 'all', $date, $direction); - if(empty($recTotal)) $recTotal = count($actions); + $period = $type == 'account' ? 'all' : $type; + $date = empty($date) ? '' : date('Y-m-d', $date); + $actions = $this->loadModel('action')->getDynamic($account, $period, $orderBy, 50, 'all', $projectID, 'all', $date, $direction); + $dateGroups = $this->action->buildDateGroup($actions, $direction, $type); - /* The header and position. */ $project = $this->project->getByID($projectID); - $this->view->title = $project->name . $this->lang->colon . $this->lang->project->dynamic; - $this->view->position[] = html::a($this->createLink('project', 'browse', "projectID=$projectID"), $project->name); - $this->view->position[] = $this->lang->project->dynamic; - - $this->view->userIdPairs = $this->loadModel('user')->getTeamMemberPairs($projectID, 'project'); - $this->view->accountPairs = $this->user->getPairs('noletter|nodeleted'); /* Assign. */ - $this->view->projectID = $projectID; - $this->view->type = $type; - $this->view->orderBy = $orderBy; - $this->view->pager = $pager; - $this->view->account = $account; - $this->view->param = $param; - $this->view->dateGroups = $this->action->buildDateGroup($actions, $direction, $type); - $this->view->direction = $direction; - $this->view->recTotal = $recTotal; + $this->view->title = $project->name . $this->lang->colon . $this->lang->project->dynamic; + $this->view->userIdPairs = $this->loadModel('user')->getTeamMemberPairs($projectID, 'project'); + $this->view->accountPairs = $this->user->getPairs('noletter|nodeleted'); + $this->view->projectID = $projectID; + $this->view->type = $type; + $this->view->orderBy = $orderBy; + $this->view->account = $account; + $this->view->param = $param; + $this->view->dateGroups = $dateGroups; + $this->view->direction = $direction; + $this->view->recTotal = count($dateGroups, 1) - count($dateGroups); $this->display(); } diff --git a/module/project/view/dynamic.html.php b/module/project/view/dynamic.html.php index 24cab33978..6fedb51d7a 100755 --- a/module/project/view/dynamic.html.php +++ b/module/project/view/dynamic.html.php @@ -106,8 +106,8 @@ $firstDate = date('Y-m-d', strtotime($firstAction->originalDate) + 24 * 3600); $lastDate = substr($action->originalDate, 0, 10); $hasPre = $this->action->hasPreOrNext($firstDate, 'pre'); $hasNext = $this->action->hasPreOrNext($lastDate, 'next'); -$preLink = $hasPre ? inlink('dynamic', "projectID=$projectID&type=$type¶m=$param&recTotal={$pager->recTotal}&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;'; -$nextLink = $hasNext ? inlink('dynamic', "projectID=$projectID&type=$type¶m=$param&recTotal={$pager->recTotal}&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;'; +$preLink = $hasPre ? inlink('dynamic', "projectID=$projectID&type=$type¶m=$param&recTotal=0&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;'; +$nextLink = $hasNext ? inlink('dynamic', "projectID=$projectID&type=$type¶m=$param&recTotal=0&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;'; ?>
diff --git a/module/user/control.php b/module/user/control.php index dbc1c72280..759c568ba8 100755 --- a/module/user/control.php +++ b/module/user/control.php @@ -1233,25 +1233,20 @@ class user extends control $this->session->set('caseList', $uri, 'qa'); $this->session->set('testtaskList', $uri, 'qa'); - /* Set the pager. */ - $this->app->loadClass('pager', $static = true); - $pager = pager::init($recTotal, $recPerPage = 50, $pageID = 1); - /* Append id for secend sort. */ $orderBy = $direction == 'next' ? 'date_desc' : 'date_asc'; $date = empty($date) ? '' : date('Y-m-d', $date); - $actions = $this->loadModel('action')->getDynamic($account, $period, $orderBy, $pager, 'all', 'all', 'all', $date, $direction); - - $this->view->title = $this->lang->user->common . $this->lang->colon . $this->lang->user->dynamic; - $this->view->position[] = $this->lang->user->dynamic; + $actions = $this->loadModel('action')->getDynamic($account, $period, $orderBy, 50, 'all', 'all', 'all', $date, $direction); + $dateGroups = $this->action->buildDateGroup($actions, $direction, $period); /* Assign. */ + $this->view->title = $this->lang->user->common . $this->lang->colon . $this->lang->user->dynamic; $this->view->type = $period; $this->view->users = $this->loadModel('user')->getPairs('noletter'); - $this->view->pager = $pager; + $this->view->recTotal = count($dateGroups, 1) - count($dateGroups); $this->view->user = $user; - $this->view->dateGroups = $this->action->buildDateGroup($actions, $direction, $period); + $this->view->dateGroups = $dateGroups; $this->view->direction = $direction; $this->display(); } diff --git a/module/user/view/dynamic.html.php b/module/user/view/dynamic.html.php index c4a5c9f744..d0d2b90a37 100644 --- a/module/user/view/dynamic.html.php +++ b/module/user/view/dynamic.html.php @@ -23,7 +23,7 @@ if($period == $type) { $active = 'btn-active-text'; - $label .= " {$pager->recTotal}"; + $label .= " {$recTotal}"; } echo html::a(inlink('dynamic', "userID={$user->id}&type=$period"), $label, '', "class='btn btn-link $active' id='{$period}'") ?> @@ -76,8 +76,8 @@ $firstDate = date('Y-m-d', strtotime($firstAction->originalDate) + 24 * 3600); $lastDate = substr($action->originalDate, 0, 10); $hasPre = $this->action->hasPreOrNext($firstDate, 'pre'); $hasNext = $this->action->hasPreOrNext($lastDate, 'next'); -$preLink = $hasPre ? inlink('dynamic', "userID={$user->id}&type=$type&recTotal={$pager->recTotal}&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;'; -$nextLink = $hasNext ? inlink('dynamic', "userID={$user->id}&type=$type&recTotal={$pager->recTotal}&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;'; +$preLink = $hasPre ? inlink('dynamic', "userID={$user->id}&type=$type&recTotal=0&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;'; +$nextLink = $hasNext ? inlink('dynamic', "userID={$user->id}&type=$type&recTotal=0&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;'; ?>