* Change page to limit in actions query.

This commit is contained in:
liumengyi
2023-08-08 13:58:04 +08:00
parent d973e51f1b
commit ecb41011a3
16 changed files with 100 additions and 173 deletions
+14 -13
View File
@@ -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);
}
/**
+3 -15
View File
@@ -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')));
}
+6 -9
View File
@@ -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();
}
+3 -4
View File
@@ -21,8 +21,7 @@
if($period == $browseType)
{
$active = 'btn-active-text';
$pager->recTotal = $recTotal ? $recTotal : $pager->recTotal;
$label .= " <span class='label label-light label-badge'>{$pager->recTotal}</span>";
$label .= " <span class='label label-light label-badge'>{$recTotal}</span>";
}
echo html::a(inlink('dynamic', "browseType=$period&param=&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&param=$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&param=$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&param=$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&param=$param&recTotal=0&date=" . strtotime($lastDate) . "&direction=next&userID=$userID&productID=$productID&projectID=$projectID&executionID=$executionID&orderBy=$orderBy") : 'javascript:;';
?>
<?php if($hasPre or $hasNext):?>
<div id="mainActions" class='main-actions'>
+3 -3
View File
@@ -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);
+16 -31
View File
@@ -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();
}
+2 -2
View File
@@ -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&param=$param&recTotal={$pager->recTotal}&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;';
$nextLink = $hasNext ? inlink('dynamic', "executionID=$executionID&type=$type&param=$param&recTotal={$pager->recTotal}&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;';
$preLink = $hasPre ? inlink('dynamic', "executionID=$executionID&type=$type&param=$param&recTotal=0&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;';
$nextLink = $hasNext ? inlink('dynamic', "executionID=$executionID&type=$type&param=$param&recTotal=0&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;';
?>
<?php if($hasPre or $hasNext):?>
<div id="mainActions" class='main-actions'>
+4 -9
View File
@@ -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();
}
+1 -4
View File
@@ -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();
+2 -2
View File
@@ -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:;';
?>
<?php if($hasPre or $hasNext):?>
<div id="mainActions" class='main-actions'>
+18 -35
View File
@@ -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();
+2 -2
View File
@@ -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&param=$param&recTotal={$pager->recTotal}&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;';
$nextLink = $hasNext ? inlink('dynamic', "productID=$productID&type=$type&param=$param&recTotal={$pager->recTotal}&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;';
$preLink = $hasPre ? inlink('dynamic', "productID=$productID&type=$type&param=$param&recTotal=0&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;';
$nextLink = $hasNext ? inlink('dynamic', "productID=$productID&type=$type&param=$param&recTotal=0&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;';
?>
<?php if($hasPre or $hasNext):?>
<div id="mainActions" class='main-actions'>
+16 -29
View File
@@ -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();
}
+2 -2
View File
@@ -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&param=$param&recTotal={$pager->recTotal}&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;';
$nextLink = $hasNext ? inlink('dynamic', "projectID=$projectID&type=$type&param=$param&recTotal={$pager->recTotal}&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;';
$preLink = $hasPre ? inlink('dynamic', "projectID=$projectID&type=$type&param=$param&recTotal=0&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;';
$nextLink = $hasNext ? inlink('dynamic', "projectID=$projectID&type=$type&param=$param&recTotal=0&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;';
?>
<?php if($hasPre or $hasNext):?>
<div id="mainActions" class='main-actions'>
+5 -10
View File
@@ -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();
}
+3 -3
View File
@@ -23,7 +23,7 @@
if($period == $type)
{
$active = 'btn-active-text';
$label .= " <span class='label label-light label-badge'>{$pager->recTotal}</span>";
$label .= " <span class='label label-light label-badge'>{$recTotal}</span>";
}
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:;';
?>
<?php if($hasPre or $hasNext):?>
<div id="mainActions" class='main-actions'>