$comment = array(); while ($uploads = $req->fetch()) { $real_name[] = $uploads['real_name']; $long_name[] = $uploads['long_name']; $comment[] = $uploads['comment']; } // files attached ? $filenb = count($real_name); if ($filenb > 0) { for ($i = 0; $i < $filenb; $i++) { // add files to archive $zip->addFile('uploads/' . $long_name[$i], $folder . "/" . $real_name[$i]); } } // add PDF to archive $pdf = new \Elabftw\Elabftw\MakePdf($id, $table); $mpdf = new mPDF(); $mpdf->SetAuthor($pdf->author); $mpdf->SetTitle($pdf->title); $mpdf->SetSubject('eLabFTW pdf'); $mpdf->SetKeywords($pdf->tags); $mpdf->SetCreator('www.elabftw.net'); $mpdf->WriteHTML($pdf->content); $mpdf->Output($pdf->getPath(), 'F'); $zip->addFile($pdf->getPath(), $folder . '/' . $pdf->getFileName()); // add CSV file to archive $csvpath = make_unique_csv($id, $table); $zip->addFile($csvpath, $folder . "/" . $clean_title . ".csv"); // add the MANIFEST file that lists the files in archive $manifest = ""; for ($i = 0; $i < $zip->numFiles; $i++) {
* PURPOSE. See the GNU Affero General Public License for more details. * * * * You should have received a copy of the GNU Affero General Public * * License along with eLabFTW. If not, see <http://www.gnu.org/licenses/>. * * * ********************************************************************************/ require_once 'inc/common.php'; require_once ELAB_ROOT . 'inc/locale.php'; require_once ELAB_ROOT . 'vendor/autoload.php'; // Check id is valid and assign it to $id if (isset($_GET['id']) && is_pos_int($_GET['id'])) { $id = $_GET['id']; } else { die(_("The id parameter is not valid!")); } // check the type if ($_GET['type'] === 'experiments' || $_GET['type'] === 'items') { $type = $_GET['type']; } else { die(_("The type parameter is not valid.")); } // do the pdf $pdf = new \Elabftw\Elabftw\MakePdf($id, $type); $mpdf = new mPDF(); $mpdf->SetAuthor($pdf->author); $mpdf->SetTitle($pdf->title); $mpdf->SetSubject('eLabFTW pdf'); $mpdf->SetKeywords($pdf->tags); $mpdf->SetCreator('www.elabftw.net'); $mpdf->WriteHTML($pdf->content); $mpdf->Output($pdf->getFileName(), 'I');
* */ use Elabftw\Elabftw\Tools; require_once 'inc/common.php'; $page_title = _('Export'); $selected_menu = null; try { switch ($_GET['what']) { case 'csv': $make = new \Elabftw\Elabftw\MakeCsv($_GET['id'], $_GET['type']); break; case 'zip': $make = new \Elabftw\Elabftw\MakeZip($_GET['id'], $_GET['type']); break; case 'pdf': $make = new \Elabftw\Elabftw\MakePdf($_GET['id'], $_GET['type']); break; default: throw new Exception(_('Bad type!')); } } catch (Exception $e) { require_once 'inc/head.php'; display_message('error', $e->getMessage()); require_once 'inc/footer.php'; exit; } // the pdf is shown directly, but for csv or zip we want a download page if ($_GET['what'] === 'csv' || $_GET['what'] === 'zip') { require_once 'inc/head.php'; echo "<div class='well' style='margin-top:20px'>"; echo "<p>" . _('Your file is ready:') . "<br>\n <a href='app/download.php?type=" . $_GET['what'] . "&f=" . $make->fileName . "&name=" . $make->getCleanName() . "' target='_blank'>\n <img src='img/download.png' alt='download' /> " . $make->getCleanName() . "</a>\n <span class='filesize'>(" . Tools::formatBytes(filesize($make->filePath)) . ")</span></p>";