summaryrefslogtreecommitdiff
authorJosh <jokajak@gmail.com>2011-10-05 20:40:29 (UTC)
committer Josh <jokajak@gmail.com>2011-10-06 01:58:00 (UTC)
commita26b219b6f4f3fee727d9b23d8cd374f6b32a4fa (patch) (unidiff)
tree3ca0b96e843f5820f0bee7dede1847b014bba1e6
parent6ba274c79e60e417132b260bd0117c5a68121387 (diff)
downloadclipperz-a26b219b6f4f3fee727d9b23d8cd374f6b32a4fa.zip
clipperz-a26b219b6f4f3fee727d9b23d8cd374f6b32a4fa.tar.gz
clipperz-a26b219b6f4f3fee727d9b23d8cd374f6b32a4fa.tar.bz2
Fix timestamps on records
- update the access and update date when a record is saved - set the creation date when a record is created
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--backend/php/src/index.php7
-rw-r--r--backend/php/src/objects/class.record.php13
-rw-r--r--backend/php/src/objects/class.recordversion.php4
3 files changed, 19 insertions, 5 deletions
diff --git a/backend/php/src/index.php b/backend/php/src/index.php
index 58c10a9..3d23e7a 100644
--- a/backend/php/src/index.php
+++ b/backend/php/src/index.php
@@ -376,4 +376,11 @@ error_log("message");
376 376
377 $result["header"] = $user->header; 377 $result["header"] = $user->header;
378 $records = $user->GetRecordList();
379 foreach ($records as $record)
380 {
381 $recordStats["updateDate"] = $record->update_date;
382 $recordsStats[$record->reference] = $recordStats;
383 }
384 $result["recordsStats"] = $recordsStats;
378 $result["statistics"] =$user->statistics; 385 $result["statistics"] =$user->statistics;
379 $result["version"] =$user->version; 386 $result["version"] =$user->version;
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
@@ -10,5 +10,5 @@
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*/
@@ -127,5 +127,6 @@ class record extends POG_Base
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 }
@@ -219,5 +220,6 @@ class record extends POG_Base
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;
@@ -234,4 +236,6 @@ class record extends POG_Base
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);
@@ -282,4 +286,5 @@ class record extends POG_Base
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 }
@@ -434,3 +439,3 @@ class record extends POG_Base
434 } 439 }
435} 440}
436?> \ No newline at end of file 441?>
diff --git a/backend/php/src/objects/class.recordversion.php b/backend/php/src/objects/class.recordversion.php
index 3fbc436..f2de14a 100644
--- a/backend/php/src/objects/class.recordversion.php
+++ b/backend/php/src/objects/class.recordversion.php
@@ -257,4 +257,6 @@ class recordversion extends POG_Base
257 { 257 {
258 $connection = Database::Connect(); 258 $connection = Database::Connect();
259 $this->update_date = date( 'Y-m-d H:i:s');
260 $this->access_date = date( 'Y-m-d H:i:s');
259 $this->pog_query = "select `recordversionid` from `recordversion` where `recordversionid`='".$this->recordversionId."' LIMIT 1"; 261 $this->pog_query = "select `recordversionid` from `recordversion` where `recordversionid`='".$this->recordversionId."' LIMIT 1";
260 $rows = Database::Query($this->pog_query, $connection); 262 $rows = Database::Query($this->pog_query, $connection);
@@ -379,3 +381,3 @@ class recordversion extends POG_Base
379 } 381 }
380} 382}
381?> \ No newline at end of file 383?>