public function Cui_MakeSaveButton(Centurion_Form $form) { $label = 'Save'; if (null !== $form->getTranslator()) { $label = $form->getTranslator()->_($label); } $form->addElement('button', '_saveBig', array('type' => 'submit', 'label' => $label)); if (null === $form->getDisplayGroup('_header')) { $this->view->getHelper('GridForm')->makeHeader($form, array('_saveBig')); } else { $form->addInDisplayGroup('_saveBig', '_header'); } $save = $form->getElement('_saveBig'); $save->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'ui-button-big')); $save->setAttrib('class', 'ui-button ui-button-bg-white-gradient ui-button-text-red ui-button-text-only'); $save->setAttrib('class1', null); $save->setAttrib('class2', 'ui-button-text'); $save->setAttrib('role', 'submit'); return $form; }
public function makeOnOff(Centurion_Form $form) { if (null !== ($displayGroups = $form->getDisplayGroup('_aside'))) { foreach ($form->getDisplayGroup('_aside') as $displayGroup) { foreach ($displayGroup->getElements() as $name => $element) { if (!strncmp($element->getName(), 'is_', 3) || !strncmp($element->getName(), 'can_be_', 7)) { $onLabel = $this->view->translate('On'); $offLabel = $this->view->translate('Off'); $value = $element->getValue(); $element = new Zend_Form_Element_Select(array('disableTranslator' => true, 'name' => $name, 'class' => 'field-switcher', 'label' => $element->getLabel(), 'decorators' => $form->defaultElementDecorators)); $element->addMultiOption('1', $onLabel); $element->addMultiOption('0', $offLabel); $element->setValue($value); $displayGroup->addElement($element); } } } } }
protected function _makeDisplayGroup(Centurion_Form $form, $data, $class) { if (isset($data['noFieldset']) && $data['noFieldset'] === true) { $form->addInDisplayGroup($data['elements'], $class, array('class' => 'form-' . substr($class, 1))); foreach ($data['elements'] as $key => $element) { if (null !== ($element = $form->getElement($element))) { $element->setLabel(null); $element->removeDecorator('label'); } } return true; } if (!isset($data['label'])) { $name = uniqid(); } else { $name = Centurion_Inflector::slugify($data['label']); } $name = $name . '_group'; $form->addDisplayGroup($data['elements'], $name, array('class' => 'form-group')); $displayGroup = $form->getDisplayGroup($name); if (isset($data['label']) && is_string($data['label'])) { $displayGroup->setLegend($data['label']); if (isset($data['description'])) { $displayGroup->setDescription($data['description']); } } else { $displayGroup->setDescription(' '); } $form->addInDisplayGroup(array($name), $class, array('class' => 'form-' . substr($class, 1))); }