/** * * @service banner read * @param $fields */ public function download(Gpf_Rpc_Params $params){ $form = new Gpf_Rpc_Form($params); $fileid = $form->getFieldValue('fileid'); $affiliateid = $form->getFieldValue('affiliateid'); $bannerid = $form->getFieldValue('bannerid'); $filetypes = $form->getFieldValue('filetypes'); $affiliate = $this->loadAffiliate($affiliateid); $banner = $this->loadBanner($bannerid); try { $channelcode = $form->getFieldValue('channelcode'); $banner->setChannel(Pap_Db_Channel::loadFromId($channelcode, $affiliate->getId())); } catch (Gpf_Exception $e) { $channelcode = null; } $unpackedZipFolderPath = $this->getZipFolderUrl() . $fileid; $cacheZipFolderPath = $this->getCahcheFolderUrl() . $bannerid . '_' . $affiliateid . '_' . $fileid; $this->copyFilesToCacheZipFolder($unpackedZipFolderPath, $cacheZipFolderPath); $this->replaceTemplatesInDirectory($cacheZipFolderPath, $filetypes, $affiliate, $banner, $channelcode); $archiveName = $this->packBanner($this->getCahcheFolderUrl(),$cacheZipFolderPath , $affiliate, $this->getFileName($fileid)); $download = new Gpf_File_Download_FileSystem($archiveName); $download->setAttachment(true); return $download; }