diff options
author | Sashi20 | 2024-02-02 18:24:09 +0530 |
---|---|---|
committer | GitHub | 2024-02-02 18:24:09 +0530 |
commit | 14adee2a53e6da2e443ca5afdb5568cd2da1186f (patch) | |
tree | 276cba9eb27da0deb3434efb71173f34c88b4268 | |
parent | 2ea493a35cfd955a1d445088160f5105b53a878c (diff) | |
parent | 5ba1b30e1b22af0750ec0eecb39a7c569b5c36e3 (diff) | |
download | cfd_hackathon_submissions-14adee2a53e6da2e443ca5afdb5568cd2da1186f.tar.gz cfd_hackathon_submissions-14adee2a53e6da2e443ca5afdb5568cd2da1186f.tar.bz2 cfd_hackathon_submissions-14adee2a53e6da2e443ca5afdb5568cd2da1186f.zip |
Update hyperlinks to download upgraded reports and case files
-rw-r--r-- | cfd_hackathon_submissions.module | 18 | ||||
-rw-r--r-- | download.inc | 35 | ||||
-rw-r--r-- | run.inc | 12 |
3 files changed, 45 insertions, 20 deletions
diff --git a/cfd_hackathon_submissions.module b/cfd_hackathon_submissions.module index ea5ebbe..2163e2b 100644 --- a/cfd_hackathon_submissions.module +++ b/cfd_hackathon_submissions.module @@ -312,26 +312,16 @@ function cfd_hackathon_submissions_menu() 'type' => MENU_NORMAL_ITEM, 'file' => 'run.inc', ); - $items['cfd-hackathon/download/resource-file'] = array( - 'title' => 'Download user defined compound file', - 'description' => 'Download resource file', - 'page callback' => 'cfd_hackathon_submissions_download_upload_file', + $items['cfd-hackathon/download/upgraded-report'] = array( + 'title' => 'Download Upgraded report', + 'description' => 'Download Upgraded report', + 'page callback' => 'cfd_hackathon_submissions_upgraded_report', 'access arguments' => array( 'download code', ), 'type' => MENU_CALLBACK, 'file' => 'download.inc', ); - $items['cfd-hackathon/download/project-title-file'] = array( - 'title' => 'Download Project Title file', - 'description' => 'Download Project Title file', - 'page callback' => 'download_case_study_project_title_files', - 'access arguments' => array( - 'download code', - ), - 'type' => MENU_CALLBACK, - 'file' => 'available_project_titles_list.inc', - ); $items['cfd-hackathon/download/project-files'] = array( 'title' => 'Download Project file', 'description' => 'Download project file', diff --git a/download.inc b/download.inc index 98153b4..5740571 100644 --- a/download.inc +++ b/download.inc @@ -63,4 +63,39 @@ 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_hackathon_submissions_upgraded_report() +{ + $proposal_id = arg(3); + //var_dump($proposal_id);die; + $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->filepath; + 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 @@ -56,18 +56,18 @@ function cfd_hackathon_project_details_callback($form, $form_state) { $commands = array(); $cfd_hackathon_default_value = $form_state['values']['cfd_hackathon']; - if ($cfd_hackathon_default_value != 0) { - $form['cfd_hackathon_details']['#markup'] = _cfd_hackathon_details($cfd_hackathon_default_value, $cfd_case_study_id); - $cfd_hackathon_details = _cfd_hackathon_information($cfd_hackathon_default_value); - $query = db_select('available_hackathon_project_titles'); + $cfd_hackathon_details = _cfd_hackathon_information($cfd_hackathon_default_value); + $query = db_select('available_hackathon_project_titles'); $query->fields('available_hackathon_project_titles'); $query->condition('project_title', $cfd_hackathon_details->project_title); $old_case_study_q = $query->execute(); $old_case_study_data = $old_case_study_q->fetchObject(); $cfd_case_study_id = $old_case_study_data->case_study_id; + if ($cfd_hackathon_default_value != 0) { + $form['cfd_hackathon_details']['#markup'] = _cfd_hackathon_details($cfd_hackathon_default_value, $cfd_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 |