/
calendar_event.php
57 lines (52 loc) · 2.22 KB
/
calendar_event.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
<?php
namespace Concrete\Controller\Element\Dashboard\Boards\Configuration;
use Concrete\Controller\Element\Search\SearchFieldSelector;
use Concrete\Core\Board\DataSource\DataSourceElementController;
use Concrete\Core\Calendar\Calendar;
use Concrete\Core\Entity\Board\DataSource\Configuration\CalendarEventConfiguration;
use Concrete\Core\Form\Service\Form;
use Concrete\Core\Calendar\Event\Search\Field\Manager as SearchFieldManager;
use Concrete\Core\Url\Resolver\Manager\ResolverManagerInterface;
class CalendarEvent extends DataSourceElementController
{
public function getElement()
{
return 'dashboard/boards/configuration/calendar_event';
}
public function view()
{
$manager = $this->app->make(SearchFieldManager::class);
$resolver = $this->app->make(ResolverManagerInterface::class);
$addFieldAction = "#";
$fieldSelector = new SearchFieldSelector($manager, $addFieldAction);
$fieldSelector->setIncludeJavaScript(true);
$fieldSelector->setAddFieldAction(
$resolver->resolve(['/ccm/calendar/dialogs/event/advanced_search/add_field'])
);
$this->set('form', $this->app->make(Form::class));
$calendars = ['' => t('** No Filtering/Current Site')];
foreach (Calendar::getList() as $calendar) {
$calendars[$calendar->getID()] = $calendar->getName();
}
$this->set('calendars', $calendars);
$this->set('maxOccurrencesOfSameEvent', 0);
if ($this->configuredDataSource) {
$configuration = $this->configuredDataSource->getConfiguration();
if ($configuration) {
/**
* @var $configuration CalendarEventConfiguration
*/
$calendar = $configuration->getCalendar();
if ($calendar) {
$this->set('calendarID', $calendar->getID());
}
$query = $configuration->getQuery();
if ($query) {
$fieldSelector->setQuery($query);
}
$this->set('maxOccurrencesOfSameEvent', $configuration->getMaxOccurrencesOfSameEvent());
}
}
$this->set('fieldSelector', $fieldSelector);
}
}