@@ -6,6 +6,8 @@ class ExportTable {
6
6
7
7
public $ db ;
8
8
public $ tableID ;
9
+ public $ tableGroupID ;
10
+ public $ page ;
9
11
public $ title ;
10
12
public $ updated ;
11
13
public $ created ;
@@ -33,6 +35,10 @@ class ExportTable {
33
35
const fileDirectory = "./exports " ;
34
36
const altFileDirectory = "../exports " ;
35
37
38
+
39
+
40
+
41
+
36
42
//gets table metadata by id
37
43
function getByID ($ tableID , $ setPage = false ){
38
44
@@ -259,7 +265,12 @@ function createUpdate($metadataString){
259
265
$ tableID = $ this ->tableID ;
260
266
261
267
$ updatedDB = date ("Y-m-d H:i:s " , time ());
262
- $ createdDB = $ updatedDB ;
268
+ if ($ this ->created ){
269
+ $ createdDB = date ("Y-m-d H:i:s " , strtotime ($ this ->created ));
270
+ }
271
+ else {
272
+ $ createdDB = $ updatedDB ;
273
+ }
263
274
264
275
$ data = array ("title " => $ this ->title ,
265
276
"recordCount " => $ this ->recordCount ,
@@ -289,6 +300,16 @@ function createUpdate($metadataString){
289
300
$ metadata ["published " ] = date ("Y-m-d\TH:i:s\-07:00 " , strtotime ($ createdDB ));
290
301
$ metadata ["updated " ] = date ("Y-m-d\TH:i:s\-07:00 " , strtotime ($ updatedDB ));
291
302
$ data ["tableID " ] = $ tableID ;
303
+ if (strstr ($ tableID , "/ " )){
304
+ $ tableIDex = explode ("/ " , $ tableID );
305
+ $ data ["tableGroupID " ] = $ tableIDex [0 ];
306
+ $ data ["page " ] = $ tableIDex [1 ];
307
+ }
308
+ else {
309
+ $ data ["tableGroupID " ] = $ tableID ;
310
+ $ data ["page " ] = 0 ;
311
+ }
312
+
292
313
$ data ["created " ] = $ createdDB ;
293
314
$ data ["num_views " ] = 0 ;
294
315
$ data ["num_downloads " ] = 0 ;
@@ -337,6 +358,12 @@ function readValidateMetadata($metadataString){
337
358
$ error = true ;
338
359
}
339
360
361
+ if (isset ($ metadata ["published " ])){
362
+ $ this ->created = $ metadata ["published " ];
363
+ }
364
+ else {
365
+ $ error = true ;
366
+ }
340
367
341
368
if (isset ($ metadata ["recordCount " ])){
342
369
$ this ->recordCount = $ metadata ["recordCount " ];
0 commit comments