enhanced the site home view to show resolve issues for the last 1 week

This commit is contained in:
hyung-hwan 2014-05-07 14:55:42 +00:00
parent e41444a8a3
commit 297ca39c53
8 changed files with 55 additions and 3 deletions

View File

@ -87,7 +87,10 @@ class Site extends Controller
// get the issue for all users // get the issue for all users
$issues = $this->issues->getMyIssues ( $issues = $this->issues->getMyIssues (
/*$login['id']*/ "", $this->issuehelper->_get_open_status_array($this->lang)); /*$login['id']*/ "", $this->issuehelper->_get_open_status_array($this->lang));
if ($issues === FALSE) $recently_resolved_issues = $this->issues->getMyIssues (
"", $this->issuehelper->_get_resolved_status_array($this->lang), 168);
if ($issues === FALSE || $recently_resolved_issues === FALSE)
{ {
$data['login'] = $login; $data['login'] = $login;
$data['message'] = 'DATABASE ERROR'; $data['message'] = 'DATABASE ERROR';
@ -95,11 +98,13 @@ class Site extends Controller
return; return;
} }
$data['login'] = $login; $data['login'] = $login;
$data['latest_projects'] = $latest_projects; $data['latest_projects'] = $latest_projects;
$data['log_entries'] = $log_entries; $data['log_entries'] = $log_entries;
$data['site'] = $site; $data['site'] = $site;
$data['issues'] = $issues; $data['issues'] = $issues;
$data['recently_resolved_issues'] = $recently_resolved_issues;
$data['issue_type_array'] = $this->issuehelper->_get_type_array($this->lang); $data['issue_type_array'] = $this->issuehelper->_get_type_array($this->lang);
$data['issue_status_array'] = $this->issuehelper->_get_status_array($this->lang); $data['issue_status_array'] = $this->issuehelper->_get_status_array($this->lang);
$data['issue_priority_array'] = $this->issuehelper->_get_priority_array($this->lang); $data['issue_priority_array'] = $this->issuehelper->_get_priority_array($this->lang);

View File

@ -61,6 +61,7 @@ $lang['Priority'] = 'Priority';
$lang['Project'] = 'Project'; $lang['Project'] = 'Project';
$lang['Projects'] = 'Projects'; $lang['Projects'] = 'Projects';
$lang['Purge'] = 'Purge'; $lang['Purge'] = 'Purge';
$lang['Recently resolved issues'] = 'Recently resolved issues';
$lang['Repository'] = 'Repository'; $lang['Repository'] = 'Repository';
$lang['Revision'] = 'Revision'; $lang['Revision'] = 'Revision';
$lang['Search'] = 'Search'; $lang['Search'] = 'Search';

View File

@ -57,6 +57,7 @@ $lang['Priority'] = 'Pirority';
$lang['Project'] = 'Proyek'; $lang['Project'] = 'Proyek';
$lang['Projects'] = 'Proyek'; $lang['Projects'] = 'Proyek';
$lang['Purge'] = 'Purge'; $lang['Purge'] = 'Purge';
$lang['Recently resolved issues'] = 'Recently resolved issues';
$lang['Repository'] = 'Repository'; $lang['Repository'] = 'Repository';
$lang['Revision'] = 'Revisi'; $lang['Revision'] = 'Revisi';
$lang['Search'] = 'Search'; $lang['Search'] = 'Search';

View File

@ -61,6 +61,7 @@ $lang['Priority'] = '중요도';
$lang['Project'] = '프로젝트'; $lang['Project'] = '프로젝트';
$lang['Projects'] = '프로젝트'; $lang['Projects'] = '프로젝트';
$lang['Purge'] = '정화하기'; $lang['Purge'] = '정화하기';
$lang['Recently resolved issues'] = '최근해결이슈';
$lang['Repository'] = '저장소'; $lang['Repository'] = '저장소';
$lang['Revision'] = '리비전'; $lang['Revision'] = '리비전';
$lang['Search'] = '찾기'; $lang['Search'] = '찾기';

View File

@ -9,7 +9,7 @@ $lang['ISSUE_STATUS_ACCEPTED'] = '승인';
$lang['ISSUE_STATUS_REJECTED'] = '거부'; $lang['ISSUE_STATUS_REJECTED'] = '거부';
$lang['ISSUE_STATUS_STARTED'] = '시작'; $lang['ISSUE_STATUS_STARTED'] = '시작';
$lang['ISSUE_STATUS_STALLED'] = '지연'; $lang['ISSUE_STATUS_STALLED'] = '지연';
$lang['ISSUE_STATUS_RESOLVED'] = '완료'; $lang['ISSUE_STATUS_RESOLVED'] = '해결';
$lang['ISSUE_PRIORITY_CRITICAL'] = '긴급'; $lang['ISSUE_PRIORITY_CRITICAL'] = '긴급';
$lang['ISSUE_PRIORITY_HIGH'] = '높음'; $lang['ISSUE_PRIORITY_HIGH'] = '높음';

View File

@ -75,6 +75,14 @@ class IssueHelper
); );
} }
function _get_resolved_status_array ($lang)
{
return array (
$this->STATUS_RESOLVED =>
$lang->line('ISSUE_STATUS_RESOLVED')
);
}
function _get_priority_array ($lang) function _get_priority_array ($lang)
{ {
return array ( return array (

View File

@ -99,7 +99,7 @@ class IssueModel extends Model
return $query->result (); return $query->result ();
} }
function getMyIssues ($userid, $filter) function getMyIssues ($userid, $filter, $hour_limit = 0)
{ {
$this->db->trans_start (); $this->db->trans_start ();
if (strlen($userid) > 0) $this->db->where ('owner', $userid); if (strlen($userid) > 0) $this->db->where ('owner', $userid);
@ -110,9 +110,15 @@ class IssueModel extends Model
$this->db->where_in ('status', array_keys($filter)); $this->db->where_in ('status', array_keys($filter));
} }
if ($hour_limit > 0)
{
$this->db->where ("updatedon >= SYSDATE() - INTERVAL {$hour_limit} HOUR");
}
$query = $this->db->get ('issue'); $query = $this->db->get ('issue');
$this->db->trans_complete (); $this->db->trans_complete ();
if ($this->db->trans_status() === FALSE) return FALSE; if ($this->db->trans_status() === FALSE) return FALSE;
return $query->result (); return $query->result ();
} }

View File

@ -255,6 +255,36 @@ foreach ($latest_projects as $project)
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if ($recently_resolved_issues && count($recently_resolved_issues) > 0): ?>
<div id="site_home_mainarea_issues">
<div><?=$this->lang->line('Recently resolved issues')?></div>
<ul>
<?php
foreach ($recently_resolved_issues as $issue)
{
$pro = $issue->projectid;
$xid = $this->converter->AsciiToHex ((string)$issue->id);
$owner = $issue->owner;
$proissueanc = anchor ("issue/home/{$issue->projectid}", $pro);
$anc = anchor ("issue/show/{$issue->projectid}/{$xid}", '#' . htmlspecialchars($issue->id));
$status = htmlspecialchars(
array_key_exists($issue->status, $issue_status_array)?
$issue_status_array[$issue->status]: $issue->status);
$type = htmlspecialchars(
array_key_exists($issue->type, $issue_type_array)?
$issue_type_array[$issue->type]: $issue->type);
$sum = htmlspecialchars ($issue->summary);
print "<li><font color='blue'>{$owner}</font> | {$proissueanc} | {$anc} | {$type} {$status} - {$sum}</li>";
}
?>
</ul>
</div>
<?php endif; ?>
<div id="site_home_mainarea_wiki"> <div id="site_home_mainarea_wiki">
<pre id="site_home_mainarea_wiki_text" style="visibility: hidden"> <pre id="site_home_mainarea_wiki_text" style="visibility: hidden">