2010-12-07 20:19:27 +01:00
|
|
|
<?php
|
2014-09-15 23:14:48 +02:00
|
|
|
|
2010-12-07 20:19:27 +01:00
|
|
|
class ScheduleController extends Zend_Controller_Action
|
|
|
|
{
|
2021-10-11 16:10:47 +02:00
|
|
|
protected $sched_sess;
|
2010-12-07 20:19:27 +01:00
|
|
|
|
|
|
|
public function init()
|
|
|
|
{
|
2011-02-09 20:12:07 +01:00
|
|
|
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
2010-12-07 20:19:27 +01:00
|
|
|
$ajaxContext->addActionContext('event-feed', 'json')
|
2021-10-11 16:10:47 +02:00
|
|
|
->addActionContext('event-feed-preload', 'json')
|
|
|
|
->addActionContext('make-context-menu', 'json')
|
|
|
|
->addActionContext('add-show-dialog', 'json')
|
|
|
|
->addActionContext('add-show', 'json')
|
|
|
|
->addActionContext('edit-show', 'json')
|
|
|
|
->addActionContext('move-show', 'json')
|
|
|
|
->addActionContext('resize-show', 'json')
|
|
|
|
->addActionContext('delete-show-instance', 'json')
|
|
|
|
->addActionContext('show-content-dialog', 'json')
|
|
|
|
->addActionContext('clear-show', 'json')
|
|
|
|
->addActionContext('get-current-playlist', 'json')
|
|
|
|
->addActionContext('remove-group', 'json')
|
|
|
|
->addActionContext('populate-show-form', 'json')
|
|
|
|
->addActionContext('populate-repeating-show-instance-form', 'json')
|
|
|
|
->addActionContext('delete-show', 'json')
|
|
|
|
->addActionContext('cancel-current-show', 'json')
|
|
|
|
->addActionContext('get-form', 'json')
|
|
|
|
->addActionContext('upload-to-sound-cloud', 'json')
|
|
|
|
->addActionContext('content-context-menu', 'json')
|
|
|
|
->addActionContext('set-time-scale', 'json')
|
|
|
|
->addActionContext('set-time-interval', 'json')
|
|
|
|
->addActionContext('edit-repeating-show-instance', 'json')
|
|
|
|
->addActionContext('dj-edit-show', 'json')
|
|
|
|
->addActionContext('calculate-duration', 'json')
|
|
|
|
->addActionContext('get-current-show', 'json')
|
|
|
|
->addActionContext('update-future-is-scheduled', 'json')
|
|
|
|
->addActionContext('localize-start-end-time', 'json')
|
2022-01-23 19:15:55 +01:00
|
|
|
->initContext();
|
2021-10-11 16:10:47 +02:00
|
|
|
|
|
|
|
$this->sched_sess = new Zend_Session_Namespace('schedule');
|
2010-12-07 20:19:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function indexAction()
|
|
|
|
{
|
2022-03-14 11:15:04 +01:00
|
|
|
// Embed the schedule in our page response so we don't have to make an AJAX request to get this data after the page load.
|
2015-04-17 17:17:35 +02:00
|
|
|
$scheduleController = new ScheduleController($this->getRequest(), $this->getResponse());
|
|
|
|
$scheduleController->eventFeedPreloadAction();
|
|
|
|
$events = json_encode($scheduleController->view->events);
|
2015-03-13 23:22:27 +01:00
|
|
|
|
2013-08-14 19:07:06 +02:00
|
|
|
$this->view->headScript()->appendScript(
|
2021-10-11 16:10:47 +02:00
|
|
|
"var calendarPref = {};\n" .
|
2022-07-07 20:01:15 +02:00
|
|
|
'calendarPref.weekStart = ' . Application_Model_Preference::GetWeekStartDay() . ";\n" .
|
|
|
|
'calendarPref.timestamp = ' . time() . ";\n" .
|
|
|
|
'calendarPref.timezoneOffset = ' . Application_Common_DateHelper::getUserTimezoneOffset() . ";\n" .
|
|
|
|
"calendarPref.timeScale = '" . Application_Model_Preference::GetCalendarTimeScale() . "';\n" .
|
|
|
|
'calendarPref.timeInterval = ' . Application_Model_Preference::GetCalendarTimeInterval() . ";\n" .
|
|
|
|
'calendarPref.weekStartDay = ' . Application_Model_Preference::GetWeekStartDay() . ";\n" .
|
|
|
|
"var calendarEvents = {$events};"
|
2013-08-14 19:07:06 +02:00
|
|
|
);
|
|
|
|
|
2022-09-19 11:58:31 +02:00
|
|
|
$this->view->headScript()->appendFile(Assets::url('js/contextmenu/jquery.contextMenu.js'), 'text/javascript');
|
2011-12-01 11:37:55 +01:00
|
|
|
|
2022-03-14 11:15:04 +01:00
|
|
|
// full-calendar-functions.js requires this variable, so that datePicker widget can be offset to server time instead of client time
|
|
|
|
// this should be as a default, however with our new drop down timezone changing for shows, we should reset this offset then??
|
2021-10-11 16:10:47 +02:00
|
|
|
$this->view->headScript()->appendScript('var timezoneOffset = ' . Application_Common_DateHelper::getStationTimezoneOffset() . '; //in seconds');
|
2022-03-14 11:15:04 +01:00
|
|
|
// set offset to ensure it loads last
|
2022-09-19 11:58:31 +02:00
|
|
|
$this->view->headScript()->offsetSetFile(90, Assets::url('js/airtime/schedule/full-calendar-functions.js'), 'text/javascript');
|
2012-02-07 23:58:36 +01:00
|
|
|
|
2022-09-19 11:58:31 +02:00
|
|
|
$this->view->headScript()->appendFile(Assets::url('js/fullcalendar/fullcalendar.js'), 'text/javascript');
|
|
|
|
$this->view->headScript()->appendFile(Assets::url('js/timepicker/jquery.ui.timepicker.js'), 'text/javascript');
|
|
|
|
$this->view->headScript()->appendFile(Assets::url('js/colorpicker/js/colorpicker.js'), 'text/javascript');
|
2012-02-07 23:58:36 +01:00
|
|
|
|
2021-01-16 20:39:52 +01:00
|
|
|
// This block needs to be added before the add-show.js script
|
2022-09-19 11:58:31 +02:00
|
|
|
$this->view->headScript()->appendFile(Assets::url('js/libs/dayjs.min.js'), 'text/javascript');
|
|
|
|
$this->view->headScript()->appendFile(Assets::url('js/libs/utc.min.js'), 'text/javascript');
|
|
|
|
$this->view->headScript()->appendFile(Assets::url('js/libs/timezone.min.js'), 'text/javascript');
|
2021-01-16 20:39:52 +01:00
|
|
|
|
2022-09-19 11:58:31 +02:00
|
|
|
$this->view->headScript()->appendFile(Assets::url('js/airtime/schedule/add-show.js'), 'text/javascript');
|
|
|
|
$this->view->headScript()->offsetSetFile(100, Assets::url('js/airtime/schedule/schedule.js'), 'text/javascript');
|
|
|
|
$this->view->headScript()->appendFile(Assets::url('js/blockui/jquery.blockUI.js'), 'text/javascript');
|
2011-04-18 17:02:09 +02:00
|
|
|
|
2022-09-19 11:58:31 +02:00
|
|
|
$this->view->headLink()->appendStylesheet(Assets::url('css/jquery.ui.timepicker.css'));
|
|
|
|
$this->view->headLink()->appendStylesheet(Assets::url('css/fullcalendar.css'));
|
|
|
|
$this->view->headLink()->appendStylesheet(Assets::url('css/colorpicker/css/colorpicker.css'));
|
|
|
|
$this->view->headLink()->appendStylesheet(Assets::url('css/add-show.css'));
|
|
|
|
$this->view->headLink()->appendStylesheet(Assets::url('css/jquery.contextMenu.css'));
|
2011-11-15 15:56:52 +01:00
|
|
|
|
2022-03-14 11:15:04 +01:00
|
|
|
// Start Show builder JS/CSS requirements
|
2015-09-24 18:56:32 +02:00
|
|
|
$headScript = $this->view->headScript();
|
2022-09-19 11:58:31 +02:00
|
|
|
AirtimeTableView::injectTableJavaScriptDependencies($headScript);
|
2013-01-14 22:00:38 +01:00
|
|
|
|
2022-09-19 11:58:31 +02:00
|
|
|
$this->view->headScript()->appendFile(Assets::url('js/airtime/utilities/utilities.js'), 'text/javascript');
|
2015-07-14 16:35:21 +02:00
|
|
|
|
2022-09-19 11:58:31 +02:00
|
|
|
$this->view->headScript()->appendFile(Assets::url('js/airtime/buttons/buttons.js'), 'text/javascript');
|
|
|
|
$this->view->headScript()->appendFile(Assets::url('js/airtime/library/events/library_showbuilder.js'), 'text/javascript');
|
|
|
|
$this->view->headScript()->appendFile(Assets::url('js/airtime/library/library.js'), 'text/javascript');
|
|
|
|
$this->view->headScript()->appendFile(Assets::url('js/airtime/showbuilder/builder.js'), 'text/javascript');
|
2013-01-14 22:00:38 +01:00
|
|
|
|
2022-09-19 11:58:31 +02:00
|
|
|
$this->view->headLink()->appendStylesheet(Assets::url('css/media_library.css'));
|
|
|
|
$this->view->headLink()->appendStylesheet(Assets::url('css/jquery.contextMenu.css'));
|
|
|
|
$this->view->headLink()->appendStylesheet(Assets::url('css/datatables/css/ColVis.css'));
|
|
|
|
$this->view->headLink()->appendStylesheet(Assets::url('css/datatables/css/dataTables.colReorder.min.css'));
|
|
|
|
$this->view->headLink()->appendStylesheet(Assets::url('css/showbuilder.css'));
|
|
|
|
$this->view->headLink()->appendStylesheet(Assets::url('css/dashboard.css'));
|
2022-03-14 11:15:04 +01:00
|
|
|
// End Show builder JS/CSS requirements
|
2012-03-01 00:19:59 +01:00
|
|
|
|
2013-03-08 22:08:43 +01:00
|
|
|
$this->createShowFormAction(true);
|
2011-02-10 17:25:28 +01:00
|
|
|
|
2012-07-11 00:51:32 +02:00
|
|
|
$user = Application_Model_User::getCurrentUser();
|
2021-10-11 16:10:47 +02:00
|
|
|
if ($user->isUserType([UTYPE_SUPERADMIN, UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER])) {
|
2012-04-09 18:19:22 +02:00
|
|
|
$this->view->preloadShowForm = true;
|
|
|
|
}
|
2012-07-11 00:53:06 +02:00
|
|
|
|
2013-02-21 23:57:56 +01:00
|
|
|
$this->view->addNewShow = true;
|
2010-12-08 06:47:51 +01:00
|
|
|
}
|
|
|
|
|
2011-02-10 06:17:07 +01:00
|
|
|
public function eventFeedAction()
|
|
|
|
{
|
2013-03-27 14:02:49 +01:00
|
|
|
$service_user = new Application_Service_UserService();
|
|
|
|
$currentUser = $service_user->getCurrentUser();
|
|
|
|
|
2013-12-12 22:39:20 +01:00
|
|
|
$userTimezone = new DateTimeZone(Application_Model_Preference::GetUserTimezone());
|
2019-09-20 02:07:50 +02:00
|
|
|
|
2013-12-12 22:39:20 +01:00
|
|
|
$start = new DateTime($this->_getParam('start', null), $userTimezone);
|
2021-10-11 16:10:47 +02:00
|
|
|
$start->setTimezone(new DateTimeZone('UTC'));
|
2013-12-12 22:39:20 +01:00
|
|
|
$end = new DateTime($this->_getParam('end', null), $userTimezone);
|
2021-10-11 16:10:47 +02:00
|
|
|
$end->setTimezone(new DateTimeZone('UTC'));
|
2011-03-22 14:55:33 +01:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$events = &Application_Model_Show::getFullCalendarEvents(
|
|
|
|
$start,
|
|
|
|
$end,
|
|
|
|
$currentUser->isAdminOrPM()
|
|
|
|
);
|
2013-01-24 18:52:24 +01:00
|
|
|
|
|
|
|
$this->view->events = $events;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function eventFeedPreloadAction()
|
|
|
|
{
|
|
|
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
|
|
|
$user = new Application_Model_User($userInfo->id);
|
2021-10-11 16:10:47 +02:00
|
|
|
$editable = $user->isUserType([UTYPE_SUPERADMIN, UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER]);
|
2011-02-10 06:17:07 +01:00
|
|
|
|
2013-01-24 20:02:50 +01:00
|
|
|
$calendar_interval = Application_Model_Preference::GetCalendarTimeScale();
|
2021-10-11 16:10:47 +02:00
|
|
|
if ($calendar_interval == 'agendaDay') {
|
Feature: Support php7.4 (#1354)
* Run CI tests against php 7.4
* Sort composer dependencies
* Remove unused Aws S3 php library
* Pin simplepie dependency to ^1.5
* Pin getid3 dependency to ^1.9
* Pin composer semver to ^3.2
* Pin php-amqplib to ^2.12
* Drop sentry logging support
* Update composer dependencies
* Move propel regenerate to Makefile
* Regenerate propel files with v1.7.0
* Pin propel orm to ^1.7
* Regenerate propel files with v1.7.2
* fix: generator_version in airtime-conf-production.php
* Replace propel/propel1 with jooola/propel1
* Regenerate propel files with v1.7.3-dev
* Fix php7.4 compatibility
Using php-cs-fixer:
'@PhpCsFixer' => true,
'concat_space' => ['spacing' => 'one'],
'ordered_class_elements' => false,
'yoda_style' => false,
'@PHP74Migration' => true,
'assign_null_coalescing_to_coalesce_equal' => false,
'ternary_to_null_coalescing' => false,
'heredoc_indentation' => false,
'@PHP74Migration:risky' => true,
'declare_strict_types' => false,
'void_return' => false,
'use_arrow_functions' => false,
* Fix pre-commit
2021-10-17 17:19:53 +02:00
|
|
|
[$start, $end] = Application_Model_Show::getStartEndCurrentDayView();
|
2021-10-11 16:10:47 +02:00
|
|
|
} elseif ($calendar_interval == 'agendaWeek') {
|
Feature: Support php7.4 (#1354)
* Run CI tests against php 7.4
* Sort composer dependencies
* Remove unused Aws S3 php library
* Pin simplepie dependency to ^1.5
* Pin getid3 dependency to ^1.9
* Pin composer semver to ^3.2
* Pin php-amqplib to ^2.12
* Drop sentry logging support
* Update composer dependencies
* Move propel regenerate to Makefile
* Regenerate propel files with v1.7.0
* Pin propel orm to ^1.7
* Regenerate propel files with v1.7.2
* fix: generator_version in airtime-conf-production.php
* Replace propel/propel1 with jooola/propel1
* Regenerate propel files with v1.7.3-dev
* Fix php7.4 compatibility
Using php-cs-fixer:
'@PhpCsFixer' => true,
'concat_space' => ['spacing' => 'one'],
'ordered_class_elements' => false,
'yoda_style' => false,
'@PHP74Migration' => true,
'assign_null_coalescing_to_coalesce_equal' => false,
'ternary_to_null_coalescing' => false,
'heredoc_indentation' => false,
'@PHP74Migration:risky' => true,
'declare_strict_types' => false,
'void_return' => false,
'use_arrow_functions' => false,
* Fix pre-commit
2021-10-17 17:19:53 +02:00
|
|
|
[$start, $end] = Application_Model_Show::getStartEndCurrentWeekView();
|
2021-10-11 16:10:47 +02:00
|
|
|
} elseif ($calendar_interval == 'month') {
|
Feature: Support php7.4 (#1354)
* Run CI tests against php 7.4
* Sort composer dependencies
* Remove unused Aws S3 php library
* Pin simplepie dependency to ^1.5
* Pin getid3 dependency to ^1.9
* Pin composer semver to ^3.2
* Pin php-amqplib to ^2.12
* Drop sentry logging support
* Update composer dependencies
* Move propel regenerate to Makefile
* Regenerate propel files with v1.7.0
* Pin propel orm to ^1.7
* Regenerate propel files with v1.7.2
* fix: generator_version in airtime-conf-production.php
* Replace propel/propel1 with jooola/propel1
* Regenerate propel files with v1.7.3-dev
* Fix php7.4 compatibility
Using php-cs-fixer:
'@PhpCsFixer' => true,
'concat_space' => ['spacing' => 'one'],
'ordered_class_elements' => false,
'yoda_style' => false,
'@PHP74Migration' => true,
'assign_null_coalescing_to_coalesce_equal' => false,
'ternary_to_null_coalescing' => false,
'heredoc_indentation' => false,
'@PHP74Migration:risky' => true,
'declare_strict_types' => false,
'void_return' => false,
'use_arrow_functions' => false,
* Fix pre-commit
2021-10-17 17:19:53 +02:00
|
|
|
[$start, $end] = Application_Model_Show::getStartEndCurrentMonthPlusView();
|
2012-07-16 03:17:13 +02:00
|
|
|
} else {
|
2021-10-11 16:10:47 +02:00
|
|
|
Logging::error("Invalid Calendar Interval '{$calendar_interval}'");
|
2012-03-01 00:19:59 +01:00
|
|
|
}
|
2011-02-10 06:17:07 +01:00
|
|
|
|
2012-07-23 01:14:29 +02:00
|
|
|
$events = &Application_Model_Show::getFullCalendarEvents($start, $end, $editable);
|
2012-07-23 01:18:53 +02:00
|
|
|
$this->view->events = $events;
|
2012-07-06 21:26:51 +02:00
|
|
|
}
|
2012-08-29 16:54:36 +02:00
|
|
|
|
2012-07-26 20:36:21 +02:00
|
|
|
public function getCurrentShowAction()
|
|
|
|
{
|
2012-09-04 19:12:35 +02:00
|
|
|
$currentShow = Application_Model_Show::getCurrentShow();
|
2012-07-26 20:36:21 +02:00
|
|
|
if (!empty($currentShow)) {
|
2021-10-11 16:10:47 +02:00
|
|
|
$this->view->si_id = $currentShow[0]['instance_id'];
|
2012-07-26 20:36:21 +02:00
|
|
|
$this->view->current_show = true;
|
|
|
|
} else {
|
|
|
|
$this->view->current_show = false;
|
|
|
|
}
|
|
|
|
}
|
2011-02-10 06:17:07 +01:00
|
|
|
|
2010-12-09 20:33:34 +01:00
|
|
|
public function moveShowAction()
|
2010-12-08 06:47:51 +01:00
|
|
|
{
|
2010-12-09 20:33:34 +01:00
|
|
|
$deltaDay = $this->_getParam('day');
|
2011-08-19 00:13:43 +02:00
|
|
|
$deltaMin = $this->_getParam('min');
|
2011-01-28 17:34:57 +01:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$log_vars = [];
|
|
|
|
$log_vars['url'] = $_SERVER['HTTP_HOST'];
|
|
|
|
$log_vars['action'] = 'schedule/move-show';
|
|
|
|
$log_vars['params'] = [];
|
|
|
|
$log_vars['params']['instance id'] = $this->_getParam('showInstanceId');
|
|
|
|
$log_vars['params']['delta day'] = $deltaDay;
|
|
|
|
$log_vars['params']['delta minute'] = $deltaMin;
|
2014-06-17 20:17:28 +02:00
|
|
|
Logging::info($log_vars);
|
|
|
|
|
2013-04-05 23:44:30 +02:00
|
|
|
try {
|
|
|
|
$service_calendar = new Application_Service_CalendarService(
|
2021-10-11 16:10:47 +02:00
|
|
|
$this->_getParam('showInstanceId')
|
|
|
|
);
|
2013-04-05 23:44:30 +02:00
|
|
|
} catch (Exception $e) {
|
|
|
|
$this->view->show_error = true;
|
2021-10-11 16:10:47 +02:00
|
|
|
|
2013-04-05 23:44:30 +02:00
|
|
|
return false;
|
2011-02-06 02:39:35 +01:00
|
|
|
}
|
2019-09-20 02:07:50 +02:00
|
|
|
|
2013-04-05 23:44:30 +02:00
|
|
|
$error = $service_calendar->moveShow($deltaDay, $deltaMin);
|
2012-03-01 00:19:59 +01:00
|
|
|
if (isset($error)) {
|
2011-08-19 00:13:43 +02:00
|
|
|
$this->view->error = $error;
|
2012-03-01 00:19:59 +01:00
|
|
|
}
|
2010-12-09 20:33:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function resizeShowAction()
|
|
|
|
{
|
2010-12-10 18:15:17 +01:00
|
|
|
$deltaDay = $this->_getParam('day');
|
2012-07-11 00:53:06 +02:00
|
|
|
$deltaMin = $this->_getParam('min');
|
|
|
|
$showId = $this->_getParam('showId');
|
2013-11-28 23:17:00 +01:00
|
|
|
$instanceId = $this->_getParam('instanceId');
|
2011-01-28 17:34:57 +01:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$log_vars = [];
|
|
|
|
$log_vars['url'] = $_SERVER['HTTP_HOST'];
|
|
|
|
$log_vars['action'] = 'schedule/resize-show';
|
|
|
|
$log_vars['params'] = [];
|
|
|
|
$log_vars['params']['instance id'] = $instanceId;
|
|
|
|
$log_vars['params']['delta day'] = $deltaDay;
|
|
|
|
$log_vars['params']['delta minute'] = $deltaMin;
|
2014-06-17 20:17:28 +02:00
|
|
|
Logging::info($log_vars);
|
2019-09-20 02:07:50 +02:00
|
|
|
|
2011-02-06 02:39:35 +01:00
|
|
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
2011-09-23 23:00:55 +02:00
|
|
|
$user = new Application_Model_User($userInfo->id);
|
2011-02-06 02:39:35 +01:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
if ($user->isUserType([UTYPE_SUPERADMIN, UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER])) {
|
2012-07-16 03:17:13 +02:00
|
|
|
try {
|
2011-11-16 16:32:04 +01:00
|
|
|
$show = new Application_Model_Show($showId);
|
2012-07-16 03:17:13 +02:00
|
|
|
} catch (Exception $e) {
|
2011-11-10 21:35:27 +01:00
|
|
|
$this->view->show_error = true;
|
2012-07-16 03:17:13 +02:00
|
|
|
|
2011-11-10 21:35:27 +01:00
|
|
|
return false;
|
|
|
|
}
|
2013-11-28 23:17:00 +01:00
|
|
|
$error = $show->resizeShow($deltaDay, $deltaMin, $instanceId);
|
2011-02-06 02:39:35 +01:00
|
|
|
}
|
2011-01-28 17:34:57 +01:00
|
|
|
|
2012-07-11 00:53:06 +02:00
|
|
|
if (isset($error)) {
|
|
|
|
$this->view->error = $error;
|
|
|
|
}
|
2010-12-07 20:19:27 +01:00
|
|
|
}
|
|
|
|
|
2013-04-03 17:46:46 +02:00
|
|
|
public function deleteShowInstanceAction()
|
2010-12-10 23:59:57 +01:00
|
|
|
{
|
2013-04-03 17:46:46 +02:00
|
|
|
$instanceId = $this->_getParam('id');
|
2011-02-06 02:39:35 +01:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$log_vars = [];
|
|
|
|
$log_vars['url'] = $_SERVER['HTTP_HOST'];
|
|
|
|
$log_vars['action'] = 'schedule/delete-show-instance';
|
|
|
|
$log_vars['params'] = [];
|
|
|
|
$log_vars['params']['instance id'] = $instanceId;
|
2014-06-17 20:17:28 +02:00
|
|
|
Logging::info($log_vars);
|
2019-09-20 02:07:50 +02:00
|
|
|
|
2013-04-03 17:46:46 +02:00
|
|
|
$service_show = new Application_Service_ShowService();
|
|
|
|
$showId = $service_show->deleteShow($instanceId, true);
|
2011-12-08 17:49:00 +01:00
|
|
|
|
2013-04-03 17:46:46 +02:00
|
|
|
if (!$showId) {
|
|
|
|
$this->view->show_error = true;
|
2011-02-06 02:39:35 +01:00
|
|
|
}
|
2013-04-03 17:46:46 +02:00
|
|
|
$this->view->show_id = $showId;
|
2010-12-10 23:59:57 +01:00
|
|
|
}
|
|
|
|
|
2010-12-14 20:58:34 +01:00
|
|
|
public function makeContextMenuAction()
|
|
|
|
{
|
2013-03-26 21:03:53 +01:00
|
|
|
$instanceId = $this->_getParam('instanceId');
|
2012-02-09 21:19:21 +01:00
|
|
|
|
2013-03-26 21:03:53 +01:00
|
|
|
$service_calendar = new Application_Service_CalendarService($instanceId);
|
2011-03-22 14:55:33 +01:00
|
|
|
|
2013-03-26 21:03:53 +01:00
|
|
|
$this->view->items = $service_calendar->makeContextMenu();
|
2010-12-14 20:58:34 +01:00
|
|
|
}
|
|
|
|
|
2010-12-16 04:33:45 +01:00
|
|
|
public function clearShowAction()
|
|
|
|
{
|
2013-05-01 16:30:51 +02:00
|
|
|
$instanceId = $this->_getParam('id');
|
2019-09-20 02:07:50 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$log_vars = [];
|
|
|
|
$log_vars['url'] = $_SERVER['HTTP_HOST'];
|
|
|
|
$log_vars['action'] = 'schedule/clear-show';
|
|
|
|
$log_vars['params'] = [];
|
|
|
|
$log_vars['params']['instance id'] = $instanceId;
|
2014-06-17 20:17:28 +02:00
|
|
|
Logging::info($log_vars);
|
2013-05-01 16:30:51 +02:00
|
|
|
|
|
|
|
$service_scheduler = new Application_Service_SchedulerService();
|
2012-07-16 03:17:13 +02:00
|
|
|
|
2013-05-01 16:30:51 +02:00
|
|
|
if (!$service_scheduler->emptyShowContent($instanceId)) {
|
|
|
|
$this->view->show_error = true;
|
2021-10-11 16:10:47 +02:00
|
|
|
|
2011-11-10 21:35:27 +01:00
|
|
|
return false;
|
|
|
|
}
|
2010-12-16 04:33:45 +01:00
|
|
|
}
|
|
|
|
|
2015-04-09 19:03:06 +02:00
|
|
|
/** This is a nasty hack to let us embed the the data the dashboard needs into the HTML response for each page.
|
|
|
|
* This was originally loaded AFTER page load by AJAX, which is needlessly slow. This should have been templated in.
|
|
|
|
*/
|
|
|
|
public static function printCurrentPlaylistForEmbedding()
|
|
|
|
{
|
|
|
|
$front = Zend_Controller_Front::getInstance();
|
2015-04-17 17:17:35 +02:00
|
|
|
$scheduleController = new ScheduleController($front->getRequest(), $front->getResponse());
|
|
|
|
$scheduleController->getCurrentPlaylistAction();
|
2021-10-11 16:10:47 +02:00
|
|
|
echo json_encode($scheduleController->view);
|
2015-04-09 19:03:06 +02:00
|
|
|
}
|
|
|
|
|
2010-12-22 00:28:17 +01:00
|
|
|
public function getCurrentPlaylistAction()
|
|
|
|
{
|
2014-10-27 20:52:14 +01:00
|
|
|
$range = Application_Model_Schedule::GetPlayOrderRangeOld();
|
2015-05-19 21:42:07 +02:00
|
|
|
|
2012-09-04 19:12:35 +02:00
|
|
|
$show = Application_Model_Show::getCurrentShow();
|
2011-11-16 16:32:04 +01:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
// Convert all UTC times to localtime before sending back to user.
|
|
|
|
$range['schedulerTime'] = Application_Common_DateHelper::UTCStringToUserTimezoneString($range['schedulerTime']);
|
2019-09-20 02:07:50 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
if (isset($range['previous'])) {
|
|
|
|
$range['previous']['starts'] = Application_Common_DateHelper::UTCStringToUserTimezoneString($range['previous']['starts']);
|
|
|
|
$range['previous']['ends'] = Application_Common_DateHelper::UTCStringToUserTimezoneString($range['previous']['ends']);
|
2011-11-15 21:45:08 +01:00
|
|
|
}
|
2021-10-11 16:10:47 +02:00
|
|
|
if (isset($range['current'])) {
|
|
|
|
if (isset($range['current']['metadata'])) {
|
|
|
|
$get_artwork = FileDataHelper::getArtworkData($range['current']['metadata']['artwork'], 256);
|
|
|
|
$range['current']['metadata']['artwork_data'] = $get_artwork;
|
2019-11-23 06:01:39 +01:00
|
|
|
}
|
2021-10-11 16:10:47 +02:00
|
|
|
$range['current']['starts'] = Application_Common_DateHelper::UTCStringToUserTimezoneString($range['current']['starts']);
|
|
|
|
$range['current']['ends'] = Application_Common_DateHelper::UTCStringToUserTimezoneString($range['current']['ends']);
|
2011-11-15 21:45:08 +01:00
|
|
|
}
|
2021-10-11 16:10:47 +02:00
|
|
|
if (isset($range['next'])) {
|
|
|
|
$range['next']['starts'] = Application_Common_DateHelper::UTCStringToUserTimezoneString($range['next']['starts']);
|
|
|
|
$range['next']['ends'] = Application_Common_DateHelper::UTCStringToUserTimezoneString($range['next']['ends']);
|
2011-11-15 21:45:08 +01:00
|
|
|
}
|
2019-09-20 02:07:50 +02:00
|
|
|
|
2013-12-10 22:45:05 +01:00
|
|
|
Application_Common_DateHelper::convertTimestamps(
|
2021-10-11 16:10:47 +02:00
|
|
|
$range['currentShow'],
|
|
|
|
['starts', 'ends', 'start_timestamp', 'end_timestamp'],
|
|
|
|
'user'
|
2013-12-10 22:45:05 +01:00
|
|
|
);
|
|
|
|
Application_Common_DateHelper::convertTimestamps(
|
2021-10-11 16:10:47 +02:00
|
|
|
$range['nextShow'],
|
|
|
|
['starts', 'ends', 'start_timestamp', 'end_timestamp'],
|
|
|
|
'user'
|
2013-12-10 22:45:05 +01:00
|
|
|
);
|
2012-07-11 00:53:06 +02:00
|
|
|
|
2022-03-14 11:15:04 +01:00
|
|
|
// TODO: Add timezone and timezoneOffset back into the ApiController's results.
|
2021-10-11 16:10:47 +02:00
|
|
|
$range['timezone'] = Application_Common_DateHelper::getUserTimezoneAbbreviation();
|
|
|
|
$range['timezoneOffset'] = Application_Common_DateHelper::getUserTimezoneOffset();
|
2019-09-20 02:07:50 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$source_status = [];
|
|
|
|
$switch_status = [];
|
|
|
|
$live_dj = Application_Model_Preference::GetSourceStatus('live_dj');
|
|
|
|
$master_dj = Application_Model_Preference::GetSourceStatus('master_dj');
|
2012-07-11 00:53:06 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$scheduled_play_switch = Application_Model_Preference::GetSourceSwitchStatus('scheduled_play');
|
|
|
|
$live_dj_switch = Application_Model_Preference::GetSourceSwitchStatus('live_dj');
|
|
|
|
$master_dj_switch = Application_Model_Preference::GetSourceSwitchStatus('master_dj');
|
2012-07-11 00:53:06 +02:00
|
|
|
|
2022-03-14 11:15:04 +01:00
|
|
|
// might not be the correct place to implement this but for now let's just do it here
|
2012-03-08 23:42:38 +01:00
|
|
|
$source_status['live_dj_source'] = $live_dj;
|
|
|
|
$source_status['master_dj_source'] = $master_dj;
|
|
|
|
$this->view->source_status = $source_status;
|
2012-07-11 00:53:06 +02:00
|
|
|
|
2012-03-09 18:27:04 +01:00
|
|
|
$switch_status['live_dj_source'] = $live_dj_switch;
|
|
|
|
$switch_status['master_dj_source'] = $master_dj_switch;
|
2012-03-13 19:34:48 +01:00
|
|
|
$switch_status['scheduled_play'] = $scheduled_play_switch;
|
2012-03-09 18:27:04 +01:00
|
|
|
$this->view->switch_status = $switch_status;
|
2012-07-11 00:53:06 +02:00
|
|
|
|
2011-11-15 21:45:08 +01:00
|
|
|
$this->view->entries = $range;
|
2021-10-11 16:10:47 +02:00
|
|
|
$this->view->show_name = isset($show[0]) ? $show[0]['name'] : '';
|
2010-12-22 00:28:17 +01:00
|
|
|
}
|
2010-12-07 20:19:27 +01:00
|
|
|
|
2011-02-03 00:08:22 +01:00
|
|
|
public function showContentDialogAction()
|
2011-01-28 06:23:39 +01:00
|
|
|
{
|
2011-02-09 20:12:07 +01:00
|
|
|
$showInstanceId = $this->_getParam('id');
|
2021-10-11 16:10:47 +02:00
|
|
|
|
2012-07-16 03:17:13 +02:00
|
|
|
try {
|
2011-11-10 21:35:27 +01:00
|
|
|
$show = new Application_Model_ShowInstance($showInstanceId);
|
2012-07-16 03:17:13 +02:00
|
|
|
} catch (Exception $e) {
|
2011-11-10 21:35:27 +01:00
|
|
|
$this->view->show_error = true;
|
2012-07-16 03:17:13 +02:00
|
|
|
|
2011-11-10 21:35:27 +01:00
|
|
|
return false;
|
|
|
|
}
|
2019-09-20 02:07:50 +02:00
|
|
|
|
2011-03-31 22:39:32 +02:00
|
|
|
$originalShowId = $show->isRebroadcast();
|
2012-07-16 03:17:13 +02:00
|
|
|
if (!is_null($originalShowId)) {
|
|
|
|
try {
|
2011-11-10 21:35:27 +01:00
|
|
|
$originalShow = new Application_Model_ShowInstance($originalShowId);
|
2012-07-16 03:17:13 +02:00
|
|
|
} catch (Exception $e) {
|
2011-11-10 21:35:27 +01:00
|
|
|
$this->view->show_error = true;
|
2012-07-16 03:17:13 +02:00
|
|
|
|
2011-11-10 21:35:27 +01:00
|
|
|
return false;
|
|
|
|
}
|
2011-03-31 22:39:32 +02:00
|
|
|
$originalShowName = $originalShow->getName();
|
2011-11-12 04:24:37 +01:00
|
|
|
$originalShowStart = $originalShow->getShowInstanceStart();
|
2011-03-31 22:39:32 +02:00
|
|
|
|
2022-03-14 11:15:04 +01:00
|
|
|
// convert from UTC to user's timezone for display.
|
2013-12-04 22:26:11 +01:00
|
|
|
$displayTimeZone = new DateTimeZone(Application_Model_Preference::GetTimezone());
|
2021-10-11 16:10:47 +02:00
|
|
|
$originalDateTime = new DateTime($originalShowStart, new DateTimeZone('UTC'));
|
2013-12-04 22:26:11 +01:00
|
|
|
$originalDateTime->setTimezone($displayTimeZone);
|
2019-09-20 02:07:50 +02:00
|
|
|
|
2011-03-31 22:39:32 +02:00
|
|
|
$this->view->additionalShowInfo =
|
2021-10-11 16:10:47 +02:00
|
|
|
sprintf(
|
|
|
|
_('Rebroadcast of show %s from %s at %s'),
|
2012-11-15 18:55:45 +01:00
|
|
|
$originalShowName,
|
2021-10-11 16:10:47 +02:00
|
|
|
$originalDateTime->format('l, F jS'),
|
|
|
|
$originalDateTime->format('G:i')
|
|
|
|
);
|
2011-03-31 22:39:32 +02:00
|
|
|
}
|
2012-01-05 16:30:37 +01:00
|
|
|
$this->view->showLength = $show->getShowLength();
|
|
|
|
$this->view->timeFilled = $show->getTimeScheduled();
|
|
|
|
$this->view->percentFilled = $show->getPercentScheduled();
|
|
|
|
$this->view->showContent = $show->getShowListContent();
|
2011-02-03 00:08:22 +01:00
|
|
|
$this->view->dialog = $this->view->render('schedule/show-content-dialog.phtml');
|
2013-02-04 18:12:57 +01:00
|
|
|
$this->view->showTitle = htmlspecialchars($show->getName());
|
2011-02-03 00:08:22 +01:00
|
|
|
unset($this->view->showContent);
|
2011-01-15 20:59:41 +01:00
|
|
|
}
|
2011-02-09 20:12:07 +01:00
|
|
|
|
2013-03-27 21:25:39 +01:00
|
|
|
public function populateRepeatingShowInstanceFormAction()
|
2013-03-27 14:02:49 +01:00
|
|
|
{
|
|
|
|
$showId = $this->_getParam('showId');
|
|
|
|
$instanceId = $this->_getParam('instanceId');
|
|
|
|
$service_showForm = new Application_Service_ShowFormService($showId, $instanceId);
|
2012-04-12 17:54:51 +02:00
|
|
|
|
2013-03-27 14:02:49 +01:00
|
|
|
$forms = $this->createShowFormAction();
|
2012-07-11 00:53:06 +02:00
|
|
|
|
2013-03-27 14:02:49 +01:00
|
|
|
$service_showForm->delegateShowInstanceFormPopulation($forms);
|
2012-07-11 00:53:06 +02:00
|
|
|
|
2013-03-27 14:02:49 +01:00
|
|
|
$this->view->addNewShow = false;
|
2021-10-11 16:10:47 +02:00
|
|
|
$this->view->action = 'edit-repeating-show-instance';
|
2012-04-12 17:54:51 +02:00
|
|
|
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
2013-03-26 21:03:53 +01:00
|
|
|
}
|
2012-04-12 17:54:51 +02:00
|
|
|
|
2012-04-11 22:45:03 +02:00
|
|
|
public function populateShowFormAction()
|
2011-02-09 20:12:07 +01:00
|
|
|
{
|
2013-03-27 14:02:49 +01:00
|
|
|
$service_user = new Application_Service_UserService();
|
|
|
|
$currentUser = $service_user->getCurrentUser();
|
2011-11-15 15:56:52 +01:00
|
|
|
|
2013-03-21 15:05:11 +01:00
|
|
|
$showId = $this->_getParam('showId');
|
|
|
|
$instanceId = $this->_getParam('instanceId');
|
|
|
|
$service_showForm = new Application_Service_ShowFormService($showId, $instanceId);
|
2012-07-11 00:53:06 +02:00
|
|
|
|
2013-03-27 14:02:49 +01:00
|
|
|
$isAdminOrPM = $currentUser->isAdminOrPM();
|
2011-05-26 21:41:47 +02:00
|
|
|
|
2013-03-21 15:05:11 +01:00
|
|
|
$forms = $this->createShowFormAction();
|
2011-04-12 06:14:26 +02:00
|
|
|
|
2013-03-27 14:02:49 +01:00
|
|
|
$service_showForm->delegateShowFormPopulation($forms);
|
2012-07-11 00:53:06 +02:00
|
|
|
|
2012-07-16 03:17:13 +02:00
|
|
|
if (!$isAdminOrPM) {
|
2013-03-21 15:05:11 +01:00
|
|
|
foreach ($forms as $form) {
|
|
|
|
$form->disable();
|
|
|
|
}
|
2011-09-02 21:24:35 +02:00
|
|
|
}
|
2011-05-26 21:41:47 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$this->view->action = 'edit-show';
|
2011-04-12 06:14:26 +02:00
|
|
|
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
|
|
|
$this->view->entries = 5;
|
2011-02-09 20:12:07 +01:00
|
|
|
}
|
|
|
|
|
2012-07-16 03:17:13 +02:00
|
|
|
public function getFormAction()
|
|
|
|
{
|
2013-03-27 14:02:49 +01:00
|
|
|
$service_user = new Application_Service_UserService();
|
|
|
|
$currentUser = $service_user->getCurrentUser();
|
2012-07-11 00:53:06 +02:00
|
|
|
|
2013-03-27 14:02:49 +01:00
|
|
|
if ($currentUser->isAdminOrPM()) {
|
2013-03-08 22:08:43 +01:00
|
|
|
$this->createShowFormAction(true);
|
2013-05-08 22:28:45 +02:00
|
|
|
$this->view->addNewShow = true;
|
2012-04-09 18:19:22 +02:00
|
|
|
$this->view->form = $this->view->render('schedule/add-show-form.phtml');
|
|
|
|
}
|
2011-04-13 22:59:53 +02:00
|
|
|
}
|
2012-07-11 00:53:06 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
public function editRepeatingShowInstanceAction()
|
|
|
|
{
|
2011-02-12 23:21:37 +01:00
|
|
|
$js = $this->_getParam('data');
|
2021-10-11 16:10:47 +02:00
|
|
|
$data = [];
|
2011-03-22 14:55:33 +01:00
|
|
|
|
2022-03-14 11:15:04 +01:00
|
|
|
// need to convert from serialized jQuery array.
|
2012-07-16 03:17:13 +02:00
|
|
|
foreach ($js as $j) {
|
2021-10-11 16:10:47 +02:00
|
|
|
$data[$j['name']] = $j['value'];
|
2011-02-10 21:00:55 +01:00
|
|
|
}
|
2012-07-11 00:53:06 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$data['add_show_hosts'] = $this->_getParam('hosts');
|
2013-03-27 21:25:39 +01:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$log_vars = [];
|
|
|
|
$log_vars['url'] = $_SERVER['HTTP_HOST'];
|
|
|
|
$log_vars['action'] = 'schedule/edit-repeating-show-instance';
|
|
|
|
$log_vars['params'] = [];
|
|
|
|
$log_vars['params']['form_data'] = $data;
|
2014-06-17 20:17:28 +02:00
|
|
|
Logging::info($log_vars);
|
2019-09-20 02:07:50 +02:00
|
|
|
|
2013-03-27 21:25:39 +01:00
|
|
|
$service_showForm = new Application_Service_ShowFormService(
|
2021-10-11 16:10:47 +02:00
|
|
|
$data['add_show_id'],
|
|
|
|
$data['add_show_instance_id']
|
|
|
|
);
|
2013-04-25 15:00:37 +02:00
|
|
|
$service_show = new Application_Service_ShowService(null, $data);
|
2013-03-27 21:25:39 +01:00
|
|
|
|
|
|
|
$forms = $this->createShowFormAction();
|
|
|
|
|
Feature: Support php7.4 (#1354)
* Run CI tests against php 7.4
* Sort composer dependencies
* Remove unused Aws S3 php library
* Pin simplepie dependency to ^1.5
* Pin getid3 dependency to ^1.9
* Pin composer semver to ^3.2
* Pin php-amqplib to ^2.12
* Drop sentry logging support
* Update composer dependencies
* Move propel regenerate to Makefile
* Regenerate propel files with v1.7.0
* Pin propel orm to ^1.7
* Regenerate propel files with v1.7.2
* fix: generator_version in airtime-conf-production.php
* Replace propel/propel1 with jooola/propel1
* Regenerate propel files with v1.7.3-dev
* Fix php7.4 compatibility
Using php-cs-fixer:
'@PhpCsFixer' => true,
'concat_space' => ['spacing' => 'one'],
'ordered_class_elements' => false,
'yoda_style' => false,
'@PHP74Migration' => true,
'assign_null_coalescing_to_coalesce_equal' => false,
'ternary_to_null_coalescing' => false,
'heredoc_indentation' => false,
'@PHP74Migration:risky' => true,
'declare_strict_types' => false,
'void_return' => false,
'use_arrow_functions' => false,
* Fix pre-commit
2021-10-17 17:19:53 +02:00
|
|
|
[$data, $validateStartDate, $validateStartTime, $originalShowStartDateTime] =
|
2013-03-27 21:25:39 +01:00
|
|
|
$service_showForm->preEditShowValidationCheck($data);
|
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
if ($service_showForm->validateShowForms(
|
|
|
|
$forms,
|
|
|
|
$data,
|
|
|
|
$validateStartDate,
|
|
|
|
$originalShowStartDateTime,
|
|
|
|
true,
|
|
|
|
$data['add_show_instance_id']
|
|
|
|
)) {
|
2013-12-12 22:47:55 +01:00
|
|
|
$service_show->editRepeatingShowInstance($data);
|
2013-03-27 21:25:39 +01:00
|
|
|
|
2012-04-12 19:29:49 +02:00
|
|
|
$this->view->addNewShow = true;
|
|
|
|
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
2021-10-11 16:10:47 +02:00
|
|
|
} else {
|
2013-03-27 21:25:39 +01:00
|
|
|
if (!$validateStartDate) {
|
2021-10-11 16:10:47 +02:00
|
|
|
$this->view->when->getElement('add_show_start_date')->setOptions(['disabled' => true]);
|
2013-03-27 21:25:39 +01:00
|
|
|
}
|
|
|
|
if (!$validateStartTime) {
|
2021-10-11 16:10:47 +02:00
|
|
|
$this->view->when->getElement('add_show_start_time')->setOptions(['disabled' => true]);
|
2013-03-27 21:25:39 +01:00
|
|
|
}
|
2021-10-11 16:10:47 +02:00
|
|
|
$this->view->rr->getElement('add_show_record')->setOptions(['disabled' => true]);
|
2012-04-12 19:29:49 +02:00
|
|
|
$this->view->addNewShow = false;
|
2021-10-11 16:10:47 +02:00
|
|
|
$this->view->action = 'edit-repeating-show-instance';
|
2012-04-12 19:29:49 +02:00
|
|
|
$this->view->form = $this->view->render('schedule/add-show-form.phtml');
|
|
|
|
}
|
2013-03-27 21:25:39 +01:00
|
|
|
}
|
2012-07-11 00:53:06 +02:00
|
|
|
|
2012-07-16 03:17:13 +02:00
|
|
|
public function editShowAction()
|
|
|
|
{
|
2012-04-11 22:45:03 +02:00
|
|
|
$js = $this->_getParam('data');
|
2021-10-11 16:10:47 +02:00
|
|
|
$data = [];
|
2012-04-11 22:45:03 +02:00
|
|
|
|
2022-03-14 11:15:04 +01:00
|
|
|
// need to convert from serialized jQuery array.
|
2012-07-16 03:17:13 +02:00
|
|
|
foreach ($js as $j) {
|
2021-10-11 16:10:47 +02:00
|
|
|
$data[$j['name']] = $j['value'];
|
2011-11-20 20:46:01 +01:00
|
|
|
}
|
2011-05-30 18:24:39 +02:00
|
|
|
|
2013-03-21 15:05:11 +01:00
|
|
|
$service_showForm = new Application_Service_ShowFormService(
|
2021-10-11 16:10:47 +02:00
|
|
|
$data['add_show_id']
|
|
|
|
);
|
2013-04-25 15:00:37 +02:00
|
|
|
$service_show = new Application_Service_ShowService(null, $data, true);
|
2013-03-21 15:05:11 +01:00
|
|
|
|
2022-03-14 11:15:04 +01:00
|
|
|
// TODO: move this to js
|
2021-10-11 16:10:47 +02:00
|
|
|
$data['add_show_hosts'] = $this->_getParam('hosts');
|
|
|
|
$data['add_show_day_check'] = $this->_getParam('days');
|
2011-02-10 21:00:55 +01:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
if ($data['add_show_day_check'] == '') {
|
2011-04-02 00:18:32 +02:00
|
|
|
$data['add_show_day_check'] = null;
|
|
|
|
}
|
2019-09-20 02:07:50 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$log_vars = [];
|
|
|
|
$log_vars['url'] = $_SERVER['HTTP_HOST'];
|
|
|
|
$log_vars['action'] = 'schedule/edit-show';
|
|
|
|
$log_vars['params'] = [];
|
|
|
|
$log_vars['params']['form_data'] = $data;
|
2014-06-17 20:17:28 +02:00
|
|
|
Logging::info($log_vars);
|
2012-07-11 00:53:06 +02:00
|
|
|
|
2013-03-11 21:18:40 +01:00
|
|
|
$forms = $this->createShowFormAction();
|
2012-07-11 00:53:06 +02:00
|
|
|
|
Feature: Support php7.4 (#1354)
* Run CI tests against php 7.4
* Sort composer dependencies
* Remove unused Aws S3 php library
* Pin simplepie dependency to ^1.5
* Pin getid3 dependency to ^1.9
* Pin composer semver to ^3.2
* Pin php-amqplib to ^2.12
* Drop sentry logging support
* Update composer dependencies
* Move propel regenerate to Makefile
* Regenerate propel files with v1.7.0
* Pin propel orm to ^1.7
* Regenerate propel files with v1.7.2
* fix: generator_version in airtime-conf-production.php
* Replace propel/propel1 with jooola/propel1
* Regenerate propel files with v1.7.3-dev
* Fix php7.4 compatibility
Using php-cs-fixer:
'@PhpCsFixer' => true,
'concat_space' => ['spacing' => 'one'],
'ordered_class_elements' => false,
'yoda_style' => false,
'@PHP74Migration' => true,
'assign_null_coalescing_to_coalesce_equal' => false,
'ternary_to_null_coalescing' => false,
'heredoc_indentation' => false,
'@PHP74Migration:risky' => true,
'declare_strict_types' => false,
'void_return' => false,
'use_arrow_functions' => false,
* Fix pre-commit
2021-10-17 17:19:53 +02:00
|
|
|
[$data, $validateStartDate, $validateStartTime, $originalShowStartDateTime] =
|
2013-03-21 15:05:11 +01:00
|
|
|
$service_showForm->preEditShowValidationCheck($data);
|
2019-09-20 02:07:50 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
if ($service_showForm->validateShowForms(
|
|
|
|
$forms,
|
|
|
|
$data,
|
|
|
|
$validateStartDate,
|
|
|
|
$originalShowStartDateTime,
|
|
|
|
true,
|
|
|
|
$data['add_show_instance_id']
|
|
|
|
)) {
|
2015-02-04 21:09:27 +01:00
|
|
|
// Get the show ID from the show service to pass as a parameter to the RESTful ShowImageController
|
2014-09-17 16:27:14 +02:00
|
|
|
$this->view->showId = $service_show->addUpdateShow($data);
|
2019-09-20 02:07:50 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$this->view->addNewShow = true;
|
2012-04-11 22:45:03 +02:00
|
|
|
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
|
|
|
} else {
|
2012-07-16 03:17:13 +02:00
|
|
|
if (!$validateStartDate) {
|
2021-10-11 16:10:47 +02:00
|
|
|
$this->view->when->getElement('add_show_start_date')->setOptions(['disabled' => true]);
|
2012-04-19 18:57:13 +02:00
|
|
|
}
|
2012-07-16 03:17:13 +02:00
|
|
|
if (!$validateStartTime) {
|
2021-10-11 16:10:47 +02:00
|
|
|
$this->view->when->getElement('add_show_start_time')->setOptions(['disabled' => true]);
|
2011-09-02 21:24:35 +02:00
|
|
|
}
|
2022-03-14 11:15:04 +01:00
|
|
|
// $this->view->rr->getElement('add_show_record')->setOptions(array('disabled' => true));
|
2019-09-20 02:07:50 +02:00
|
|
|
|
2012-04-11 22:45:03 +02:00
|
|
|
$this->view->addNewShow = false;
|
2021-10-11 16:10:47 +02:00
|
|
|
$this->view->action = 'edit-show';
|
2012-04-11 22:45:03 +02:00
|
|
|
$this->view->form = $this->view->render('schedule/add-show-form.phtml');
|
2011-09-02 21:24:35 +02:00
|
|
|
}
|
2012-04-11 22:45:03 +02:00
|
|
|
}
|
2012-07-11 00:53:06 +02:00
|
|
|
|
2012-07-16 03:17:13 +02:00
|
|
|
public function addShowAction()
|
|
|
|
{
|
2013-03-21 15:05:11 +01:00
|
|
|
$service_showForm = new Application_Service_ShowFormService(null);
|
2019-09-20 02:07:50 +02:00
|
|
|
|
2012-04-11 22:45:03 +02:00
|
|
|
$js = $this->_getParam('data');
|
2021-10-11 16:10:47 +02:00
|
|
|
$data = [];
|
2011-11-15 15:56:52 +01:00
|
|
|
|
2022-03-14 11:15:04 +01:00
|
|
|
// need to convert from serialized jQuery array.
|
2012-07-16 03:17:13 +02:00
|
|
|
foreach ($js as $j) {
|
2021-10-11 16:10:47 +02:00
|
|
|
$data[$j['name']] = $j['value'];
|
2011-02-10 21:00:55 +01:00
|
|
|
}
|
|
|
|
|
2013-04-25 15:00:37 +02:00
|
|
|
$service_show = new Application_Service_ShowService(null, $data);
|
|
|
|
|
2013-02-25 15:15:03 +01:00
|
|
|
// TODO: move this to js
|
2021-10-11 16:10:47 +02:00
|
|
|
$data['add_show_hosts'] = $this->_getParam('hosts');
|
|
|
|
$data['add_show_day_check'] = $this->_getParam('days');
|
2019-09-20 02:07:50 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
if ($data['add_show_day_check'] == '') {
|
2012-04-11 22:45:03 +02:00
|
|
|
$data['add_show_day_check'] = null;
|
|
|
|
}
|
2019-09-20 02:07:50 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$log_vars = [];
|
|
|
|
$log_vars['url'] = $_SERVER['HTTP_HOST'];
|
|
|
|
$log_vars['action'] = 'schedule/add-show';
|
|
|
|
$log_vars['params'] = [];
|
|
|
|
$log_vars['params']['form_data'] = $data;
|
2014-06-17 20:17:28 +02:00
|
|
|
Logging::info($log_vars);
|
2019-09-20 02:07:50 +02:00
|
|
|
|
2013-03-08 22:08:43 +01:00
|
|
|
$forms = $this->createShowFormAction();
|
2019-09-20 02:07:50 +02:00
|
|
|
|
2013-03-08 22:08:43 +01:00
|
|
|
$this->view->addNewShow = true;
|
2015-07-14 16:35:21 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
if ($data['add_show_start_now'] == 'now') {
|
2022-03-14 11:15:04 +01:00
|
|
|
// have to use the timezone the user has entered in the form to check past/present
|
2021-10-11 16:10:47 +02:00
|
|
|
$showTimezone = new DateTimeZone($data['add_show_timezone']);
|
|
|
|
$nowDateTime = new DateTime('now', $showTimezone);
|
2022-03-14 11:15:04 +01:00
|
|
|
// $showStartDateTime = new DateTime($start_time, $showTimezone);
|
|
|
|
// $showEndDateTime = new DateTime($end_time, $showTimezone);
|
2015-07-14 16:35:21 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$data['add_show_start_time'] = $nowDateTime->format('H:i');
|
|
|
|
$data['add_show_start_date'] = $nowDateTime->format('Y-m-d');
|
2015-07-14 16:35:21 +02:00
|
|
|
}
|
|
|
|
|
2013-03-21 15:05:11 +01:00
|
|
|
if ($service_showForm->validateShowForms($forms, $data)) {
|
2021-10-11 16:10:47 +02:00
|
|
|
// Get the show ID from the show service to pass as a parameter to the RESTful ShowImageController
|
|
|
|
$this->view->showId = $service_show->addUpdateShow($data);
|
2019-09-20 02:07:50 +02:00
|
|
|
|
2022-03-14 11:15:04 +01:00
|
|
|
// send new show forms to the user
|
2013-03-08 22:08:43 +01:00
|
|
|
$this->createShowFormAction(true);
|
2013-05-15 21:47:45 +02:00
|
|
|
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
2019-09-20 02:07:50 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
Logging::debug('Show creation succeeded');
|
2012-04-11 22:45:03 +02:00
|
|
|
} else {
|
2021-10-11 16:10:47 +02:00
|
|
|
$this->view->form = $this->view->render('schedule/add-show-form.phtml');
|
|
|
|
Logging::debug('Show creation failed');
|
2011-02-12 23:21:37 +01:00
|
|
|
}
|
2011-02-10 21:00:55 +01:00
|
|
|
}
|
2019-09-20 02:07:50 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
public function createShowFormAction($populateDefaults = false)
|
2011-02-12 23:21:37 +01:00
|
|
|
{
|
2013-03-21 15:05:11 +01:00
|
|
|
$service_showForm = new Application_Service_ShowFormService();
|
2011-03-22 14:55:33 +01:00
|
|
|
|
2013-03-21 15:05:11 +01:00
|
|
|
$forms = $service_showForm->createShowForms();
|
2011-02-12 23:21:37 +01:00
|
|
|
|
2013-03-08 22:08:43 +01:00
|
|
|
// populate forms with default values
|
2013-03-21 15:05:11 +01:00
|
|
|
if ($populateDefaults) {
|
|
|
|
$service_showForm->populateNewShowForms(
|
2021-10-11 16:10:47 +02:00
|
|
|
$forms['what'],
|
|
|
|
$forms['when'],
|
|
|
|
$forms['repeats']
|
|
|
|
);
|
2013-03-08 22:08:43 +01:00
|
|
|
}
|
2012-07-16 03:17:13 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$this->view->what = $forms['what'];
|
|
|
|
$this->view->autoplaylist = $forms['autoplaylist'];
|
|
|
|
$this->view->when = $forms['when'];
|
|
|
|
$this->view->repeats = $forms['repeats'];
|
|
|
|
$this->view->live = $forms['live'];
|
|
|
|
$this->view->rr = $forms['record'];
|
|
|
|
$this->view->absoluteRebroadcast = $forms['abs_rebroadcast'];
|
|
|
|
$this->view->rebroadcast = $forms['rebroadcast'];
|
|
|
|
$this->view->who = $forms['who'];
|
|
|
|
$this->view->style = $forms['style'];
|
2013-02-25 23:31:43 +01:00
|
|
|
|
2013-03-08 22:08:43 +01:00
|
|
|
return $forms;
|
|
|
|
}
|
2013-02-25 23:31:43 +01:00
|
|
|
|
2013-04-03 17:46:46 +02:00
|
|
|
public function deleteShowAction()
|
2011-02-12 23:21:37 +01:00
|
|
|
{
|
2013-04-03 17:46:46 +02:00
|
|
|
$instanceId = $this->_getParam('id');
|
2019-09-20 02:07:50 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$log_vars = [];
|
|
|
|
$log_vars['url'] = $_SERVER['HTTP_HOST'];
|
|
|
|
$log_vars['action'] = 'schedule/delete-show';
|
|
|
|
$log_vars['params'] = [];
|
|
|
|
$log_vars['params']['instance id'] = $instanceId;
|
2014-06-17 20:17:28 +02:00
|
|
|
Logging::info($log_vars);
|
2011-02-12 23:21:37 +01:00
|
|
|
|
2013-04-03 17:46:46 +02:00
|
|
|
$service_show = new Application_Service_ShowService();
|
|
|
|
$showId = $service_show->deleteShow($instanceId);
|
2019-09-20 02:07:50 +02:00
|
|
|
|
2013-04-03 17:46:46 +02:00
|
|
|
if (!$showId) {
|
|
|
|
$this->view->show_error = true;
|
2011-03-22 14:55:33 +01:00
|
|
|
}
|
2013-04-03 17:46:46 +02:00
|
|
|
$this->view->show_id = $showId;
|
2011-02-12 23:21:37 +01:00
|
|
|
}
|
2011-03-10 04:25:02 +01:00
|
|
|
|
|
|
|
public function cancelCurrentShowAction()
|
|
|
|
{
|
2021-10-11 16:10:47 +02:00
|
|
|
$log_vars = [];
|
|
|
|
$log_vars['url'] = $_SERVER['HTTP_HOST'];
|
|
|
|
$log_vars['action'] = 'schedule/cancel-current-show';
|
|
|
|
$log_vars['params'] = [];
|
|
|
|
$log_vars['params']['instance id'] = $this->_getParam('id');
|
2014-06-17 20:17:28 +02:00
|
|
|
Logging::info($log_vars);
|
2019-09-20 02:07:50 +02:00
|
|
|
|
2012-07-11 00:51:32 +02:00
|
|
|
$user = Application_Model_User::getCurrentUser();
|
2011-03-22 14:55:33 +01:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
if ($user->isUserType([UTYPE_SUPERADMIN, UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER])) {
|
2012-04-02 15:20:13 +02:00
|
|
|
$id = $this->_getParam('id');
|
2012-07-11 00:53:06 +02:00
|
|
|
|
2012-07-16 03:17:13 +02:00
|
|
|
try {
|
|
|
|
$scheduler = new Application_Model_Scheduler();
|
2012-04-18 21:38:47 +02:00
|
|
|
$scheduler->cancelShow($id);
|
2013-02-13 17:29:43 +01:00
|
|
|
Application_Model_StoredFile::updatePastFilesIsScheduled();
|
2012-04-18 21:38:47 +02:00
|
|
|
// send kick out source stream signal to pypo
|
2021-10-11 16:10:47 +02:00
|
|
|
$data = ['sourcename' => 'live_dj'];
|
|
|
|
Application_Model_RabbitMq::SendMessageToPypo('disconnect_source', $data);
|
2012-07-16 03:17:13 +02:00
|
|
|
} catch (Exception $e) {
|
|
|
|
$this->view->error = $e->getMessage();
|
2012-08-22 00:41:56 +02:00
|
|
|
Logging::info($e->getMessage());
|
2011-11-10 21:35:27 +01:00
|
|
|
}
|
2011-03-10 04:25:02 +01:00
|
|
|
}
|
|
|
|
}
|
2011-05-26 21:41:47 +02:00
|
|
|
|
2012-07-16 03:17:13 +02:00
|
|
|
public function contentContextMenuAction()
|
|
|
|
{
|
2012-07-11 00:53:06 +02:00
|
|
|
$id = $this->_getParam('id');
|
2011-05-04 22:07:29 +02:00
|
|
|
|
|
|
|
$params = '/format/json/id/#id#/';
|
|
|
|
|
|
|
|
$paramsPop = str_replace('#id#', $id, $params);
|
|
|
|
|
2014-09-17 00:03:14 +02:00
|
|
|
// added for download
|
2011-05-04 22:07:29 +02:00
|
|
|
$id = $this->_getParam('id');
|
|
|
|
|
|
|
|
$file_id = $this->_getParam('id', null);
|
2013-04-20 02:24:05 +02:00
|
|
|
$file = Application_Model_StoredFile::RecallById($file_id);
|
2011-11-15 15:56:52 +01:00
|
|
|
|
2011-10-14 00:12:33 +02:00
|
|
|
$baseUrl = $this->getRequest()->getBaseUrl();
|
2021-10-11 16:10:47 +02:00
|
|
|
$url = $file->getRelativeFileUrl($baseUrl) . 'download/true';
|
|
|
|
$menu = [];
|
2022-07-07 20:01:15 +02:00
|
|
|
$menu[] = [
|
|
|
|
'action' => ['type' => 'gourl', 'url' => $url],
|
|
|
|
'title' => _('Download'),
|
|
|
|
];
|
2011-05-04 22:07:29 +02:00
|
|
|
|
2022-03-14 11:15:04 +01:00
|
|
|
// returns format jjmenu is looking for.
|
2013-02-07 21:41:47 +01:00
|
|
|
$this->_helper->json->sendJson($menu);
|
2011-05-04 22:07:29 +02:00
|
|
|
}
|
2011-11-15 15:56:52 +01:00
|
|
|
|
2011-10-14 20:17:06 +02:00
|
|
|
/**
|
|
|
|
* Sets the user specific preference for which time scale to use in Calendar.
|
|
|
|
* This is only being used by schedule.js at the moment.
|
|
|
|
*/
|
2012-07-16 03:17:13 +02:00
|
|
|
public function setTimeScaleAction()
|
|
|
|
{
|
2012-07-11 00:53:06 +02:00
|
|
|
Application_Model_Preference::SetCalendarTimeScale($this->_getParam('timeScale'));
|
2011-10-14 20:17:06 +02:00
|
|
|
}
|
2011-11-15 15:56:52 +01:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
/**
|
2011-10-18 16:10:35 +02:00
|
|
|
* Sets the user specific preference for which time interval to use in Calendar.
|
|
|
|
* This is only being used by schedule.js at the moment.
|
|
|
|
*/
|
2012-07-16 03:17:13 +02:00
|
|
|
public function setTimeIntervalAction()
|
|
|
|
{
|
2012-07-11 00:53:06 +02:00
|
|
|
Application_Model_Preference::SetCalendarTimeInterval($this->_getParam('timeInterval'));
|
2011-10-18 16:10:35 +02:00
|
|
|
}
|
2012-07-11 00:53:06 +02:00
|
|
|
|
2012-07-16 03:17:13 +02:00
|
|
|
public function calculateDurationAction()
|
|
|
|
{
|
2021-10-11 16:10:47 +02:00
|
|
|
$start = $this->_getParam('startTime');
|
|
|
|
$end = $this->_getParam('endTime');
|
|
|
|
$timezone = $this->_getParam('timezone');
|
2019-09-20 02:07:50 +02:00
|
|
|
|
2013-03-26 21:03:53 +01:00
|
|
|
$service_showForm = new Application_Service_ShowFormService();
|
2013-12-05 21:12:01 +01:00
|
|
|
$result = $service_showForm->calculateDuration($start, $end, $timezone);
|
2012-07-11 00:53:06 +02:00
|
|
|
|
2012-04-25 23:21:25 +02:00
|
|
|
echo Zend_Json::encode($result);
|
2021-10-11 16:10:47 +02:00
|
|
|
|
2022-07-11 17:07:30 +02:00
|
|
|
exit;
|
2012-04-25 23:21:25 +02:00
|
|
|
}
|
2013-02-01 23:47:07 +01:00
|
|
|
|
|
|
|
public function updateFutureIsScheduledAction()
|
|
|
|
{
|
|
|
|
$schedId = $this->_getParam('schedId');
|
2019-09-20 02:07:50 +02:00
|
|
|
|
2013-10-02 17:24:48 +02:00
|
|
|
$scheduleService = new Application_Service_SchedulerService();
|
|
|
|
$redrawLibTable = $scheduleService->updateFutureIsScheduled($schedId, false);
|
2019-09-20 02:07:50 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$this->_helper->json->sendJson(['redrawLibTable' => $redrawLibTable]);
|
2013-02-01 23:47:07 +01:00
|
|
|
}
|
2013-09-24 21:04:25 +02:00
|
|
|
|
|
|
|
public function localizeStartEndTimeAction()
|
|
|
|
{
|
2013-09-24 22:23:45 +02:00
|
|
|
$newTimezone = $this->_getParam('newTimezone');
|
|
|
|
$oldTimezone = $this->_getParam('oldTimezone');
|
2021-10-11 16:10:47 +02:00
|
|
|
$localTime = [];
|
2013-09-24 21:04:25 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$localTime['start'] = Application_Service_ShowFormService::localizeDateTime(
|
|
|
|
$this->_getParam('startDate'),
|
|
|
|
$this->_getParam('startTime'),
|
|
|
|
$newTimezone,
|
|
|
|
$oldTimezone
|
|
|
|
);
|
2013-09-24 21:04:25 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$localTime['end'] = Application_Service_ShowFormService::localizeDateTime(
|
|
|
|
$this->_getParam('endDate'),
|
|
|
|
$this->_getParam('endTime'),
|
|
|
|
$newTimezone,
|
|
|
|
$oldTimezone
|
|
|
|
);
|
2013-09-24 21:04:25 +02:00
|
|
|
|
|
|
|
$this->_helper->json->sendJson($localTime);
|
|
|
|
}
|
2012-04-25 23:21:25 +02:00
|
|
|
}
|