public function __construct($options = null) { parent::__construct($options); $mints = new Mints(); $mints_options = $mints->getRomanMints(); $this->setDecorators(array('FormElements', 'Fieldset', 'Form')); $this->setName('romanmints'); $id = new Zend_Form_Element_Hidden('ID'); $id->removeDecorator('label')->removeDecorator('HtmlTag'); $name = new Zend_Form_Element_Text('name'); $name->setLabel('Issuing mint known as: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Alnum', false, array('allowWhiteSpace' => true)); $description = new Zend_Form_Element_TextArea('description'); $description->setLabel('Description of mint: ')->addFilters(array('BasicHtml', 'StringTrim', 'EmptyParagraph'))->setAttribs(array('cols' => 50, 'rows' => 10))->setAttrib('class', 'expanding'); $abbrev = new Zend_Form_Element_Text('abbrev'); $abbrev->setLabel('Abbreviation appearing on coins: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty')->addValidator('Alnum', false, array('allowWhiteSpace' => true)); $latitude = new Zend_Form_Element_Text('latitude'); $latitude->setLabel('Latitude: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Float'); $longitude = new Zend_Form_Element_Text('longitude'); $longitude->setLabel('Longitude: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Float'); $pasID = new Zend_Form_Element_Select('pasID'); $pasID->setLabel('Corresponding database entry: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('InArray', false, array(array_keys($mints_options)))->addMultiOptions($mints_options); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(4800); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $this->addElements(array($id, $name, $description, $latitude, $longitude, $pasID, $abbrev, $submit, $hash)); $this->addDisplayGroup(array('name', 'description', 'abbrev', 'pasID', 'latitude', 'longitude'), 'details'); $this->setLegend('Active Roman Mints'); $this->addDisplayGroup(array('submit'), 'submit'); }
public function init() { /* Form Elements & Other Definitions Here ... */ //Id: Hidden $id = new Zend_Form_Element_Hidden('id'); //Author : Text $author = new Zend_Form_Element_Text('author'); $author->setLabel('Enter your name:')->setAttrib('size', 30)->setRequired(TRUE)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); //Email : Text-EMail $email = new Zend_Form_Element_Text('email'); $email->setLabel('Your email address:')->setRequired(TRUE)->addValidator(new Zend_Validate_EmailAddress())->addFilters(array(new Zend_Filter_StringTrim(), new Zend_Filter_StringToLower()))->setAttrib('size', 40); //Date : Text-Date $date = new Zend_Form_Element_Text('date'); $date->setLabel('Date the issue occurred (mm-dd-yyyy):')->setRequired(TRUE)->addValidator(new Zend_Validate_Date('MM-DD-YYYY'))->setAttrib('size', 20); //Url : Text-Url $url = new Zend_Form_Element_Text('url'); $url->setLabel('Issue URL:')->setRequired(TRUE)->setAttrib('size', 50); //Description : Text Area $description = new Zend_Form_Element_TextArea('description'); $description->setLabel('Issue description:')->setRequired(TRUE)->setAttrib('cols', 50)->setAttrib('rows', 4); //Priority: Select Box $priority = new Zend_Form_Element_Select('priority'); $priority->setLabel('Issue priority:')->setRequired(TRUE)->addMultiOptions(array('low' => 'Low', 'med' => 'Medium', 'high' => 'High')); //Status : Select Box $status = new Zend_Form_Element_Select('status'); $status->setLabel('Current status:')->setRequired(TRUE)->addMultiOption('new', 'New')->addMultiOption('in_progress', 'In Progress')->addMultiOption('resolved', 'Resolved'); //Submit : Submit $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $this->addElements(array($id, $author, $email, $date, $url, $description, $priority, $status, $submit)); }
function init() { parent::init(); $this->setMethod('post'); $this->addElement('hidden', 'idP'); $name = new Zend_Form_Element_Text('Name'); $name->setLabel('Name:')->setRequired(true)->addFilters(array('StringTrim'))->setDecorators($this->decorators); $this->addElement($name); $definition = new Zend_Form_Element_TextArea('Definition'); $definition->setLabel('Definition:')->addFilters(array('StringTrim'))->setDecorators($this->decorators); $this->addElement($definition); $this->addDisplayGroup(array('Name', 'Definition'), 'groups', array("legend" => "Property")); }
public function init() { /* Form Elements & Other Definitions Here ... */ $this->setName('job'); $title = new Zend_Form_Element_Text('title'); $title->setLabel('Job Title')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', 'Description', array(array('inner' => 'HtmlTag', array('tag' => 'div'))), array('label', array('tag' => 'p')), array(array('out' => 'HtmlTag'), array('tag' => 'div', 'class' => 'out')))); $shortd = new Zend_Form_Element_Text('shortd'); $shortd->setLabel('Short Description')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', 'Description', array(array('inner' => 'HtmlTag', array('tag' => 'div'))), array('label', array('tag' => 'p')), array(array('out' => 'HtmlTag'), array('tag' => 'div', 'class' => 'out')))); $longd = new Zend_Form_Element_TextArea('longd'); $longd->setLabel('Long Description')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', 'Description', array(array('inner' => 'HtmlTag', array('tag' => 'div'))), array('label', array('tag' => 'p')), array(array('out' => 'HtmlTag'), array('tag' => 'div', 'class' => 'out')))); $exp = new Zend_Form_Element_Text('exp'); $exp->setLabel('Experience/Skills Required')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', 'Description', array(array('inner' => 'HtmlTag', array('tag' => 'div'))), array('label', array('tag' => 'p')), array(array('out' => 'HtmlTag'), array('tag' => 'div', 'class' => 'out')))); $location = new Zend_Form_Element_Text('location'); $location->setLabel('Location')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', 'Description', array(array('inner' => 'HtmlTag', array('tag' => 'div'))), array('label', array('tag' => 'p')), array(array('out' => 'HtmlTag'), array('tag' => 'div', 'class' => 'out')))); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $this->addElements(array($title, $shortd, $longd, $exp, $location, $submit)); }
public function init() { parent::init(); $this->setMethod('post'); $this->addElement('hidden', 'idDE'); $name = new Zend_Form_Element_Text('Name'); $name->setLabel('Name:')->setRequired(true)->addFilters(array('StringTrim'))->setDecorators($this->decorators); $this->addElement($name); $definition = new Zend_Form_Element_TextArea('Definition'); $definition->setLabel('Definition:')->setRequired(true)->addFilters(array('StringTrim'))->setDecorators($this->decorators); $this->addElement($definition); $dec = new Zend_Form_Element_Select('idDEC'); $dec->setLabel('Data Element Concept:')->addMultiOptions($this->_getDependentSelect('Default_Model_DataElementConcept'))->setDecorators($this->decorators); $this->addElement($dec); $vm = new Zend_Form_Element_Select('idVD'); $vm->setLabel('Value Domain:')->addMultiOptions($this->_getDependentSelect('Default_Model_ValueDomain'))->setDecorators($this->decorators); $this->addElement($vm); $this->addDisplayGroup(array('Name', 'Definition', 'idDEC', 'idVD'), 'groups', array("legend" => "Data Element")); }
public function init() { parent::init(); $this->setMethod('post'); $this->addElement('hidden', 'idDEC'); $name = new Zend_Form_Element_Text('Name'); $name->setLabel('Name:')->setRequired(true)->addFilters(array('StringTrim'))->setDecorators($this->decorators); $this->addElement($name); $definition = new Zend_Form_Element_TextArea('Definition'); $definition->setLabel('Definition:')->addFilters(array('StringTrim'))->setDecorators($this->decorators); $this->addElement($definition); $oc = new Zend_Form_Element_Select('idOC'); $oc->setLabel('Object Class:')->addMultiOptions($this->_getDependentSelect('Default_Model_ObjectClass'))->setDecorators($this->decorators); $this->addElement($oc); $p = new Zend_Form_Element_Select('idP'); $p->setLabel('Property:')->addMultiOptions($this->_getDependentSelect('Default_Model_Property'))->setDecorators($this->decorators); $this->addElement($p); $cd = new Zend_Form_Element_Select('idCD'); $cd->setLabel('Conceptual Domain:')->addMultiOptions($this->_getDependentSelect('Default_Model_ConceptualDomain'))->setDecorators($this->decorators); $this->addElement($cd); $this->addDisplayGroup(array('Name', 'Definition', 'idOC', 'idP', 'idCD'), 'groups', array("legend" => "Data Element Concept")); }
public function init() { // Set the method for the display form to POST $this->setMethod('post'); $this->setAttrib('enctype', Zend_Form::ENCTYPE_MULTIPART); //'multipart/form-data' $this->addPrefixPath('PAP_Form_Element_', 'PAP/Form/Element/', 'Element'); $decorators = array(array('ViewHelper'), array('Errors'), array('Label', array('class' => 'leftalign ui-button-text')), array('HtmlTag', array('tag' => 'div'))); $decoratorsButton = array(array('ViewHelper'), array('HtmlTag', array('tag' => 'div'))); $this->addElement('text', 'promoCode', array('label' => 'Código ', 'required' => false, 'size' => 16, 'maxsize' => 50, 'readonly' => 'true')); $control = $this->getElement("promoCode"); $control->setDecorators($decorators); $this->addElement('textarea', 'shortDescription', array('label' => 'Texto ', 'required' => true, 'size' => 60, 'maxlength' => 60, 'filters' => array('StringTrim', 'StripTags'))); $control = $this->getElement('shortDescription'); $validator = new Zend_Validate_Alnum(array('allowWhiteSpace' => true)); $control->addValidator($validator, true); $control->setDecorators($decorators); $control->setOptions(array('rows' => '2', 'cols' => '30')); /* $this->addElement('textarea', 'long_description', array( 'label' => 'Descripción larga:', 'required' => true, 'size' => 60, 'maxlength' => 250, 'filters' => array('StringTrim'), )); $control->addValidator($validator, true); $control = $this->getElement("long_description"); $control->setDecorators($decorators);*/ $allowWhiteSpace = new Zend_Validate_Alnum(array('allowWhiteSpace' => true)); $control = new Zend_Form_Element_TextArea('longDescription'); $control->setLabel('Desc. larga ')->setOptions(array('rows' => '5', 'cols' => '30'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true)->addDecorators($decorators); $this->addElement($control); $this->addElement('text', 'starts', array('label' => 'Desde ', 'required' => true, 'size' => 10, 'maxlength' => 10)); $control = $this->getElement('starts'); $control->addValidator('Date', false, array('format' => 'dd/MM/yyyy')); $control->setDecorators($decorators); $control = $this->addElement('text', 'ends', array('label' => 'Hasta ', 'required' => true, 'size' => 10, 'maxlength' => 10)); $control = $this->getElement('ends'); $control->addValidator('Date', false, array('format' => 'dd/MM/yyyy')); $control->setDecorators($decorators); $this->addElement('text', 'promoValue', array('label' => 'Valor ', 'required' => true, 'size' => 8, 'maxlength' => 8, 'style' => 'text-align:right;', 'validators' => array(array('Float', true, array('locale' => 'en_US'))))); $control = $this->getElement('promoValue'); $control->setDecorators($decorators); $this->addElement('checkbox', 'valueSince', array('label' => 'Precio "desde" ', 'required' => false, 'value' => 0)); $control = $this->getElement('valueSince'); $control->setDecorators($decorators); $this->addElement('text', 'quantity', array('label' => 'Unidades ', 'required' => false, 'size' => 4, 'maxlength' => 8, 'validators' => array('Int'))); $control = $this->getElement('quantity'); $control->setDecorators($decorators); $this->addElement('select', 'promoType', array('label' => 'Tipo Promo ', 'required' => true)); $control = $this->getElement('promoType'); $control->addMultioption('P', 'Producto')->addMultioption('S', 'Servicio'); $control->setDecorators($decorators); $control = $this->addElement('text', 'displayedText', array('label' => 'Título ', 'required' => true, 'size' => 25, 'validators' => array('StringLength'))); $control = $this->getElement('displayedText'); //$control->addValidator('regex',true,array('^([A-Za-z0-9.,@?!%]*)$')); //^([A-Za-z0-9-'.,&@:?!()$#/\\]*)$ $control->setDecorators($decorators); $control = new Zend_Form_Element_Radio('alertType'); $control->setLabel('Alertas')->setMultiOptions(array('D' => 'Mostror por días', 'Q' => 'Mostrar por cantidad', 'N' => 'No mostrar'))->setOptions(array('id' => 'alertType'))->setAttrib('label_class', 'leftalign ui-button-text'); $this->addElement($control); $this->alertType->setAttrib('class', 'leftalign ui-button-text'); $this->addElement('select', 'state', array('label' => 'Estado', 'required' => true)); $control = $this->getElement("state"); $control->addMultiOptions(array('A' => 'Activa', 'I' => 'Inactiva')); $control->setDecorators($decorators); $this->addElement('select', 'promoCost', array('label' => 'Costo', 'required' => true)); $control = $this->getElement('promoCost'); $control->setRegisterInArrayValidator(false); $control->setDecorators($decorators); $this->addElement('text', 'visited', array('label' => 'Visitas', 'required' => false, 'size' => 5)); $this->visited->setAttrib('readonly', true)->setDecorators($decorators); $file = new Zend_Form_Element_File('filePromo'); $file->setLabel('Imagenes Promo')->setDestination(PUBLIC_PATH . '/images/tmp')->setRequired(false)->setValueDisabled(true); // ensure only one file $file->addValidator('Count', false, 1); // max 2MB $file->addValidator('Size', false, 1048576)->setMaxFileSize(1048576); $file->addValidator('Extension', false, 'jpg,png,gif')->setAttrib('onChange', 'sub(this)')->setDecorators(array('File', 'Errors', array('HtmlTag', array('tag' => 'div', 'style' => 'height:0px; width:0px; overflow:hidden;')))); $this->addElement($file); //@todo Hacerlo para 3 imàgenes $this->addElement('button', 'fakefile', array('ignore' => true, 'label' => 'Cambiar')); $this->fakefile->setAttrib('class', 'buttons')->setAttrib("onClick", "clickFile();"); $this->addElement('img', 'imagePromo', array('label' => 'Imagen', 'ignore' => true, 'width' => '75', 'height' => '75')); $this->imagePromo->setDecorators($decorators); //$div = new PAP_Form_Element_Div('totalCost'); //$div->setValue('Costo de la promo')->setAttrib('class', 'costo'); //$this->addElement($div); $this->addElement('multiselect', 'branches', array('label' => 'Sucursales', 'ignore' => true)); $this->branches->setRegisterInArrayValidator(false)->setDecorators($decorators)->setAttrib('class', 'invisible'); $this->addElement('hidden', 'userId'); $this->addElement('hidden', 'promoId'); $this->addElement('submit', 'save', array('ignore' => true, 'label' => 'Guardar')); $control = $this->getElement("save"); $control->setDecorators($decoratorsButton); $control->setAttrib('class', 'buttons'); }