class Default_Form_Settings_Messages extends Zend_Form
{
public function init()
{
$this -> addElement('multiCheckbox' , 'events' , array( 'friednChangedAvatar' => 'Gdy ktoś z mojej listy znajomych zmienił awatar',
'friendAddThought' => 'Gdy ktoś z mojej listy znajomych dokonał wpisu "Co myśli"'
))
));
$this -> addElement('submit' , 'submit' , array( 'label' => 'Zapisz',
'ignore' => true
));
return parent::init();
}
public function getValues()
{
$values = parent::getValues();
);
foreach($options as $index)
{
$defaults[$index] = (int
)(in_array($index , $values['events'])); }
}
public function populate($values)
{
$eventkeys = array_keys($this -> events -> getMultiOptions()); foreach($values as $index => $value)
{
if(in_array($index, $eventkeys) && $value) {
$events[] = $index;
}
}
$values['events'] = $events;
return parent::populate($values);
}
}
Formularz z projktu, ale powinieneś być w stanie przystosować go sobie do własnych potrzeb