loadType($type, $id); if ($obj) { if (get_input('download_csv', false)) { $table_name = $obj->getTitle(); if ($type == "TestFolder") { $csv_data = $obj->getCSVCache(); header("Content-Type: application/csv"); header("Content-Disposition: attachment; filename=\"".$table_name.".csv\""); if ($csv_data) { echo strip_tags($csv_data, "
"); } else { echo "Sorry, no rendered data, please render it before downloading"; } } else if ($type == "Test") { $zip = new ZipArchive; $res = $zip->open($table_name.".zip", ZipArchive::CREATE); if ($res === TRUE) { $conts = $obj->getContents(); $nr = 1; foreach ($conts as $cont) { $o = $psyhvel->loadType("TestFolder", $cont->id); $csv_data = strip_tags($o->getCSVCache(), "
"); if ($csv_data) { $zip->addFromString($nr."_".$o->getTitle().".csv", $csv_data); } else { $zip->addFromString($nr."_".$o->getTitle().".csv", "Sorry, no rendered data, please render it before downloading"); } $nr++; } $zip->close(); header("Content-type: application/zip"); header("Content-Disposition: attachment; filename=\"".$table_name.".zip\""); header("Pragma: no-cache"); header("Expires: 0"); header("Content-Length: ".filesize($table_name.".zip")); ob_clean(); flush(); readfile($table_name.".zip"); unlink($table_name.".zip"); } } } else if (get_input('start_shoot_screenshots', false)) { $obj->setupTestShooter(); } else if (get_input('next_shoot_screenshots', false)) { $obj->nextTestShooter(); } else if (get_input('download_screenshots', false)) { $obj->zipScreenshots(); } } ?>