summaryrefslogtreecommitdiff
path: root/backend
Side-by-side diff
Diffstat (limited to 'backend') (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
@@ -374,8 +374,15 @@ error_log("message");
$user = new user();
$user = $user->Get($_SESSION["userId"]);
$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;
$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
@@ -8,9 +8,9 @@
`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;
*/
/**
@@ -125,9 +125,10 @@ class record extends POG_Base
$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;
}
@@ -217,9 +218,10 @@ class record extends POG_Base
$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;
@@ -232,8 +234,10 @@ class record extends POG_Base
*/
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)
{
@@ -280,8 +284,9 @@ class record extends POG_Base
*/
function SaveNew($deep = false)
{
$this->recordId = '';
+ $this->creation_date = date( 'Y-m-d H:i:s');
return $this->Save($deep);
}
@@ -432,5 +437,5 @@ class record extends POG_Base
$this->_recordversionList[] = $recordversion;
}
}
}
-?> \ 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
@@ -255,8 +255,10 @@ class recordversion extends POG_Base
*/
function Save()
{
$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";
$rows = Database::Query($this->pog_query, $connection);
if ($rows > 0)
{
@@ -377,5 +379,5 @@ class recordversion extends POG_Base
{
$this->recordId = $record->recordId;
}
}
-?> \ No newline at end of file
+?>