protected function _onPopulateWithInstance($instance = null) { parent::_onPopulateWithInstance($instance); if ($this->hasInstance()) { $this->getElement('url')->getValidator('Centurion_Form_Model_Validator_AlreadyTaken')->mergeParams(array('!id' => $this->getInstance()->pk, 'language_id' => $this->getInstance()->language_id)); } }
/** * Constructor * * @param array|Zend_Config $options Options * @param Centurion_Db_Table_Abstract $instance Instance attached to the form * @return void */ public function __construct($options = array(), Centurion_Db_Table_Row_Abstract $instance = null) { $this->_model = Centurion_Db::getSingleton('core/navigation'); $this->_exclude = array('mptt_parent_id'); $this->_elementLabels = array('label' => $this->_translate('Label'), 'module' => $this->_translate('Module name'), 'controller' => $this->_translate('Controller name'), 'action' => $this->_translate('Action name'), 'params' => $this->_translate('Params (json)'), 'route' => $this->_translate('Route name'), 'uri' => $this->_translate('URI'), 'is_visible' => $this->_translate('Visible?'), 'class' => $this->_translate('Stylesheet'), 'proxy' => $this->_translate('Proxy')); return parent::__construct($options, $instance); }
public function __construct($options = array(), Centurion_Db_Table_Row_Abstract $instance = null) { $this->_model = Centurion_Db::getSingleton('cms/flatpage_template'); $this->_exclude = array(); $this->_elementLabels = array('name' => $this->_translate('Name'), 'view_script' => $this->_translate('View script')); $this->setLegend($this->_translate('Edit flatpage template')); parent::__construct($options, $instance); }
public function init() { parent::init(); $avatar = new Media_Form_Model_Admin_File(); $this->addReferenceSubForm($avatar, 'avatar'); $user = new Auth_Form_Model_User(); $this->addReferenceSubForm($user, 'user'); }
/** * Render form * * @param Zend_View_Interface $view * @return string */ public function render(Zend_View_Interface $view = null) { foreach ($this->getElements() as $key => $element) { if (!$element->hasErrors()) { continue; } $element->setDecorators($this->defaultErrorElementDecorators); } return parent::render($view); }
/** * Retrieve the form attached to the controller. * * @param Centurion_Db_Table_Row_Abstract $instance * @return Centurion_Form_Model_Abstract */ protected function _getForm($options = array(), Centurion_Db_Table_Row_Abstract $instance = null) { if (null === $this->_form) { if (!isset($options['method'])) { $options['method'] = Centurion_Form::METHOD_POST; } $this->_form = new $this->_formClass($options, $instance); $this->_form->cleanForm(); } return $this->_form; }
/** * @return Centurion_Form_Model_Abstract|null * @throws Centurion_Controller_Action_Exception */ public function getForm() { if (null === $this->_form) { if (!$this->_formClassName || !is_string($this->_formClassName)) { throw new Centurion_Controller_Action_Exception("Empty or invalid property _formClassName"); } $this->_form = new $this->_formClassName(array('method' => Centurion_Form::METHOD_POST)); if (method_exists($this->_form, 'setDateFormat')) { //For form whom not inherits of Centurion_Form_Model $this->_form->setDateFormat($this->_dateFormatIso, $this->_timeFormatIso); } $this->_form->cleanForm(); $action = $this->_helper->url->url(array_merge($this->_extraParam, array('controller' => $this->_request->getControllerName(), 'action' => 'post', 'module' => $this->_request->getModuleName())), null, true); $this->_form->setAction($action); if ($next = $this->_getParam('_next', null)) { $this->_form->addElement('hidden', '_next', array('value' => $next)); } $this->_postInitForm(); } return $this->_form; }
/** * Process values attached to the form. * * @param array $values Values * @return array Values processed */ protected function _processValues($values) { $values = parent::_processValues($values); if ($this->hasInstance()) { $password = $this->getElement('password'); if (null !== $password && !$password->getValue()) { unset($values['password']); } } return $values; }
public function __construct($options = array()) { $this->setModel(Centurion_Db::getSingleton('media/file'))->setEnctype(self::ENCTYPE_MULTIPART); parent::__construct($options); }
public function __construct($options = array(), Centurion_Db_Table_Row_Abstract $instance = null) { $this->_elementLabels = array('name' => $this->_translate('Name'), 'description' => $this->_translate('Description'), 'users' => $this->_translate('Users'), 'groups' => $this->_translate('Groups')); $this->_model = Centurion_Db::getSingleton('auth/permission'); parent::__construct($options, $instance); }
public function init() { parent::init(); $this->getElement('description')->setAttrib('class', 'field-rte')->setAttrib('large', true)->removeFilter('StripTags'); }