aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Gallo <tonicucoz@gmail.com>2011-10-13 07:50:44 +0000
committerAntonio Gallo <tonicucoz@gmail.com>2011-10-13 07:50:44 +0000
commit086b034d3ba202e81e656ce99bb8933089263edf (patch)
treee19a3f5c19ce88720a7360fdf896776bb5eeb5a5
parent9e0955c96d888fc2e00014498d095a7d65ab48fb (diff)
improved history
-rw-r--r--h-source/Application/Controllers/IssuesController.php12
-rw-r--r--h-source/Application/Models/IssuesModel.php12
-rw-r--r--h-source/Application/Models/MessagesModel.php11
-rw-r--r--h-source/Application/Models/TalkModel.php7
-rw-r--r--h-source/Application/Models/WikitalkModel.php11
-rw-r--r--h-source/tables.sql2
6 files changed, 46 insertions, 9 deletions
diff --git a/h-source/Application/Controllers/IssuesController.php b/h-source/Application/Controllers/IssuesController.php
index e69c598..d34e0f8 100644
--- a/h-source/Application/Controllers/IssuesController.php
+++ b/h-source/Application/Controllers/IssuesController.php
@@ -64,11 +64,14 @@ class IssuesController extends BaseController
//set the page to 1 in the viewStatus
$this->viewArgs['page'] = 1;
$this->buildStatus();
+
+ $clean['id_user'] = (int)$this->s['registered']->status['id_user'];
- $this->m['IssuesModel']->values['created_by'] = (int)$this->s['registered']->status['id_user'];
+ $this->m['IssuesModel']->values['created_by'] = $clean['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');
+
}
}
@@ -131,15 +134,18 @@ class IssuesController extends BaseController
if (!$this->s['registered']->checkCsrf($this->viewArgs['token'])) $this->redirect('home/index/'.$this->lang,2,'wrong token..');
if ($this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) $this->redirect('my/home/'.$this->lang,2,'your account has been blocked..');
+
+ $clean['id_user'] = (int)$this->s['registered']->status['id_user'];
- $this->m['MessagesModel']->values['created_by'] = (int)$this->s['registered']->status['id_user'];
+ $this->m['MessagesModel']->values['created_by'] = $clean['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/Models/IssuesModel.php b/h-source/Application/Models/IssuesModel.php
index eec86be..9d6a4ef 100644
--- a/h-source/Application/Models/IssuesModel.php
+++ b/h-source/Application/Models/IssuesModel.php
@@ -20,7 +20,7 @@
if (!defined('EG')) die('Direct access not allowed!');
-class IssuesModel extends Model_Tree {
+class IssuesModel extends BaseModel {
public function __construct() {
$this->_tables = 'issues';
@@ -103,4 +103,14 @@ class IssuesModel extends Model_Tree {
{
return parent::update($id);
}
+
+ public function insert()
+ {
+ if (parent::insert())
+ {
+ //update the history
+ $this->updateHistory('issue_ins');
+ }
+ }
+
} \ No newline at end of file
diff --git a/h-source/Application/Models/MessagesModel.php b/h-source/Application/Models/MessagesModel.php
index 989facc..b36e76e 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 Model_Tree {
+class MessagesModel extends BaseModel {
public function __construct() {
$this->_tables = 'messages';
@@ -49,6 +49,15 @@ class MessagesModel extends Model_Tree {
{
return parent::update($id);
}
+
+ public function insert()
+ {
+ if (parent::insert())
+ {
+ //update the history
+ $this->updateHistory('message_ins');
+ }
+ }
public $formStruct = array(
'entries' => array(
diff --git a/h-source/Application/Models/TalkModel.php b/h-source/Application/Models/TalkModel.php
index b98a5a4..0edcdda 100644
--- a/h-source/Application/Models/TalkModel.php
+++ b/h-source/Application/Models/TalkModel.php
@@ -20,7 +20,7 @@
if (!defined('EG')) die('Direct access not allowed!');
-class TalkModel extends Model_Tree {
+class TalkModel extends BaseModel {
public function __construct() {
$this->_tables = 'talk';
@@ -52,11 +52,14 @@ class TalkModel extends Model_Tree {
{
if (parent::insert())
{
+ //update the history
+ $this->updateHistory('talk_ins');
+
if (strcmp($this->values['id_hard'],0) !== 0)
{
$clean['id_hard'] = (int)$this->values['id_hard'];
$clean['created_by'] = (int)$this->values['created_by'];
-
+
$hard = new HardwareModel();
$users = $hard->select('username,e_mail')
->where(array('id_hard'=>$clean['id_hard'],'has_confirmed'=>0,'deleted'=>'no'))
diff --git a/h-source/Application/Models/WikitalkModel.php b/h-source/Application/Models/WikitalkModel.php
index 3bff3d3..2595a1a 100644
--- a/h-source/Application/Models/WikitalkModel.php
+++ b/h-source/Application/Models/WikitalkModel.php
@@ -20,7 +20,7 @@
if (!defined('EG')) die('Direct access not allowed!');
-class WikitalkModel extends Model_Tree
+class WikitalkModel extends BaseModel
{
public function __construct() {
@@ -41,6 +41,15 @@ class WikitalkModel extends Model_Tree
{
return parent::update($id);
}
+
+ public function insert()
+ {
+ if (parent::insert())
+ {
+ //update the history
+ $this->updateHistory('wiki_talk_ins');
+ }
+ }
public $formStruct = array(
'entries' => array(
diff --git a/h-source/tables.sql b/h-source/tables.sql
index 7269ee1..2cd87ec 100644
--- a/h-source/tables.sql
+++ b/h-source/tables.sql
@@ -244,7 +244,7 @@ create table history (
id_history int not null auto_increment primary key,
created_by int not null,
creation_date timestamp default CURRENT_TIMESTAMP,
- type char(10) not null,
+ type char(15) not null,
action char(15) not null,
id INT UNSIGNED NOT NULL,
message text CHARACTER SET utf8 not null,