aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Gallo <tonicucoz@gmail.com>2010-12-25 22:00:58 +0000
committerAntonio Gallo <tonicucoz@gmail.com>2010-12-25 22:00:58 +0000
commit18d7cd4c01a71e1304b2e9e782d0490ca2e6e5a9 (patch)
tree00c7f02ecb908ca7820912f31208dbeaf1c0c734
parentb1ee308d12b28adf851b04946237bbc5a91c822d (diff)
improved the way issues are sorted
-rw-r--r--h-source/Application/Controllers/IssuesController.php17
-rw-r--r--h-source/Application/Include/languages.php1
-rw-r--r--h-source/Application/Models/MessagesModel.php2
-rw-r--r--h-source/Application/Views/Issues/viewall.php6
4 files changed, 16 insertions, 10 deletions
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;
+ }
}
}
diff --git a/h-source/Application/Include/languages.php b/h-source/Application/Include/languages.php
index 44c9020..2702fc8 100644
--- a/h-source/Application/Include/languages.php
+++ b/h-source/Application/Include/languages.php
@@ -140,6 +140,7 @@ class Lang
"contributions" => "contributi",
"contributions of" => "contributi di",
"No sound cards found" => "Non รจ stata trovata alcuna scheda audio",
+ "LAST UPDATE" => "ULTIMA MODIFICA",
),
'es' => array
(
diff --git a/h-source/Application/Models/MessagesModel.php b/h-source/Application/Models/MessagesModel.php
index c77894d..2417739 100644
--- a/h-source/Application/Models/MessagesModel.php
+++ b/h-source/Application/Models/MessagesModel.php
@@ -20,7 +20,7 @@
if (!defined('EG')) die('Direct access not allowed!');
-class MessagesModel extends NorepeatModel {
+class MessagesModel extends Model_Tree {
public function __construct() {
$this->_tables = 'messages';
diff --git a/h-source/Application/Views/Issues/viewall.php b/h-source/Application/Views/Issues/viewall.php
index 73ab0c0..b47294f 100644
--- a/h-source/Application/Views/Issues/viewall.php
+++ b/h-source/Application/Views/Issues/viewall.php
@@ -44,11 +44,10 @@
<table class="issues_viewall_table">
<thead>
<tr>
- <th>ID</th>
<th><?php echo gtext("TITLE");?></th>
<th><?php echo gtext("TOPIC");?></th>
<th><?php echo gtext("OPENED BY");?></th>
- <th><?php echo gtext("DATE");?></th>
+ <th><?php echo gtext("LAST UPDATE");?></th>
<th><?php echo gtext("REPLIES");?></th>
<th><?php echo gtext("PRIORITY");?></th>
<th><?php echo gtext("STATUS");?></th>
@@ -57,11 +56,10 @@
<?php foreach ($table as $row) { ?>
<tr>
- <td><?php echo $row['issues']['id_issue'];?></td>
<td><a href="<?php echo $this->baseUrl."/issues/view/$lang/".$row['issues']['id_issue'].$this->viewStatus;?>"><?php echo $row['issues']['title'];?></a></td>
<td><?php echo str_replace('-',' ',$row['issues']['topic']);?></td>
<td><?php echo getLinkToUser($u->getUser($row['issues']['created_by']));?></td>
- <td><?php echo smartDate($row['issues']['creation_date']);?></td>
+ <td><?php echo smartDate($row['issues']['update_date']);?></td>
<td>
<?php
if (strcmp($row['messages']['message'],'') !== 0)