From 7cb63e2f1300ca19468db50e9648a1ddff24cea3 Mon Sep 17 00:00:00 2001 From: zhujinyong Date: Thu, 4 Mar 2021 17:34:15 +0800 Subject: [PATCH] * Adjust code of my, project, user module. --- module/my/control.php | 10 +++--- module/my/lang/en.php | 10 ------ module/my/lang/zh-cn.php | 10 ------ module/my/view/execution.html.php | 12 +++---- module/my/view/project.html.php | 60 +++++++++++++++---------------- module/project/model.php | 51 +++++++++++++------------- module/user/model.php | 6 ++-- 7 files changed, 70 insertions(+), 89 deletions(-) diff --git a/module/my/control.php b/module/my/control.php index 7a99609c65..6df83a2910 100644 --- a/module/my/control.php +++ b/module/my/control.php @@ -203,7 +203,7 @@ class my extends control $this->view->position[] = $this->lang->my->story; $this->view->stories = $this->loadModel('story')->getUserStories($this->app->user->account, $type, $sort, $pager, 'story'); $this->view->users = $this->user->getPairs('noletter'); - $this->view->projects = $this->loadModel('program')->getPRJPairs(); + $this->view->projects = $this->loadModel('project')->getPairsByProgram(); $this->view->type = $type; $this->view->recTotal = $recTotal; $this->view->recPerPage = $recPerPage; @@ -244,7 +244,7 @@ class my extends control $this->view->position[] = $this->lang->my->story; $this->view->stories = $this->loadModel('story')->getUserStories($this->app->user->account, $type, $sort, $pager, 'requirement'); $this->view->users = $this->user->getPairs('noletter'); - $this->view->projects = $this->loadModel('program')->getPRJPairs(); + $this->view->projects = $this->loadModel('project')->getPairsByProgram(); $this->view->type = $type; $this->view->recTotal = $recTotal; $this->view->recPerPage = $recPerPage; @@ -319,13 +319,13 @@ class my extends control $this->view->position[] = $this->lang->my->task; $this->view->tabID = 'task'; $this->view->tasks = $tasks; - $this->view->summary = $this->loadModel('project')->summary($tasks); + $this->view->summary = $this->loadModel('execution')->summary($tasks); $this->view->type = $type; $this->view->recTotal = $recTotal; $this->view->recPerPage = $recPerPage; $this->view->pageID = $pageID; $this->view->orderBy = $orderBy; - $this->view->projects = $this->loadModel('program')->getPRJPairs(); + $this->view->projects = $this->loadModel('project')->getPairsByProgram(); $this->view->users = $this->loadModel('user')->getPairs('noletter'); $this->view->pager = $pager; $this->view->mode = 'task'; @@ -491,7 +491,7 @@ class my extends control $this->app->loadLang('project'); $this->app->session->set('programList', $this->app->getURI(true)); - $this->app->session->set('PRJBrowse', $this->app->getURI(true)); + $this->app->session->set('projectBrowse', $this->app->getURI(true)); /* Set the pager. */ $this->app->loadClass('pager', $static = true); diff --git a/module/my/lang/en.php b/module/my/lang/en.php index 2fd90dc565..e245ffe90f 100644 --- a/module/my/lang/en.php +++ b/module/my/lang/en.php @@ -70,16 +70,6 @@ $lang->my->projectMenu->suspended = 'Suspended'; $lang->my->projectMenu->closed = 'Closed'; $lang->my->projectMenu->openedbyme = 'CreatedByMe'; -$lang->my->home = new stdclass(); -$lang->my->home->latest = 'Dynamics'; -$lang->my->home->action = "%s, %s %s %s %s."; -$lang->my->home->projects = $lang->executionCommon; -$lang->my->home->products = $lang->productCommon; -$lang->my->home->createProject = "Create {$lang->executionCommon}"; -$lang->my->home->createProduct = "Create {$lang->productCommon}"; -$lang->my->home->help = "Help"; -$lang->my->home->noProductsTip = "No {$lang->productCommon} found here."; - $lang->my->form = new stdclass(); $lang->my->form->lblBasic = 'Basic Info'; $lang->my->form->lblContact = 'Contact Info'; diff --git a/module/my/lang/zh-cn.php b/module/my/lang/zh-cn.php index 627ebf551f..ee797a15bb 100644 --- a/module/my/lang/zh-cn.php +++ b/module/my/lang/zh-cn.php @@ -70,16 +70,6 @@ $lang->my->projectMenu->suspended = '已挂起'; $lang->my->projectMenu->closed = '已关闭'; $lang->my->projectMenu->openedbyme = '由我创建'; -$lang->my->home = new stdclass(); -$lang->my->home->latest = '最新动态'; -$lang->my->home->action = "%s, %s %s %s %s。"; -$lang->my->home->projects = $lang->executionCommon; -$lang->my->home->products = $lang->productCommon; -$lang->my->home->createProject = "添加{$lang->executionCommon}"; -$lang->my->home->createProduct = "添加{$lang->productCommon}"; -$lang->my->home->help = "帮助文档"; -$lang->my->home->noProductsTip = "这里还没有{$lang->productCommon}。"; - $lang->my->form = new stdclass(); $lang->my->form->lblBasic = '基本信息'; $lang->my->form->lblContact = '联系信息'; diff --git a/module/my/view/execution.html.php b/module/my/view/execution.html.php index 48412826f8..554362b4ac 100644 --- a/module/my/view/execution.html.php +++ b/module/my/view/execution.html.php @@ -29,20 +29,20 @@

- +
- - - + + + - - + + diff --git a/module/my/view/project.html.php b/module/my/view/project.html.php index 3467dad7c0..c84d46a18d 100644 --- a/module/my/view/project.html.php +++ b/module/my/view/project.html.php @@ -25,71 +25,71 @@

- program->noPRJ;?> - - createLink('program', 'createGuide'), " " . $lang->my->createProgram, '', "class='btn btn-info' data-toggle=modal");?> + project->empty;?> + + createLink('project', 'createGuide'), " " . $lang->my->createProgram, '', "class='btn btn-info' data-toggle=modal");?>

- -
idAB;?> my->name;?>my->projects;?>project->begin;?>project->end;?>my->execution;?>execution->begin;?>execution->end;?> statusAB;?> team->role;?> team->join;?> my->hours;?>project->assignedToMe;?>project->progress;?>execution->assignedToMe;?>execution->progress;?>
+ +
- + - + - - - - + + + + - + - + - app->getClientLang(), ['zh-cn','zh-tw']) && $project->budget >= 10000 ? number_format($project->budget / 10000, 1) . $this->lang->program->tenThousand : number_format((float)$project->budget, 1);?> - + app->getClientLang(), ['zh-cn','zh-tw']) && $project->budget >= 10000 ? number_format($project->budget / 10000, 1) . $this->lang->project->tenThousand : number_format((float)$project->budget, 1);?> +
idAB;?>program->PRJName;?>project->name;?> program->PRJStatus;?> project->status;?> program->begin;?>program->end;?>program->PRJBudget;?>program->PRJPM;?>project->begin;?>project->end;?>project->budget;?>project->PM;?> actions;?>
id);?> - createLink('program', 'index', "projectID=$project->id", '', '', $project->id), $project->name, '', "data-group='project'");?> + createLink('project', 'index', "projectID=$project->id", '', '', $project->id), $project->name, '', "data-group='project'");?> project->statusList, $project->status, '');?>project->statusList, $project->status, '');?> begin;?> end == '0000-00-00' ? '' : $project->end;?>budget != 0 ? zget($lang->program->currencySymbol, $project->budgetUnit) . ' ' . $programBudget : $lang->program->future;?>budget != 0 ? zget($lang->project->currencySymbol, $project->budgetUnit) . ' ' . $projectBudget : $lang->project->future;?> PM]) ? $PMList[$project->PM]->id : ''?> PM)) echo html::a($this->createLink('user', 'profile', "userID=$userID", '', true), zget($users, $project->PM), '', "data-toggle='modal' data-type='iframe' data-width='600'");?> - status == 'wait' || $project->status == 'suspended') common::printIcon('program', 'PRJStart', "projectID=$project->id", $project, 'list', 'play', '', 'iframe', true);?> - status == 'doing') common::printIcon('program', 'PRJClose', "projectID=$project->id", $project, 'list', 'off', '', 'iframe', true);?> - status == 'closed') common::printIcon('program', 'PRJActivate', "projectID=$project->id", $project, 'list', 'magic', '', 'iframe', true);?> - status != 'doing') || (common::hasPriv('program','PRJActivate') && $project->status != 'closed')):?> + status == 'wait' || $project->status == 'suspended') common::printIcon('project', 'start', "projectID=$project->id", $project, 'list', 'play', '', 'iframe', true);?> + status == 'doing') common::printIcon('project', 'close', "projectID=$project->id", $project, 'list', 'off', '', 'iframe', true);?> + status == 'closed') common::printIcon('project', 'activate', "projectID=$project->id", $project, 'list', 'magic', '', 'iframe', true);?> + status != 'doing') || (common::hasPriv('project','activate') && $project->status != 'closed')):?>
- id&from=PRJ", $project, 'list', 'edit', '', '', false, "data-group='project'", '', $project->id);?> - id", $project, 'list', 'group', '', '', false, "data-group='project'", '', $project->id);?> - id", $project, 'list', 'lock', '', '', false, "data-group='project'", '', $project->id);?> - + id", $project, 'list', 'edit', '', '', false, "data-group='project'", '', $project->id);?> + id", $project, 'list', 'group', '', '', false, "data-group='project'", '', $project->id);?> + id", $project, 'list', 'lock', '', '', false, "data-group='project'", '', $project->id);?> +
diff --git a/module/project/model.php b/module/project/model.php index 5d73ab69e4..7c6357ce46 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -77,7 +77,7 @@ class projectModel extends model { $count = 0; $count += (int)$this->dao->select('count(*) as count')->from(TABLE_PROJECT)->where('parent')->eq($projectID)->fetch('count'); - $count += (int)$this->dao->select('count(*) as count')->from(TABLE_TASK)->where('PRJ')->eq($projectID)->fetch('count'); + $count += (int)$this->dao->select('count(*) as count')->from(TABLE_TASK)->where('project')->eq($projectID)->fetch('count'); return $count > 0; } @@ -213,12 +213,12 @@ class projectModel extends model ->groupBy('root') ->fetchAll('root'); - $estimates = $this->dao->select('PRJ, sum(estimate) as estimate')->from(TABLE_TASK) - ->where('PRJ')->in($projectIdList) + $estimates = $this->dao->select('project, sum(estimate) as estimate')->from(TABLE_TASK) + ->where('project')->in($projectIdList) ->andWhere('deleted')->eq(0) ->andWhere('parent')->lt(1) - ->groupBy('PRJ') - ->fetchAll('PRJ'); + ->groupBy('project') + ->fetchAll('project'); $this->app->loadClass('pager', $static = true); $this->loadModel('execution'); @@ -280,21 +280,21 @@ class projectModel extends model $teams = $this->dao->select('root, count(*) as teams')->from(TABLE_TEAM)->where('root')->in($projectIdList)->groupBy('root')->fetchPairs(); - $hours = $this->dao->select('PRJ, + $hours = $this->dao->select('project, cast(sum(consumed) as decimal(10,2)) as consumed, cast(sum(estimate) as decimal(10,2)) as estimate') ->from(TABLE_TASK) - ->where('PRJ')->in($projectIdList) + ->where('project')->in($projectIdList) ->andWhere('deleted')->eq(0) ->andWhere('parent')->lt(1) - ->groupBy('PRJ') - ->fetchAll('PRJ'); + ->groupBy('project') + ->fetchAll('project'); - $leftTasks = $this->dao->select('PRJ, count(*) as tasks')->from(TABLE_TASK) - ->where('PRJ')->in($projectIdList) + $leftTasks = $this->dao->select('project, count(*) as tasks')->from(TABLE_TASK) + ->where('project')->in($projectIdList) ->andWhere('deleted')->eq(0) ->andWhere('status')->in('wait,doing,pause') - ->groupBy('PRJ') + ->groupBy('project') ->fetchPairs(); foreach($projectIdList as $projectID) @@ -483,12 +483,12 @@ class projectModel extends model */ public function getTotalBugByProject($projectIdList, $status) { - return $this->dao->select('PRJ, count(*) as bugs')->from(TABLE_BUG) - ->where('PRJ')->in($projectIdList) + return $this->dao->select('project, count(*) as bugs')->from(TABLE_BUG) + ->where('project')->in($projectIdList) ->andWhere('deleted')->eq(0) ->beginIF($status != 'all')->andWhere('status')->eq($status)->fi() - ->groupBy('PRJ') - ->fetchPairs('PRJ'); + ->groupBy('project') + ->fetchPairs('project'); } /** @@ -763,21 +763,22 @@ class projectModel extends model $groupPriv = $this->dao->select('t1.*')->from(TABLE_USERGROUP)->alias('t1') ->leftJoin(TABLE_GROUP)->alias('t2')->on('t1.group = t2.id') ->where('t1.account')->eq($this->app->user->account) - ->andWhere('t2.role')->eq('PRJAdmin') + ->andWhere('t2.role')->eq('projectAdmin') ->fetch(); if(!empty($groupPriv)) { - $newProject = $groupPriv->PRJ . ",$projectID"; - $this->dao->update(TABLE_USERGROUP)->set('PRJ')->eq($newProject)->where('account')->eq($groupPriv->account)->andWhere('`group`')->eq($groupPriv->group)->exec(); + $newProject = $groupPriv->project . ",$projectID"; + $this->dao->update(TABLE_USERGROUP)->set('project')->eq($newProject)->where('account')->eq($groupPriv->account)->andWhere('`group`')->eq($groupPriv->group)->exec(); } else { - $PRJAdminID = $this->dao->select('id')->from(TABLE_GROUP)->where('role')->eq('PRJAdmin')->fetch('id'); - $groupPriv = new stdclass(); + $projectAdminID = $this->dao->select('id')->from(TABLE_GROUP)->where('role')->eq('projectAdmin')->fetch('id'); + + $groupPriv = new stdclass(); $groupPriv->account = $this->app->user->account; - $groupPriv->group = $PRJAdminID; - $groupPriv->PRJ = $projectID; + $groupPriv->group = $projectAdminID; + $groupPriv->project = $projectID; $this->dao->insert(TABLE_USERGROUP)->data($groupPriv)->exec(); } @@ -1106,8 +1107,8 @@ class projectModel extends model echo ""; } - $from = $project->from == 'PRJ' ? 'PRJ' : 'pgmproject'; - $openApp = $project->from == 'PRJ' ? 'project' : 'project'; + $from = $project->from == 'project' ? 'project' : 'pgmproject'; + $openApp = $project->from == 'project' ? 'project' : 'project'; common::printIcon('project', 'edit', "projectID=$project->id&from=$from", $project, 'list', 'edit', '', '', '', "data-app=$openApp", '', $project->id); common::printIcon('project', 'manageMembers', "projectID=$project->id", $project, 'list', 'group', '', '', '', '', $this->lang->execution->team, $project->id); if($this->config->systemMode == 'new') common::printIcon('project', 'group', "projectID=$project->id&projectID=$projectID", $project, 'list', 'lock', '', '', '', '', '', $project->id); diff --git a/module/user/model.php b/module/user/model.php index 90144f7878..32041971cb 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -1048,8 +1048,8 @@ class userModel extends model /* Get all tasks and compute totalConsumed, totalLeft, totalWait, progress according to them. */ $hours = array(); $emptyHour = array('totalConsumed' => 0, 'totalLeft' => 0, 'progress' => 0, 'waitTasks' => 0, 'assignedToMeTasks' => 0); - $searchField = $type == 'project' ? 'PRJ' : 'project'; - $tasks = $this->dao->select('id, PRJ, project, consumed, `left`, status, assignedTo') + $searchField = $type == 'project' ? 'project' : 'execution'; + $tasks = $this->dao->select('id, project, project, consumed, `left`, status, assignedTo') ->from(TABLE_TASK) ->where('parent')->lt(1) ->andWhere($searchField)->in($projectIdList)->fi() @@ -1080,7 +1080,7 @@ class userModel extends model } $projectIdList = array_keys($myProjectsList); - $projectList = $this->loadModel('program')->getPRJByIdList($projectIdList); + $projectList = $this->loadModel('project')->getByIdList($projectIdList); $myProjects = array(); foreach($myProjectsList as $projects)