changing the site home to show issue counts
This commit is contained in:
parent
67f331fa28
commit
c51f44ec8c
@ -24,7 +24,6 @@ class Site extends Controller
|
||||
$this->lang->load ('common', CODEPOT_LANG);
|
||||
$this->lang->load ('site', CODEPOT_LANG);
|
||||
|
||||
|
||||
$this->load->library ('IssueHelper', 'issuehelper');
|
||||
$this->lang->load ('issue', CODEPOT_LANG);
|
||||
}
|
||||
@ -86,11 +85,24 @@ class Site extends Controller
|
||||
|
||||
// get the issue for all users
|
||||
$issues = $this->issues->getMyIssues (
|
||||
/*$login['id']*/ "", $this->issuehelper->_get_open_status_array($this->lang));
|
||||
/*$login['id']*/ '', $this->issuehelper->_get_open_status_array($this->lang));
|
||||
$recently_resolved_issues = $this->issues->getMyIssues (
|
||||
"", $this->issuehelper->_get_resolved_status_array($this->lang), 168);
|
||||
'', $this->issuehelper->_get_resolved_status_array($this->lang), 168);
|
||||
|
||||
if ($issues === FALSE || $recently_resolved_issues === FALSE)
|
||||
$open_issue_counts_per_project = $this->issues->countIssuesPerProject (
|
||||
'', $this->issuehelper->_get_open_status_array($this->lang), 0);
|
||||
|
||||
if ($login['id'] == '')
|
||||
{
|
||||
$your_open_issue_counts_per_project = array ();
|
||||
}
|
||||
else
|
||||
{
|
||||
$your_open_issue_counts_per_project = $this->issues->countIssuesPerProject (
|
||||
$login['id'], $this->issuehelper->_get_open_status_array($this->lang), 0);
|
||||
}
|
||||
|
||||
if ($issues === FALSE || $recently_resolved_issues === FALSE || $open_issue_counts_per_project === FALSE)
|
||||
{
|
||||
$data['login'] = $login;
|
||||
$data['message'] = 'DATABASE ERROR';
|
||||
@ -98,13 +110,14 @@ 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['open_issue_counts_per_project'] = $open_issue_counts_per_project;
|
||||
$data['your_open_issue_counts_per_project'] = $your_open_issue_counts_per_project;
|
||||
$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);
|
||||
@ -401,7 +414,7 @@ class Site extends Controller
|
||||
$this->load->model ('LogModel', 'logs');
|
||||
$this->load->model ('SiteModel', 'sites');
|
||||
|
||||
$site = $this->sites->get ($this->config->config['language']);
|
||||
$site = $this->sites->get ($this->config->config['language']);
|
||||
if ($site === FALSE)
|
||||
{
|
||||
$data['login'] = $login;
|
||||
@ -411,7 +424,7 @@ class Site extends Controller
|
||||
}
|
||||
if ($site === NULL && CODEPOT_DEFAULT_SITE_LANGUAGE != '')
|
||||
{
|
||||
$site = $this->sites->get (CODEPOT_DEFAULT_SITE_LANGUAGE);
|
||||
$site = $this->sites->get (CODEPOT_DEFAULT_SITE_LANGUAGE);
|
||||
if ($site === FALSE)
|
||||
{
|
||||
$data['login'] = $login;
|
||||
|
@ -197,6 +197,37 @@ class IssueModel extends Model
|
||||
return $result[0]->issue_count;
|
||||
}
|
||||
|
||||
function countIssuesPerProject ($userid, $status_filter, $hour_limit = 0)
|
||||
{
|
||||
$this->db->trans_begin ();
|
||||
if (strlen($userid) > 0) $this->db->where ('owner', $userid);
|
||||
|
||||
if (is_array($status_filter))
|
||||
{
|
||||
$this->db->where_in ('status', array_keys($status_filter));
|
||||
}
|
||||
|
||||
if ($hour_limit > 0)
|
||||
{
|
||||
//$this->db->where ("updatedon >= SYSDATE() - INTERVAL {$hour_limit} HOUR");
|
||||
$this->db->where ("updatedon >= CURRENT_TIMESTAMP - INTERVAL '{$hour_limit}' HOUR");
|
||||
}
|
||||
|
||||
$this->db->select ('projectid, COUNT(id) AS issue_count');
|
||||
$this->db->group_by ('projectid');
|
||||
$query = $this->db->get ('issue');
|
||||
if ($this->db->trans_status() === FALSE)
|
||||
{
|
||||
$this->errmsg = $this->db->_error_message();
|
||||
$this->db->trans_rollback ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$this->db->trans_commit();
|
||||
|
||||
return $query->result ();
|
||||
}
|
||||
|
||||
function getFile ($userid, $project, $issueid, $filename)
|
||||
{
|
||||
$this->db->trans_start ();
|
||||
|
@ -290,8 +290,25 @@ foreach ($latest_projects as $project)
|
||||
<div id="site_home_result_open_issues_header" class="collapsible-box-header">
|
||||
<?php print $this->lang->line('Open issues')?>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<ul id="site_home_result_open_issues_list" class="collapsible-box-list">
|
||||
<?php
|
||||
foreach ($open_issue_counts_per_project as $issue)
|
||||
{
|
||||
$pro = $issue->projectid;
|
||||
$proissueanc = anchor ("issue/home/{$issue->projectid}", $pro);
|
||||
print "<li>{$proissueanc} <span class='codepot-open-issue-count'>{$issue->issue_count}</span></li>";
|
||||
}
|
||||
|
||||
foreach ($your_open_issue_counts_per_project as $issue)
|
||||
{
|
||||
$pro = $issue->projectid;
|
||||
$proissueanc = anchor ("issue/home/{$issue->projectid}", $pro);
|
||||
print "<li>{$proissueanc} <span class='codepot-open-issue-count'>{$issue->issue_count}</span></li>";
|
||||
}
|
||||
|
||||
foreach ($issues as $issue)
|
||||
{
|
||||
$pro = $issue->projectid;
|
||||
@ -311,6 +328,7 @@ foreach ($latest_projects as $project)
|
||||
$sum = htmlspecialchars ($issue->summary);
|
||||
print "<li><font color='blue'>{$owner}</font> | {$proissueanc} | {$anc} | {$type} {$status} - {$sum}</li>";
|
||||
}
|
||||
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user