public function init() { $defaultValueField = new \SAP\Form\Element\Text('default_value'); $defaultValueField->setLabel('Default value')->setValue($this->_model->getDefaultValue()); $submitButton = new Zend_Form_Element_Submit('edit'); $this->addElements(array($defaultValueField, $submitButton)); }
public function init() { $nameField = new \SAP\Form\Element\Text('name'); $nameField->setLabel('Name')->setRequired(true)->setAllowEmpty(false)->addValidator(new Zend_Validate_StringLength(array('max' => 64)))->setValue($this->_model !== null ? $this->_model->getName() : null); $submitButton = new Zend_Form_Element_Submit('submit'); $submitButton->setLabel('Create user'); $this->addElements(array($nameField, $submitButton)); }
public function init() { $nameField = new \SAP\Form\Element\Text('name'); $nameField->setLabel('Name')->setDescription('f*****g servername')->setRequired(true)->setAllowEmpty(false)->addValidator(new Zend_Validate_StringLength(array('max' => 64)))->setValue($this->_model !== null ? $this->_model->getName() : null); $typeField = new \SAP\Form\Element\Select('server_type_id'); $typeField->setLabel('Server Type')->setDescription('f*****g server type')->setRequired(true)->setAllowEmpty(false)->setMultiOptions($this->getServerTypes())->setValue($this->_model !== null ? $this->_model->getServerTypeId() : null); $submitButton = new Zend_Form_Element_Submit('submit'); $submitButton->setLabel('Create server'); $this->addElements(array($nameField, $typeField, $submitButton)); }
public function init() { $usernameField = new \SAP\Form\Element\Text('username'); $usernameField->setLabel('Username')->setRequired(true)->setAllowEmpty(false)->setDescription('Your personal username'); $passwordField = new Zend_Form_Element_Password('password'); $passwordField->setLabel('Password')->setRequired(true)->setAllowEmpty(false)->setDescription('Your personal password'); $submitButton = new Zend_Form_Element_Submit('login'); $submitButton->setLabel('Login'); $this->addElements(array($usernameField, $passwordField, $submitButton)); }
public function init() { $exclude = $this->_model !== null ? array('field' => 'id', 'value' => $this->_model->getId()) : null; $usernameField = new \SAP\Form\Element\Text('username'); $usernameField->setLabel('Username')->setRequired(true)->setAllowEmpty(false)->addValidator(new Zend_Validate_StringLength(array('min' => 3, 'max' => 16)))->addValidator(new Zend_Validate_Alnum())->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'user', 'field' => 'username', 'exclude' => $exclude)))->setValue($this->_model !== null ? $this->_model->getUsername() : null); $emailField = new \SAP\Form\Element\Text('email'); $emailField->setLabel('Email')->setRequired(true)->setAllowEmpty(true)->addValidator(new Zend_Validate_EmailAddress())->addValidator(new Zend_Validate_StringLength(array('max' => 128)))->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'user', 'field' => 'email', 'exclude' => $exclude)))->setValue($this->_model !== null ? $this->_model->getEmail() : null); $submitButton = new Zend_Form_Element_Submit('send'); $submitButton->setLabel('Create user'); $this->addElements(array($usernameField, $emailField, $submitButton)); }
protected function _getElementForServerSetting(Application_Model_ServerSetting2Server $serverSetting) { $name = $serverSetting->getSetting()->getName(); switch ($name) { case 'MaxUser': $element = new \SAP\Form\Element\Text($name); $element->setRequired(true)->setAllowEmpty(false)->addValidator(new Zend_Validate_Int(), true)->addValidator(new Zend_Validate_GreaterThan(0)); break; case 'Password': $element = new \SAP\Form\Element\Text($name); $element->setRequired(true)->setAllowEmpty(false)->addValidator(new Zend_Validate_Alnum(false)); break; case 'PortBase': $element = new \SAP\Form\Element\Text($name); $element->setRequired(true)->setAllowEmpty(false)->addValidator(new Zend_Validate_Int(), true)->addValidator(new Zend_Validate_GreaterThan(1024)); break; case 'ShowLastSongs': $element = new \SAP\Form\Element\Text($name); $element->setRequired(true)->setAllowEmpty(false)->addValidator(new Zend_Validate_Int(), true)->addValidator(new Zend_Validate_GreaterThan(0))->addValidator(new Zend_Validate_LessThan(21)); break; case 'SrcIP': $element = new \SAP\Form\Element\Text($name); $element->setRequired(true)->setAllowEmpty(false)->addValidator(new Zend_Validate_Callback(array($this, 'validateIpOrAny'))); break; case 'AdminPassword': $element = new \SAP\Form\Element\Text($name); $element->setRequired(true)->setAllowEmpty(false)->addValidator(new Zend_Validate_Alnum(false)); break; case 'AutoDumpUsers': $element = new Zend_Form_Element_Checkbox($name); $element->setRequired(true)->setAllowEmpty(false); break; case 'AutoDumpSourceTime': $element = new \SAP\Form\Element\Text($name); $element->setRequired(true)->setAllowEmpty(false)->addValidator(new Zend_Validate_Int())->addValidator(new Zend_Validate_GreaterThan(0)); break; case 'IntroFile': $element = new \SAP\Form\Element\Text($name); break; case 'BackupFile': $element = new \SAP\Form\Element\Text($name); break; case 'TitleFormat': $element = new \SAP\Form\Element\Text($name); break; case 'URLFormat': $element = new \SAP\Form\Element\Text($name); break; case 'PublicServer': $element = new Zend_Form_Element_Select($name); $element->setRequired(true)->setAllowEmpty(false)->setMultiOptions(array('default', 'always', 'never')); break; case 'AllowRelay': $element = new Zend_Form_Element_Checkbox($name); $element->setRequired(true)->setAllowEmpty(false); break; case 'AllowPublicRelay': $element = new Zend_Form_Element_Checkbox($name); $element->setRequired(true)->setAllowEmpty(false); break; case 'MetaInterval': $element = new \SAP\Form\Element\Text($name); $element->setRequired(true)->setAllowEmpty(false)->addValidator(new Zend_Validate_Int()); break; } $element->setLabel($name)->setValue($serverSetting->getValue()); return $element; }