-rw-r--r-- | backend/php/src/index.php | 7 | ||||
-rw-r--r-- | backend/php/src/objects/class.record.php | 13 | ||||
-rw-r--r-- | backend/php/src/objects/class.recordversion.php | 4 |
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 | |||
@@ -372,12 +372,19 @@ error_log("message"); | |||
372 | if ($message == "getUserDetails") { | 372 | if ($message == "getUserDetails") { |
373 | //{"message":"getUserDetails", "srpSharedSecret":"f18e5cf7c3a83b67d4db9444af813ee48c13daf4f8f6635397d593e52ba89a08", "parameters":{}} | 373 | //{"message":"getUserDetails", "srpSharedSecret":"f18e5cf7c3a83b67d4db9444af813ee48c13daf4f8f6635397d593e52ba89a08", "parameters":{}} |
374 | $user = new user(); | 374 | $user = new user(); |
375 | $user = $user->Get($_SESSION["userId"]); | 375 | $user = $user->Get($_SESSION["userId"]); |
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; |
380 | 387 | ||
381 | //============================================================= | 388 | //============================================================= |
382 | } else if ($message == "addNewRecords") { | 389 | } else if ($message == "addNewRecords") { |
383 | /* | 390 | /* |
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 |
@@ -430,7 +435,7 @@ class record extends POG_Base | |||
430 | if (!$found) | 435 | if (!$found) |
431 | { | 436 | { |
432 | $this->_recordversionList[] = $recordversion; | 437 | $this->_recordversionList[] = $recordversion; |
433 | } | 438 | } |
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 | |||
@@ -253,12 +253,14 @@ class recordversion extends POG_Base | |||
253 | * Saves the object to the database | 253 | * Saves the object to the database |
254 | * @return integer $recordversionId | 254 | * @return integer $recordversionId |
255 | */ | 255 | */ |
256 | function Save() | 256 | function Save() |
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); |
261 | if ($rows > 0) | 263 | if ($rows > 0) |
262 | { | 264 | { |
263 | $this->pog_query = "update `recordversion` set | 265 | $this->pog_query = "update `recordversion` set |
264 | `recordid`='".$this->recordId."', | 266 | `recordid`='".$this->recordId."', |
@@ -375,7 +377,7 @@ class recordversion extends POG_Base | |||
375 | */ | 377 | */ |
376 | function SetRecord(&$record) | 378 | function SetRecord(&$record) |
377 | { | 379 | { |
378 | $this->recordId = $record->recordId; | 380 | $this->recordId = $record->recordId; |
379 | } | 381 | } |
380 | } | 382 | } |
381 | ?> \ No newline at end of file | 383 | ?> |