From 9714800af6a441ca7f812b26d23f15fe5e8fd047 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Tue, 6 May 2014 13:48:37 +0000 Subject: [PATCH] enhanced the site home page to display open issues --- codepot/src/codepot/controllers/site.php | 21 ++++++++++++++++ codepot/src/codepot/models/issuemodel.php | 2 +- codepot/src/codepot/views/site_home.php | 29 +++++++++++++++++++++++ 3 files changed, 51 insertions(+), 1 deletion(-) diff --git a/codepot/src/codepot/controllers/site.php b/codepot/src/codepot/controllers/site.php index afcc4bb5..2688a4cd 100644 --- a/codepot/src/codepot/controllers/site.php +++ b/codepot/src/codepot/controllers/site.php @@ -23,6 +23,10 @@ class Site extends Controller $this->load->library ('Language', 'lang'); $this->lang->load ('common', CODEPOT_LANG); $this->lang->load ('site', CODEPOT_LANG); + + + $this->load->library ('IssueHelper', 'issuehelper'); + $this->lang->load ('issue', CODEPOT_LANG); } function index () @@ -39,6 +43,7 @@ class Site extends Controller $this->load->model ('SiteModel', 'sites'); $this->load->model ('ProjectModel', 'projects'); $this->load->model ('LogModel', 'logs'); + $this->load->model ('IssueModel', 'issues'); $site = $this->sites->get ($this->config->config['language']); if ($site === FALSE) @@ -79,10 +84,26 @@ class Site extends Controller return; } + // get the issue for all users + $issues = $this->issues->getMyIssues ( + /*$login['id']*/ "", $this->issuehelper->_get_open_status_array($this->lang)); + if ($issues === FALSE) + { + $data['login'] = $login; + $data['message'] = 'DATABASE ERROR'; + $this->load->view ($this->VIEW_ERROR, $data); + return; + } + $data['login'] = $login; $data['latest_projects'] = $latest_projects; $data['log_entries'] = $log_entries; $data['site'] = $site; + $data['issues'] = $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); + //$data['user_name'] = ''; //$data['user_pass'] = ''; $this->load->view ($this->VIEW_HOME, $data); diff --git a/codepot/src/codepot/models/issuemodel.php b/codepot/src/codepot/models/issuemodel.php index 3446314e..c48e586b 100644 --- a/codepot/src/codepot/models/issuemodel.php +++ b/codepot/src/codepot/models/issuemodel.php @@ -102,7 +102,7 @@ class IssueModel extends Model function getMyIssues ($userid, $filter) { $this->db->trans_start (); - $this->db->where ('owner', $userid); + if (strlen($userid) > 0) $this->db->where ('owner', $userid); //$this->db->order_by ('id', 'desc'); if (is_array($filter)) diff --git a/codepot/src/codepot/views/site_home.php b/codepot/src/codepot/views/site_home.php index bd6df251..7e300d16 100644 --- a/codepot/src/codepot/views/site_home.php +++ b/codepot/src/codepot/views/site_home.php @@ -226,6 +226,35 @@ foreach ($latest_projects as $project) + 0): ?> +
+
lang->line('Open issues')?>
+ +
+ + +