/** * Delete the file given in arguments * * @return void */ public function deleteFileAction() { if ($this->request->hasArgument('file')) { $file = $this->fileRepository->findByUid($this->request->getArgument('file')); if ($file && Tools::userHasFileWriteAccess($this->user, $file, array('folderRoot' => $this->startFolder))) { $this->storage->deleteFile($file->getOriginalResource()); } } }
/** * Return the csv line corresponding to the $row parameter with the $colomns as columns * * @param string $columns * @param array $row * @return string */ public function getCsvLine($columns, $row) { $file = $this->fileRepository->findByUid($row['uid']); $line = ''; if ($file) { foreach ($columns as $column) { if ($column == 'title') { $line .= '"' . $file->getTitle() . '";'; } if ($column == 'createdAt') { $line .= '"' . strftime('%d/%m/%Y', $file->getCrdate()) . '";'; } if ($column == 'updatedAt') { $line .= '"' . strftime('%d/%m/%Y', $file->getTstamp()) . '";'; } if ($column == 'description') { $line .= '"' . $file->getDescription() . '";'; } if ($column == 'owner') { $line .= '"' . $file->getOwnerUsername() . '";'; } if ($column == 'size') { $line .= '"' . $file->getOriginalResource()->getSize() . '";'; } if ($column == 'keywords') { $line .= '"' . $file->getkeywords . '";'; } if ($column == 'path') { $line .= '"' . $file->getGedPath() . '";'; } if ($column == 'nbDownload') { $line .= '"' . $row['nb_downloads'] . '";'; } if ($column == 'extension') { $line .= '"' . $file->getOriginalResource()->getExtension() . '";'; } } $line .= "\n"; } return $line; }