summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSashi202024-02-02 17:41:40 +0530
committerSashi202024-02-02 17:41:40 +0530
commit9df9d0038d808c88540e3785a3d37d1dc7837d25 (patch)
tree7f0d7fe94625f6dc7d483760683939f739daaed5
parent1025679c51f4b6044561b682da99e0b1bc9c34ae (diff)
downloadcfd_hackathon_submissions-9df9d0038d808c88540e3785a3d37d1dc7837d25.tar.gz
cfd_hackathon_submissions-9df9d0038d808c88540e3785a3d37d1dc7837d25.tar.bz2
cfd_hackathon_submissions-9df9d0038d808c88540e3785a3d37d1dc7837d25.zip
Update hyperlinks to download files
-rw-r--r--cfd_hackathon_submissions.module6
-rw-r--r--download.inc33
-rw-r--r--run.inc4
3 files changed, 38 insertions, 5 deletions
diff --git a/cfd_hackathon_submissions.module b/cfd_hackathon_submissions.module
index ea5ebbe..bceaafb 100644
--- a/cfd_hackathon_submissions.module
+++ b/cfd_hackathon_submissions.module
@@ -312,10 +312,10 @@ function cfd_hackathon_submissions_menu()
'type' => MENU_NORMAL_ITEM,
'file' => 'run.inc',
);
- $items['cfd-hackathon/download/resource-file'] = array(
+ $items['cfd-hackathon/download/upgraded-report'] = array(
'title' => 'Download user defined compound file',
- 'description' => 'Download resource file',
- 'page callback' => 'cfd_hackathon_submissions_download_upload_file',
+ 'description' => 'Download Upgraded report file',
+ 'page callback' => 'cfd_hackathon_submissions_download_upgraded_report',
'access arguments' => array(
'download code',
),
diff --git a/download.inc b/download.inc
index 98153b4..6b1ff51 100644
--- a/download.inc
+++ b/download.inc
@@ -63,4 +63,37 @@ function cfd_hackathon_submissions_project_files()
drupal_set_message("There are no case files to download", 'error');
drupal_goto('cfd-hackathon/all-submissions');
}
+}
+
+function cfd_case_study_project_files() {
+ $proposal_id = arg(3);
+ $root_path = cfd_hackathon_submissions_path();
+ $query = db_select('cfd_hackathon_submitted_abstracts_file');
+ $query->fields('cfd_hackathon_submitted_abstracts_file');
+ $query->condition('proposal_id', $proposal_id);
+ $query->condition('filetype', 'A');
+ $result = $query->execute();
+ $cfd_case_study_project_files = $result->fetchObject();
+ $query1 = db_select('cfd_hackathon_proposal');
+ $query1->fields('cfd_hackathon_proposal');
+ $query1->condition('id', $proposal_id);
+ $result1 = $query1->execute();
+ $case_study = $result1->fetchObject();
+ $directory_name = $case_study->directory_name . '/';
+ $abstract_file = $cfd_case_study_project_files->filename;
+ ob_clean();
+ header("Pragma: public");
+ header("Expires: 0");
+ header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
+ header("Cache-Control: public");
+ header("Content-Description: File Transfer");
+ header("Content-Type: application/pdf");
+ header('Content-disposition: attachment; filename="' . $abstract_file . '"');
+ header("Content-Length: " . filesize($root_path . $directory_name . $abstract_file));
+ header("Content-Transfer-Encoding: binary");
+ header("Expires: 0");
+ header("Pragma: no-cache");
+ readfile($root_path . $directory_name . $abstract_file);
+ ob_end_flush();
+ ob_clean();
} \ No newline at end of file
diff --git a/run.inc b/run.inc
index 5317308..3cf2068 100644
--- a/run.inc
+++ b/run.inc
@@ -67,7 +67,7 @@ function cfd_hackathon_project_details_callback($form, $form_state)
$cfd_case_study_id = $old_case_study_data->case_study_id;
$provider = user_load($cfd_hackathon_details->uid);
if ($cfd_hackathon_details->uid > 0) {
- $commands[] = ajax_command_html('#ajax_selected_cfd_hackathon', l('Download Report of the Upgraded Case Study', "case-study-project/download/project-file/" . $cfd_hackathon_default_value) . '<br>' . l('Download Upgraded Case Files', 'case-study-project/full-download/project/' . $cfd_hackathon_default_value) . '<br><br>' . l('Download the report of the Case Study', "https://cfd.fossee.in/case-study-project/download/project-file/" . $cfd_case_study_id) . '<br>' . l('Download Case Files of the Original Case Study', 'https://cfd.fossee.in/case-study-project/full-download/project/' . $cfd_case_study_id));
+ $commands[] = ajax_command_html('#ajax_selected_cfd_hackathon', l('Download Report of the Upgraded Case Study', "cfd-hackathon/download/upgraded-report/" . $cfd_hackathon_default_value) . '<br>' . l('Download Upgraded Case Files', 'cfd-hackathon/download/project-files/' . $cfd_hackathon_default_value) . '<br><br>' . l('Download the report of the Case Study', "https://cfd.fossee.in/case-study-project/download/project-file/" . $cfd_case_study_id) . '<br>' . l('Download Case Files of the Original Case Study', 'https://cfd.fossee.in/case-study-project/full-download/project/' . $cfd_case_study_id));
} //$cfd_hackathon_details->uid > 0
else {
$commands[] = ajax_command_html('#ajax_selected_cfd_hackathon', '');
@@ -195,7 +195,7 @@ function _cfd_hackathon_details($cfd_hackathon_default_value, $cfd_case_study_id
if ($cfd_hackathon_default_value != 0) {
$form['cfd_hackathon_details']['#markup'] = '<table cellspacing="1" cellpadding="1" border="0" style="width: 100%;" valign="top">' . '<tr><td style="width: 35%;"><span style="color: rgb(128, 0, 0);"><strong>About the Case Study</strong></span></td>
<td style="width: 35%;"><span style="color: rgb(128, 0, 0);"><strong>Contributor details during the hackathon</strong></span></td></tr>' . '<tr><td valign="top"><ul>' . '<li><strong>Title of the Case Study:</strong> ' . $cfd_hackathon_details->project_title . '</li>' . '<li><strong>Contributor Name:</strong> ' . $case_study_details->name_title . ' ' . $case_study_details->contributor_name . '</li>' . '<li><strong>Version:</strong> ' . $case_study_version . '</li>' . '<li><strong>Faculty Guide:</strong> ' . $faculty_name . '</li>' . '<li><strong>University:</strong> ' . $case_study_details->university . '</li>' . '</ul></td><td valign="top"><ul>' . '<li><strong>Contributor Name:</strong> ' . $cfd_hackathon_details->name_title . ' ' . $cfd_hackathon_details->contributor_name . '</li>' . '<li><strong>Version upgraded to:</strong> ' . $cfd_hackathon_details->version . '<li><strong>Faculty Guide:</strong> ' . $cfd_hackathon_details->faculty_guide_name . '</li>' . '<li><strong>University:</strong> ' . $cfd_hackathon_details->university . '</li>' . '</ul></td></tr>' . '<tr><td style="width: 35%;">' . l('Download the report of the Case Study', "https://cfd.fossee.in/case-study-project/download/project-file/" . $cfd_case_study_id) . '<br>' . l('Download Case Files of the Original Case Study', 'https://cfd.fossee.in/case-study-project/full-download/project/' . $cfd_case_study_id) . '</td>
- <td style="width: 35%;">' . l('Download Report of the Upgraded Case Study', "case-study-project/download/project-file/" . $cfd_hackathon_default_value) . '<br>' . l('Download Upgraded Case Files', 'case-study-project/full-download/project/' . $cfd_hackathon_default_value) . '</td></tr></table>';
+ <td style="width: 35%;">' . l('Download Report of the Upgraded Case Study', "cfd-hackathon/download/upgraded-report/" . $cfd_hackathon_default_value) . '<br>' . l('Download Upgraded Case Files', 'cfd-hackathon/download/project-files/' . $cfd_hackathon_default_value) . '</td></tr></table>';
$details = $form['cfd_hackathon_details']['#markup'];
return $details;
} //$cfd_hackathon_default_value != 0