mon
By: a guest | Mar 5th, 2009 | Syntax:
PHP | Size: 6.29 KB | Hits: 41 | Expires: Never
class DecorsController extends Zend_Controller_Action
{
public function indexAction()
{
$this->getHelper('ViewRenderer')->setNoRender(true);
'ViewHelper',
'Label',
'Errors',
);
'ViewHelper',
array(array('elemWrap' => 'HtmlTag'), array('tag' => 'div', 'class' => 'checkbox-wrap')),
array('Description', array('tag' => 'label', 'placement' => 'prepend')),
'Errors',
);
'ViewHelper',
array('HtmlTag', array('tag' => 'li', 'class' => 'button'))
);
'FormElements',
array('HtmlTag', array('tag' => 'ul', 'class' => 'list-form')),
'Form'
);
'Label',
array(array('labelTd' => 'HtmlTag'), array('tag' => 'td', 'class' => 'labelWrap')),
array(array('elemTdOpen' => 'HtmlTag'), array('tag' => 'td', 'openOnly' => true, 'placement' => 'append')),
'ViewHelper',
'Errors',
array(array('elemTdClose' => 'HtmlTag'), array('tag' => 'td', 'closeOnly' => true, 'placement' => 'append')),
);
array(array('labelTd' => 'HtmlTag'), array('tag' => 'td', 'class' => 'labelWrap')),
array(array('elemTdOpen' => 'HtmlTag'), array('tag' => 'td', 'openOnly' => true, 'placement' => 'append')),
'ViewHelper',
'Errors',
array(array('elemTdClose' => 'HtmlTag'), array('tag' => 'td', 'closeOnly' => true, 'placement' => 'append')),
);
'Description',
array(array('labelTd' => 'HtmlTag'), array('tag' => 'td', 'class' => 'labelWrap')),
array(array('elemTdOpen' => 'HtmlTag'), array('tag' => 'td', 'openOnly' => true, 'placement' => 'append')),
'ViewHelper',
array(array('elemTdClose' => 'HtmlTag'), array('tag' => 'td', 'closeOnly' => true, 'placement' => 'append')),
);
'FormElements',
array('HtmlTag', array('tag' => 'table', 'class' => 'table-form')),
'Form'
);
array(array('ddOpen' => 'HtmlTag'), array('tag' => 'dd', 'openOnly' => true, 'placement' => 'append')),
'ViewHelper',
'Errors',
array(array('ddClose' => 'HtmlTag'), array('tag' => 'dd', 'closeOnly' => true, 'placement' => 'append')),
);
array(array('ddOpen' => 'HtmlTag'), array('tag' => 'dd', 'openOnly' => true, 'placement' => 'append')),
'ViewHelper',
'Errors',
array(array('ddClose' => 'HtmlTag'), array('tag' => 'dd', 'closeOnly' => true, 'placement' => 'append')),
);
array(array('ddOpen' => 'HtmlTag'), array('tag' => 'dd', 'openOnly' => true, 'placement' => 'append')),
'ViewHelper',
array(array('ddClose' => 'HtmlTag'), array('tag' => 'dd', 'closeOnly' => true, 'placement' => 'append')),
);
'FormElements',
array('HtmlTag', array('tag' => 'div', 'class' => 'dl-form')),
'Form'
);
$text = new Zend_Form_Element_Text
('foo', array('label' => 'Foo:'));
$select = new Zend_Form_Element_Select
('bar', array('label' => 'Bar:'));
$select->setMultiOptions(array('one', 'two', 'three'));
$textarea = new Zend_Form_Element_Textarea
('baz', array('label' => 'Baz:'));
$checkbox = new Zend_Form_Element_Checkbox
('bat', array('description' => 'What?', 'label' => 'Yes'));
$radio = new Zend_Form_Element_Radio
('quux', array('description' => 'Choose one:'));
$radio->setMultiOptions(array('first', 'second', 'third'));
$submit = new Zend_Form_Element_Submit
('submit', array('label' => 'Submit'));
$elements = array($text, $select, $textarea, $checkbox, $radio, $submit);
foreach ($elements as $elem) {
$elem->addError('some error');
}
$form = new Zend_Form();
$form->addElements($elements);
$text->setDecorators($elementLi);
$select->setDecorators($elementLi);
$textarea->setDecorators($elementLi);
$checkbox->setDecorators($checkboxLi);
$radio->setDecorators($checkboxLi);
$submit->setDecorators($buttonLi);
$form->setDecorators($formUl);
echo $form;
$text->setDecorators($elementTr);
$select->setDecorators($elementTr);
$textarea->setDecorators($elementTr);
$checkbox->setDecorators($checkboxTr);
$radio->setDecorators($checkboxTr);
$submit->setDecorators($buttonTr);
$form->setDecorators($formTable);
echo $form;
$text->setDecorators($elementDl);
$select->setDecorators($elementDl);
$textarea->setDecorators($elementDl);
$checkbox->setDecorators($checkboxDl);
$radio->setDecorators($checkboxDl);
$submit->setDecorators($buttonDl);
$form->setDecorators($formDl);
echo $form;
}
}