CC-2933: Add From When: Create custom decorator(phtml) for
the section - done
This commit is contained in:
parent
b90b69ebde
commit
75f57fc18c
2 changed files with 77 additions and 20 deletions
|
@ -5,6 +5,10 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
|||
|
||||
public function init()
|
||||
{
|
||||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/add-show-when.phtml'))
|
||||
));
|
||||
|
||||
// Add start date element
|
||||
$startDate = new Zend_Form_Element_Text('add_show_start_date');
|
||||
$startDate->class = 'input_text';
|
||||
|
@ -15,11 +19,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
|||
->setValidators(array(
|
||||
'NotEmpty',
|
||||
array('date', false, array('YYYY-MM-DD'))))
|
||||
->setDecorators(array(
|
||||
array(array('open'=>'HtmlTag'), array('tag' => 'dd', 'openOnly'=>true)),
|
||||
'ViewHelper',
|
||||
'Description',
|
||||
array('Label', array('tag' =>'dt'))));
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$startDate->setAttrib('alt', 'date');
|
||||
$this->addElement($startDate);
|
||||
|
||||
|
@ -33,10 +33,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
|||
'NotEmpty',
|
||||
array('date', false, array('HH:mm')),
|
||||
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))))
|
||||
->setDecorators(array(
|
||||
'ViewHelper',
|
||||
'Errors',
|
||||
array(array('close'=>'HtmlTag'), array('tag' => 'dd', 'closeOnly'=>true))));
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$startTime->setAttrib('alt', 'time');
|
||||
$this->addElement($startTime);
|
||||
|
||||
|
@ -50,11 +47,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
|||
->setValidators(array(
|
||||
'NotEmpty',
|
||||
array('date', false, array('YYYY-MM-DD'))))
|
||||
->setDecorators(array(
|
||||
array(array('open'=>'HtmlTag'), array('tag' => 'dd', 'openOnly'=>true)),
|
||||
'ViewHelper',
|
||||
'Description',
|
||||
array('Label', array('tag' =>'dt'))));
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$endDate->setAttrib('alt', 'date');
|
||||
$this->addElement($endDate);
|
||||
|
||||
|
@ -68,10 +61,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
|||
'NotEmpty',
|
||||
array('date', false, array('HH:mm')),
|
||||
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))))
|
||||
->setDecorators(array(
|
||||
'ViewHelper',
|
||||
'Errors',
|
||||
array(array('close'=>'HtmlTag'), array('tag' => 'dd', 'closeOnly'=>true))));
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$endTime->setAttrib('alt', 'time');
|
||||
$this->addElement($endTime);
|
||||
|
||||
|
@ -80,20 +70,22 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
|||
'label' => 'Duration:',
|
||||
'class' => 'input_text',
|
||||
'value' => '01h00m',
|
||||
'readonly' => true
|
||||
'readonly' => true,
|
||||
'decorators' => array('ViewHelper')
|
||||
));
|
||||
|
||||
// Add repeats element
|
||||
$this->addElement('checkbox', 'add_show_repeats', array(
|
||||
'label' => 'Repeats?',
|
||||
'required' => false,
|
||||
'decorators' => array('ViewHelper')
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
public function checkReliantFields($formData, $startDateModified) {
|
||||
$valid = true;
|
||||
|
||||
|
||||
$start_time = $formData['add_show_start_date']." ".$formData['add_show_start_time'];
|
||||
|
||||
//DateTime stores $start_time in the current timezone
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue