diff options
author | prashantsinalkar | 2016-04-07 16:18:04 +0530 |
---|---|---|
committer | prashantsinalkar | 2016-04-07 16:18:04 +0530 |
commit | f45d48b9da8764141edbf5dc10d0b17f01870ed3 (patch) | |
tree | 2607d2f958e60380327f655d85e517c90226e469 /download.inc | |
parent | 64b7656aa8140441e07a96218085fe3b55595681 (diff) | |
download | scilab_textbook_companion-f45d48b9da8764141edbf5dc10d0b17f01870ed3.tar.gz scilab_textbook_companion-f45d48b9da8764141edbf5dc10d0b17f01870ed3.tar.bz2 scilab_textbook_companion-f45d48b9da8764141edbf5dc10d0b17f01870ed3.zip |
added category in book proposal and edited mail function
Diffstat (limited to 'download.inc')
-rwxr-xr-x | download.inc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/download.inc b/download.inc index f851273..e4d2a5d 100755 --- a/download.inc +++ b/download.inc @@ -135,6 +135,7 @@ function textbook_companion_download_example() function textbook_companion_download_chapter() { $chapter_id = arg(2); + // var_dump($chapter_id);die; $root_path = textbook_companion_path(); /* get example data */ @@ -297,4 +298,24 @@ $zip->addFile($root_path . $dependency_file_data->filepath, $BK_PATH . $CH_PATH drupal_goto('textbook_run'); } } + +function textbook_companion_download_sample_code() +{ + $proposal_id = arg(2); + $root_path = textbook_companion_samplecode_path(); + + $query = db_select('textbook_companion_proposal'); + $query->fields('textbook_companion_proposal'); + $query->condition('id', $proposal_id); + $query->range(0, 1); + $result = $query->execute(); + + $example_file_data =$result->fetchObject(); + $samplecodename=substr($example_file_data->samplefilepath, strrpos($example_file_data->samplefilepath, '/') + 1); + header('Content-Type: application/zip'); + header('Content-disposition: attachment; filename="'.$samplecodename.'"'); + header('Content-Length: ' . filesize($root_path . $example_file_data->samplefilepath)); + ob_clean(); + readfile($root_path . $example_file_data->samplefilepath); +} |