/
DashboardExpressEntityTrait.php
70 lines (59 loc) · 2.48 KB
/
DashboardExpressEntityTrait.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
namespace Concrete\Core\Controller\Traits;
use Concrete\Core\Attribute\Category\ExpressCategory;
use Concrete\Core\Csv\WriterFactory;
use Concrete\Core\Entity\Express\Entity;
use Concrete\Core\Entity\Search\Query;
use Concrete\Core\Entity\Search\SavedExpressSearch;
use Concrete\Core\Error\UserMessageException;
use Concrete\Core\Express\Export\EntryList\CsvWriter;
use Concrete\Core\Express\Search\Field\SiteField;
use Concrete\Core\Express\Search\SearchProvider;
use Concrete\Core\Filesystem\Element;
use Concrete\Core\Filesystem\ElementManager;
use Concrete\Core\Localization\Service\Date;
use Concrete\Core\Navigation\Breadcrumb\Dashboard\DashboardExpressBreadcrumbFactory;
use Concrete\Core\Page\Page;
use Concrete\Core\Permission\Checker;
use Concrete\Core\Search\Field\Field\KeywordsField;
use Concrete\Core\Search\Query\Modifier\AutoSortColumnRequestModifier;
use Concrete\Core\Search\Query\Modifier\ItemsPerPageRequestModifier;
use Concrete\Core\Search\Query\QueryFactory;
use Concrete\Core\Search\Query\QueryModifier;
use Concrete\Core\Search\Result\Result;
use Concrete\Core\Search\Result\ResultFactory;
use Concrete\Core\Site\InstallationService;
use Concrete\Core\Url\Url;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\StreamedResponse;
/**
* Adds specific Dashboard endpoints for viewing an entity's results and advanced search.
*/
trait DashboardExpressEntityTrait
{
use DashboardExpressEntryListTrait;
use DashboardExpressEntryDetailsTrait;
protected function getBackURL(Entity $entity)
{
return $this->app->make('url')->to($this->getPageObject()->getCollectionPath());
}
abstract public function getExpressEntity() : Entity;
protected function getHeaderSearchAction(Entity $entity)
{
return $this->app->make('url')->to($this->getPageObject()->getCollectionPath());
}
public function view()
{
$this->renderExpressEntryDefaultResults($this->getExpressEntity());
}
public function advanced_search($entityID = null)
{
// Note $entityID has to exist here because the advanced search controller passes it back as the
// first argument to the `advanced_search` endpoint always.
$this->renderExpressEntryAdvancedSearchResults($this->getExpressEntity());
}
public function csv_export($entityID = null, $searchMethod = null, $savedSearchPresetId = null)
{
return $this->exportCsv($this->getExpressEntity(), $searchMethod, $savedSearchPresetId);
}
}