public function __construct(IManager $mediaManager, $namespace, $label = null, $withPrimary = false)
 {
     parent::__construct($label);
     $this->mediaManager = $mediaManager;
     $this->namespace = $namespace;
     $this->fileFilter = FileFilter::create()->getByNamespace($this->namespace);
     $this->withPrimary = $withPrimary;
 }
 public function __construct(IManager $manager, FilterFormFactory $filterFormFactory, CardViewControl $cardViewControl)
 {
     parent::__construct();
     $this->mediaManager = $manager;
     $this->filterFormFactory = $filterFormFactory;
     $this->cardViewControl = $cardViewControl;
     $this->currentFilter = FileFilter::create()->orderDESC();
 }
Ejemplo n.º 3
0
 public function build()
 {
     $filter = FileFilter::create()->findAll();
     if (count($this->stream) == 0) {
         return $filter;
     }
     while (null !== ($token = $this->getNextToken())) {
         $this->parseToken($token);
     }
     return $filter->customWhere($this->where, $this->params);
 }
 public function __construct(IManager $mediaManager, $namespace, $label = null, $withPrimary = true)
 {
     parent::__construct($mediaManager, $namespace, $label = null, $withPrimary);
     $this->fileFilter = FileFilter::create()->findByNamespace($this->namespace);
 }
Ejemplo n.º 5
0
 public function duplicateUsage($fromNs, $toNs)
 {
     $fromFiles = $this->storage->find(FileFilter::create()->findByNamespace($fromNs . '%'));
     $results = [];
     /** @var IFile $file */
     foreach ($fromFiles as $file) {
         $newNs = str_replace($fromNs, $toNs, $file->getNamespace());
         $results[] = $this->storage->saveUsages($newNs, [$file->getUID()], null);
     }
     return $results;
 }
Ejemplo n.º 6
0
 public function deleteById($id, $webRoot)
 {
     $filter = FileFilter::create()->getbyId($id);
     /** @var ActiveRow $file */
     $file = $this->databaseStorage->find($filter);
     if (!$file) {
         throw new FileNotFoundException('File not found.');
     }
     $this->databaseStorage->deleteById($file->id);
     FilesystemStorage::deleteFile(self::$mediaStoragePath . DIRECTORY_SEPARATOR . $file->id);
     /** TODO: Nepředávat webRoot path k media z Manageru do Storage */
     FilesystemStorage::deleteFiles(FilesystemStorage::findFiles($webRoot . '/media/', $file->name));
     return true;
     //?
 }