* Change the redirect url when toggle year or dept or account in annual data page - fix bug #34836.
This commit is contained in:
+12
-19
@@ -118,11 +118,11 @@ class report extends control
|
||||
*
|
||||
* @param string $year
|
||||
* @param string $dept
|
||||
* @param string $userID
|
||||
* @param string $account
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function annualData($year = '', $dept = '', $userID = '')
|
||||
public function annualData($year = '', $dept = '', $account = '')
|
||||
{
|
||||
$this->app->loadLang('story');
|
||||
$this->app->loadLang('task');
|
||||
@@ -154,19 +154,14 @@ class report extends control
|
||||
}
|
||||
|
||||
/* Get users and depts. */
|
||||
$accounts = array();
|
||||
if($userID)
|
||||
if($account)
|
||||
{
|
||||
$user = $this->user->getById($userID, 'id');
|
||||
$dept = $user->dept;
|
||||
$users = array('' => $this->lang->report->annualData->allUser) + $this->dept->getDeptUserPairs($dept, 'id');
|
||||
$accounts = array($user->account => ($user->realname ? $user->realname : $user->account));
|
||||
}
|
||||
else
|
||||
{
|
||||
$users = array('' => $this->lang->report->annualData->allUser) + $this->dept->getDeptUserPairs($dept, 'id');
|
||||
$accounts = $this->dept->getDeptUserPairs($dept);
|
||||
$user = $this->user->getByID($account);
|
||||
$dept = $user->dept;
|
||||
}
|
||||
$userPairs = $this->dept->getDeptUserPairs($dept);
|
||||
$accounts = !empty($user) ? array($user->account) : array_keys($userPairs);
|
||||
$users = array('' => $this->lang->report->annualData->allUser) + $userPairs;
|
||||
|
||||
$noDepartment = array('0' => '/' . $this->lang->dept->noDepartment);
|
||||
$depts = $this->dept->getOptionMenu();
|
||||
@@ -182,11 +177,9 @@ class report extends control
|
||||
$depts += $noDepartment;
|
||||
}
|
||||
|
||||
if($accounts) $accounts = array_keys($accounts);
|
||||
|
||||
/* Get annual data. */
|
||||
$data = array();
|
||||
if(!$userID)
|
||||
if(!$account)
|
||||
{
|
||||
$data['users'] = $dept ? count($accounts) : (count($users) - 1);
|
||||
}
|
||||
@@ -208,7 +201,7 @@ class report extends control
|
||||
$yearEfforts = $this->report->getUserYearEfforts($accounts, $year);
|
||||
$data['consumed'] = $yearEfforts->consumed;
|
||||
|
||||
if(empty($dept) and empty($userID)) $data['statusStat'] = $this->report->getAllTimeStatusStat();
|
||||
if(empty($dept) and empty($account)) $data['statusStat'] = $this->report->getAllTimeStatusStat();
|
||||
|
||||
$contributionGroups = array();
|
||||
$maxCount = 0;
|
||||
@@ -240,14 +233,14 @@ class report extends control
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->title = sprintf($this->lang->report->annualData->title, ($userID ? zget($users, $userID, '') : (($dept !== '') ? substr($depts[$dept], strrpos($depts[$dept], '/') + 1) : '')), $year);
|
||||
$this->view->title = sprintf($this->lang->report->annualData->title, ($account ? zget($users, $account, '') : (($dept !== '') ? substr($depts[$dept], strrpos($depts[$dept], '/') + 1) : '')), $year);
|
||||
$this->view->data = $data;
|
||||
$this->view->year = $year;
|
||||
$this->view->users = $users;
|
||||
$this->view->depts = $depts;
|
||||
$this->view->years = $years;
|
||||
$this->view->dept = $dept;
|
||||
$this->view->userID = $userID;
|
||||
$this->view->account = $account;
|
||||
$this->view->months = $this->report->getYearMonths($year);
|
||||
$this->view->contributionGroups = $contributionGroups;
|
||||
$this->view->radarData = $contributionGroups[$year];
|
||||
|
||||
@@ -17,7 +17,7 @@ body {height: 100vh; padding: 0;}
|
||||
#toolbar #year {width: 70px; display: inline-block; margin-right: 5px; padding-top: 5px; border-color: #1a77a5; background-color: transparent; color: #fff;}
|
||||
#toolbar #year option {background: #141414;}
|
||||
#toolbar #dept, #dept_chosen, #dept_chosen > .chosen-single {width: 100px !important; display: inline-block; margin-right: 5px; padding-top: 0px; border-color: #1a77a5; background-color: transparent; color: #fff;}
|
||||
#toolbar #userID, #userID_chosen, #userID_chosen > .chosen-single, #toolbar .picker-single {width: 100px !important; display: inline-block; margin-right: 5px; padding-top: 0px; border-color: #1a77a5; background-color: transparent; color: #fff;}
|
||||
#toolbar #account, #account_chosen, #account_chosen > .chosen-single, #toolbar .picker-single {width: 100px !important; display: inline-block; margin-right: 5px; padding-top: 0px; border-color: #1a77a5; background-color: transparent; color: #fff;}
|
||||
|
||||
.chosen-container > .chosen-single > span {padding-top: 5px; height: 28px;}
|
||||
.chosen-container .chosen-drop {background: #141414; text-align: left;}
|
||||
|
||||
@@ -196,12 +196,13 @@ $(function()
|
||||
exportAnnualImage();
|
||||
});
|
||||
|
||||
$('select#year, select#dept, select#userID').change(function()
|
||||
$('select#year, select#dept, select#account').change(function()
|
||||
{
|
||||
var dept = $('select#dept').val();
|
||||
var userID = $('select#userID').val();
|
||||
if($(this).attr('id') == 'dept') userID = 0;
|
||||
location.href = createLink('report', 'annualData', 'year=' + $('select#year').val() + '&dept=' + dept + '&userID=' + userID);
|
||||
var year = $('select#year').val();
|
||||
var dept = $('select#dept').val();
|
||||
var account = $('select#account').val();
|
||||
if($(this).attr('id') == 'dept') account = '';
|
||||
location.href = createLink('screen', 'view', 'screenID=3&year=' + year + '&dept=' + dept + '&account=' + account);
|
||||
});
|
||||
|
||||
$('#actionData > div > ul > li').mouseenter(function(e)
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<span><?php echo $annualDataLang->scope;?></span>
|
||||
<?php echo html::select('year', $years, $year, "class='form-control'");?>
|
||||
<?php echo html::select('dept', $depts, $dept, "class='form-control chosen'");?>
|
||||
<?php echo html::select('userID', $users, $userID, "class='form-control chosen'");?>
|
||||
<?php echo html::select('account', $users, $account, "class='form-control chosen'");?>
|
||||
</div>
|
||||
<div class='pull-right'>
|
||||
<button type='button' class='btn btn-primary' id='exportBtn' title='<?php echo $lang->export;?>'><i class='icon icon-export'></i></button>
|
||||
@@ -29,8 +29,8 @@
|
||||
<div>
|
||||
<ul id='infoList'>
|
||||
<li>
|
||||
<?php echo $userID ? $annualDataLang->logins : ($dept !== '' ? $annualDataLang->deptUsers : $annualDataLang->companyUsers);?>
|
||||
<strong><?php echo $userID ? $data['logins'] : $data['users'];?></strong>
|
||||
<?php echo $account ? $annualDataLang->logins : ($dept !== '' ? $annualDataLang->deptUsers : $annualDataLang->companyUsers);?>
|
||||
<strong><?php echo $account ? $data['logins'] : $data['users'];?></strong>
|
||||
</li>
|
||||
<li>
|
||||
<?php echo $annualDataLang->actions;?>
|
||||
@@ -50,7 +50,7 @@
|
||||
<li><span class='todoStatus'><?php echo $annualDataLang->todoStatus['done'];?></span><span><?php echo (int)$data['todos']->done;?></span></li>
|
||||
</ul>
|
||||
</li>
|
||||
<?php if($dept !== '' or !empty($userID)):?>
|
||||
<?php if($dept !== '' or !empty($account)):?>
|
||||
<li>
|
||||
<?php echo $annualDataLang->contributions;?>
|
||||
<strong><?php echo $contributions;?></strong>
|
||||
@@ -60,7 +60,7 @@
|
||||
</div>
|
||||
</section>
|
||||
<section id='actionData'>
|
||||
<header><h2 class='text-holder'><?php echo (($dept === '' and empty($userID)) ? $annualDataLang->actionData :$annualDataLang->contributionData) . $soFar;?></h2></header>
|
||||
<header><h2 class='text-holder'><?php echo (($dept === '' and empty($account)) ? $annualDataLang->actionData :$annualDataLang->contributionData) . $soFar;?></h2></header>
|
||||
<div>
|
||||
<ul>
|
||||
<?php foreach($annualDataLang->objectTypeList as $objectType => $objectName):?>
|
||||
@@ -192,7 +192,7 @@
|
||||
</div>
|
||||
<div class='table-header-fixed'>
|
||||
</section>
|
||||
<?php if($dept === '' and empty($userID)):?>
|
||||
<?php if($dept === '' and empty($account)):?>
|
||||
<section id='allTimeStatusStat'>
|
||||
<header><h2 class='text-holder'><?php echo $annualDataLang->statusStat;?></h2></header>
|
||||
<div>
|
||||
@@ -360,7 +360,7 @@ $(function()
|
||||
<?php unset($lang->story->statusList['']);?>
|
||||
<?php unset($lang->bug->statusList['']);?>
|
||||
<?php unset($lang->task->statusList['']);?>
|
||||
<?php if($dept === '' and empty($userID)):?>
|
||||
<?php if($dept === '' and empty($account)):?>
|
||||
<?php foreach($data['statusStat'] as $objectType => $objectStatusStat):?>
|
||||
<?php
|
||||
$statusStat = array();
|
||||
|
||||
@@ -78,7 +78,7 @@ class screen extends control
|
||||
|
||||
if($screenID == 3)
|
||||
{
|
||||
echo $this->fetch('report', 'annualData');
|
||||
echo $this->fetch('report', 'annualData', "year=$year&dept=$dept&account=$account");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user