summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSashi202019-12-27 17:59:47 +0530
committerSashi202019-12-27 17:59:47 +0530
commit328da2ded286bbf22d8044563b8c82a2239592c0 (patch)
tree0f84d029287dcc0e680efe16af4c6c16630b6122
parent61835b123f3257c121b7992afc04cda687990f73 (diff)
downloadcfd_case_study-328da2ded286bbf22d8044563b8c82a2239592c0.tar.gz
cfd_case_study-328da2ded286bbf22d8044563b8c82a2239592c0.tar.bz2
cfd_case_study-328da2ded286bbf22d8044563b8c82a2239592c0.zip
Modify the directory structure
-rw-r--r--add_project_titles.inc3
-rw-r--r--available_project_titles_list.inc35
-rwxr-xr-xcfd_case_study.module12
3 files changed, 41 insertions, 9 deletions
diff --git a/add_project_titles.inc b/add_project_titles.inc
index 257e9b5..d441911 100644
--- a/add_project_titles.inc
+++ b/add_project_titles.inc
@@ -85,6 +85,7 @@ function add_project_title_form_submit($form, &$form_state) {
'return' => Database::RETURN_INSERT_ID
));
$dest_path = cfd_case_study_project_titles_resource_file_path();
+ //var_dump($dest_path);die;
foreach ($_FILES['files']['name'] as $file_form_name => $file_name)
{
if ($file_name)
@@ -112,7 +113,7 @@ function add_project_title_form_submit($form, &$form_state) {
} //move_uploaded_file($_FILES['files']['tmp_name'][$file_form_name], $root_path . $dest_path . $_FILES['files']['name'][$file_form_name])
else
{
- drupal_set_message('Error uploading file : ' . $dest_path . '/' . $file_name, 'error');
+ drupal_set_message('Error uploading file: ' . $dest_path . $result1 . '_' . $file_name, 'error');
}
} //$file_name
} //$_FILES['files']['name'] as $file_form_name => $file_name
diff --git a/available_project_titles_list.inc b/available_project_titles_list.inc
index 0787856..236a870 100644
--- a/available_project_titles_list.inc
+++ b/available_project_titles_list.inc
@@ -3,7 +3,7 @@
function list_of_available_project_titles()
{
$output = "";
- $static_url = "https://static.fossee.in/cfd/project-titles/";
+ //$static_url = "https://static.fossee.in/cfd/project-titles/";
$preference_rows = array();
$i = 1;
$query = db_query("SELECT * from list_of_project_titles WHERE {project_title_name} NOT IN( SELECT project_title from case_study_proposal WHERE approval_status = 0 OR approval_status = 1 OR approval_status = 3)");
@@ -11,12 +11,7 @@ function list_of_available_project_titles()
$preference_rows[] = array(
$i,
//print_r(array_keys($case_studies_list))
- l($result->project_title_name, $static_url . $result->filepath, array(
- 'external' => TRUE,
- 'attributes' => array(
- 'target'=> '_blank',
- ),
- ))
+ l($result->project_title_name, 'case-study-project/download/project-title-file/' .$result->id)
);
$i++;
}
@@ -30,4 +25,30 @@ function list_of_available_project_titles()
));
return $output;
+}
+function download_case_study_project_title_files() {
+ $id = arg(3);
+ $root_path = cfd_case_study_project_titles_resource_file_path();
+ $query = db_select('list_of_project_titles');
+ $query->fields('list_of_project_titles');
+ $query->condition('id', $id);
+ $result = $query->execute();
+ $case_study_project_files_list = $result->fetchObject();
+ //$directory_name = $case_study_project_files_list->filepath;
+ $abstract_file = $case_study_project_files_list->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 . $abstract_file));
+ header("Content-Transfer-Encoding: binary");
+ header("Expires: 0");
+ header("Pragma: no-cache");
+ readfile($root_path . $abstract_file);
+ ob_end_flush();
+ ob_clean();
} \ No newline at end of file
diff --git a/cfd_case_study.module b/cfd_case_study.module
index 576a8d7..89cf6df 100755
--- a/cfd_case_study.module
+++ b/cfd_case_study.module
@@ -222,6 +222,16 @@ function cfd_case_study_menu()
'type'=> MENU_CALLBACK,
'file'=> 'download.inc'
);
+ $items['case-study-project/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['case-study-project/download/project-file'] = array(
'title'=> 'Download Project file',
'description'=> 'Download project file',
@@ -418,7 +428,7 @@ function cfd_case_study_file_path($value='')
return $_SERVER['DOCUMENT_ROOT'] . base_path() . 'cfd_uploads/';
}
function cfd_case_study_project_titles_resource_file_path() {
- return $_SERVER['DOCUMENT_ROOT'] . '/SiteFiles/cfd/project-titles/';
+ return $_SERVER['DOCUMENT_ROOT'] . base_path() . 'cfd_uploads/case_project_titles_resource_files/';
}
/************************* USER VERIFICATION FUNCTIONS ************************/
function cfd_case_study_get_proposal()