Beispiel #1
0
require_once "../classes/Localize.php";
$loc = new Localize(OBIB_LOCALE, $tab);
#****************************************************************************
#*  Checking for post vars.  Go back to form if none found.
#****************************************************************************
if (count($_POST) == 0) {
    header("Location: ../circ/loc_new_form.php");
    exit;
}
#****************************************************************************
#*  Validate data
#****************************************************************************
$location = $_POST["locationid"];
$bibCopyQ = new BiblioCopyQuery();
$bibCopyQ->connect();
$booksList = $bibCopyQ->getBooksList($location);
$my_file = '../layouts/default/LocationBooksFile.csv';
$handle = fopen($my_file, 'w') or die('Cannot open file:  ' . $my_file);
foreach ($booksList as $book) {
    $line = array($book['barcode_nmbr'], $book['title'], $book['author']);
    fputcsv($handle, $line);
}
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Length: ' . filesize($my_file));
header('Content-Disposition: attachment; filename="' . 'LocationOfBooks.csv' . '"');
readfile($my_file);
/**
* 
* Retrieval and downloading of books need to be done here
*