Merge branch 'sprint/175_liumengyi_45156' into 'sprint/168'
* Finish task #45156. See merge request easycorp/zentaopms!639
This commit is contained in:
+13
-2
@@ -1424,10 +1424,11 @@ class actionModel extends model
|
||||
* @param array $actions
|
||||
* @param string $direction
|
||||
* @param string $type all|today|yesterday|thisweek|lastweek|thismonth|lastmonth
|
||||
* @param string $orderBy date_desc|date_asc
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function buildDateGroup($actions, $direction = 'next', $type = 'today')
|
||||
public function buildDateGroup($actions, $direction = 'next', $type = 'today', $orderBy = 'date_desc')
|
||||
{
|
||||
$dateGroup = array();
|
||||
foreach($actions as $action)
|
||||
@@ -1455,7 +1456,17 @@ class actionModel extends model
|
||||
}
|
||||
}
|
||||
|
||||
if($direction != 'next') $dateGroup = array_reverse($dateGroup);
|
||||
/* Modify date to the corrret order. */
|
||||
if($this->app->rawModule != 'company' and $direction != 'next')
|
||||
{
|
||||
$dateGroup = array_reverse($dateGroup);
|
||||
}
|
||||
elseif($this->app->rawModule == 'company' and (($direction == 'next' and $orderBy == 'date_asc') or ($direction == 'pre' and $orderBy == 'date_desc')))
|
||||
{
|
||||
$dateGroup = array_reverse($dateGroup);
|
||||
foreach($dateGroup as $key => $dateItem) $dateGroup[$key] = array_reverse($dateItem);
|
||||
}
|
||||
|
||||
return $dateGroup;
|
||||
}
|
||||
|
||||
|
||||
@@ -167,7 +167,7 @@ class company extends control
|
||||
* @param int $productID
|
||||
* @param int $projectID
|
||||
* @param int $executionID
|
||||
* @param string $orderBy
|
||||
* @param string $orderBy date_deac|date_asc
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -204,7 +204,8 @@ class company extends control
|
||||
$pager = new pager($recTotal, $recPerPage = 50, $pageID = 1);
|
||||
|
||||
/* Append id for secend sort. */
|
||||
$sort = $this->loadModel('common')->appendOrder($orderBy);
|
||||
$order = $direction == 'next' ? 'date_desc' : 'date_asc';
|
||||
$sort = $this->loadModel('common')->appendOrder($order);
|
||||
|
||||
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
|
||||
$date = empty($date) ? '' : date('Y-m-d', $date);
|
||||
@@ -289,7 +290,7 @@ class company extends control
|
||||
$this->view->userID = $userID;
|
||||
$this->view->param = $param;
|
||||
$this->view->browseType = $browseType;
|
||||
$this->view->dateGroups = $this->action->buildDateGroup($actions, $direction, $browseType);
|
||||
$this->view->dateGroups = $this->action->buildDateGroup($actions, $direction, $browseType, $orderBy);
|
||||
$this->view->direction = $direction;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -96,8 +96,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') : 'javascript:;';
|
||||
$nextLink = $hasNext ? inlink('dynamic', "browseType=$browseType¶m=$param&recTotal={$pager->recTotal}&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;';
|
||||
$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:;';
|
||||
?>
|
||||
<?php if($hasPre or $hasNext):?>
|
||||
<div id="mainActions" class='main-actions'>
|
||||
|
||||
Reference in New Issue
Block a user