From 18d7cd4c01a71e1304b2e9e782d0490ca2e6e5a9 Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Sat, 25 Dec 2010 22:00:58 +0000 Subject: improved the way issues are sorted --- h-source/Application/Controllers/IssuesController.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'h-source/Application/Controllers/IssuesController.php') diff --git a/h-source/Application/Controllers/IssuesController.php b/h-source/Application/Controllers/IssuesController.php index 53b3c58..2a584b7 100644 --- a/h-source/Application/Controllers/IssuesController.php +++ b/h-source/Application/Controllers/IssuesController.php @@ -41,8 +41,6 @@ class IssuesController extends BaseController $this->setArgKeys($argKeys); - $this->m['IssuesModel']->setFields('title,topic,priority,message','sanitizeAll'); - $data['title'] = 'issues - '.Website::$generalName; $this->append($data); } @@ -51,6 +49,8 @@ class IssuesController extends BaseController { $this->shift(1); + $this->m['IssuesModel']->setFields('title,topic,priority,message','sanitizeAll'); + $data['preview_message'] = null; if (isset($_POST['insertAction'])) @@ -67,7 +67,7 @@ class IssuesController extends BaseController $this->m['IssuesModel']->values['created_by'] = (int)$this->s['registered']->status['id_user']; $this->m['IssuesModel']->values['status'] = 'opened'; - + $this->m['IssuesModel']->values['update_date'] = date('Y-m-d H:i:s'); $this->m['IssuesModel']->updateTable('insert'); } } @@ -95,13 +95,12 @@ class IssuesController extends BaseController //load the Pages helper $this->helper('Pages',$this->controller.'/viewall/'.$this->lang,'page'); //get the number of records - $this->m['IssuesModel']->from('issues left join messages')->using('id_issue')->aWhere(array('deleted'=>'no'))->groupBy('issues.id_issue'); + $this->m['IssuesModel']->from('issues left join messages')->using('id_issue')->aWhere(array('deleted'=>'no'))->groupBy('issues.id_issue')->orderBy('issues.update_date desc'); $recordNumber = $this->m['IssuesModel']->rowNumber(); $page = $this->viewArgs['page']; //set the limit clause $this->m['IssuesModel']->limit = $this->h['Pages']->getLimit($page,$recordNumber,20); -// $data['table'] = $this->m['IssuesModel']->getFields('id_issue,created_by,title,status,creation_date,topic,priority'); $data['table'] = $this->m['IssuesModel']->getFields('issues.*,messages.message,count(*) as numb_mess'); $data['pageList'] = $this->h['Pages']->render($page-3,7); @@ -133,6 +132,14 @@ class IssuesController extends BaseController $this->m['MessagesModel']->values['created_by'] = (int)$this->s['registered']->status['id_user']; $this->m['MessagesModel']->values['id_issue'] = $clean['id_issue']; $this->m['MessagesModel']->updateTable('insert'); + + if ($this->m['MessagesModel']->queryResult) + { + $this->m['IssuesModel']->values = array('update_date' => date('Y-m-d H:i:s')); + $this->m['IssuesModel']->update($clean['id_issue']); + header('Refresh: 0;url=http://'.DOMAIN_NAME.$_SERVER['REQUEST_URI']); + exit; + } } } -- cgit v1.2.3