summaryrefslogtreecommitdiff
path: root/backend/php
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) (side-by-side diff)
tree3ca0b96e843f5820f0bee7dede1847b014bba1e6 /backend/php
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 (limited to 'backend/php') (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
@@ -377,2 +377,9 @@ error_log("message");
$result["header"] = $user->header;
+ $records = $user->GetRecordList();
+ foreach ($records as $record)
+ {
+ $recordStats["updateDate"] = $record->update_date;
+ $recordsStats[$record->reference] = $recordStats;
+ }
+ $result["recordsStats"] = $recordsStats;
$result["statistics"] = $user->statistics;
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
@@ -11,3 +11,3 @@
`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;
@@ -128,3 +128,4 @@ class record extends POG_Base
$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'];
@@ -220,3 +221,4 @@ class record extends POG_Base
$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'];
@@ -235,2 +237,4 @@ class record extends POG_Base
$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";
@@ -283,2 +287,3 @@ class record extends POG_Base
$this->recordId = '';
+ $this->creation_date = date( 'Y-m-d H:i:s');
return $this->Save($deep);
@@ -435,2 +440,2 @@ class record extends POG_Base
}
-?> \ No newline at end of file
+?>
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
@@ -258,2 +258,4 @@ class recordversion extends POG_Base
$connection = Database::Connect();
+ $this->update_date = date( 'Y-m-d H:i:s');
+ $this->access_date = date( 'Y-m-d H:i:s');
$this->pog_query = "select `recordversionid` from `recordversion` where `recordversionid`='".$this->recordversionId."' LIMIT 1";
@@ -380,2 +382,2 @@ class recordversion extends POG_Base
}
-?> \ No newline at end of file
+?>