From 297ca39c53daa95f7447b00ab3b0f66c9546737e Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Wed, 7 May 2014 14:55:42 +0000 Subject: [PATCH] enhanced the site home view to show resolve issues for the last 1 week --- codepot/src/codepot/controllers/site.php | 7 ++++- .../codepot/language/english/common_lang.php | 1 + .../language/indonesian/common_lang.php | 1 + .../codepot/language/korean/common_lang.php | 1 + .../codepot/language/korean/issue_lang.php | 2 +- codepot/src/codepot/libraries/issuehelper.php | 8 +++++ codepot/src/codepot/models/issuemodel.php | 8 ++++- codepot/src/codepot/views/site_home.php | 30 +++++++++++++++++++ 8 files changed, 55 insertions(+), 3 deletions(-) diff --git a/codepot/src/codepot/controllers/site.php b/codepot/src/codepot/controllers/site.php index 2688a4cd..7abeab2c 100644 --- a/codepot/src/codepot/controllers/site.php +++ b/codepot/src/codepot/controllers/site.php @@ -87,7 +87,10 @@ class Site extends Controller // get the issue for all users $issues = $this->issues->getMyIssues ( /*$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['message'] = 'DATABASE ERROR'; @@ -95,11 +98,13 @@ class Site extends Controller return; } + $data['login'] = $login; $data['latest_projects'] = $latest_projects; $data['log_entries'] = $log_entries; $data['site'] = $site; $data['issues'] = $issues; + $data['recently_resolved_issues'] = $recently_resolved_issues; $data['issue_type_array'] = $this->issuehelper->_get_type_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); diff --git a/codepot/src/codepot/language/english/common_lang.php b/codepot/src/codepot/language/english/common_lang.php index 061fa377..22b668c3 100644 --- a/codepot/src/codepot/language/english/common_lang.php +++ b/codepot/src/codepot/language/english/common_lang.php @@ -61,6 +61,7 @@ $lang['Priority'] = 'Priority'; $lang['Project'] = 'Project'; $lang['Projects'] = 'Projects'; $lang['Purge'] = 'Purge'; +$lang['Recently resolved issues'] = 'Recently resolved issues'; $lang['Repository'] = 'Repository'; $lang['Revision'] = 'Revision'; $lang['Search'] = 'Search'; diff --git a/codepot/src/codepot/language/indonesian/common_lang.php b/codepot/src/codepot/language/indonesian/common_lang.php index da69bda5..28162f01 100644 --- a/codepot/src/codepot/language/indonesian/common_lang.php +++ b/codepot/src/codepot/language/indonesian/common_lang.php @@ -57,6 +57,7 @@ $lang['Priority'] = 'Pirority'; $lang['Project'] = 'Proyek'; $lang['Projects'] = 'Proyek'; $lang['Purge'] = 'Purge'; +$lang['Recently resolved issues'] = 'Recently resolved issues'; $lang['Repository'] = 'Repository'; $lang['Revision'] = 'Revisi'; $lang['Search'] = 'Search'; diff --git a/codepot/src/codepot/language/korean/common_lang.php b/codepot/src/codepot/language/korean/common_lang.php index 07067b13..b92bf56f 100644 --- a/codepot/src/codepot/language/korean/common_lang.php +++ b/codepot/src/codepot/language/korean/common_lang.php @@ -61,6 +61,7 @@ $lang['Priority'] = '중요도'; $lang['Project'] = '프로젝트'; $lang['Projects'] = '프로젝트'; $lang['Purge'] = '정화하기'; +$lang['Recently resolved issues'] = '최근해결이슈'; $lang['Repository'] = '저장소'; $lang['Revision'] = '리비전'; $lang['Search'] = '찾기'; diff --git a/codepot/src/codepot/language/korean/issue_lang.php b/codepot/src/codepot/language/korean/issue_lang.php index 7497e6b5..2161c857 100644 --- a/codepot/src/codepot/language/korean/issue_lang.php +++ b/codepot/src/codepot/language/korean/issue_lang.php @@ -9,7 +9,7 @@ $lang['ISSUE_STATUS_ACCEPTED'] = '승인'; $lang['ISSUE_STATUS_REJECTED'] = '거부'; $lang['ISSUE_STATUS_STARTED'] = '시작'; $lang['ISSUE_STATUS_STALLED'] = '지연'; -$lang['ISSUE_STATUS_RESOLVED'] = '완료'; +$lang['ISSUE_STATUS_RESOLVED'] = '해결'; $lang['ISSUE_PRIORITY_CRITICAL'] = '긴급'; $lang['ISSUE_PRIORITY_HIGH'] = '높음'; diff --git a/codepot/src/codepot/libraries/issuehelper.php b/codepot/src/codepot/libraries/issuehelper.php index c230c66a..b123c3d1 100644 --- a/codepot/src/codepot/libraries/issuehelper.php +++ b/codepot/src/codepot/libraries/issuehelper.php @@ -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) { return array ( diff --git a/codepot/src/codepot/models/issuemodel.php b/codepot/src/codepot/models/issuemodel.php index c48e586b..056d9628 100644 --- a/codepot/src/codepot/models/issuemodel.php +++ b/codepot/src/codepot/models/issuemodel.php @@ -99,7 +99,7 @@ class IssueModel extends Model return $query->result (); } - function getMyIssues ($userid, $filter) + function getMyIssues ($userid, $filter, $hour_limit = 0) { $this->db->trans_start (); 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)); } + if ($hour_limit > 0) + { + $this->db->where ("updatedon >= SYSDATE() - INTERVAL {$hour_limit} HOUR"); + } + $query = $this->db->get ('issue'); $this->db->trans_complete (); + if ($this->db->trans_status() === FALSE) return FALSE; return $query->result (); } diff --git a/codepot/src/codepot/views/site_home.php b/codepot/src/codepot/views/site_home.php index 4705db62..ab3d87db 100644 --- a/codepot/src/codepot/views/site_home.php +++ b/codepot/src/codepot/views/site_home.php @@ -255,6 +255,36 @@ foreach ($latest_projects as $project) + 0): ?> +
+
lang->line('Recently resolved issues')?>
+ +
+ + +