summaryrefslogtreecommitdiff
path: root/download.inc
diff options
context:
space:
mode:
Diffstat (limited to 'download.inc')
-rwxr-xr-xdownload.inc37
1 files changed, 1 insertions, 36 deletions
diff --git a/download.inc b/download.inc
index d52982c..5b54648 100755
--- a/download.inc
+++ b/download.inc
@@ -25,11 +25,6 @@ function dwsim_flowsheet_download_solution_file()
$solution_files_q = db_query("SELECT lmsf.*, lmp.directory_name FROM dwsim_flowsheet_solution_files lmsf JOIN dwsim_flowsheet_solution lms JOIN dwsim_flowsheet_experiment lme JOIN dwsim_flowsheet_proposal lmp WHERE lms.id = lmsf.solution_id AND lme.id = lms.experiment_id AND lmp.id = lme.proposal_id AND lmsf.id = :solution_id LIMIT 1", array(
':solution_id' => $solution_file_id
));
- /*$query = db_select('dwsim_flowsheet_solution_files');
- $query->fields('dwsim_flowsheet_solution_files');
- $query->condition('id', $solution_file_id);
- $query->range(0, 1);
- $solution_files_q = $query->execute();*/
$solution_file_data = $solution_files_q->fetchObject();
header('Content-Type: ' . $solution_file_data->filemime);
//header('Content-Type: application/octet-stram');
@@ -41,7 +36,6 @@ function dwsim_flowsheet_download_dependency_file()
{
$dependency_file_id = arg(3);
$root_path = dwsim_flowsheet_path();
- //$dependency_file_q = db_query("SELECT * FROM {dwsim_flowsheet_dependency_files} WHERE id = %d LIMIT 1", $dependency_file_id);
$query = db_select('dwsim_flowsheet_dependency_files');
$query->fields('dwsim_flowsheet_dependency_files');
$query->condition('id', $dependency_file_id);
@@ -57,28 +51,19 @@ function dwsim_flowsheet_download_solution()
{
$solution_id = arg(3);
$root_path = dwsim_flowsheet_path();
- /* get solution data */
- //$solution_q = db_query("SELECT * FROM {dwsim_flowsheet_solution} WHERE id = %d", $solution_id);
$query = db_select('dwsim_flowsheet_solution');
$query->fields('dwsim_flowsheet_solution');
$query->condition('id', $solution_id);
$solution_q = $query->execute();
$solution_data = $solution_q->fetchObject();
- //$experiment_q = db_query("SELECT * FROM {dwsim_flowsheet_experiment} WHERE id = %d", $solution_data->experiment_id);
$query = db_select('dwsim_flowsheet_experiment');
$query->fields('dwsim_flowsheet_experiment');
$query->condition('id', $solution_data->experiment_id);
$experiment_q = $query->execute();
$experiment_data = $experiment_q->fetchObject();
- //$solution_files_q = db_query("SELECT * FROM {dwsim_flowsheet_solution_files} WHERE solution_id = %d", $solution_id);
- /*$query = db_select('dwsim_flowsheet_solution_files');
- $query->fields('dwsim_flowsheet_solution_files');
- $query->condition('solution_id', $solution_id);
- $solution_files_q = $query->execute();*/
$solution_files_q = db_query("SELECT lmsf.*, lmp.directory_name FROM dwsim_flowsheet_solution_files lmsf JOIN dwsim_flowsheet_solution lms JOIN dwsim_flowsheet_experiment lme JOIN dwsim_flowsheet_proposal lmp WHERE lms.id = lmsf.solution_id AND lme.id = lms.experiment_id AND lmp.id = lme.proposal_id AND lmsf.id = :solution_id", array(
':solution_id' => $solution_id
));
- //$solution_dependency_files_q = db_query("SELECT * FROM {dwsim_flowsheet_solution_dependency} WHERE solution_id = %d", $solution_id);
$query = db_select('dwsim_flowsheet_solution_dependency');
$query->fields('dwsim_flowsheet_solution_dependency');
$query->condition('solution_id', $solution_id);
@@ -92,11 +77,10 @@ function dwsim_flowsheet_download_solution()
while ($solution_files_row = $solution_files_q->fetchObject())
{
$zip->addFile($root_path . $solution_files_row->directory_name . '/' . $solution_files_row->filepath, $CODE_PATH . str_replace(' ', '_', ($solution_files_row->filename)));
- } //$solution_files_row = $solution_files_q->fetchObject()
+ }
/* dependency files */
while ($solution_dependency_files_row = $solution_dependency_files_q->fetchObject())
{
- //$dependency_file_data = (db_query("SELECT * FROM {dwsim_flowsheet_dependency_files} WHERE id = %d LIMIT 1", $solution_dependency_files_row->dependency_id))->fetchObject();
$query = db_select('dwsim_flowsheet_dependency_files');
$query->fields('dwsim_flowsheet_dependency_files');
$query->condition('id', $solution_dependency_files_row->dependency_id);
@@ -129,7 +113,6 @@ function dwsim_flowsheet_download_experiment()
$experiment_id = (int) arg(3);
$root_path = dwsim_flowsheet_path();
/* get solution data */
- //$experiment_q = db_query("SELECT * FROM {dwsim_flowsheet_experiment} WHERE id = %d", $experiment_id);
$query = db_select('dwsim_flowsheet_experiment');
$query->fields('dwsim_flowsheet_experiment');
$query->condition('id', $experiment_id);
@@ -141,7 +124,6 @@ function dwsim_flowsheet_download_experiment()
/* creating zip archive on the server */
$zip = new ZipArchive;
$zip->open($zip_filename, ZipArchive::CREATE);
- //$solution_q = db_query("SELECT * FROM {dwsim_flowsheet_solution} WHERE experiment_id = %d AND approval_status = 1", $experiment_id);
$query = db_select('dwsim_flowsheet_solution');
$query->fields('dwsim_flowsheet_solution');
$query->condition('experiment_id', $experiment_id);
@@ -150,15 +132,9 @@ function dwsim_flowsheet_download_experiment()
while ($solution_row = $solution_q->fetchObject())
{
$CODE_PATH = 'CODE' . $solution_row->code_number . '/';
- // $solution_files_q = db_query("SELECT * FROM {dwsim_flowsheet_solution_files} WHERE solution_id = %d", $solution_row->id);
$solution_files_q = db_query("SELECT lmsf.*, lmp.directory_name FROM dwsim_flowsheet_solution_files lmsf JOIN dwsim_flowsheet_solution lms JOIN dwsim_flowsheet_experiment lme JOIN dwsim_flowsheet_proposal lmp WHERE lms.id = lmsf.solution_id AND lme.id = lms.experiment_id AND lmp.id = lme.proposal_id AND lmsf.solution_id = :solution_id", array(
':solution_id' => $solution_row->id
));
- /* $query = db_select('dwsim_flowsheet_solution_files');
- $query->fields('dwsim_flowsheet_solution_files');
- $query->condition('solution_id', $solution_row->id);
- $solution_files_q = $query->execute();*/
- // $solution_dependency_files_q = db_query("SELECT * FROM {dwsim_flowsheet_solution_dependency} WHERE solution_id = %d", $solution_row->id);
while ($solution_files_row = $solution_files_q->fetchObject())
{
$zip->addFile($root_path . $solution_files_row->directory_name . '/' . $solution_files_row->filepath, $EXP_PATH . $CODE_PATH . str_replace(' ', '_', ($solution_files_row->filename)));
@@ -170,7 +146,6 @@ function dwsim_flowsheet_download_experiment()
$solution_dependency_files_q = $query->execute();
while ($solution_dependency_files_row = $solution_dependency_files_q->fetchObject())
{
- //$dependency_file_data = (db_query("SELECT * FROM {dwsim_flowsheet_dependency_files} WHERE id = %d LIMIT 1", $solution_dependency_files_row->dependency_id))->fetchObject();
$query = db_select('dwsim_flowsheet_dependency_files');
$query->fields('dwsim_flowsheet_dependency_files');
$query->condition('id', $solution_dependency_files_row->dependency_id);
@@ -205,7 +180,6 @@ function dwsim_flowsheet_download_lab()
$lab_id = arg(3);
$root_path = dwsim_flowsheet_path();
/* get solution data */
- //$lab_q = db_query("SELECT * FROM {dwsim_flowsheet_proposal} WHERE id = %d", $lab_id);
$query = db_select('dwsim_flowsheet_proposal');
$query->fields('dwsim_flowsheet_proposal');
$query->condition('id', $lab_id);
@@ -217,7 +191,6 @@ function dwsim_flowsheet_download_lab()
/* creating zip archive on the server */
$zip = new ZipArchive();
$zip->open($zip_filename, ZipArchive::CREATE);
- //$experiment_q = db_query("SELECT * FROM {dwsim_flowsheet_experiment} WHERE proposal_id = %d", $lab_id);
$query = db_select('dwsim_flowsheet_experiment');
$query->fields('dwsim_flowsheet_experiment');
$query->condition('proposal_id', $lab_id);
@@ -225,7 +198,6 @@ function dwsim_flowsheet_download_lab()
while ($experiment_row = $experiment_q->fetchObject())
{
$EXP_PATH = 'EXP' . $experiment_row->number . '/';
- //$solution_q = db_query("SELECT * FROM {dwsim_flowsheet_solution} WHERE experiment_id = %d AND approval_status = 1", $experiment_row->id);
$query = db_select('dwsim_flowsheet_solution');
$query->fields('dwsim_flowsheet_solution');
$query->condition('experiment_id', $experiment_row->id);
@@ -234,15 +206,9 @@ function dwsim_flowsheet_download_lab()
while ($solution_row = $solution_q->fetchObject())
{
$CODE_PATH = 'CODE' . $solution_row->code_number . '/';
- //$solution_files_q = db_query("SELECT * FROM {dwsim_flowsheet_solution_files} WHERE solution_id = %d", $solution_row->id);
$solution_files_q = db_query("SELECT lmsf.*, lmp.directory_name FROM dwsim_flowsheet_solution_files lmsf JOIN dwsim_flowsheet_solution lms JOIN dwsim_flowsheet_experiment lme JOIN dwsim_flowsheet_proposal lmp WHERE lms.id = lmsf.solution_id AND lme.id = lms.experiment_id AND lmp.id = lme.proposal_id AND lmsf.id = :solution_id", array(
':solution_id' => $solution_row->id
));
- /*$query = db_select('dwsim_flowsheet_solution_files');
- $query->fields('dwsim_flowsheet_solution_files');
- $query->condition('solution_id', $solution_row->id);
- $solution_files_q = $query->execute();*/
- //$solution_dependency_files_q = db_query("SELECT * FROM {dwsim_flowsheet_solution_dependency} WHERE solution_id = %d", $solution_row->id);
$query = db_select('dwsim_flowsheet_solution_dependency');
$query->fields('dwsim_flowsheet_solution_dependency');
$query->condition('solution_id', $solution_row->id);
@@ -256,7 +222,6 @@ function dwsim_flowsheet_download_lab()
/* dependency files */
while ($solution_dependency_files_row = $solution_dependency_files_q->fetchObject())
{
- //$dependency_file_data = (db_query("SELECT * FROM {dwsim_flowsheet_dependency_files} WHERE id = %d LIMIT 1", $solution_dependency_files_row->dependency_id))->fetchObject();
$query = db_select('dwsim_flowsheet_dependency_files');
$query->fields('dwsim_flowsheet_dependency_files');
$query->condition('id', $solution_dependency_files_row->dependency_id);