Diffstat (limited to 'backend/php/src/objects/class.record.php') (more/less context) (show whitespace changes)
-rw-r--r-- | backend/php/src/objects/class.record.php | 11 |
1 files changed, 8 insertions, 3 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 @@ | |||
6 | `recordid` int(11) NOT NULL auto_increment, | 6 | `recordid` int(11) NOT NULL auto_increment, |
7 | `userid` int(11) NOT NULL, | 7 | `userid` int(11) NOT NULL, |
8 | `reference` VARCHAR(255) NOT NULL, | 8 | `reference` VARCHAR(255) NOT NULL, |
9 | `data` LONGTEXT NOT NULL, | 9 | `data` LONGTEXT NOT NULL, |
10 | `version` VARCHAR(255) NOT NULL, | 10 | `version` VARCHAR(255) NOT NULL, |
11 | `creation_date` TIMESTAMP NOT NULL, | 11 | `creation_date` TIMESTAMP NOT NULL, |
12 | `update_date` TIMESTAMP NOT NULL, | 12 | `update_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
13 | `access_date` TIMESTAMP NOT NULL, INDEX(`userid`), PRIMARY KEY (`recordid`)) ENGINE=MyISAM; | 13 | `access_date` TIMESTAMP NOT NULL, INDEX(`userid`), PRIMARY KEY (`recordid`)) ENGINE=MyISAM; |
14 | */ | 14 | */ |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * <b>record</b> class with integrated CRUD methods. | 17 | * <b>record</b> class with integrated CRUD methods. |
18 | * @author Php Object Generator | 18 | * @author Php Object Generator |
@@ -123,13 +123,14 @@ class record extends POG_Base | |||
123 | $this->recordId = $row['recordid']; | 123 | $this->recordId = $row['recordid']; |
124 | $this->userId = $row['userid']; | 124 | $this->userId = $row['userid']; |
125 | $this->reference = $this->Unescape($row['reference']); | 125 | $this->reference = $this->Unescape($row['reference']); |
126 | $this->data = $this->Unescape($row['data']); | 126 | $this->data = $this->Unescape($row['data']); |
127 | $this->version = $this->Unescape($row['version']); | 127 | $this->version = $this->Unescape($row['version']); |
128 | $this->creation_date = $row['creation_date']; | 128 | $this->creation_date = $row['creation_date']; |
129 | $this->update_date = $row['update_date']; | 129 | $oDate = strtotime($row['update_date']); |
130 | $this->update_date = date('r', $oDate); | ||
130 | $this->access_date = $row['access_date']; | 131 | $this->access_date = $row['access_date']; |
131 | } | 132 | } |
132 | return $this; | 133 | return $this; |
133 | } | 134 | } |
134 | 135 | ||
135 | 136 | ||
@@ -215,13 +216,14 @@ class record extends POG_Base | |||
215 | $record->recordId = $row['recordid']; | 216 | $record->recordId = $row['recordid']; |
216 | $record->userId = $row['userid']; | 217 | $record->userId = $row['userid']; |
217 | $record->reference = $this->Unescape($row['reference']); | 218 | $record->reference = $this->Unescape($row['reference']); |
218 | $record->data = $this->Unescape($row['data']); | 219 | $record->data = $this->Unescape($row['data']); |
219 | $record->version = $this->Unescape($row['version']); | 220 | $record->version = $this->Unescape($row['version']); |
220 | $record->creation_date = $row['creation_date']; | 221 | $record->creation_date = $row['creation_date']; |
221 | $record->update_date = $row['update_date']; | 222 | $oDate = strtotime($row['update_date']); |
223 | $record->update_date = date('r', $oDate); | ||
222 | $record->access_date = $row['access_date']; | 224 | $record->access_date = $row['access_date']; |
223 | $recordList[] = $record; | 225 | $recordList[] = $record; |
224 | } | 226 | } |
225 | return $recordList; | 227 | return $recordList; |
226 | } | 228 | } |
227 | 229 | ||
@@ -230,12 +232,14 @@ class record extends POG_Base | |||
230 | * Saves the object to the database | 232 | * Saves the object to the database |
231 | * @return integer $recordId | 233 | * @return integer $recordId |
232 | */ | 234 | */ |
233 | function Save($deep = true) | 235 | function Save($deep = true) |
234 | { | 236 | { |
235 | $connection = Database::Connect(); | 237 | $connection = Database::Connect(); |
238 | $this->update_date = date( 'r'); | ||
239 | $this->access_date = date( 'r'); | ||
236 | $this->pog_query = "select `recordid` from `record` where `recordid`='".$this->recordId."' LIMIT 1"; | 240 | $this->pog_query = "select `recordid` from `record` where `recordid`='".$this->recordId."' LIMIT 1"; |
237 | $rows = Database::Query($this->pog_query, $connection); | 241 | $rows = Database::Query($this->pog_query, $connection); |
238 | if ($rows > 0) | 242 | if ($rows > 0) |
239 | { | 243 | { |
240 | $this->pog_query = "update `record` set | 244 | $this->pog_query = "update `record` set |
241 | `userid`='".$this->userId."', | 245 | `userid`='".$this->userId."', |
@@ -278,12 +282,13 @@ class record extends POG_Base | |||
278 | * Clones the object and saves it to the database | 282 | * Clones the object and saves it to the database |
279 | * @return integer $recordId | 283 | * @return integer $recordId |
280 | */ | 284 | */ |
281 | function SaveNew($deep = false) | 285 | function SaveNew($deep = false) |
282 | { | 286 | { |
283 | $this->recordId = ''; | 287 | $this->recordId = ''; |
288 | $this->creation_date = date( 'Y-m-d H:i:s'); | ||
284 | return $this->Save($deep); | 289 | return $this->Save($deep); |
285 | } | 290 | } |
286 | 291 | ||
287 | 292 | ||
288 | /** | 293 | /** |
289 | * Deletes the object from the database | 294 | * Deletes the object from the database |