From 9df9d0038d808c88540e3785a3d37d1dc7837d25 Mon Sep 17 00:00:00 2001
From: Sashi20
Date: Fri, 2 Feb 2024 17:41:40 +0530
Subject: Update hyperlinks to download files
---
cfd_hackathon_submissions.module | 6 +++---
download.inc | 33 +++++++++++++++++++++++++++++++++
run.inc | 4 ++--
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) . '
' . l('Download Upgraded Case Files', 'case-study-project/full-download/project/' . $cfd_hackathon_default_value) . '
' . l('Download the report of the Case Study', "https://cfd.fossee.in/case-study-project/download/project-file/" . $cfd_case_study_id) . '
' . 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) . '
' . l('Download Upgraded Case Files', 'cfd-hackathon/download/project-files/' . $cfd_hackathon_default_value) . '
' . l('Download the report of the Case Study', "https://cfd.fossee.in/case-study-project/download/project-file/" . $cfd_case_study_id) . '
' . 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'] = '
About the Case Study | Contributor details during the hackathon |
|
|
' . l('Download the report of the Case Study', "https://cfd.fossee.in/case-study-project/download/project-file/" . $cfd_case_study_id) . ' ' . l('Download Case Files of the Original Case Study', 'https://cfd.fossee.in/case-study-project/full-download/project/' . $cfd_case_study_id) . ' |
- ' . l('Download Report of the Upgraded Case Study', "case-study-project/download/project-file/" . $cfd_hackathon_default_value) . ' ' . l('Download Upgraded Case Files', 'case-study-project/full-download/project/' . $cfd_hackathon_default_value) . ' |