* fix score module
This commit is contained in:
@@ -44,7 +44,6 @@ $filter->mail = new stdclass();
|
||||
$filter->user = new stdclass();
|
||||
$filter->block = new stdclass();
|
||||
$filter->file = new stdclass();
|
||||
$filter->my = new stdclass();
|
||||
|
||||
$filter->block->default = new stdclass();
|
||||
$filter->block->main = new stdclass();
|
||||
@@ -86,7 +85,6 @@ $filter->testtask->default = new stdclass();
|
||||
$filter->todo->export = new stdclass();
|
||||
$filter->upgrade->license = new stdclass();
|
||||
$filter->user->login = new stdclass();
|
||||
$filter->my->index = new stdclass();
|
||||
|
||||
$filter->bug->batchcreate->cookie['preBranch'] = 'int';
|
||||
$filter->bug->browse->cookie['bugModule'] = 'int';
|
||||
@@ -162,8 +160,6 @@ $filter->todo->export->cookie['checkedItem'] = 'reg::checked';
|
||||
|
||||
$filter->user->login->cookie['keepLogin'] = 'equal::on';
|
||||
|
||||
$filter->my->index->cookie['showNotice'] = 'int';
|
||||
|
||||
$filter->block->default->get['hash'] = 'reg::md5';
|
||||
$filter->block->main->get['blockid'] = 'code';
|
||||
$filter->block->main->get['blockTitle'] = 'reg::any';
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<?php commonModel::printNotifyLink();?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="noticeBox"><?php echo $this->loadModel('score')->getNotice(); ?></div>
|
||||
<script>
|
||||
<?php if(!isset($config->global->browserNotice)):?>
|
||||
browserNotice = '<?php echo $lang->browserNotice?>'
|
||||
|
||||
@@ -17,7 +17,6 @@ $lang->custom->setPublic = '设为公共';
|
||||
$lang->custom->required = '必填项';
|
||||
$lang->custom->score = '积分';
|
||||
$lang->custom->scoreReset = '重置积分';
|
||||
$lang->custom->scoreInit = '初始化积分';
|
||||
|
||||
$lang->custom->object['story'] = '需求';
|
||||
$lang->custom->object['task'] = '任务';
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php echo html::submitButton() ?><?php common::printLink('score', 'init', '', "<i class='icon-refresh'></i> " . isset($config->global->scoreInit) ? $lang->custom->scoreReset : $lang->custom->scoreInit, '', ' id="scoreRefresh" class="btn iframe" data-width="480"', true, true); ?></td>
|
||||
<td><?php echo html::submitButton() ?><?php common::printLink('score', 'reset', '', "<i class='icon-refresh'></i> " . $lang->custom->scoreReset, '', ' id="scoreRefresh" class="btn iframe" data-width="480"', true, true); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
@@ -34,7 +34,6 @@ class my extends control
|
||||
public function index()
|
||||
{
|
||||
$this->view->title = $this->lang->my->common;
|
||||
$this->view->notice = $this->loadModel('score')->getNotice();
|
||||
$this->display();
|
||||
}
|
||||
|
||||
|
||||
@@ -12,5 +12,4 @@
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php css::import($defaultTheme . 'index.css', $config->version);?>
|
||||
<?php echo $this->fetch('block', 'dashboard', 'module=my');?>
|
||||
<div id="noticeBox"><?php echo $notice; ?></div>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
+47
-55
@@ -1,6 +1,4 @@
|
||||
<?php
|
||||
$config->score = new stdClass();
|
||||
|
||||
$config->score->user = new stdClass();
|
||||
$config->score->tutorial = new stdClass();
|
||||
$config->score->ajax = new stdClass();
|
||||
@@ -17,72 +15,66 @@ $config->score->productplan = new stdClass();
|
||||
$config->score->release = new stdClass();
|
||||
$config->score->block = new stdClass();
|
||||
$config->score->search = new stdClass();
|
||||
$config->score->extended = new stdClass();
|
||||
|
||||
//user rule
|
||||
$config->score->user->login = array('num' => 3, 'time' => 24, 'score' => 1, 'ext' => '');
|
||||
$config->score->user->changePassword = array('num' => 1, 'time' => 0, 'score' => 10, 'ext' => array(1 => 2, 2 => 5));
|
||||
$config->score->user->editProfile = array('num' => 1, 'time' => 0, 'score' => 10, 'ext' => '');
|
||||
/* Score rule. */
|
||||
$config->score->user->login = array('times' => 3, 'time' => 24, 'score' => 1);
|
||||
$config->score->user->changePassword = array('times' => 1, 'time' => 0, 'score' => 10);
|
||||
$config->score->user->editProfile = array('times' => 1, 'time' => 0, 'score' => 10);
|
||||
|
||||
//tutorial rule
|
||||
$config->score->tutorial->keepAll = array('num' => 1, 'time' => 0, 'score' => 100, 'ext' => '');
|
||||
$config->score->tutorial->keepAll = array('times' => 1, 'time' => 0, 'score' => 100);
|
||||
|
||||
//javascript ajax rule
|
||||
$config->score->ajax->selectTheme = array('num' => 1, 'time' => 0, 'score' => 10, 'ext' => '');
|
||||
$config->score->ajax->selectLang = array('num' => 1, 'time' => 0, 'score' => 10, 'ext' => '');
|
||||
$config->score->ajax->showSearchMenu = array('num' => 1, 'time' => 0, 'score' => 10, 'ext' => '');
|
||||
$config->score->ajax->dragSelected = array('num' => 1, 'time' => 0, 'score' => 20, 'ext' => '');
|
||||
$config->score->ajax->lastNext = array('num' => 1, 'time' => 0, 'score' => 20, 'ext' => '');
|
||||
$config->score->ajax->switchToDataTable = array('num' => 1, 'time' => 0, 'score' => 1, 'ext' => '');
|
||||
$config->score->ajax->submitPage = array('num' => 1, 'time' => 0, 'score' => 1, 'ext' => '');
|
||||
$config->score->ajax->customMenu = array('num' => 1, 'time' => 0, 'score' => 1, 'ext' => '');
|
||||
$config->score->ajax->quickJump = array('num' => 1, 'time' => 0, 'score' => 10, 'ext' => '');
|
||||
$config->score->ajax->batchCreate = array('num' => 1, 'time' => 0, 'score' => 20, 'ext' => '');
|
||||
$config->score->ajax->batchEdit = array('num' => 1, 'time' => 0, 'score' => 20, 'ext' => '');
|
||||
$config->score->ajax->selectTheme = array('times' => 1, 'time' => 0, 'score' => 10);
|
||||
$config->score->ajax->selectLang = array('times' => 1, 'time' => 0, 'score' => 10);
|
||||
$config->score->ajax->showSearchMenu = array('times' => 1, 'time' => 0, 'score' => 10);
|
||||
$config->score->ajax->dragSelected = array('times' => 1, 'time' => 0, 'score' => 20);
|
||||
$config->score->ajax->lastNext = array('times' => 1, 'time' => 0, 'score' => 20);
|
||||
$config->score->ajax->switchToDataTable = array('times' => 1, 'time' => 0, 'score' => 1);
|
||||
$config->score->ajax->submitPage = array('times' => 1, 'time' => 0, 'score' => 1);
|
||||
$config->score->ajax->customMenu = array('times' => 1, 'time' => 0, 'score' => 1);
|
||||
$config->score->ajax->quickJump = array('times' => 1, 'time' => 0, 'score' => 10);
|
||||
$config->score->ajax->batchCreate = array('times' => 1, 'time' => 0, 'score' => 20);
|
||||
$config->score->ajax->batchEdit = array('times' => 1, 'time' => 0, 'score' => 20);
|
||||
|
||||
//doc rule
|
||||
$config->score->doc->create = array('num' => 0, 'time' => 0, 'score' => 1, 'ext' => '');
|
||||
$config->score->doc->create = array('times' => 0, 'time' => 0, 'score' => 1);
|
||||
|
||||
//todo rule
|
||||
$config->score->todo->create = array('num' => 5, 'time' => 24, 'score' => 1, 'ext' => '');
|
||||
$config->score->todo->create = array('times' => 5, 'time' => 24, 'score' => 1);
|
||||
|
||||
//story rule
|
||||
$config->score->story->create = array('num' => 0, 'time' => 0, 'score' => 1, 'ext' => '');
|
||||
$config->score->story->close = array('num' => 0, 'time' => 0, 'score' => 1, 'ext' => array('createID' => 2));
|
||||
$config->score->story->create = array('times' => 0, 'time' => 0, 'score' => 1);
|
||||
$config->score->story->close = array('times' => 0, 'time' => 0, 'score' => 1);
|
||||
|
||||
//task rule
|
||||
$config->score->task->create = array('num' => 0, 'time' => 0, 'score' => 1, 'ext' => '');
|
||||
$config->score->task->close = array('num' => 0, 'time' => 0, 'score' => 1, 'ext' => '');
|
||||
$config->score->task->finish = array('num' => 0, 'time' => 0, 'score' => 1, 'ext' => array(1 => 2, 2 => 1, 3 => 0));
|
||||
$config->score->task->create = array('times' => 0, 'time' => 0, 'score' => 1);
|
||||
$config->score->task->close = array('times' => 0, 'time' => 0, 'score' => 1);
|
||||
$config->score->task->finish = array('times' => 0, 'time' => 0, 'score' => 1);
|
||||
|
||||
//bug rule
|
||||
$config->score->bug->create = array('num' => 0, 'time' => 0, 'score' => 1, 'ext' => '');
|
||||
$config->score->bug->confirmBug = array('num' => 0, 'time' => 0, 'score' => 1, 'ext' => array(1 => 3, 2 => 2, 3 => 1));
|
||||
$config->score->bug->createFormCase = array('num' => 0, 'time' => 0, 'score' => 1, 'ext' => '');
|
||||
$config->score->bug->resolve = array('num' => 0, 'time' => 0, 'score' => 1, 'ext' => array(1 => 3, 2 => 2, 3 => 1));
|
||||
$config->score->bug->saveTplModal = array('num' => 0, 'time' => 0, 'score' => 20, 'ext' => '');
|
||||
$config->score->bug->create = array('times' => 0, 'time' => 0, 'score' => 1);
|
||||
$config->score->bug->confirmBug = array('times' => 0, 'time' => 0, 'score' => 1);
|
||||
$config->score->bug->createFormCase = array('times' => 0, 'time' => 0, 'score' => 1);
|
||||
$config->score->bug->resolve = array('times' => 0, 'time' => 0, 'score' => 1);
|
||||
$config->score->bug->saveTplModal = array('times' => 0, 'time' => 0, 'score' => 20);
|
||||
|
||||
//testcase rule
|
||||
$config->score->testcase->create = array('num' => 0, 'time' => 0, 'score' => 1, 'ext' => '');
|
||||
$config->score->testcase->create = array('times' => 0, 'time' => 0, 'score' => 1);
|
||||
|
||||
//testtask rule
|
||||
$config->score->testtask->runCase = array('num' => 0, 'time' => 0, 'score' => 1, 'ext' => '');
|
||||
$config->score->testtask->runCase = array('times' => 0, 'time' => 0, 'score' => 1);
|
||||
|
||||
//bulid rule
|
||||
$config->score->build->create = array('num' => 0, 'time' => 0, 'score' => 10, 'ext' => '');
|
||||
$config->score->build->create = array('times' => 0, 'time' => 0, 'score' => 10);
|
||||
|
||||
//project rule
|
||||
$config->score->project->create = array('num' => 0, 'time' => 0, 'score' => 10, 'ext' => '');
|
||||
$config->score->project->close = array('num' => 0, 'time' => 0, 'score' => 0, 'ext' => array('manager' => array(20, 10), 'member' => array(5, 5)));
|
||||
$config->score->project->create = array('times' => 0, 'time' => 0, 'score' => 10);
|
||||
$config->score->project->close = array('times' => 0, 'time' => 0, 'score' => 0);
|
||||
|
||||
//productplan rule
|
||||
$config->score->productplan->create = array('num' => 0, 'time' => 0, 'score' => 10, 'ext' => '');
|
||||
$config->score->productplan->create = array('times' => 0, 'time' => 0, 'score' => 10);
|
||||
|
||||
//release rule
|
||||
$config->score->release->create = array('num' => 0, 'time' => 0, 'score' => 10, 'ext' => '');
|
||||
$config->score->release->create = array('times' => 0, 'time' => 0, 'score' => 10);
|
||||
|
||||
//block rule
|
||||
$config->score->block->set = array('num' => 1, 'time' => 0, 'score' => 20, 'ext' => '');
|
||||
$config->score->block->set = array('times' => 1, 'time' => 0, 'score' => 20);
|
||||
|
||||
//search rule
|
||||
$config->score->search->saveQuery = array('num' => 1, 'time' => 0, 'score' => 1, 'ext' => '');
|
||||
$config->score->search->saveQueryAdvanced = array('num' => 1, 'time' => 0, 'score' => 1, 'ext' => '');
|
||||
$config->score->search->saveQuery = array('times' => 1, 'time' => 0, 'score' => 1);
|
||||
$config->score->search->saveQueryAdvanced = array('times' => 1, 'time' => 0, 'score' => 1);
|
||||
|
||||
/* Extended rule. */
|
||||
$config->score->extended->changePassword = array('strength' => array(1 => 2, 2 => 5));
|
||||
$config->score->extended->projectClose = array('manager' => array('in' => 20, 'out' => 10), 'member' => array('in' => 5, 'out' => 5));
|
||||
$config->score->extended->bugResolve = array('severity' => array(1 => 3, 2 => 2, 3 => 1));
|
||||
$config->score->extended->bugConfirmBug = array('severity' => array(1 => 3, 2 => 2, 3 => 1));
|
||||
$config->score->extended->taskFinish = array('pri' => array(1 => 2, 2 => 1, 3 => 0));
|
||||
$config->score->extended->storyClose = array('createID' => 2);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
class score extends control
|
||||
{
|
||||
/**
|
||||
* Ajax action score
|
||||
* Ajax action score.
|
||||
* javascript use : $.get(createLink('score', 'ajax', "method=method"));
|
||||
*
|
||||
* @param string $method
|
||||
@@ -20,32 +20,38 @@ class score extends control
|
||||
*/
|
||||
public function ajax($method = '')
|
||||
{
|
||||
$this->loadModel('score')->create('ajax', $method);
|
||||
$this->score->create('ajax', $method);
|
||||
}
|
||||
|
||||
|
||||
public function a()
|
||||
{
|
||||
$this->score->create('user');exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* initialization score
|
||||
* Initialize score.
|
||||
*
|
||||
* @param int $lastID
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function init($lastID = 0)
|
||||
public function reset($lastID = 0)
|
||||
{
|
||||
if(helper::isAjaxRequest())
|
||||
{
|
||||
$result = $this->score->init($lastID);
|
||||
$result = $this->score->reset($lastID);
|
||||
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
if($result['status'] == 'finish')
|
||||
{
|
||||
$this->send(array('result' => 'finished', 'message' => $this->lang->score->initFinish));
|
||||
$this->send(array('result' => 'finished', 'message' => $this->lang->score->resetFinish));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->send(array('result' => 'unfinished', 'message' => $this->lang->score->processed, 'lastID' => $result['lastID']));
|
||||
$this->send(array('result' => 'unfinished', 'message' => $this->lang->score->resetLoading, 'lastID' => $result['lastID'], 'total' => $result['number']));
|
||||
}
|
||||
}
|
||||
$this->display();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+10
-11
@@ -1,15 +1,14 @@
|
||||
<?php
|
||||
$lang->score->common = 'Score';
|
||||
$lang->score->record = 'Score record';
|
||||
$lang->score->current = 'Current score';
|
||||
$lang->score->level = 'Level score';
|
||||
$lang->score->init = 'Initialize';
|
||||
$lang->score->tips = 'Yesterday added score:<strong>%d</strong><br/>Today total score:<strong>%d</strong><br/>Come on! ^_^';
|
||||
$lang->score->initTips = 'Initialization will be based on historical records, the execution time may be longer. <strong>Do not close the window before the completion</strong>';
|
||||
$lang->score->initStart = 'Start initialize';
|
||||
$lang->score->initLoading = 'Initializing...';
|
||||
$lang->score->initFinish = 'initialized';
|
||||
$lang->score->processed = 'Processed ...';
|
||||
$lang->score->common = 'My score';
|
||||
$lang->score->record = 'Score record';
|
||||
$lang->score->current = 'Current score';
|
||||
$lang->score->level = 'Level score';
|
||||
$lang->score->reset = 'Reset';
|
||||
$lang->score->tips = 'Yesterday added score:<strong>%d</strong><br/>Total score:<strong>%d</strong>';
|
||||
$lang->score->resetTips = 'Reset score the execution time may be longer. <strong>Do not close the window.</strong>';
|
||||
$lang->score->resetStart = 'Start reset';
|
||||
$lang->score->resetLoading = 'Resetting,process:';
|
||||
$lang->score->resetFinish = 'Reset finish';
|
||||
|
||||
$lang->score->id = 'ID';
|
||||
$lang->score->userID = 'UserID';
|
||||
|
||||
+11
-12
@@ -1,15 +1,14 @@
|
||||
<?php
|
||||
$lang->score->common = '积分';
|
||||
$lang->score->record = '积分记录';
|
||||
$lang->score->current = '当前积分';
|
||||
$lang->score->level = '等级积分';
|
||||
$lang->score->init = '初始化';
|
||||
$lang->score->tips = '昨天增加了积分:<strong>%d</strong><br/>现共有积分:<strong>%d</strong><br/>今天再接再厉哟! ^_^';
|
||||
$lang->score->initTips = '初始化将根据历史记录计算,执行时间可能会比较长.<br/><strong>请勿在未完成前关闭窗口</strong>';
|
||||
$lang->score->initStart = '开始初始化';
|
||||
$lang->score->initLoading = '正在初始化...';
|
||||
$lang->score->initFinish = '初始化完成';
|
||||
$lang->score->processed = '正在处理中...';
|
||||
$lang->score->common = '我的积分';
|
||||
$lang->score->record = '积分记录';
|
||||
$lang->score->current = '当前积分';
|
||||
$lang->score->level = '等级积分';
|
||||
$lang->score->reset = '重置';
|
||||
$lang->score->tips = '昨天增加了积分:<strong>%d</strong><br/>总积分:<strong>%d</strong>';
|
||||
$lang->score->resetTips = '重置积分执行时间可能会比较长,<br/><strong>请不要关闭窗口。</strong>';
|
||||
$lang->score->resetStart = '开始重置';
|
||||
$lang->score->resetLoading = '正在重置中,已处理:';
|
||||
$lang->score->resetFinish = '重置完成';
|
||||
|
||||
$lang->score->id = '编号';
|
||||
$lang->score->userID = '用户ID';
|
||||
@@ -32,7 +31,7 @@ $lang->score->models['todo'] = '待办';
|
||||
$lang->score->models['story'] = '需求';
|
||||
$lang->score->models['bug'] = 'Bug';
|
||||
$lang->score->models['testcase'] = '用例';
|
||||
$lang->score->models['testtask'] = '测试';
|
||||
$lang->score->models['testtask'] = '测试单';
|
||||
$lang->score->models['build'] = 'Build';
|
||||
$lang->score->models['project'] = '项目';
|
||||
$lang->score->models['productplan'] = '计划';
|
||||
|
||||
+11
-12
@@ -1,15 +1,14 @@
|
||||
<?php
|
||||
$lang->score->common = '積分';
|
||||
$lang->score->record = '積分記錄';
|
||||
$lang->score->current = '當前積分';
|
||||
$lang->score->level = '等級積分';
|
||||
$lang->score->init = '初始化';
|
||||
$lang->score->tips = '昨天增加了積分:<strong>%d</strong><br/>現共有積分:<strong>%d</strong><br/>今天再接再厲喲! ^_^';
|
||||
$lang->score->initTips = '初始化將根據歷史記錄計算,執行時間可能會比較長.<br/><strong>請勿在未完成前關閉窗口</strong>';
|
||||
$lang->score->initStart = '開始初始化';
|
||||
$lang->score->initLoading = '正在初始化...';
|
||||
$lang->score->initFinish = '初始化完成';
|
||||
$lang->score->processed = '正在處理中...';
|
||||
$lang->score->common = '我的積分';
|
||||
$lang->score->record = '積分記錄';
|
||||
$lang->score->current = '當前積分';
|
||||
$lang->score->level = '等級積分';
|
||||
$lang->score->reset = '重置';
|
||||
$lang->score->tips = '昨天增加了積分:<strong>%d</strong><br/>總積分:<strong>%d</strong>';
|
||||
$lang->score->resetTips = '重置積分執行時間可能會比較長,<br/><strong>請不要關閉窗口</strong>';
|
||||
$lang->score->resetStart = '開始重置';
|
||||
$lang->score->resetLoading = '正在重置,已處理:';
|
||||
$lang->score->resetFinish = '重置完成';
|
||||
|
||||
$lang->score->id = '編號';
|
||||
$lang->score->userID = '用戶ID';
|
||||
@@ -32,7 +31,7 @@ $lang->score->models['todo'] = '待辦';
|
||||
$lang->score->models['story'] = '需求';
|
||||
$lang->score->models['bug'] = 'Bug';
|
||||
$lang->score->models['testcase'] = '用例';
|
||||
$lang->score->models['testtask'] = '測試';
|
||||
$lang->score->models['testtask'] = '測試單';
|
||||
$lang->score->models['build'] = 'Build';
|
||||
$lang->score->models['project'] = '項目';
|
||||
$lang->score->models['productplan'] = '計劃';
|
||||
|
||||
+50
-43
@@ -10,13 +10,13 @@
|
||||
class scoreModel extends model
|
||||
{
|
||||
/**
|
||||
* get user score list
|
||||
* Get user score list.
|
||||
*
|
||||
* @param $account
|
||||
* @param $pager
|
||||
* @param string $account
|
||||
* @param object $pager
|
||||
*
|
||||
* @access public
|
||||
* @return array|bool
|
||||
* @return array
|
||||
*/
|
||||
public function getListByAccount($account, $pager)
|
||||
{
|
||||
@@ -24,7 +24,7 @@ class scoreModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* add score logs
|
||||
* Add score logs.
|
||||
*
|
||||
* @param string $module
|
||||
* @param string $method
|
||||
@@ -37,7 +37,7 @@ class scoreModel extends model
|
||||
*/
|
||||
public function create($module = '', $method = '', $param = '', $account = '', $time = '')
|
||||
{
|
||||
if(!isset($this->config->score->$module->$method) || empty($this->config->score->$module->$method)) return true;
|
||||
if(empty($this->config->score->$module->$method)) return true;
|
||||
|
||||
$rule = $this->config->score->$module->$method;
|
||||
$desc = $this->lang->score->models[$module];
|
||||
@@ -52,7 +52,7 @@ class scoreModel extends model
|
||||
|
||||
if($method == 'changePassword')
|
||||
{
|
||||
if(!empty($rule['ext'][$param])) $rule['score'] = $rule['score'] + $rule['ext'][$param];
|
||||
if(!empty($this->config->score->extended->changePassword['strength'][$param])) $rule['score'] = $rule['score'] + $this->config->score->extended->changePassword['strength'][$param];
|
||||
$desc = $this->lang->score->methods[$module][$method];
|
||||
}
|
||||
break;
|
||||
@@ -67,12 +67,12 @@ class scoreModel extends model
|
||||
|
||||
if($method == 'close')
|
||||
{
|
||||
$createUser = $this->dao->findById($param)->from(TABLE_STORY)->fetch();
|
||||
if(!empty($createUser))
|
||||
$openedBy = $this->dao->findById($param)->from(TABLE_STORY)->fetch('openedBy');
|
||||
if(!empty($openedBy))
|
||||
{
|
||||
$newRule = $rule;
|
||||
$newRule['score'] = $rule['ext']['createID'];
|
||||
$this->saveScore($createUser->openedBy, $newRule, $module, $method, $desc, $objectID, $time);
|
||||
$newRule['score'] = $this->config->score->extended->storyClose['createID'];
|
||||
$this->saveScore($openedBy, $newRule, $module, $method, $desc, $objectID, $time);
|
||||
unset($newRule);
|
||||
}
|
||||
}
|
||||
@@ -83,10 +83,14 @@ class scoreModel extends model
|
||||
if($method == 'finish')
|
||||
{
|
||||
$desc = $this->lang->score->methods[$module][$method] . 'ID:' . $param;
|
||||
$task = $this->loadModel('task')->getById($param);
|
||||
|
||||
if(!empty($rule['ext'][$task->pri])) $rule['score'] = $rule['score'] + $rule['ext'][$task->pri];
|
||||
if(!empty($task->estimate)) $rule['score'] = $rule['score'] + round(($task->consumed / 10 * $task->estimate / $task->consumed), 1);
|
||||
/* Check child task. */
|
||||
$childTask = $this->dao->select('id')->from(TABLE_TASK)->where('parent')->eq($param)->fetch('id');
|
||||
if(!empty($childTask)) return true;
|
||||
|
||||
$task = $this->loadModel('task')->getById($param);
|
||||
if(!empty($this->config->score->extended->taskFinish['pri'][$task->pri])) $rule['score'] = $rule['score'] + $this->config->score->extended->taskFinish['pri'][$task->pri];
|
||||
if(!empty($task->estimate)) $rule['score'] = $rule['score'] + round(($task->consumed / 10 * $task->estimate / $task->consumed));
|
||||
}
|
||||
break;
|
||||
case 'bug':
|
||||
@@ -95,7 +99,7 @@ class scoreModel extends model
|
||||
if($method == 'createFormCase')
|
||||
{
|
||||
$desc = $this->lang->score->models['testcase'] . 'ID:' . $param;
|
||||
$caseUser = $this->dao->findById($param)->from(TABLE_CASE)->fetch();
|
||||
$caseUser = $this->dao->findById($param)->from(TABLE_CASE)->fetch(); ####
|
||||
if(!empty($caseUser))
|
||||
{
|
||||
$user = $caseUser->openedBy;
|
||||
@@ -109,13 +113,13 @@ class scoreModel extends model
|
||||
$objectID = $param->id;
|
||||
$user = $param->openedBy;
|
||||
$desc .= 'ID:' . $param->id;
|
||||
if(!empty($rule['ext'][$param->severity])) $rule['score'] = $rule['score'] + $rule['ext'][$param->severity];
|
||||
if(!empty($this->config->score->extended->bugConfirmBug['severity'][$param->severity])) $rule['score'] = $rule['score'] + $this->config->score->extended->bugConfirmBug['severity'][$param->severity];
|
||||
}
|
||||
|
||||
if($method == 'resolve' && !empty($rule['ext'][$param->severity]))
|
||||
if($method == 'resolve' && !empty($this->config->score->extended->bugResolve['severity'][$param->severity]))
|
||||
{
|
||||
$objectID = $param->id;
|
||||
$rule['score'] = $rule['score'] + $rule['ext'][$param->severity];
|
||||
$rule['score'] = $rule['score'] + $this->config->score->extended->bugResolve['severity'][$param->severity];
|
||||
}
|
||||
break;
|
||||
case 'testTask':
|
||||
@@ -132,26 +136,27 @@ class scoreModel extends model
|
||||
$objectID = $param->id;
|
||||
$timestamp = empty($time) ? time() : strtotime($time);
|
||||
|
||||
//project PM
|
||||
/* Project PM. */
|
||||
if(!empty($param->PM))
|
||||
{
|
||||
$rule['score'] = $param->end > date('Y-m-d', $timestamp) ? $rule['ext']['manager'][0] + $rule['ext']['manager'][1] : $rule['ext']['manager'][0];
|
||||
$rule['score'] = $param->end > date('Y-m-d', $timestamp) ? $this->config->score->extended->projectClose['manager']['in'] : $this->config->score->extended->projectClose['manager']['out'];
|
||||
$this->saveScore($param->PM, $rule, $module, $method, $desc, $objectID, $time);
|
||||
}
|
||||
|
||||
//project team user
|
||||
$teams = $this->dao->select('account')->from(TABLE_TEAM)->where('project')->eq($param->id)->fetchGroup('account');
|
||||
/* Project team user. */
|
||||
$teams = $this->dao->select('account')->from(TABLE_TEAM)->where('project')->eq($param->id)->fetchPairs();
|
||||
if(!empty($teams))
|
||||
{
|
||||
$users = array_keys($teams);
|
||||
$rule['score'] = $param->end > date('Y-m-d', $timestamp) ? $rule['ext']['member'][0] + $rule['ext']['member'][1] : $rule['ext']['member'][0];
|
||||
foreach($users as $user)
|
||||
$rule['score'] = $param->end > date('Y-m-d', $timestamp) ? $this->config->score->extended->projectClose['member']['in'] : $this->config->score->extended->projectClose['member']['out'];
|
||||
foreach($teams as $user)
|
||||
{
|
||||
if($user != $param->PM) $this->saveScore($user, $rule, $module, $method, $desc, $objectID, $time);
|
||||
}
|
||||
}
|
||||
|
||||
#####
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
case 'productplan':
|
||||
if($method == 'create') $desc .= 'ID:' . $param;
|
||||
@@ -174,7 +179,7 @@ class scoreModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* save user score
|
||||
* Save user score.
|
||||
*
|
||||
* @param string $account
|
||||
* @param array $rule
|
||||
@@ -189,18 +194,22 @@ class scoreModel extends model
|
||||
*/
|
||||
private function saveScore($account = '', $rule = array(), $module = '', $method = '', $desc = '', $objectID = 0, $time = '')
|
||||
{
|
||||
if(!empty($rule['num']) || !empty($rule['time']))
|
||||
if(!empty($rule['times']) || !empty($rule['time']))
|
||||
{
|
||||
if(empty($rule['time']))
|
||||
{
|
||||
$count = $this->dao->select('id')->from(TABLE_SCORE)->where('account')->eq($account)->andWhere('module')->eq($module)->andWhere('method')->eq($method)->count();
|
||||
if($count >= $rule['num']) return true;
|
||||
if($count >= $rule['times']) return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$timestamp = empty($time) ? time() : strtotime($time);
|
||||
$count = $this->dao->select('id')->from(TABLE_SCORE)->where('account')->eq($account)->andWhere('time')->between(date('Y-m-d 0:0:0', $timestamp), date('Y-m-d 23:59:59', $timestamp))->andWhere('module')->eq($module)->andWhere('method')->eq($method)->count();
|
||||
if($count >= $rule['num']) return true;
|
||||
$count = $this->dao->select('id')->from(TABLE_SCORE)->where('account')->eq($account)
|
||||
->andWhere('time')->between(date('Y-m-d 00:00:00', $timestamp), date('Y-m-d 23:59:59', $timestamp))
|
||||
->andWhere('module')->eq($module)
|
||||
->andWhere('method')->eq($method)
|
||||
->count();
|
||||
if($count >= $rule['times']) return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,14 +241,14 @@ class scoreModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Score init from action
|
||||
* Score reset.
|
||||
*
|
||||
* @param int $lastID
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function init($lastID = 0)
|
||||
public function reset($lastID = 0)
|
||||
{
|
||||
if($lastID == 0)
|
||||
{
|
||||
@@ -252,7 +261,7 @@ class scoreModel extends model
|
||||
if(empty($actions))
|
||||
{
|
||||
$this->loadModel('setting')->setItem('system.common.global.scoreInit', 1);
|
||||
return array('num' => 0, 'status' => 'finish');
|
||||
return array('number' => 0, 'status' => 'finish');
|
||||
}
|
||||
|
||||
foreach($actions as $action)
|
||||
@@ -269,11 +278,11 @@ class scoreModel extends model
|
||||
$this->create($action->objectType, $this->fixKey($action->action), $param, $action->actor, $action->date);
|
||||
}
|
||||
|
||||
return array('status' => 'more', 'lastID' => max(array_keys($actions)));
|
||||
return array('status' => 'more', 'lastID' => max(array_keys($actions)), 'number' => count($actions));
|
||||
}
|
||||
|
||||
/**
|
||||
* fix action type for score
|
||||
* Fix action type for score.
|
||||
*
|
||||
* @param $string
|
||||
*
|
||||
@@ -287,7 +296,7 @@ class scoreModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* get yesterday's score for user
|
||||
* Get yesterday's score for user.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
@@ -295,15 +304,13 @@ class scoreModel extends model
|
||||
public function getNotice()
|
||||
{
|
||||
if(!isset($this->config->global->score) || empty($this->config->global->score)) return '';
|
||||
if($this->cookie->showNotice == strtotime(date('Y-m-d'))) return '';
|
||||
if(date('Y-m-d', $this->app->user->lastTime) == helper::today()) return '';
|
||||
|
||||
setcookie('showNotice', strtotime(date('Y-m-d')), $this->config->cookieLife, $this->config->webRoot);
|
||||
$this->app->user->lastTime = time();
|
||||
|
||||
$yesterday = $this->dao->select("sum(score) as score")->from(TABLE_SCORE)->where('time')->between(date('Y-m-d 00:00:00', strtotime('-1 day')), date('Y-m-d 23:59:59', strtotime('-1 day')))->andWhere('account')->eq($this->app->user->account)->fetch();
|
||||
$score = $this->dao->select("sum(score) as score")->from(TABLE_SCORE)->where('time')->between(date('Y-m-d 00:00:00', strtotime('-1 day')), date('Y-m-d 23:59:59', strtotime('-1 day')))->andWhere('account')->eq($this->app->user->account)->fetch('score');
|
||||
|
||||
$notice = empty($yesterday->score) ? '' : sprintf($this->lang->score->tips, $yesterday->score, $this->app->user->score);
|
||||
|
||||
$notice .= $this->cookie->showNotice;
|
||||
$notice = empty($score) ? '' : sprintf($this->lang->score->tips, $score, $this->app->user->score);
|
||||
|
||||
$fullNotice = <<<EOT
|
||||
<div id='noticeAttend' class='alert alert-success with-icon alert-dismissable' style='width:280px; position:fixed; bottom:25px; right:15px; z-index: 9999;' id='planInfo'>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* The init view file of score module of ZenTaoPMS.
|
||||
* The reset view file of score module of ZenTaoPMS.
|
||||
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
||||
* @license ZPL (http://zpl.pub/page/zplv12.html)
|
||||
* @author Memory <lvtao@cnezsoft.com>
|
||||
@@ -13,38 +13,34 @@
|
||||
<div class="alert with-icon" id="score_start">
|
||||
<i class="icon-inbox"></i>
|
||||
<div class="content">
|
||||
<h4><?php echo $lang->score->init; ?></h4>
|
||||
<hr>
|
||||
<p><?php echo $lang->score->initTips; ?></p>
|
||||
<p><?php echo $lang->score->resetTips; ?></p>
|
||||
<p>
|
||||
<button class="btn btn-primary" id="score_init"><?php echo $lang->score->initStart; ?></button>
|
||||
<button class="btn btn-primary" id="score_reset"><?php echo $lang->score->resetStart; ?></button>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="alert alert-info with-icon hidden" id="score_loading">
|
||||
<i class="icon-info-sign"></i>
|
||||
<h4><?php echo $lang->score->initLoading; ?></h4>
|
||||
<hr/>
|
||||
<p><?php echo $lang->score->initTips; ?></p>
|
||||
<p><?php echo $lang->score->resetTips; ?></p>
|
||||
<p id="loading_content"></p>
|
||||
</div>
|
||||
<div class="alert alert-success with-icon hidden" id="score_finish">
|
||||
<i class="icon-ok-sign"></i>
|
||||
<div class="content">
|
||||
<strong><?php echo $lang->score->initFinish; ?></strong>
|
||||
<strong><?php echo $lang->score->resetFinish; ?></strong>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$("#score_init").on('click', function()
|
||||
$("#score_reset").on('click', function()
|
||||
{
|
||||
$("#score_start").addClass('hidden');
|
||||
$("#score_loading").removeClass('hidden');
|
||||
score_init(0);
|
||||
score_reset(0);
|
||||
});
|
||||
|
||||
function score_init(lastID)
|
||||
var total = 0;
|
||||
function score_reset(lastID)
|
||||
{
|
||||
$.getJSON(createLink('score', 'init', 'lastID=' + lastID), function(response)
|
||||
$.getJSON(createLink('score', 'reset', 'lastID=' + lastID), function(response)
|
||||
{
|
||||
if(response.result == 'finished')
|
||||
{
|
||||
@@ -55,8 +51,9 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#loading_content').html("<li class='text-success' style='color:#" + (Math.random() * 0xffffff << 0).toString(16) + "'>" + response.message + "</li>");
|
||||
setTimeout(function(){score_init(response.lastID);}, 500);
|
||||
total = total + response.total;
|
||||
$('#loading_content').html("<li class='text-success'>" + response.message + total + "</li>");
|
||||
setTimeout(function(){score_reset(response.lastID);}, 500);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -627,8 +627,9 @@ class userModel extends model
|
||||
{
|
||||
$ip = $this->server->remote_addr;
|
||||
$last = $this->server->request_time;
|
||||
$user->last = date(DT_DATETIME1, $last);
|
||||
$user->admin = strpos($this->app->company->admins, ",{$user->account},") !== false;
|
||||
$user->lastTime = $user->last;
|
||||
$user->last = date(DT_DATETIME1, $last);
|
||||
$user->admin = strpos($this->app->company->admins, ",{$user->account},") !== false;
|
||||
$user->modifyPassword = ($user->visits == 0 and !empty($this->config->safe->modifyPasswordFirstLogin));
|
||||
if($user->modifyPassword) $user->modifyPasswordReason = 'modifyPasswordFirstLogin';
|
||||
if(!$user->modifyPassword and !empty($this->config->safe->changeWeak))
|
||||
|
||||
Reference in New Issue
Block a user