2011-01-21 00:30:53 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class Application_Form_AddShowWhat extends Zend_Form_SubForm
|
|
|
|
{
|
|
|
|
public function init()
|
|
|
|
{
|
2011-10-24 19:27:53 +02:00
|
|
|
// retrieves the length limit for each char field
|
|
|
|
// and store to assoc array
|
|
|
|
$maxLens = Application_Model_Show::GetMaxLengths();
|
|
|
|
|
2011-04-12 06:14:26 +02:00
|
|
|
// Hidden element to indicate whether the show is new or
|
|
|
|
// whether we are updating an existing show.
|
|
|
|
$this->addElement('hidden', 'add_show_id', array(
|
|
|
|
'decorators' => array('ViewHelper')
|
|
|
|
));
|
|
|
|
|
2011-01-21 00:30:53 +01:00
|
|
|
// Add name element
|
|
|
|
$this->addElement('text', 'add_show_name', array(
|
|
|
|
'label' => 'Name:',
|
2011-01-28 23:37:31 +01:00
|
|
|
'class' => 'input_text',
|
2011-01-21 00:30:53 +01:00
|
|
|
'required' => true,
|
|
|
|
'filters' => array('StringTrim'),
|
2011-05-05 00:44:10 +02:00
|
|
|
'validators' => array('NotEmpty'),
|
2011-10-24 19:27:53 +02:00
|
|
|
'value' => 'Untitled Show',
|
|
|
|
'validators' => array(array('StringLength', false, array(0, $maxLens['name'])))
|
2011-01-21 00:30:53 +01:00
|
|
|
));
|
|
|
|
|
2011-03-17 23:23:05 +01:00
|
|
|
// Add URL element
|
|
|
|
$this->addElement('text', 'add_show_url', array(
|
2011-04-04 19:50:51 +02:00
|
|
|
'label' => 'URL:',
|
2011-03-17 23:23:05 +01:00
|
|
|
'class' => 'input_text',
|
|
|
|
'required' => false,
|
|
|
|
'filters' => array('StringTrim'),
|
2011-10-24 19:27:53 +02:00
|
|
|
'validators' => array('NotEmpty', array('StringLength', false, array(0, $maxLens['url'])))
|
2011-04-02 23:09:37 +02:00
|
|
|
));
|
|
|
|
|
|
|
|
// Add genre element
|
|
|
|
$this->addElement('text', 'add_show_genre', array(
|
|
|
|
'label' => 'Genre:',
|
|
|
|
'class' => 'input_text',
|
|
|
|
'required' => false,
|
2011-10-24 19:27:53 +02:00
|
|
|
'filters' => array('StringTrim'),
|
|
|
|
'validators' => array(array('StringLength', false, array(0, $maxLens['genre'])))
|
2011-04-04 19:50:51 +02:00
|
|
|
));
|
2011-01-28 23:37:31 +01:00
|
|
|
|
2011-01-21 00:30:53 +01:00
|
|
|
// Add the description element
|
|
|
|
$this->addElement('textarea', 'add_show_description', array(
|
|
|
|
'label' => 'Description:',
|
|
|
|
'required' => false,
|
2011-10-24 19:27:53 +02:00
|
|
|
'class' => 'input_text_area',
|
|
|
|
'validators' => array(array('StringLength', false, array(0, $maxLens['description'])))
|
2011-01-21 00:30:53 +01:00
|
|
|
));
|
|
|
|
|
2011-01-31 02:11:18 +01:00
|
|
|
$descText = $this->getElement('add_show_description');
|
|
|
|
|
|
|
|
$descText->setDecorators(array(array('ViewScript', array(
|
|
|
|
'viewScript' => 'form/add-show-block.phtml',
|
|
|
|
'class' => 'block-display'
|
|
|
|
))));
|
|
|
|
|
2011-01-21 00:30:53 +01:00
|
|
|
}
|
2012-03-30 21:11:24 +02:00
|
|
|
|
|
|
|
public function disable(){
|
|
|
|
$elements = $this->getElements();
|
|
|
|
foreach ($elements as $element)
|
|
|
|
{
|
|
|
|
if ($element->getType() != 'Zend_Form_Element_Hidden')
|
|
|
|
{
|
2012-04-05 22:01:27 +02:00
|
|
|
$element->setAttrib('disabled','disabled');
|
2012-03-30 21:11:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-01-21 00:30:53 +01:00
|
|
|
}
|
|
|
|
|