enhanced the site home page to display open issues
This commit is contained in:
		| @ -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); | ||||||
|  | |||||||
| @ -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)) | ||||||
|  | |||||||
| @ -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); ?> | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user