checks on dates, UI work mostly done

This commit is contained in:
naomiaro 2011-01-30 20:11:18 -05:00
parent dc6fcec0e3
commit 092b36c346
17 changed files with 293 additions and 197 deletions

View file

@ -23,10 +23,16 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm
),
));
$checkboxes = $this->getElement('add_show_day_check');
$checkboxes->setDecorators(array(array('ViewScript', array(
'viewScript' => 'form/add-show-checkbox.phtml'
))));
// Add end date element
$this->addElement('text', 'add_show_end_date', array(
'label' => 'Date End:',
//'class' => 'input_text hasDatepicker',
'class' => 'input_text',
'required' => false,
'filters' => array('StringTrim'),
'validators' => array(
@ -42,6 +48,21 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm
));
}
public function checkReliantFields($formData) {
$start_timestamp = $formData['add_show_start_date'];
$end_timestamp = $formData['add_show_end_date'];
$start_epoch = strtotime($start_timestamp);
$end_epoch = strtotime($end_timestamp);
if($end_epoch < $start_epoch) {
$this->getElement('add_show_end_date')->setErrors(array('End date must be after start date'));
return false;
}
return true;
}
}

View file

@ -14,11 +14,11 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
'validators' => array('NotEmpty')
));
$nameLabel = $this->getElement('add_show_name');
$nameInput = $this->getElement('add_show_name');
$nameLabel->setDecorators(array(array('ViewScript', array(
'viewScript' => 'testform.phtml',
'class' => 'test template'
$nameInput->setDecorators(array(array('ViewScript', array(
'viewScript' => 'form/add-show-block.phtml',
'class' => 'block-display'
))));
@ -29,6 +29,13 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
'class' => 'input_text_area'
));
$descText = $this->getElement('add_show_description');
$descText->setDecorators(array(array('ViewScript', array(
'viewScript' => 'form/add-show-block.phtml',
'class' => 'block-display'
))));
}

View file

@ -8,7 +8,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
// Add start date element
$this->addElement('text', 'add_show_start_date', array(
'label' => 'Date Start:',
//'class' => 'input_text hasDatepicker',
'class' => 'input_text',
'required' => true,
'filters' => array('StringTrim'),
'validators' => array(
@ -49,8 +49,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
}
/*
public function postValidation(array $formData) {
public function checkReliantFields($formData) {
$now_timestamp = date("Y-m-d H:i:s");
$start_timestamp = $formData['add_show_start_date']."".$formData['add_show_start_time'];
@ -65,7 +64,6 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
return true;
}
*/
}