How do I do that with Zend_Form?
<ul>
<?php foreach ($this->roles as $module => $resources): ?>
<li>
<?php echo $module; ?>
<ul>
<?php foreach ($resources as $resource => $privileges): ?>
<li>
<?php echo $resource; ?>
<ul>
<?php foreach ($privileges as $id => $privilege): ?>
<li><input type="checkbox" name="privileges[]" value="<?php echo $id ?>" /><?php echo $privilege; ?></li>
<?php endforeach; ?>
</ul>
</li>
<?php endforeach; ?>
</ul>
</li>
<?php endforeach; ?>
</ul>
I've started with something like that:
class Admin_Form_AclRole extends Zend_Form {
public function __construct($options = NULL)
{
parent::__construct($options);
$this->setName('role');
$role = new Zend_Form_Element_Text('role');
$role->setLabel('Grupo:')
->addFilter('stripTags')
->addFilter('StringTrim')
->setAllowEmpty(false)
->setRequired(true);
$privileges = new Zend_Form_Element_MultiCheckbox('foo', array(
'multiOptions' => array(
'foo' => 'Foo Option',
'bar' => 'Bar Option',
'baz' => 'Baz Option',
'bat' => 'Bat Option'
)
));
$privileges->addDecorator('HtmlTag', array('tag' => 'ul'));
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel('Cadastrar');
$this->addElements(array($role,$privileges,$submit));
}
}