CC-2176 : Allow up to 10 rebroadcasts, add in the plus button with hidden elements
creating elements inside for loop to be less redundant.
This commit is contained in:
parent
32c9d9b7f2
commit
492c76cb2f
2 changed files with 34 additions and 289 deletions
|
@ -5,177 +5,29 @@ class Application_Form_AddShowAbsoluteRebroadcastDates extends Zend_Form_SubForm
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
//$this->setDisableLoadDefaultDecorators(true);
|
|
||||||
|
|
||||||
$this->setDecorators(array(
|
$this->setDecorators(array(
|
||||||
array('ViewScript', array('viewScript' => 'form/add-show-rebroadcast-absolute.phtml'))
|
array('ViewScript', array('viewScript' => 'form/add-show-rebroadcast-absolute.phtml'))
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add start date element
|
for($i=1; $i<=10; $i++) {
|
||||||
$this->addElement('text', 'add_show_rebroadcast_absolute_date_1', array(
|
|
||||||
'label' => 'Rebroadcast Date:',
|
|
||||||
'class' => 'input_text',
|
|
||||||
'required' => false,
|
|
||||||
'value' => '',
|
|
||||||
'filters' => array('StringTrim'),
|
|
||||||
'validators' => array(
|
|
||||||
'NotEmpty',
|
|
||||||
array('date', false, array('YYYY-MM-DD'))
|
|
||||||
),
|
|
||||||
'decorators' => array(
|
|
||||||
'ViewHelper'
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
|
$text = new Zend_Form_Element_Text("add_show_rebroadcast_absolute_date_$i");
|
||||||
// Add start time element
|
$text->setAttrib('class', 'input_text');
|
||||||
$this->addElement('text', 'add_show_rebroadcast_absolute_time_1', array(
|
$text->addFilter('StringTrim');
|
||||||
'label' => 'Rebroadcast Time:',
|
$text->addValidator('date', false, array('YYYY-MM-DD'));
|
||||||
'class' => 'input_text',
|
$text->setRequired(false);
|
||||||
'required' => false,
|
$text->setDecorators(array('ViewHelper'));
|
||||||
'value' => '',
|
$this->addElement($text);
|
||||||
'filters' => array('StringTrim'),
|
|
||||||
'validators' => array(
|
|
||||||
array('date', false, array('HH:mm')),
|
|
||||||
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))
|
|
||||||
),
|
|
||||||
'decorators' => array(
|
|
||||||
'ViewHelper'
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
// Add start date element
|
|
||||||
$this->addElement('text', 'add_show_rebroadcast_absolute_date_2', array(
|
|
||||||
'label' => 'Rebroadcast Date:',
|
|
||||||
'class' => 'input_text',
|
|
||||||
'required' => false,
|
|
||||||
'value' => '',
|
|
||||||
'filters' => array('StringTrim'),
|
|
||||||
'validators' => array(
|
|
||||||
'NotEmpty',
|
|
||||||
array('date', false, array('YYYY-MM-DD'))
|
|
||||||
),
|
|
||||||
'decorators' => array(
|
|
||||||
'ViewHelper'
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
|
|
||||||
// Add start time element
|
|
||||||
$this->addElement('text', 'add_show_rebroadcast_absolute_time_2', array(
|
|
||||||
'label' => 'Rebroadcast Time:',
|
|
||||||
'class' => 'input_text',
|
|
||||||
'required' => false,
|
|
||||||
'value' => '',
|
|
||||||
'filters' => array('StringTrim'),
|
|
||||||
'validators' => array(
|
|
||||||
array('date', false, array('HH:mm')),
|
|
||||||
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))
|
|
||||||
),
|
|
||||||
'decorators' => array(
|
|
||||||
'ViewHelper'
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
// Add start date element
|
|
||||||
$this->addElement('text', 'add_show_rebroadcast_absolute_date_3', array(
|
|
||||||
'label' => 'Rebroadcast Date:',
|
|
||||||
'class' => 'input_text',
|
|
||||||
'required' => false,
|
|
||||||
'value' => '',
|
|
||||||
'filters' => array('StringTrim'),
|
|
||||||
'validators' => array(
|
|
||||||
'NotEmpty',
|
|
||||||
array('date', false, array('YYYY-MM-DD'))
|
|
||||||
),
|
|
||||||
'decorators' => array(
|
|
||||||
'ViewHelper'
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
|
|
||||||
// Add start time element
|
|
||||||
$this->addElement('text', 'add_show_rebroadcast_absolute_time_3', array(
|
|
||||||
'label' => 'Rebroadcast Time:',
|
|
||||||
'class' => 'input_text',
|
|
||||||
'required' => false,
|
|
||||||
'value' => '',
|
|
||||||
'filters' => array('StringTrim'),
|
|
||||||
'validators' => array(
|
|
||||||
array('date', false, array('HH:mm')),
|
|
||||||
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))
|
|
||||||
),
|
|
||||||
'decorators' => array(
|
|
||||||
'ViewHelper'
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
// Add start date element
|
|
||||||
$this->addElement('text', 'add_show_rebroadcast_absolute_date_4', array(
|
|
||||||
'label' => 'Rebroadcast Date:',
|
|
||||||
'class' => 'input_text',
|
|
||||||
'required' => false,
|
|
||||||
'value' => '',
|
|
||||||
'filters' => array('StringTrim'),
|
|
||||||
'validators' => array(
|
|
||||||
'NotEmpty',
|
|
||||||
array('date', false, array('YYYY-MM-DD'))
|
|
||||||
),
|
|
||||||
'decorators' => array(
|
|
||||||
'ViewHelper'
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
|
|
||||||
// Add start time element
|
|
||||||
$this->addElement('text', 'add_show_rebroadcast_absolute_time_4', array(
|
|
||||||
'label' => 'Rebroadcast Time:',
|
|
||||||
'class' => 'input_text',
|
|
||||||
'required' => false,
|
|
||||||
'value' => '',
|
|
||||||
'filters' => array('StringTrim'),
|
|
||||||
'validators' => array(
|
|
||||||
array('date', false, array('HH:mm')),
|
|
||||||
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))
|
|
||||||
),
|
|
||||||
'decorators' => array(
|
|
||||||
'ViewHelper'
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
// Add start date element
|
|
||||||
$this->addElement('text', 'add_show_rebroadcast_absolute_date_5', array(
|
|
||||||
'label' => 'Rebroadcast Date:',
|
|
||||||
'class' => 'input_text',
|
|
||||||
'required' => false,
|
|
||||||
'value' => '',
|
|
||||||
'filters' => array('StringTrim'),
|
|
||||||
'validators' => array(
|
|
||||||
'NotEmpty',
|
|
||||||
array('date', false, array('YYYY-MM-DD'))
|
|
||||||
),
|
|
||||||
'decorators' => array(
|
|
||||||
'ViewHelper'
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
|
|
||||||
// Add start time element
|
|
||||||
$this->addElement('text', 'add_show_rebroadcast_absolute_time_5', array(
|
|
||||||
'label' => 'Rebroadcast Time:',
|
|
||||||
'class' => 'input_text',
|
|
||||||
'required' => false,
|
|
||||||
'value' => '',
|
|
||||||
'filters' => array('StringTrim'),
|
|
||||||
'validators' => array(
|
|
||||||
array('date', false, array('HH:mm')),
|
|
||||||
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))
|
|
||||||
),
|
|
||||||
'decorators' => array(
|
|
||||||
'ViewHelper'
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
|
$text = new Zend_Form_Element_Text("add_show_rebroadcast_absolute_time_$i");
|
||||||
|
$text->setAttrib('class', 'input_text');
|
||||||
|
$text->addFilter('StringTrim');
|
||||||
|
$text->addValidator('date', false, array('HH:mm'));
|
||||||
|
$text->addValidator('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'));
|
||||||
|
$text->setRequired(false);
|
||||||
|
$text->setDecorators(array('ViewHelper'));
|
||||||
|
$this->addElement($text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkReliantFields($formData) {
|
public function checkReliantFields($formData) {
|
||||||
|
|
|
@ -9,137 +9,30 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm
|
||||||
array('ViewScript', array('viewScript' => 'form/add-show-rebroadcast.phtml'))
|
array('ViewScript', array('viewScript' => 'form/add-show-rebroadcast.phtml'))
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
||||||
$relativeDates = array();
|
$relativeDates = array();
|
||||||
$relativeDates[""] = "";
|
$relativeDates[""] = "";
|
||||||
for($i=0; $i <=30; $i++) {
|
for($i=0; $i<=30; $i++) {
|
||||||
$relativeDates["$i days"] = "+$i days";
|
$relativeDates["$i days"] = "+$i days";
|
||||||
}
|
}
|
||||||
|
|
||||||
//Add date select
|
for($i=1; $i<=10; $i++) {
|
||||||
$this->addElement('select', 'add_show_rebroadcast_date_1', array(
|
|
||||||
'required' => false,
|
|
||||||
'class' => ' input_select',
|
|
||||||
'multiOptions' => $relativeDates,
|
|
||||||
'decorators' => array(
|
|
||||||
'ViewHelper'
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
// Add start time element
|
$select = new Zend_Form_Element_Select("add_show_rebroadcast_date_$i");
|
||||||
$this->addElement('text', 'add_show_rebroadcast_time_1', array(
|
$select->setAttrib('class', 'input_select');
|
||||||
'class' => 'input_text',
|
$select->setMultiOptions($relativeDates);
|
||||||
'required' => false,
|
$select->setRequired(false);
|
||||||
'value' => '',
|
$select->setDecorators(array('ViewHelper'));
|
||||||
'filters' => array('StringTrim'),
|
$this->addElement($select);
|
||||||
'validators' => array(
|
|
||||||
array('date', false, array('HH:mm')),
|
|
||||||
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))
|
|
||||||
),
|
|
||||||
'decorators' => array(
|
|
||||||
'ViewHelper'
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
//Add date select
|
$text = new Zend_Form_Element_Text("add_show_rebroadcast_time_$i");
|
||||||
$this->addElement('select', 'add_show_rebroadcast_date_2', array(
|
$text->setAttrib('class', 'input_text');
|
||||||
'required' => false,
|
$text->addFilter('StringTrim');
|
||||||
'class' => ' input_select',
|
$text->addValidator('date', false, array('HH:mm'));
|
||||||
'multiOptions' => $relativeDates,
|
$text->addValidator('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'));
|
||||||
'decorators' => array(
|
$text->setRequired(false);
|
||||||
'ViewHelper'
|
$text->setDecorators(array('ViewHelper'));
|
||||||
)
|
$this->addElement($text);
|
||||||
));
|
}
|
||||||
|
|
||||||
// Add start time element
|
|
||||||
$this->addElement('text', 'add_show_rebroadcast_time_2', array(
|
|
||||||
'class' => 'input_text',
|
|
||||||
'required' => false,
|
|
||||||
'value' => '',
|
|
||||||
'filters' => array('StringTrim'),
|
|
||||||
'validators' => array(
|
|
||||||
array('date', false, array('HH:mm')),
|
|
||||||
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))
|
|
||||||
),
|
|
||||||
'decorators' => array(
|
|
||||||
'ViewHelper'
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
//Add date select
|
|
||||||
$this->addElement('select', 'add_show_rebroadcast_date_3', array(
|
|
||||||
'required' => false,
|
|
||||||
'class' => ' input_select',
|
|
||||||
'multiOptions' => $relativeDates,
|
|
||||||
'decorators' => array(
|
|
||||||
'ViewHelper'
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
// Add start time element
|
|
||||||
$this->addElement('text', 'add_show_rebroadcast_time_3', array(
|
|
||||||
'class' => 'input_text',
|
|
||||||
'required' => false,
|
|
||||||
'value' => '',
|
|
||||||
'filters' => array('StringTrim'),
|
|
||||||
'validators' => array(
|
|
||||||
array('date', false, array('HH:mm')),
|
|
||||||
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))
|
|
||||||
),
|
|
||||||
'decorators' => array(
|
|
||||||
'ViewHelper'
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
//Add date select
|
|
||||||
$this->addElement('select', 'add_show_rebroadcast_date_4', array(
|
|
||||||
'required' => false,
|
|
||||||
'class' => ' input_select',
|
|
||||||
'multiOptions' => $relativeDates,
|
|
||||||
'decorators' => array(
|
|
||||||
'ViewHelper'
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
// Add start time element
|
|
||||||
$this->addElement('text', 'add_show_rebroadcast_time_4', array(
|
|
||||||
'class' => 'input_text',
|
|
||||||
'required' => false,
|
|
||||||
'value' => '',
|
|
||||||
'filters' => array('StringTrim'),
|
|
||||||
'validators' => array(
|
|
||||||
array('date', false, array('HH:mm')),
|
|
||||||
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))
|
|
||||||
),
|
|
||||||
'decorators' => array(
|
|
||||||
'ViewHelper'
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
//Add date select
|
|
||||||
$this->addElement('select', 'add_show_rebroadcast_date_5', array(
|
|
||||||
'required' => false,
|
|
||||||
'class' => ' input_select',
|
|
||||||
'multiOptions' => $relativeDates,
|
|
||||||
'decorators' => array(
|
|
||||||
'ViewHelper'
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
// Add start time element
|
|
||||||
$this->addElement('text', 'add_show_rebroadcast_time_5', array(
|
|
||||||
'class' => 'input_text',
|
|
||||||
'required' => false,
|
|
||||||
'value' => '',
|
|
||||||
'filters' => array('StringTrim'),
|
|
||||||
'validators' => array(
|
|
||||||
array('date', false, array('HH:mm')),
|
|
||||||
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))
|
|
||||||
),
|
|
||||||
'decorators' => array(
|
|
||||||
'ViewHelper'
|
|
||||||
)
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkReliantFields($formData) {
|
public function checkReliantFields($formData) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue