* Adjust recent function logic.
This commit is contained in:
@@ -544,8 +544,8 @@ class commonModel extends model
|
||||
echo '<li><hr></li>';
|
||||
echo '<li><span><i class="icon icon-menu-doc"></i> ' . $this->lang->recent . '</span></li>';
|
||||
|
||||
$recentProjects = $this->dao->select('id,code')->from(TABLE_PROJECT)
|
||||
->where('type')->eq('project')
|
||||
$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')
|
||||
@@ -555,7 +555,10 @@ class commonModel extends model
|
||||
|
||||
if(!empty($recentProjects))
|
||||
{
|
||||
foreach($recentProjects as $project) echo '<li>' . html::a(helper::createLink('program', 'index', 'projectID=' . $project->id), $project->code) . '</li>';
|
||||
foreach($recentProjects as $project)
|
||||
{
|
||||
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>';
|
||||
}
|
||||
|
||||
@@ -752,10 +752,13 @@ class program extends control
|
||||
*/
|
||||
public function ajaxGetRecentProjects()
|
||||
{
|
||||
$recentProjects = $this->program->getPRJPairs(0, 15);
|
||||
$recentProjects = $this->program->getPRJRecent();
|
||||
if(!empty($recentProjects))
|
||||
{
|
||||
foreach($recentProjects as $project) echo html::a(helper::createLink('program', 'index', 'projectID=' . $project->id), '<i class="icon icon-menu-doc"></i>' . $project->name);
|
||||
foreach($recentProjects as $project)
|
||||
{
|
||||
echo html::a(helper::createLink('project', 'task', 'projectID=' . $project->id, '', false, $project->parent), '<i class="icon icon-menu-doc"></i>' . $project->name, '', "class='text-ellipsis' title='$project->name'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+21
-16
@@ -817,23 +817,28 @@ class programModel extends model
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getPRJPairs($projectID = 0, $limit = 0)
|
||||
public function getPRJPairs($projectID = 0)
|
||||
{
|
||||
if($limit)
|
||||
{
|
||||
return $this->dao->select('id,name')->from(TABLE_PROJECT)
|
||||
->where('type')->eq('project')
|
||||
->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->projects)->fi()
|
||||
->andWhere('status')->ne('status')
|
||||
->andWhere('deleted')->eq('0')
|
||||
->orderBy('id_desc')
|
||||
->limit('5,' . $limit)
|
||||
->fetchAll();
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->dao->select('id,name')->from(TABLE_PROJECT)->where('id')->eq($projectID)->fetch();
|
||||
}
|
||||
return $this->dao->select('id,name')->from(TABLE_PROJECT)->where('id')->eq($projectID)->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get recent projects.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getPRJRecent($limit = 15)
|
||||
{
|
||||
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()
|
||||
->andWhere('status')->ne('status')
|
||||
->andWhere('deleted')->eq('0')
|
||||
->orderBy('id_desc')
|
||||
->limit('5,' . $limit)
|
||||
->fetchAll();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user