コード例 #1
0
 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;
 }
コード例 #2
0
 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();
 }
コード例 #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);
 }
コード例 #4
0
 public function __construct(IManager $mediaManager, $namespace, $label = null, $withPrimary = true)
 {
     parent::__construct($mediaManager, $namespace, $label = null, $withPrimary);
     $this->fileFilter = FileFilter::create()->findByNamespace($this->namespace);
 }
コード例 #5
0
ファイル: Manager.php プロジェクト: vojtabiberle/MediaStorage
 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;
 }
コード例 #6
0
ファイル: Storage.php プロジェクト: vojtabiberle/MediaStorage
 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;
     //?
 }