*Adjust code.

This commit is contained in:
leiyong
2020-09-29 08:31:27 +08:00
parent 456dbffd68
commit d066fef4e5
4 changed files with 15 additions and 20 deletions
+1 -1
View File
@@ -44,7 +44,7 @@
<tr>
<td class='c-id-xs'><?php echo sprintf('%03d', $task->id);?></td>
<td class='c-pri <?php if($longBlock) echo "c-pri-long"?>'><span class='label-pri label-pri-<?php echo $task->pri;?>' title='<?php echo zget($lang->task->priList, $task->pri, $task->pri)?>'><?php echo zget($lang->task->priList, $task->pri, $task->pri)?></span></td>
<td class='c-name' style='color: <?php echo $task->color?>' title='<?php echo $task->name?>'><?php echo html::a($this->createLink('task', 'view', "taskID=$task->id", '', '', $task->program), $task->name)?></td>
<td class='c-name' style='color: <?php echo $task->color?>' title='<?php echo $task->name?>'><?php echo html::a($this->createLink('task', 'view', "taskID=$task->id", '', '', $task->PRJ), $task->name)?></td>
<?php if($longBlock):?>
<td class='c-estimate text-center'><?php echo $task->estimate?></td>
<td class='c-deadline'><?php if(substr($task->deadline, 0, 4) > 0) echo $task->deadline;?></td>
+8 -13
View File
@@ -539,28 +539,23 @@ class commonModel extends model
* @access public
* @return string
*/
public function getRecentProjects()
public static function getRecentProjects()
{
global $dbh, $lang, $app;
echo '<li><hr></li>';
echo '<li><span><i class="icon icon-menu-doc"></i> ' . $this->lang->recent . '</span></li>';
echo '<li><span><i class="icon icon-menu-doc"></i> ' . $lang->recent . '</span></li>';
$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 '<li>' . html::a(helper::createLink('project', 'task', 'projectID=' . $project->id, '', false, $project->parent), $project->name, '', "class='text-ellipsis' title='$project->name'") . '</li>';
}
if(count($recentProjects) >= 5) echo '<li onclick="getMorePRJ();" class="text-center"><span>' . $this->lang->more . '</span></li>';
if(count($recentProjects) > 5) echo '<li onclick="getMorePRJ();" class="text-center"><span>' . $lang->more . '</span></li>';
}
echo "</ul>\n";
+1 -1
View File
@@ -14,7 +14,7 @@ include 'chosen.html.php';
<div id='menu'>
<nav id='menuNav'>
<?php commonModel::printMainNav($app->rawModule);?>
<?php $this->loadModel('common')->getRecentProjects();?>
<?php commonModel::getRecentProjects();?>
</nav>
<div id='menuFooter'>
<button type='button' id='menuToggle'><i class='icon icon-sm icon-menu-collapse'></i></button>
+5 -5
View File
@@ -139,12 +139,12 @@ class programModel extends model
->groupBy('root')
->fetchAll('root');
$estimates = $this->dao->select('program, sum(estimate) as estimate')->from(TABLE_TASK)
->where('program')->in($programIdList)
$estimates = $this->dao->select('PRJ, sum(estimate) as estimate')->from(TABLE_TASK)
->where('PRJ')->in($programIdList)
->andWhere('deleted')->eq(0)
->andWhere('parent')->lt(1)
->groupBy('program')
->fetchAll('program');
->groupBy('PRJ')
->fetchAll('PRJ');
foreach($programs as $programID => $program)
{
@@ -833,7 +833,7 @@ class programModel extends model
{
return $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()
->beginIF(!$this->app->user->admin && $this->app->user->view->projects)->andWhere('parent')->in($this->app->user->view->projects)->fi()
->andWhere('status')->ne('status')
->andWhere('deleted')->eq('0')
->orderBy('id_desc')