/**
  *  exportExcelAction
  */
 public function exportExcelAction()
 {
     $this->get('request')->setLocale(strtolower($this->client->getLanguage()));
     $excel = $this->get('client.operation.excel');
     $excel->set('_client', $this->client);
     $excel->set('_config_excel', $this->_config_excel);
     $excel->set('_locking', $this->getLocking());
     $excel->set('_admin', $this->admin);
     $excel->set('_year', $this->_year);
     $excel->set('_month', $this->_month);
     $excel->render();
     if ($this->getLocking()) {
         $this->client->moveFile($excel->getFileAbsolute(), $excel->getFileNameExt());
         $excelFile = $this->client->getFilesWebDir($this->client) . '/' . $excel->getFileNameExt();
         $this->get('session')->setFlash('sonata_flash_success|raw', $this->admin->trans('File %name% was successfully saved at Client directory. Or download it <a href="%file%">here</a>', array('%name%' => $excel, '%file%' => $excelFile)));
         return new RedirectResponse($this->admin->generateUrl('list'));
     }
     exit;
 }
Exemplo n.º 2
0
 /**
  * @return mixed
  */
 public function upload()
 {
     if (null === $this->file) {
         return;
     }
     $pathinfo = pathinfo($this->file->getClientOriginalName());
     $extension = $this->getAllowedExtension($pathinfo['extension']);
     $this->file_alias = $pathinfo['filename'] . '.' . $extension;
     $this->file->move(Client::getFilesAbsoluteDir($this->getClient()), $this->file_alias);
     Client::scanFilesTree($this->getClient());
     $this->document = $pathinfo['filename'];
     unset($this->file);
 }