From d066fef4e55fec47b9f144eff8e44d7ff52f825f Mon Sep 17 00:00:00 2001 From: leiyong <1549684884@qq.com> Date: Tue, 29 Sep 2020 08:31:27 +0800 Subject: [PATCH] *Adjust code. --- module/block/view/taskblock.html.php | 2 +- module/common/model.php | 21 ++++++++------------- module/common/view/header.html.php | 2 +- module/program/model.php | 10 +++++----- 4 files changed, 15 insertions(+), 20 deletions(-) diff --git a/module/block/view/taskblock.html.php b/module/block/view/taskblock.html.php index 0b2d1d9b4e..1f3ecfedc5 100644 --- a/module/block/view/taskblock.html.php +++ b/module/block/view/taskblock.html.php @@ -44,7 +44,7 @@ id);?> task->priList, $task->pri, $task->pri)?> - createLink('task', 'view', "taskID=$task->id", '', '', $task->program), $task->name)?> + createLink('task', 'view', "taskID=$task->id", '', '', $task->PRJ), $task->name)?> estimate?> deadline, 0, 4) > 0) echo $task->deadline;?> diff --git a/module/common/model.php b/module/common/model.php index 60fb288711..e6c975f2da 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -539,28 +539,23 @@ class commonModel extends model * @access public * @return string */ - public function getRecentProjects() + public static function getRecentProjects() { + global $dbh, $lang, $app; echo '

  • '; - echo '
  • ' . $this->lang->recent . '
  • '; + echo '
  • ' . $lang->recent . '
  • '; - $recentProjects = $this->dao->select('id,parent,name')->from(TABLE_PROJECT) - ->where('type')->in('stage,sprint') - ->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->projects)->fi() - ->andWhere('status')->ne('close') - ->andWhere('deleted')->eq('0') - ->orderBy('id_desc') - ->limit(5) - ->fetchAll(); + $extraWhere = empty($app->user->admin) && !empty($app->user->view->projects) ? ' and parent in (' . $app->user->view->projects . ') ' : ''; + $recentProjects = $dbh->query('select * from ' . TABLE_PROJECT . " where type in ('stage','sprint') $extraWhere and status != 'close' and deleted = '0' order by 'id' desc limit 6")->fetchAll(); if(!empty($recentProjects)) { - foreach($recentProjects as $project) + foreach($recentProjects as $key => $project) { + if($key == 5) continue; echo '
  • ' . html::a(helper::createLink('project', 'task', 'projectID=' . $project->id, '', false, $project->parent), $project->name, '', "class='text-ellipsis' title='$project->name'") . '
  • '; } - - if(count($recentProjects) >= 5) echo '
  • ' . $this->lang->more . '
  • '; + if(count($recentProjects) > 5) echo '
  • ' . $lang->more . '
  • '; } echo "\n"; diff --git a/module/common/view/header.html.php b/module/common/view/header.html.php index 9d8603b835..fb260770fa 100755 --- a/module/common/view/header.html.php +++ b/module/common/view/header.html.php @@ -14,7 +14,7 @@ include 'chosen.html.php';