From 2d0c4265e1a061522d0e4f4d1b5b772c92f3803a Mon Sep 17 00:00:00 2001 From: prashant Date: Thu, 5 Nov 2015 10:54:12 +0530 Subject: added rename directory function in lab proposal edit --- full_download.inc | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'full_download.inc') diff --git a/full_download.inc b/full_download.inc index 0546be2..a8e7173 100755 --- a/full_download.inc +++ b/full_download.inc @@ -25,15 +25,16 @@ function lab_migration_download_full_experiment() $query->fields('lab_migration_solution'); $query->condition('experiment_id', $experiment_id); $query->condition('approval_status', 1); - $result = $query->execute(); + $solution_q = $query->execute(); while ($solution_row = $solution_q->fetchObject()) { $CODE_PATH = 'CODE' . $solution_row->code_number . '/'; //$solution_files_q = db_query("SELECT * FROM {lab_migration_solution_files} WHERE solution_id = %d", $solution_row->id); - $query = db_select('lab_migration_solution_files'); + /*$query = db_select('lab_migration_solution_files'); $query->fields('lab_migration_solution_files'); $query->condition('solution_id', $solution_row->id); - $solution_files_q = $query->execute(); + $solution_files_q = $query->execute();*/ + $solution_files_q = db_query("SELECT lmsf.*, lmp.directory_name FROM lab_migration_solution_files lmsf JOIN lab_migration_solution lms JOIN lab_migration_experiment lme JOIN lab_migration_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)); //$solution_dependency_files_q = db_query("SELECT * FROM {lab_migration_solution_dependency} WHERE solution_id = %d", $solution_row->id); $query = db_select('lab_migration_solution_dependency'); $query->fields('lab_migration_solution_dependency'); @@ -41,7 +42,7 @@ function lab_migration_download_full_experiment() $solution_dependency_files_q = $query->execute(); while ($solution_files_row = $solution_files_q->fetchObject()) { - $zip->addFile($root_path . $solution_files_row->filepath, $APPROVE_PATH . $EXP_PATH . $CODE_PATH . $solution_files_row->filename); + $zip->addFile($root_path . $solution_files_row->directory_name. '/' . $solution_files_row->filepath, $APPROVE_PATH . $EXP_PATH . $CODE_PATH . $solution_files_row->filename); } /* dependency files */ while ($solution_dependency_files_row = $solution_dependency_files_q->fetchObject()) @@ -67,10 +68,12 @@ function lab_migration_download_full_experiment() { $CODE_PATH = 'CODE' . $solution_row->code_number . '/'; //$solution_files_q = db_query("SELECT * FROM {lab_migration_solution_files} WHERE solution_id = %d", $solution_row->id); - $query = db_select('lab_migration_solution_files'); + /*$query = db_select('lab_migration_solution_files'); $query->fields('lab_migration_solution_files'); $query->condition('solution_id', $solution_row->id); - $solution_files_q = $query->execute(); + $solution_files_q = $query->execute();*/ + $solution_files_q = db_query("SELECT lmsf.*, lmp.directory_name FROM lab_migration_solution_files lmsf JOIN lab_migration_solution lms JOIN lab_migration_experiment lme JOIN lab_migration_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)); + //$solution_dependency_files_q = db_query("SELECT * FROM {lab_migration_solution_dependency} WHERE solution_id = %d", $solution_row->id); $query = db_select('lab_migration_solution_dependency'); $query->fields('lab_migration_solution_dependency'); @@ -78,7 +81,7 @@ function lab_migration_download_full_experiment() $solution_dependency_files_q = $query->execute(); while ($solution_files_row = $solution_files_q->fetchObject()) { - $zip->addFile($root_path . $solution_files_row->filepath, $PENDING_PATH . $EXP_PATH . $CODE_PATH . $solution_files_row->filename); + $zip->addFile($root_path . $solution_files_row->directory_name . '/' . $solution_files_row->filepath, $PENDING_PATH . $EXP_PATH . $CODE_PATH . $solution_files_row->filename); } /* dependency files */ while ($solution_dependency_files_row = $solution_dependency_files_q->fetchObject()) @@ -107,7 +110,7 @@ function lab_migration_download_full_experiment() else { drupal_set_message("There are no solutions in this experiment to download", 'error'); - drupal_goto('lab_migration/code_approval/bulk'); + drupal_goto('lab-migration/code-approval/bulk'); } } function lab_migration_download_full_lab() @@ -150,10 +153,11 @@ function lab_migration_download_full_lab() { $CODE_PATH = 'CODE' . $solution_row->code_number . '/'; //$solution_files_q = db_query("SELECT * FROM {lab_migration_solution_files} WHERE solution_id = %d", $solution_row->id); - $query = db_select('lab_migration_solution_files'); + /*$query = db_select('lab_migration_solution_files'); $query->fields('lab_migration_solution_files'); $query->condition('solution_id', $solution_row->id); - $solution_files_q = $query->execute(); + $solution_files_q = $query->execute();*/ + $solution_files_q = db_query("SELECT lmsf.*, lmp.directory_name FROM lab_migration_solution_files lmsf JOIN lab_migration_solution lms JOIN lab_migration_experiment lme JOIN lab_migration_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)); //$solution_dependency_files_q = db_query("SELECT * FROM {lab_migration_solution_dependency} WHERE solution_id = %d", $solution_row->id); $query = db_select('lab_migration_solution_dependency'); $query->fields('lab_migration_solution_dependency'); @@ -161,7 +165,7 @@ function lab_migration_download_full_lab() $solution_dependency_files_q = $query->execute(); while ($solution_files_row = $solution_files_q->fetchObject()) { - $zip->addFile($root_path . $solution_files_row->filepath, $APPROVE_PATH . $EXP_PATH . $CODE_PATH . $solution_files_row->filename); + $zip->addFile($root_path . $solution_files_row->directory_name. '/' . $solution_files_row->filepath, $APPROVE_PATH . $EXP_PATH . $CODE_PATH . $solution_files_row->filename); } /* dependency files */ while ($solution_dependency_files_row = $solution_dependency_files_q->fetchObject()) @@ -187,10 +191,12 @@ function lab_migration_download_full_lab() { $CODE_PATH = 'CODE' . $solution_row->code_number . '/'; //$solution_files_q = db_query("SELECT * FROM {lab_migration_solution_files} WHERE solution_id = %d", $solution_row->id); - $query = db_select('lab_migration_solution_files'); + /* $query = db_select('lab_migration_solution_files'); $query->fields('lab_migration_solution_files'); $query->condition('solution_id', $solution_row->id); - $solution_files_q = $query->execute(); + $solution_files_q = $query->execute();*/ + $solution_files_q = db_query("SELECT lmsf.*, lmp.directory_name FROM lab_migration_solution_files lmsf JOIN lab_migration_solution lms JOIN lab_migration_experiment lme JOIN lab_migration_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)); + //$solution_dependency_files_q = db_query("SELECT * FROM {lab_migration_solution_dependency} WHERE solution_id = %d", $solution_row->id); $query = db_select('lab_migration_solution_dependency'); $query->fields('lab_migration_solution_dependency'); @@ -198,7 +204,7 @@ function lab_migration_download_full_lab() $solution_dependency_files_q = $query->execute(); while ($solution_files_row = $solution_files_q->fetchObject()) { - $zip->addFile($root_path . $solution_files_row->filepath, $LAB_PATH . $PENDING_PATH . $EXP_PATH . $CODE_PATH . $solution_files_row->filename); + $zip->addFile($root_path .$solution_files_row->directory_name . '/' . $solution_files_row->filepath, $LAB_PATH . $PENDING_PATH . $EXP_PATH . $CODE_PATH . $solution_files_row->filename); } /* dependency files */ while ($solution_dependency_files_row = $solution_dependency_files_q->fetchObject()) -- cgit