summaryrefslogtreecommitdiff
path: root/download.inc
diff options
context:
space:
mode:
authorprashantsinalkar2016-04-07 16:18:04 +0530
committerprashantsinalkar2016-04-07 16:18:04 +0530
commitf45d48b9da8764141edbf5dc10d0b17f01870ed3 (patch)
tree2607d2f958e60380327f655d85e517c90226e469 /download.inc
parent64b7656aa8140441e07a96218085fe3b55595681 (diff)
downloadscilab_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-xdownload.inc21
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);
+}