CC-6064: Allow shows to be started "now"
This commit is contained in:
parent
8e15dd5e99
commit
66caf2574a
9 changed files with 117 additions and 21 deletions
|
@ -98,6 +98,9 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.columnFilter.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/libs/moment.min.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/libs/moment-timezone-with-data-2010-2020.min.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/events/library_showbuilder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/library.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
@ -584,7 +587,20 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$forms = $this->createShowFormAction();
|
||||
|
||||
$this->view->addNewShow = true;
|
||||
|
||||
|
||||
if ($data['add_show_start_now'] == "now") {
|
||||
|
||||
//have to use the timezone the user has entered in the form to check past/present
|
||||
$showTimezone = new DateTimeZone($data["add_show_timezone"]);
|
||||
$nowDateTime = new DateTime("now", $showTimezone);
|
||||
//$showStartDateTime = new DateTime($start_time, $showTimezone);
|
||||
//$showEndDateTime = new DateTime($end_time, $showTimezone);
|
||||
|
||||
$data['add_show_start_time'] = $nowDateTime->format("H:i");
|
||||
$data['add_show_start_date'] = $nowDateTime->format("Y-m-d");
|
||||
}
|
||||
|
||||
|
||||
if ($service_showForm->validateShowForms($forms, $data)) {
|
||||
// Get the show ID from the show service to pass as a parameter to the RESTful ShowImageController
|
||||
$this->view->showId = $service_show->addUpdateShow($data);
|
||||
|
|
|
@ -15,11 +15,26 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
|||
"/^[0-2]?[0-9]:[0-5][0-9]$/",
|
||||
_("'%value%' does not fit the time format 'HH:mm'"));
|
||||
|
||||
|
||||
// Add start date element
|
||||
$startNow = new Zend_Form_Element_Radio('add_show_start_now');
|
||||
$startNow->setRequired(false)
|
||||
->setLabel(_('Start Time:'))
|
||||
->addMultiOptions(array(
|
||||
'now' => 'Now',
|
||||
'future' => 'In the Future:'
|
||||
))
|
||||
->setValue('future')
|
||||
->setDecorators(array('ViewHelper'));
|
||||
//$startDate->setAttrib('alt', 'date');
|
||||
$this->addElement($startNow);
|
||||
|
||||
|
||||
// Add start date element
|
||||
$startDate = new Zend_Form_Element_Text('add_show_start_date');
|
||||
$startDate->class = 'input_text';
|
||||
$startDate->setRequired(true)
|
||||
->setLabel(_('Date/Time Start:'))
|
||||
->setLabel(_('In the Future:'))
|
||||
->setValue(date("Y-m-d"))
|
||||
->setFilters(array('StringTrim'))
|
||||
->setValidators(array(
|
||||
|
@ -46,7 +61,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
|||
$endDate = new Zend_Form_Element_Text('add_show_end_date_no_repeat');
|
||||
$endDate->class = 'input_text';
|
||||
$endDate->setRequired(true)
|
||||
->setLabel(_('Date/Time End:'))
|
||||
->setLabel(_('End Time:'))
|
||||
->setValue(date("Y-m-d"))
|
||||
->setFilters(array('StringTrim'))
|
||||
->setValidators(array(
|
||||
|
@ -119,7 +134,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
|||
$showStartDateTime = new DateTime($start_time, $showTimezone);
|
||||
$showEndDateTime = new DateTime($end_time, $showTimezone);
|
||||
|
||||
if ($validateStartDate) {
|
||||
if ($validateStartDate && ($formData['add_show_start_now'] != "now")) {
|
||||
if ($showStartDateTime < $nowDateTime) {
|
||||
$this->getElement('add_show_start_time')->setErrors(array(_('Cannot create show in the past')));
|
||||
$valid = false;
|
||||
|
|
|
@ -169,6 +169,9 @@ class Application_Service_ShowFormService
|
|||
}
|
||||
}
|
||||
|
||||
//Disable starting a show 'now' when editing an existing show.
|
||||
$form->getElement('add_show_start_now')->setAttrib('disable', array('now'));
|
||||
|
||||
$form->populate(
|
||||
array(
|
||||
'add_show_start_date' => $showStart->format("Y-m-d"),
|
||||
|
@ -225,8 +228,12 @@ class Application_Service_ShowFormService
|
|||
$form->disableStartDateAndTime();
|
||||
}
|
||||
|
||||
//Disable starting a show 'now' when editing an existing show.
|
||||
$form->getElement('add_show_start_now')->setAttrib('disable', array('now'));
|
||||
|
||||
$form->populate(
|
||||
array(
|
||||
'add_show_start_now' => 'future',
|
||||
'add_show_start_date' => $showStart->format("Y-m-d"),
|
||||
'add_show_start_time' => $showStart->format("H:i"),
|
||||
'add_show_end_date_no_repeat' => $showEnd->format("Y-m-d"),
|
||||
|
|
|
@ -1,8 +1,18 @@
|
|||
<fieldset>
|
||||
<dl>
|
||||
<dt id="add_show_start_now-label">
|
||||
<label for="add_show_start_now">
|
||||
<?php echo $this->element->getElement('add_show_start_now')->getLabel()?>
|
||||
</label>
|
||||
</dt>
|
||||
<dd>
|
||||
<?php echo $this->element->getElement('add_show_start_now') ?>
|
||||
</dd>
|
||||
|
||||
|
||||
<dt id="add_show_start_date-label">
|
||||
<label for="add_show_start_date" class="required">
|
||||
<?php echo $this->element->getElement('add_show_start_date')->getLabel()?>
|
||||
<?php //echo $this->element->getElement('add_show_start_date')->getLabel()?>
|
||||
</label>
|
||||
</dt>
|
||||
<dd>
|
||||
|
@ -19,6 +29,9 @@
|
|||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
|
||||
<dt id="add_show_end_date_no_repeat-label">
|
||||
<label for="add_show_end_date_no_repeat" class="required">
|
||||
<?php echo $this->element->getElement('add_show_end_date_no_repeat')->getLabel()?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue