Example #1
0
 /**
  * @return bool 
  */
 public function getAuditReport()
 {
     return SupplierFileQuery::create()->whereAdd('SupplierFile.' . SupplierFile::ID_SUPPLIER, $this->getIdSupplier())->whereAdd('SupplierFile.' . SupplierFile::DOCUMENT_TYPE, self::$FileTypes['AuditReport'])->innerJoinFile()->count() ? true : false;
 }
Example #2
0
 /**
  * To download a single file
  * @author joseluis
  * @param int $id
  * @param int $documentType
  */
 public function downloadFileAction()
 {
     $id = $this->getRequest()->getParam('id');
     $documentType = $this->getRequest()->getParam('document-type');
     $filePath = 'public/' . SupplierFileQuery::create()->whereAdd(SupplierFile::ID_SUPPLIER, $id)->whereAdd(SupplierFile::DOCUMENT_TYPE, $documentType)->findOne()->getContent();
     header('Content-Disposition: attachment; filename="' . basename($filePath) . '"');
     readfile($filePath);
     exit;
 }