enhanced the site home page to display open issues

This commit is contained in:
hyung-hwan 2014-05-06 13:48:37 +00:00
parent 61a825cad1
commit 9714800af6
3 changed files with 51 additions and 1 deletions

View File

@ -23,6 +23,10 @@ class Site extends Controller
$this->load->library ('Language', 'lang'); $this->load->library ('Language', 'lang');
$this->lang->load ('common', CODEPOT_LANG); $this->lang->load ('common', CODEPOT_LANG);
$this->lang->load ('site', CODEPOT_LANG); $this->lang->load ('site', CODEPOT_LANG);
$this->load->library ('IssueHelper', 'issuehelper');
$this->lang->load ('issue', CODEPOT_LANG);
} }
function index () function index ()
@ -39,6 +43,7 @@ class Site extends Controller
$this->load->model ('SiteModel', 'sites'); $this->load->model ('SiteModel', 'sites');
$this->load->model ('ProjectModel', 'projects'); $this->load->model ('ProjectModel', 'projects');
$this->load->model ('LogModel', 'logs'); $this->load->model ('LogModel', 'logs');
$this->load->model ('IssueModel', 'issues');
$site = $this->sites->get ($this->config->config['language']); $site = $this->sites->get ($this->config->config['language']);
if ($site === FALSE) if ($site === FALSE)
@ -79,10 +84,26 @@ class Site extends Controller
return; 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['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['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_name'] = '';
//$data['user_pass'] = ''; //$data['user_pass'] = '';
$this->load->view ($this->VIEW_HOME, $data); $this->load->view ($this->VIEW_HOME, $data);

View File

@ -102,7 +102,7 @@ class IssueModel extends Model
function getMyIssues ($userid, $filter) function getMyIssues ($userid, $filter)
{ {
$this->db->trans_start (); $this->db->trans_start ();
$this->db->where ('owner', $userid); if (strlen($userid) > 0) $this->db->where ('owner', $userid);
//$this->db->order_by ('id', 'desc'); //$this->db->order_by ('id', 'desc');
if (is_array($filter)) if (is_array($filter))

View File

@ -226,6 +226,35 @@ foreach ($latest_projects as $project)
</div> <!-- site_home_mainarea_sidebar --> </div> <!-- site_home_mainarea_sidebar -->
<?php if ($issues && count($issues) > 0): ?>
<div id="site_home_mainarea_issues">
<div><?=$this->lang->line('Open issues')?></div>
<ul>
<?php
foreach ($issues as $issue)
{
$pro = $issue->projectid;
$xid = $this->converter->AsciiToHex ((string)$issue->id);
$owner = $issue->owner;
$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> {$pro} {$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">
<?php print htmlspecialchars($site->text); ?> <?php print htmlspecialchars($site->text); ?>