summaryrefslogtreecommitdiff
path: root/backend/php/src/objects/class.record.php
Side-by-side diff
Diffstat (limited to 'backend/php/src/objects/class.record.php') (more/less context) (ignore whitespace changes)
-rw-r--r--backend/php/src/objects/class.record.php13
1 files changed, 9 insertions, 4 deletions
diff --git a/backend/php/src/objects/class.record.php b/backend/php/src/objects/class.record.php
index a269e75..37a9702 100644
--- a/backend/php/src/objects/class.record.php
+++ b/backend/php/src/objects/class.record.php
@@ -6,13 +6,13 @@
`recordid` int(11) NOT NULL auto_increment,
`userid` int(11) NOT NULL,
`reference` VARCHAR(255) NOT NULL,
`data` LONGTEXT NOT NULL,
`version` VARCHAR(255) NOT NULL,
`creation_date` TIMESTAMP NOT NULL,
- `update_date` TIMESTAMP NOT NULL,
+ `update_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`access_date` TIMESTAMP NOT NULL, INDEX(`userid`), PRIMARY KEY (`recordid`)) ENGINE=MyISAM;
*/
/**
* <b>record</b> class with integrated CRUD methods.
* @author Php Object Generator
@@ -123,13 +123,14 @@ class record extends POG_Base
$this->recordId = $row['recordid'];
$this->userId = $row['userid'];
$this->reference = $this->Unescape($row['reference']);
$this->data = $this->Unescape($row['data']);
$this->version = $this->Unescape($row['version']);
$this->creation_date = $row['creation_date'];
- $this->update_date = $row['update_date'];
+ $oDate = strtotime($row['update_date']);
+ $this->update_date = date('r', $oDate);
$this->access_date = $row['access_date'];
}
return $this;
}
@@ -215,13 +216,14 @@ class record extends POG_Base
$record->recordId = $row['recordid'];
$record->userId = $row['userid'];
$record->reference = $this->Unescape($row['reference']);
$record->data = $this->Unescape($row['data']);
$record->version = $this->Unescape($row['version']);
$record->creation_date = $row['creation_date'];
- $record->update_date = $row['update_date'];
+ $oDate = strtotime($row['update_date']);
+ $record->update_date = date('r', $oDate);
$record->access_date = $row['access_date'];
$recordList[] = $record;
}
return $recordList;
}
@@ -230,12 +232,14 @@ class record extends POG_Base
* Saves the object to the database
* @return integer $recordId
*/
function Save($deep = true)
{
$connection = Database::Connect();
+ $this->update_date = date( 'r');
+ $this->access_date = date( 'r');
$this->pog_query = "select `recordid` from `record` where `recordid`='".$this->recordId."' LIMIT 1";
$rows = Database::Query($this->pog_query, $connection);
if ($rows > 0)
{
$this->pog_query = "update `record` set
`userid`='".$this->userId."',
@@ -278,12 +282,13 @@ class record extends POG_Base
* Clones the object and saves it to the database
* @return integer $recordId
*/
function SaveNew($deep = false)
{
$this->recordId = '';
+ $this->creation_date = date( 'Y-m-d H:i:s');
return $this->Save($deep);
}
/**
* Deletes the object from the database
@@ -430,7 +435,7 @@ class record extends POG_Base
if (!$found)
{
$this->_recordversionList[] = $recordversion;
}
}
}
-?> \ No newline at end of file
+?>