Пример #1
0
 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');
 }
Пример #2
0
 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));
 }
Пример #3
0
 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"));
 }
Пример #4
0
 public function __construct($parent = null, $options = null)
 {
     parent::__construct($options);
     $parentId = 0;
     if ($parent != null) {
         $parentId = $parent;
     }
     $translate = Zend_Registry::get('Zend_Translate');
     $this->setName('Create a campaign');
     $this->addElementPrefixPath('Oibs_Form_Decorator', 'Oibs/Form/Decorator/', 'decorator');
     // Clear div
     $clear = '<div class="clear"></div>';
     // Campaign name
     $campaignname = new Zend_Form_Element_Text('campaign_name');
     $campaignname->setLabel('Name')->setRequired(true)->setFilters(array('StringTrim'))->setValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'field-empty'))), new Oibs_Validators_CampaignExists('campaign_name'), array('StringLength', false, array(1, 140, 'messages' => array('stringLengthTooLong' => 'Name too long.')))))->setDescription('<div id="progressbar_campaign_name" class="limit ok"></div>')->setDecorators(array('FieldDecorator'));
     $campaignname_clear = new Oibs_Form_Element_Note('campaignname_clear');
     $campaignname_clear->setValue($clear)->setDecorators(array('ViewHelper'));
     // Ingress
     $campaigningress = new Zend_Form_Element_TextArea('campaign_ingress');
     $campaigningress->setAttrib('cols', '45')->setAttrib('rows', '6')->setLabel('Ingress')->setRequired(true)->setFilters(array('StringTrim'))->setValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => "Ingress can't be empty."))), array('StringLength', false, array(1, 320, 'messages' => array('stringLengthTooLong' => 'Ingress too long.')))))->setDescription('<div id="progressbar_campaign_ingress" class="limit ok"></div>')->setDecorators(array('FieldDecorator'));
     $campaigningress_clear = new Oibs_Form_Element_Note('campaigningress_clear');
     $campaigningress_clear->setValue($clear)->setDecorators(array('ViewHelper'));
     // Description
     $campaigndesc = new Zend_Form_Element_TextArea('campaign_desc');
     $campaigndesc->setAttrib('cols', '45')->setAttrib('rows', '20')->setLabel('Body text')->setRequired(true)->setFilters(array('StringTrim'))->setValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => "Body text can't be empty."))), array('StringLength', false, array(1, 4000, 'messages' => array('stringLengthTooLong' => 'Body text too long.')))))->setDescription('<div id="progressbar_campaign_desc" class="limit ok"></div>')->setDecorators(array('FieldDecorator'));
     $campaigndesc_clear = new Oibs_Form_Element_Note('campaigndesc_clear');
     $campaigndesc_clear->setValue($clear)->setDecorators(array('ViewHelper'));
     // Start date
     $campaignstart = new Zend_Form_Element_Text('campaign_start');
     $campaignstart->setAttrib('id', 'campaign_start')->setAttrib('name', 'campaign_start')->setLabel('Start date')->setRequired(true)->setAttrib('invalidMessage', 'Invalid date specified')->setAttrib('formalLength', 'long')->setValidators(array(new Zend_Validate_Date('campaign_start')))->setDecorators(array('FieldDecorator'));
     $campaignstart_clear = new Oibs_Form_Element_Note('campaignstart_clear');
     $campaignstart_clear->setValue($clear)->setDecorators(array('ViewHelper'));
     // End date
     $campaignend = new Zend_Form_Element_Text('campaign_end');
     $campaignend->setAttrib('id', 'campaign_end')->setLabel('End date')->setRequired(true)->setAttrib('invalidMessage', 'Invalid date specified')->setAttrib('formalLength', 'long')->setValidators(array(new Zend_Validate_Date('campaign_end')))->setDecorators(array('FieldDecorator'));
     $campaignend_clear = new Oibs_Form_Element_Note('campaignend_clear');
     $campaignend_clear->setValue($clear)->setDecorators(array('ViewHelper'));
     $save = new Zend_Form_Element_Submit('save');
     $save->setLabel('Create')->setAttrib('id', 'publish')->setAttrib('class', 'submit-button')->setAttrib('style', 'float: none;');
     $cancel = new Zend_Form_Element_Submit('cancel');
     $cancel->setLabel('Cancel')->setAttrib('id', 'preview')->setAttrib('class', 'submit-button')->setAttrib('style', 'float: none;');
     $this->addElements(array($campaignname, $campaignname_clear, $campaigningress, $campaigningress_clear, $campaigndesc, $campaigndesc_clear, $save));
     $save->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'openOnly' => true, 'id' => 'submit', 'style' => 'clear: both;'))));
     $cancel->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'closeOnly' => true))));
 }
Пример #5
0
 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));
 }
Пример #6
0
 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"));
 }
Пример #7
0
 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"));
 }
Пример #8
0
 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');
 }