/
search.php
52 lines (43 loc) · 1.56 KB
/
search.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
namespace Concrete\Controller\Dialog\File;
use Concrete\Controller\Backend\UserInterface as BackendInterfaceController;
use Concrete\Core\File\Component\Chooser\ChooserConfiguration;
use Concrete\Core\File\Component\Chooser\ChooserConfigurationInterface;
use Concrete\Core\File\Component\Chooser\FilterCollectionFactory;
use Concrete\Core\File\Filesystem;
use Concrete\Core\Foundation\Service\ProviderList;
use Concrete\Core\Permission\Checker;
class Search extends BackendInterfaceController
{
protected $viewPath = '/dialogs/file/search';
/**
* @var Filesystem
*/
protected $filesystem;
public function __construct(Filesystem $filesystem)
{
parent::__construct();
$this->filesystem = $filesystem;
}
public function view()
{
$configuration = $this->app->make(ChooserConfigurationInterface::class);
$filters = $this->app->make(FilterCollectionFactory::class)->createFromRequest($this->request);
if ($filters) {
$configuration->setFilters($filters);
}
$this->set('configuration', $configuration);
$this->set('multipleSelection', $this->request->query->getBoolean('multipleSelection') || $this->request->request->getBoolean('multipleSelection'));
}
/**
* {@inheritdoc}
*
* @see \Concrete\Controller\Backend\UserInterface::canAccess()
*/
protected function canAccess()
{
$folder = $this->filesystem->getRootFolder();
$cp = new Checker($folder);
return $cp->canSearchFiles() || $cp->canAddFile();
}
}