Skip to content

Commit d6939f2

Browse files
committed
Handling of multipart export tables
Some metadata enhancements
1 parent 26a38c1 commit d6939f2

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

application/controllers/ExportController.php

+20
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,26 @@ public function dbDumpAction() {
117117
echo Zend_Json::encode($output);
118118
}
119119

120+
//iterate through and export all of the projects, subjects, media, and diary items
121+
public function dbDumpSpaceAction() {
122+
mb_internal_encoding( 'UTF-8' );
123+
$this->_helper->viewRenderer->setNoRender();
124+
125+
$projects = false;
126+
127+
$exportObj = new DBexport_OCexport;
128+
$exportObj->limitingProjArray = $projects;
129+
//$exportObj->testing = true;
130+
$counts = $exportObj->makeSaveSpace();
131+
$output = array("projects" => $projects,
132+
"files" => $exportObj->files,
133+
"counts" => $counts
134+
);
135+
136+
header('Content-Type: application/json; charset=utf8');
137+
echo Zend_Json::encode($output);
138+
}
139+
120140

121141
public function subjectJsonAction(){
122142
$this->_helper->viewRenderer->setNoRender();

application/models/ExportTable.php

+28-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ class ExportTable {
66

77
public $db;
88
public $tableID;
9+
public $tableGroupID;
10+
public $page;
911
public $title;
1012
public $updated;
1113
public $created;
@@ -33,6 +35,10 @@ class ExportTable {
3335
const fileDirectory = "./exports";
3436
const altFileDirectory = "../exports";
3537

38+
39+
40+
41+
3642
//gets table metadata by id
3743
function getByID($tableID, $setPage = false){
3844

@@ -259,7 +265,12 @@ function createUpdate($metadataString){
259265
$tableID = $this->tableID;
260266

261267
$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+
}
263274

264275
$data = array("title" => $this->title,
265276
"recordCount" => $this->recordCount,
@@ -289,6 +300,16 @@ function createUpdate($metadataString){
289300
$metadata["published"] = date("Y-m-d\TH:i:s\-07:00", strtotime($createdDB));
290301
$metadata["updated"] = date("Y-m-d\TH:i:s\-07:00", strtotime($updatedDB));
291302
$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+
292313
$data["created"] = $createdDB;
293314
$data["num_views"] = 0;
294315
$data["num_downloads"] = 0;
@@ -337,6 +358,12 @@ function readValidateMetadata($metadataString){
337358
$error = true;
338359
}
339360

361+
if(isset($metadata["published"])){
362+
$this->created = $metadata["published"];
363+
}
364+
else{
365+
$error = true;
366+
}
340367

341368
if(isset($metadata["recordCount"])){
342369
$this->recordCount = $metadata["recordCount"];

0 commit comments

Comments
 (0)