public function downloadallAction()
 {
     $pids = $this->params('pids');
     if ($pids != '') {
         $zip = new Zip();
         $parent_dir = sys_get_temp_dir() . "/CCDA_" . time();
         if (!is_dir($parent_dir)) {
             mkdir($parent_dir, true);
             chmod($parent_dir, 0777);
         }
         $arr = explode('|', $pids);
         foreach ($arr as $row) {
             $pid = $row;
             $id = $this->getEncountermanagerTable()->getFileID($pid);
             $dir = $parent_dir . "/CCDA_{$id}/";
             $filename = "CCDA_{$id}.xml";
             if (!is_dir($dir)) {
                 mkdir($dir, true);
                 chmod($dir, 0777);
             }
             $content = $this->getEncountermanagerTable()->getFile($id);
             $f2 = fopen($dir . $filename, "w");
             fwrite($f2, $content);
             fclose($f2);
             copy(dirname(__FILE__) . "/../../../../../public/css/CDA.xsl", $dir . "CDA.xsl");
         }
         $zip_dir = sys_get_temp_dir() . "/";
         $zip_name = "CCDA.zip";
         $zip->setArchive($zip_dir . $zip_name);
         $zip->compress($parent_dir);
         ob_clean();
         header("Cache-Control: public");
         header("Content-Description: File Transfer");
         header("Content-Disposition: attachment; filename={$zip_name}");
         header("Content-Type: application/download");
         header("Content-Transfer-Encoding: binary");
         readfile($zip_dir . $zip_name);
         exit;
     }
 }
Пример #2
0
 /**
  * Setting Archive
  *
  * @return void
  */
 public function testZipGetSetArchive()
 {
     $filter = new ZipCompression();
     $this->assertEquals(null, $filter->getArchive());
     $filter->setArchive('Testfile.txt');
     $this->assertEquals('Testfile.txt', $filter->getArchive());
     $this->assertEquals('Testfile.txt', $filter->getOptions('archive'));
 }