public function init() { $this->setMethod('post'); $this->setAttrib('class', 'col-md-9'); $decoratorField = new My_Decorator_Field(); $elements = array(); //render our form elements and the "form" tag $this->setDecorators(array('FormElements', 'Form')); $this->setElementDecorators(array('ViewHelper', 'Label')); // Add Quantity field $input = new Zend_Form_Element_Text('quantity', array('required' => true, 'class' => '"col-md-6"', 'min' => self::MIN, 'max' => self::MAX, 'step' => '1', 'type' => 'number')); $min = new Zend_Validate_LessThan(self::MAX + 1); $max = new Zend_Validate_GreaterThan(self::MIN); $input->addValidators(array(new Zend_Validate_Float(), $min, $max, new Zend_Validate_NotEmpty())); $input->addDecorator($decoratorField); $elements[] = $input; //Add id hidden field $input = new Zend_Form_Element_Hidden('product_id'); $min = new Zend_Validate_GreaterThan(self::MIN); $input->addValidators(array(new Zend_Validate_Digits(), $min, new Zend_Validate_NotEmpty())); $input->removeDecorator('HtmlTag'); $input->removeDecorator('Label'); $elements[] = $input; $this->addElements($elements); }
public function __construct($options = null) { // variable parent::__construct($options); $baseDir = $options['baseDir']; // name $name = new Zend_Form_Element_Text('EGI_Name'); $name->setLabel($this->getView()->getCibleText('form_label_name'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput'); $this->addElement($name); // description $description = new Zend_Form_Element_Textarea('EGI_Description'); $description->setLabel($this->getView()->getCibleText('form_label_description'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextareaEdit'); $this->addElement($description); //status $status = new Zend_Form_Element_Select('EG_Status'); $status->setLabel($this->getView()->getCibleText('form_label_status'))->setAttrib('class', 'stdSelect'); $status = Cible_FunctionsGeneral::fillStatusSelectBox($status, 'Extranet_Groups', 'EG_Status'); $this->addElement($status); // Hidden GroupID $groupID = new Zend_Form_Element_Hidden('groupID'); $groupID->removeDecorator('label'); $groupID->removeDecorator('DtDdWrapper'); if (isset($options['groupID'])) { $groupID->setValue($options['groupID']); } $this->addElement($groupID); }
public function init() { $this->setMethod('post'); $this->setAttrib('enctype', 'multipart/form-data'); $photo = new Zend_Form_Element_File('photo'); $photo->setLabel('photo.upload'); $photo->setDestination($this->getAttrib('tmp')); $photo->addValidator('Count', false, 1); $photo->addValidator('Size', false, $this->getAttrib('filesize')); $photo->addValidator( 'Extension', false, $this->getAttrib('extensions') ); $photo->setRequired(true); $photo->removeDecorator('Errors'); $this->addElement($photo, 'photo'); $fbId = new Zend_Form_Element_Hidden('fbid'); $fbId->addValidator( 'Db_NoRecordExists', false, array( 'table' => 'zdjecia', 'field' => 'fbuserid' ) ); $fbId->setLabel('fbid'); $fbId->setRequired(true); $fbId->removeDecorator('Errors'); $fbId->removeDecorator('Label'); $this->addElement($fbId); $save = new Zend_Form_Element_Submit('Save'); $save->setLabel('Zgłoś Zdjęcie'); $save->setAttrib('class', 'ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only'); $this->addElement($save); $this->addDecorator( new Zend_Form_Decorator_FormErrors( array( 'ignoreSubForms'=>true, 'markupListStart' => '<ul class="ui-state-error ui-corner-all">', ) ) ) ->addDecorator('FormElements') ->addDecorator('HtmlTag') ->addDecorator('Form'); }
public function init() { $this->setName('user'); $id = new Zend_Form_Element_Hidden('id'); $id->addFilter('Int'); $id->removeDecorator('label'); $name = new Zend_Form_Element_Text('name'); $name->setLabel('name')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $password = new Zend_Form_Element_Password('password'); $password->setLabel('Password')->addValidator('NotEmpty', true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('StringLength', false, array(3, 20))->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $date = new Zend_Form_Element_Text('date'); $date->setLabel('Date')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $email = new Zend_Form_Element_Text('email'); $email->setLabel('Email')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('emailAddress', TRUE)->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $status = new Zend_Form_Element_Text('status'); $status->setLabel('status')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $person_id = new Zend_Form_Element_Text('person_id'); $person_id->setLabel('person_id')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $validation_code = new Zend_Form_Element_Text('validation_code'); $validation_code->setLabel('validation')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $phone = new Zend_Form_Element_Text('phone'); $phone->setLabel('Phone')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $role_id = new Zend_Form_Element_Select('role_id'); $role_id->setLabel('Role')->setRequired(true)->addValidator('NotEmpty', true)->setmultiOptions($this->_selectOptionsRole())->setAttrib('maxlength', 200)->setAttrib('size', 1)->setAttrib("class", "toolboxdrop")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_select.phtml')))); $company_id = new Zend_Form_Element_Select('company_id'); $company_id->setLabel('company')->setRequired(true)->addValidator('NotEmpty', true)->setmultiOptions($this->_selectOptionsCompany())->setAttrib('maxlength', 200)->setAttrib('size', 1)->setAttrib("class", "toolboxdrop")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_select.phtml')))); $submit = new Zend_Form_Element_Submit('submit'); $submit->setValue('Guardar')->setAttrib('id', 'submitbutton')->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_submit.phtml'))))->setAttrib('class', 'btn')->removeDecorator('label'); $add_contact = new Zend_Form_Element_Checkbox('add_contact'); $add_contact->setLabel('add contact')->setRequired(true); $this->addElements(array($id, $name, $password, $date, $email, $status, $validation_code, $person_id, $phone, $role_id, $company_id, $add_contact, $submit)); }
/** * (non-PHPdoc) * @see Zend_Form#init() */ public function init() { $table = new Tri_Db_Table('activity_text'); $validators = $table->getValidators(); $filters = $table->getFilters(); $translate = Zend_Registry::get('Zend_Translate'); $this->setAction('activity/text/save')->setMethod('post'); $activityId = new Zend_Form_Element_Hidden('activity_id'); $activityId->addValidators($validators['activity_id'])->addFilters($filters['activity_id'])->removeDecorator('Label')->removeDecorator('HtmlTag'); $userId = new Zend_Form_Element_Hidden('user_id'); $userId->addValidators($validators['user_id'])->addFilters($filters['user_id'])->removeDecorator('Label')->removeDecorator('HtmlTag'); $description = new Zend_Form_Element_Textarea('description'); $description->setLabel('Description')->addValidators($validators['description'])->addFilters($filters['description'])->setAttrib('rows', 20)->setAttrib('cols', '70%')->setAttrib('id', 'text-description-text')->setAllowEmpty(false); $status = new Zend_Form_Element_Hidden('status'); $status->removeDecorator('Label')->removeDecorator('HtmlTag'); $this->addElement($userId)->addElement($activityId)->addElement($status)->addElement($description); if (Zend_Auth::getInstance()->getIdentity()->role == 'student') { $saveDraft = new Zend_Form_Element_Submit('saveDraft'); $sendCorrection = new Zend_Form_Element_Submit('sendCorrection'); $saveDraft->removeDecorator('Label')->removeDecorator('DtDdWrapper'); $sendCorrection->removeDecorator('Label')->removeDecorator('DtDdWrapper'); $this->addElement($saveDraft)->addElement($sendCorrection); } else { $openButton = new Zend_Form_Element_Submit('openButton'); $finalize = new Zend_Form_Element_Submit('finalize'); $openButton->removeDecorator('Label')->removeDecorator('DtDdWrapper'); $finalize->removeDecorator('Label')->removeDecorator('DtDdWrapper'); $note = new Zend_Form_Element_Text('note'); $note->setLabel('Note')->addValidator('Int')->addFilter('Digits'); $this->addElement($note)->addElement($openButton)->addElement($finalize); } }
public function __construct($options = null) { $periods = new Periods(); $periodword_options = $periods->getPeriodFromWords(); $activities = new PrimaryActivities(); $activities_options = $activities->getTerms(); $counties = new Counties(); $county_options = $counties->getCountyName2(); parent::__construct($options); $this->setName('filterpeople'); $decorator = array('TableDecInput'); $name = new Zend_Form_Element_Text('organisation'); $name->setLabel('Filter by name')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Come on it\'s not that hard, enter a title!')->setAttrib('size', 40)->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'td'))->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->addValidator('Alnum', false, array('allowWhiteSpace' => true)); $contact = new Zend_Form_Element_Text('contact'); $contact->setLabel('Filter by contact person: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Enter a valid organisation')->setAttrib('size', 20)->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'td'))->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper'); $contactpersonID = new Zend_Form_Element_Hidden('contactpersonID'); $contactpersonID->removeDecorator('Label')->removeDecorator('DtDdWrapper')->addFilters(array('StripTags', 'StringTrim'))->removeDecorator('HtmlTag')->addValidator('Alnum'); $county = new Zend_Form_Element_Select('county'); $county->setLabel('Filter by county')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'td'))->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->addMultiOptions(array(NULL => NULL, 'Choose county' => $county_options))->addValidator('InArray', false, array(array_keys($county_options))); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton')->setLabel('Filter')->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'td'))->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(4800); $this->addElement($hash); $this->addElements(array($name, $county, $contact, $contactpersonID, $submit)); }
public function init() { // Задаём имя форме $this->setName('warehouse'); // Создаём переменную, которая будет хранить сообщение валидации $isEmptyMessage = 'Значение является обязательным и не может быть пустым'; // Создаём элемент формы – text c именем = number $image = new Zend_Form_Element_File('image'); $image->setLabel('Загрузить фотографию')->setDestination(DATA_PATH . '/public/img/')->addValidator('Size', false, '204800000')->addValidator('Extension', true, 'png,jpg,gif')->addValidator('ImageSize', false, array('minwidth' => 50, 'minheight' => 50, 'maxwidth' => 5000, 'maxheight' => 5000)); $serial = new Zend_Form_Element_Text('serial', array('class' => 'form-control')); $serial->setLabel('Серийный номер')->setAttrib('placeholder', 'S\\N:')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $isEmptyMessage)))->addValidator('regex', true, array("/^[а-яА-Яa-zA-Z0-9 \\. \\-]{3,200}\$/i", 'messages' => 'Не верный формат ввода'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('class' => 'test')), array('Label', array('tag' => 'div', 'class' => 'form-control-static')), array('Errors', array('tag' => 'div', 'class' => 'form-control-static')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $name = new Zend_Form_Element_Text('name', array('class' => 'form-control')); $name->setLabel('Название')->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty', true, array('messages' => 'Йо на, не может быть пустым'))->addValidator('regex', true, array("/^[а-яА-Яa-zA-Z0-9 \\. \\- \\s ]{3,50}\$/i", 'messages' => 'Не верный формат ввода'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('class' => 'test')), array('Label', array('tag' => 'div', 'class' => 'form-control-static')), array('Errors', array('tag' => 'div', 'class' => 'form-control-static')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $type = new Zend_Form_Element_Text('type', array('class' => 'form-control')); $type->setLabel('Тип')->setAttrib('placeholder', 'Viena,Royal,All')->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty', true, array('messages' => 'Йо на, не может быть пустым'))->addValidator('regex', true, array("/^[a-zA-Z0-9 \\- \\s]{3,20}\$/i", 'messages' => 'Не верный формат ввода'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('class' => 'test')), array('Label', array('tag' => 'div', 'class' => 'form-control-static')), array('Errors', array('tag' => 'div', 'class' => 'form-control-static')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $remain = new Zend_Form_Element_Text('remain', array('class' => 'form-control')); $remain->setLabel('Остаток')->setAttrib('placeholder', 'кол-во')->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty', true, array('messages' => 'Йо на, не может быть пустым'))->addValidator('regex', true, array("/^[0-9 \\-]{1,20}\$/i", 'messages' => 'Не верный формат ввода'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('class' => 'test')), array('Label', array('tag' => 'div', 'class' => 'form-control-static')), array('Errors', array('tag' => 'div', 'class' => 'form-control-static')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $price = new Zend_Form_Element_Text('price', array('class' => 'form-control')); $price->setLabel('Цена')->setAttrib('placeholder', 'введите цену в грн')->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty', true, array('messages' => 'Йо на, не может быть пустым'))->addValidator('regex', true, array("/^[0-9]{0,20}\$/i", 'messages' => 'Не верный формат ввода, для ввода доступны только цифры'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('class' => 'test')), array('Label', array('tag' => 'div', 'class' => 'form-control-static')), array('Errors', array('tag' => 'div', 'class' => 'form-control-static')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); // Создаём элемент hidden c именем = id $id = new Zend_Form_Element_Hidden('id'); // Указываем, что данные в этом элементе фильтруются как число int $id->addFilter('Int')->removeDecorator('label')->removeDecorator('element'); // Создаём элемент hidden c именем = id $path = new Zend_Form_Element_Hidden('path'); // Указываем, что данные в этом элементе фильтруются как число int $path->removeDecorator('label')->removeDecorator('element'); // Создаём элемент формы Submit c именем = submit $submit = new Zend_Form_Element_Submit('submit', array('class' => 'btn btn-default')); // Добавляем все созданные элементы к форме. $this->addElements(array($id, $serial, $name, $type, $remain, $price, $image, $submit, $path)); }
public function init() { $this->setName('Form User Edit'); $this->setAttrib('class', 'Form_Edit'); $this->setMethod('post')->setAction('/user/save'); $id = new Zend_Form_Element_Hidden('id'); $name = new Zend_Form_Element_Text('name'); $name->setLabel('Name:')->setRequired(true)->addValidator('alnum')->addValidator('regex', false, array('/^[a-z]+/'))->addValidator('stringLength', false, array(4, 12))->addFilter('StringToLower'); $pwd = new Zend_Form_Element_Password('pwd'); $pwd->setLabel('Password:'******'re_pwd'); $re_pwd->setLabel('Re-password:'******'role'); $role->setLabel('Role:')->addMultiOptions(array(array('key' => 'guest', 'value' => 'Guest'), array('key' => 'memeber', 'value' => 'Member'), array('key' => 'admin', 'value' => 'Admin')))->setDescription('Choose one role'); $truename = new Zend_Form_Element_Text('true_name'); $truename->setLabel('Real Name:'); $phone = new Zend_Form_Element_Text('cellphone'); $phone->setLabel('Cell Phone:')->addValidator(new SP_Validate_CellPhone()); $btnSubmit = new Zend_Form_Element_Submit('submit'); $btnSubmit->setLabel('Submit'); $this->addElements(array($id, $name, $pwd, $re_pwd, $role, $truename, $phone, $btnSubmit)); parent::init(); $this->addDecorator('OuterBox', array('attrs' => array('class' => 'form user_edit_form'), 'title' => 'Edit/Create User', 'placement' => 'PREPEND')); $id->removeDecorator('Label'); $btnSubmit->removeDecorator('Label'); }
public function __construct($options = null) { parent::__construct($options); $this->setName('relatedfindform'); $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li'))); $old_findID = new Zend_Form_Element_Text('old_findID'); $old_findID->setLabel('Find number: ')->setDecorators($decorators)->setAttrib('size', 25); $find1ID = new Zend_Form_Element_Hidden('find1ID'); $find1ID->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->removeDecorator('Label'); $clause = 'AND find1ID = ' . $find1ID->getValue; $find2ID = new Zend_Form_Element_Hidden('find2ID'); $find2ID->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->removeDecorator('Label'); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->setAttrib('class', 'large'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(4800); $this->addElement($hash); $this->addElements(array($old_findID, $find2ID, $find1ID, $submit)); $this->addDisplayGroup(array('old_findID', 'find1ID', 'find2ID'), 'details')->removeDecorator('HtmlTag'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('DtDdWrapper'); $this->details->removeDecorator('HtmlTag'); $this->details->setLegend('Add a new reference'); $this->addDisplayGroup(array('submit'), 'submit'); }
public function __construct($options = null) { parent::__construct($options); $decorators = array(array('ViewHelper'), array('Description', array('tag' => '', 'placement' => 'append')), array('Errors', array('placement' => 'append', 'tag' => 'li')), array('Label', array('separator' => ' ', 'requiredSuffix' => ' *')), array('HtmlTag', array('tag' => 'li'))); $this->setName('comments'); $comment_author_IP = new Zend_Form_Element_Hidden('comment_author_IP'); $comment_author_IP->removeDecorator('HtmlTag')->addFilters(array('StripTags', 'StringTrim'))->removeDecorator('DtDdWrapper')->removeDecorator('Label')->setValue($_SERVER['REMOTE_ADDR'])->addValue('Ip'); $comment_agent = new Zend_Form_Element_Hidden('comment_agent'); $comment_agent->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->removeDecorator('Label')->setValue($_SERVER['HTTP_USER_AGENT'])->setRequired(false)->addFilters(array('StripTags', 'StringTrim')); $comment_findID = new Zend_Form_Element_Hidden('comment_findID'); $comment_findID->addFilters(array('StripTags', 'StringTrim'))->setDecorators(array(array('ViewHelper'), array('Description', array('tag' => '')), array('Errors'), array('HtmlTag', array('tag' => 'p')), array('Label', array('tag' => '')))); $comment_author = new Zend_Form_Element_Text('comment_author'); $comment_author->setLabel('Enter your name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Alnum', false, array('allowWhiteSpace' => true))->addErrorMessage('Please enter a valid name!')->setDecorators($decorators); $comment_author_email = new Zend_Form_Element_Text('comment_author_email'); $comment_author_email->setLabel('Enter your email address: ')->setDecorators($decorators)->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'))->addValidator('EmailAddress', false, array('mx' => true))->addErrorMessage('Please enter a valid email address!')->setDescription('* This will not be displayed to the public.'); $comment_author_url = new Zend_Form_Element_Text('comment_author_url'); $comment_author_url->setLabel('Enter your web address: ')->setDecorators($decorators)->setRequired(false)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'))->addErrorMessage('Please enter a valid address!')->addValidator('Url')->setDescription('* Not compulsory'); $comment_content = new Pas_Form_Element_RTE('comment_content'); $comment_content->setLabel('Enter your comment: ')->setRequired(true)->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars')); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton')->removeDecorator('label')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->setAttrib('class', 'large'); $approval = new Zend_Form_Element_Radio('comment_approval'); $approval->setLabel('What would you like to do? ')->addMultiOptions(array('spam' => 'Set as spam', 'ham' => 'Submit ham?', 'approved' => 'Publish it?', 'delete' => 'Delete it?'))->setValue('approved')->addFilters(array('StripTags', 'StringTrim', 'StringToLower'))->setOptions(array('separator' => ''))->setDecorators($decorators); $this->addElements(array($comment_author_IP, $comment_agent, $comment_author, $comment_author_email, $comment_content, $comment_author_url, $comment_findID, $approval, $submit)); $this->addDisplayGroup(array('comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_approval', 'comment_findID'), 'details'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('HtmlTag'); $this->details->removeDecorator('DtDdWrapper'); $this->details->setLegend('Enter your comments: '); $this->addDisplayGroup(array('submit'), 'submit'); }
public function init() { /* Form Elements & Other Definitions Here ... */ $this->setName('FormularioNoticia'); $ID_NOTICIA = new Zend_Form_Element_Hidden('ID_NOTICIA'); $ID_NOTICIA->addFilter('Int'); $ID_NOTICIA->removeDecorator('Label'); $FK_ARQUIVO = new Zend_Form_Element_Hidden('FK_ARQUIVO'); $FK_ARQUIVO->addFilter('Int'); $FK_ARQUIVO->removeDecorator('Label'); $DS_TITULO = new Zend_Form_Element_Text('DS_TITULO'); $DS_TITULO->setLabel('TÍTULO')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', "Enter t�tulo"); $TX_NOTICIA = new Zend_Form_Element_Textarea('TX_NOTICIA'); $TX_NOTICIA->setLabel('TEXTO')->setRequired(true)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('rows', '20'); $DS_RESUMO = new Zend_Form_Element_Textarea('DS_RESUMO'); $DS_RESUMO->setLabel('RESUMO')->setRequired(true)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('rows', '5'); $DT_NOTICIA = new Zend_Form_Element_Hidden('DT_NOTICIA'); $DT_NOTICIA->removeDecorator('Label'); $tiposNoticia = array("1" => "NOTICIAS", "2" => "NOVIDADES", "3" => "RECADOS"); $FK_TIPO_NOTICIA = new Zend_Form_Element_Select('FK_TIPO_NOTICIA'); $FK_TIPO_NOTICIA->setLabel('TIPO NOTÍCIA')->setRequired(true)->addMultiOptions($tiposNoticia)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control select2')->setAttrib('placeholder', "Enter tipo not�cia"); $FK_OPERADOR = new Zend_Form_Element_Hidden('FK_OPERADOR'); $FK_OPERADOR->addFilter('Int'); $FK_OPERADOR->removeDecorator('Label'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel("Adiconar"); $submit->setAttrib('id', 'submitbutton'); $submit->removeDecorator('DtDdWrapper')->setAttrib('class', 'btn btn-primary button')->removeDecorator('HtmlTag')->removeDecorator('Label'); $this->addElements(array($ID_NOTICIA, $DS_TITULO, $TX_NOTICIA, $FK_ARQUIVO, $DS_RESUMO, $DT_NOTICIA, $FK_TIPO_NOTICIA, $FK_OPERADOR, $submit)); $this->setDecorators(array(array('ViewScript', array('viewScript' => '/forms/formularioNoticia.phtml')))); }
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() { $this->setName('resource'); $id = new Zend_Form_Element_Hidden('id'); $id->addFilter('Int'); $id->removeDecorator('label'); $name = new Zend_Form_Element_Text('name'); $name->setLabel('name')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $suppliers_id = new Zend_Form_Element_Select('suppliers_id'); $suppliers_id->setLabel('suppliers')->addValidator('NotEmpty', true)->setmultiOptions($this->_selectOptionsSuppliers())->setOptions(array('onChange' => 'javascript:getAjaxResponse("http://globalpms.es/production/resource/getdataresource/id/"+this.value,"resource_id");javascript:getAjaxResponse("http://globalpms.es/production/resource/getdata/id/"+this.value,"contacts_id");'))->setAttrib('size', 1)->setAttrib("class", "toolboxdrop")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_select.phtml')))); $contacts_id = new Zend_Form_Element_Select('contacts_id'); $contacts_id->setLabel('supplier contact ')->setmultiOptions($this->_selectOptionsContactSuppliers())->setAttrib('maxlength', 200)->setAttrib('size', 1)->setAttrib("class", "toolboxdrop")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_select.phtml')))); $resource_id = new Zend_Form_Element_Select('resource_id'); $resource_id->setLabel('resource')->setmultiOptions($this->_selectOptionsResources())->setAttrib('maxlength', 200)->setAttrib('size', 1)->setAttrib("class", "toolboxdrop")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_select.phtml')))); $unbilled_hours = new Zend_Form_Element_Text('unbilled_hours'); $unbilled_hours->setLabel('Unbilled hours')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $facturation_types_id = new Zend_Form_Element_Select('facturation_types_id'); $facturation_types_id->setLabel('Facturation type')->addValidator('NotEmpty', true)->setmultiOptions($this->_selectOptionsFacturation_types())->setAttrib('maxlength', 200)->setAttrib('size', 1)->setAttrib("class", "toolboxdrop")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_select.phtml')))); $price = new Zend_Form_Element_Text('price'); $price->setLabel('Price')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $observation = new Zend_Form_Element_Text('observation'); $observation->setLabel('observation')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $submit = new Zend_Form_Element_Submit('submit'); $submit->setValue('Guardar')->setAttrib('id', 'submitbutton')->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_submit.phtml'))))->setAttrib('class', 'btn')->removeDecorator('label'); $this->addElements(array($id, $name, $suppliers_id, $resource_id, $contacts_id, $unbilled_hours, $facturation_types_id, $price, $observation, $submit)); }
public function init() { $this->setName('resource_activity_has_receipt'); $id = new Zend_Form_Element_Hidden('id'); $id->addFilter('Int'); $id->removeDecorator('label'); $name = new Zend_Form_Element_Text('name'); $name->setLabel('name')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); // // $resource_activity_has_receipt_types_id = new Zend_Form_Element_Select('resource_activity_has_receipt_types_id'); // $resource_activity_has_receipt_types_id->setLabel('resource_activity_has_receipt types') // ->addValidator('NotEmpty', true) // ->setmultiOptions($this->_selectOptions_types()) // ->setAttrib('maxlength', 200) // ->setAttrib('size', 1) // ->setAttrib("class", "toolboxdrop") // ->setDecorators(array(array('ViewScript', array( // 'viewScript' => 'forms/_element_select.phtml')))) // ; // // $resource_activity_has_receipt_types_id = new Zend_Form_Element_Multiselect('$resource_activity_has_receipt_types_id'); // $resource_activity_has_receipt_types_id->setLabel('resource_activity_has_receipt types') // ->setmultiOptions($this->_selectOptions_types()) // ->setAttrib('maxlength', 200) // ->setAttrib('size', 5) // ->setDecorators(array(array('ViewScript', array( // 'viewScript' => 'forms/_element_select.phtml')))) // ->setAttrib("class","toolboxdrop") // ; // $submit = new Zend_Form_Element_Submit('submit'); $submit->setValue('Guardar')->setAttrib('id', 'submitbutton')->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_submit.phtml'))))->setAttrib('class', 'btn')->removeDecorator('label'); $this->addElements(array($id, $name, $submit)); }
public function init() { $this->setName('activity'); $id = new Zend_Form_Element_Hidden('id'); $id->addFilter('Int'); $id->removeDecorator('label'); $name = new Zend_Form_Element_Text('name'); $name->setLabel('Name')->setRequired(true)->addFilter('StripTags')->addfilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $activity_types_id = new Zend_Form_Element_Select('activity_types_id'); $activity_types_id->setLabel('activity type')->addValidator('NotEmpty', true)->setmultiOptions($this->_selectOptionsActivity_types())->setAttrib('maxlength', 200)->setAttrib('size', 1)->setAttrib("class", "toolboxdrop")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_select.phtml')))); $contact_own_company_id = new Zend_Form_Element_Select('contact_own_company_id'); $contact_own_company_id->setLabel('contact own company')->addValidator('NotEmpty', true)->setmultiOptions($this->_selectOptionsContactOwnCompanies())->setAttrib('maxlength', 200)->setAttrib('size', 1)->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_select.phtml')))); // $contact_client_company_id = new Zend_Form_Element_Select('contact_client_company_id'); $contact_client_company_id->setLabel('contact client company')->addValidator('NotEmpty', true)->setmultiOptions($this->_selectOptionsContactClientCompanies())->setAttrib('maxlength', 200)->setAttrib('size', 1)->setAttrib("class", "toolboxdrop")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_select.phtml')))); $status_id = new Zend_Form_Element_Select('status_id'); $status_id->setLabel('Status')->addValidator('NotEmpty', true)->setmultiOptions($this->_selectOptionsStatus())->setAttrib('maxlength', 300)->setAttrib('size', 1)->setAttrib("class", "toolboxdrop")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_select.phtml')))); $date_start = new Zend_Form_Element_Text('date_start'); $date_start->setLabel('date start')->setRequired(true)->addFilter('StripTags')->addfilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))))->setAttrib('id', 'f_date_start'); $date_end = new Zend_Form_Element_Text('date_end'); $date_end->setLabel('date end')->setRequired(true)->addFilter('StripTags')->addfilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))))->setAttrib('id', 'f_date_end'); $observation = new Zend_Form_Element_Text('observation'); $observation->setLabel('Observation')->setRequired(true)->addfilter('StripTags')->addfilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $submit = new Zend_Form_Element_Submit('submit'); $submit->setValue('Guardar')->setAttrib('id', 'submitbutton')->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_submit.phtml'))))->setAttrib('class', 'btn')->removeDecorator('label'); $this->addElements(array($id, $name, $activity_types_id, $contact_own_company_id, $contact_client_company_id, $status_id, $date_start, $date_end, $observation, $submit)); }
public function init() { $this->setName('contact'); $id = new Zend_Form_Element_Hidden('id'); $id->addFilter('Int'); $id->removeDecorator('label'); // // $company_id = new Zend_Form_Element_Hidden('company_id'); // $company_id->addFilter('Int'); // $company_id->removeDecorator('label'); // $name = new Zend_Form_Element_Text('name'); $name->setLabel('name')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $email = new Zend_Form_Element_Text('email'); $email->setLabel('Email')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('emailAddress', TRUE)->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $telephone = new Zend_Form_Element_Text('telephone'); $telephone->setLabel('Telephone')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $status = new Zend_Form_Element_Text('status'); $status->setLabel('Status')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $direction = new Zend_Form_Element_Text('direction'); $direction->setLabel('Direction')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $submit = new Zend_Form_Element_Submit('submit'); $submit->setValue('Guardar')->setAttrib('id', 'submitbutton')->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_submit.phtml'))))->setAttrib('class', 'btn')->removeDecorator('label'); $this->addElements(array($id, $name, $email, $telephone, $direction, $status, $submit)); }
public function __construct($options = null) { $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'prepend', 'class' => 'error', 'tag' => 'li')), array('Label', array('separator' => ' ', 'class' => 'leftalign')), array('HtmlTag', array('tag' => 'div'))); parent::__construct($options); $this->setName('MintToRuler'); $denomination_id = new Zend_Form_Element_Select('denomination_id'); $denomination_id->setLabel('Denomination: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'))->addValidator('Int')->setAttribs(array('class' => 'textInput'))->setDecorators($decorators); $ruler_id = new Zend_Form_Element_Hidden('ruler_id'); $ruler_id->removeDecorator('label')->addValidator('Int')->removeDecorator('HtmlTag'); $period_id = new Zend_Form_Element_Hidden('period_id'); $period_id->removeDecorator('label')->removeDecorator('HtmlTag'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60); $this->addElement($hash); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Add a denomination for this ruler')->setAttribs(array('class' => 'large')); $this->addElements(array($denomination_id, $ruler_id, $period_id, $submit))->setLegend('Add an active denomination'); $this->addDisplayGroup(array('denomination_id'), 'details')->removeDecorator('HtmlTag'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('DtDdWrapper'); $this->details->removeDecorator('HtmlTag'); $this->addDisplayGroup(array('submit'), 'submit'); $this->submit->removeDecorator('DtDdWrapper'); $this->submit->removeDecorator('HtmlTag'); }
/** * Build easy mail form * * @return void */ public function init() { // Create and configure query field elements: $recipient = new Zend_Form_Element_Text('recipient'); $recipient->setRequired(false); $recipient->setLabel('frontdoor_recipientname'); $recipient_mail = new Zend_Form_Element_Text('recipient_mail'); $recipient_mail->setRequired(true); $recipient_mail->setLabel('frontdoor_recipientmail'); $sender = new Zend_Form_Element_Text('sender'); $sender->setRequired(false); $sender->setLabel('frontdoor_sendername'); $sender_mail = new Zend_Form_Element_Text('sender_mail'); $sender_mail->setRequired(false); $sender_mail->setLabel('frontdoor_sendermail'); $message = new Zend_Form_Element_Textarea('message'); $message->setRequired(false); $message->setLabel('frontdoor_messagetext'); $title = new Zend_Form_Element_Hidden('title'); $htmlTag = $title->getDecorator('htmlTag'); $htmlTag->setOption('tag', 'div'); $title->removeDecorator('label'); $doc_id = new Zend_Form_Element_Hidden('doc_id'); $htmlTag = $doc_id->getDecorator('htmlTag'); $htmlTag->setOption('tag', 'div'); $doc_id->removeDecorator('label'); $doc_type = new Zend_Form_Element_Hidden('doc_type'); $htmlTag = $doc_type->getDecorator('htmlTag'); $htmlTag->setOption('tag', 'div'); $doc_type->removeDecorator('label'); $submit = new Zend_Form_Element_Submit('frontdoor_send_recommendation'); $submit->setLabel('frontdoor_sendrecommendation'); // Add elements to form: $this->addElements(array($recipient, $recipient_mail, $sender, $sender_mail, $message, $title, $doc_id, $doc_type, $submit)); }
public function __construct($options = null) { parent::__construct($options); $this->setAttrib('enctype', 'multipart/form-data'); $this->setName('AddRulerImage'); $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li'))); $image = new Zend_Form_Element_File('image'); $image->setLabel('Upload an image: ')->setRequired(true)->setDestination('./images/rulers/')->addValidator('Size', false, 2097152)->addValidator('Extension', false, 'jpeg,tif,jpg,png,gif,JPG,TIFF')->setMaxFileSize(1024000)->setAttribs(array('class' => 'textInput'))->addValidator('Count', false, array('min' => 1, 'max' => 1))->addDecorator('File'); $caption = new Zend_Form_Element_Text('caption'); $caption->setLabel('Image caption')->setRequired(true)->setAttrib('size', 60)->setDecorators($decorators)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a label'); $rulerID = new Zend_Form_Element_Hidden('rulerID'); $rulerID->removeDecorator('label')->removeDecorator('HtmlTag')->addValidator('Int')->setRequired(true); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60); $this->addElement($hash); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Upload an image of a ruler')->setAttribs(array('class' => 'large')); $this->addElements(array($image, $rulerID, $caption, $submit))->setLegend('Add an image to a ruler profile'); $this->addDisplayGroup(array('image', 'caption'), 'details')->removeDecorator('HtmlTag'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('DtDdWrapper'); $this->details->removeDecorator('HtmlTag'); $this->addDisplayGroup(array('submit'), 'submit'); $this->submit->removeDecorator('DtDdWrapper'); $this->submit->removeDecorator('HtmlTag'); }
public function __construct($options = null) { $this->_disabledDefaultActions = true; $readOnly = $options['readOnlyForm']; $payement = $options['payMean']; $config = Zend_Registry::get('config'); unset($options['readOnlyForm']); unset($options['payMean']); parent::__construct($options); $this->setAttrib('id', 'accountManagement'); $buttonLabel = $this->getView()->getClientText('form_label_confirm_order_btn'); if (in_array($payement, array('visa', 'mastercard'))) { $this->setAction($config->payment->url); $buttonLabel = $this->getView()->getClientText('form_label_confirm_payment_btn'); } $baseDir = $this->getView()->baseUrl(); // Account data summary $summary = new Cible_Form_Element_Html('summary', array('value' => $readOnly)); $summary->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline left')))); $this->addElement($summary); $storeId = new Zend_Form_Element_Hidden('ps_store_id', array('value' => $config->payment->storeId)); $storeId->removeDecorator('label'); $this->addElement($storeId); $hppKey = new Zend_Form_Element_Hidden('hpp_key', array('value' => $config->payment->hppkey)); $hppKey->removeDecorator('label'); $this->addElement($hppKey); $total = new Zend_Form_Element_Hidden('charge_total'); $total->removeDecorator('label'); $this->addElement($total); // Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel($buttonLabel)->setAttrib('class', 'nextStepButton')->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'stepBottomNext')))); $this->addElement($submit); }
public function init() { $this->setName('client'); $id = new Zend_Form_Element_Hidden('id'); $id->addFilter('Int'); $id->removeDecorator('label'); $name = new Zend_Form_Element_Text('name'); $name->setLabel('name')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $fiscal_name = new Zend_Form_Element_Text('fiscal_name'); $fiscal_name->setLabel('Fiscal name')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $company_types_id = new Zend_Form_Element_Select('company_types_id'); $company_types_id->setLabel('Type')->setRequired(true)->addValidator('NotEmpty', true)->setmultiOptions($this->_selectOptionsCompanyTypes())->setAttrib('maxlength', 200)->setAttrib('size', 1)->setAttrib("class", "toolboxdrop")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_select.phtml')))); $email = new Zend_Form_Element_Text('email'); $email->setLabel('Email')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('emailAddress', TRUE)->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $telephone = new Zend_Form_Element_Text('telephone'); $telephone->setLabel('Telephone')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $fax = new Zend_Form_Element_Text('fax'); $fax->setLabel('fax')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $direction = new Zend_Form_Element_Text('direction'); $direction->setLabel('Direction')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $city = new Zend_Form_Element_Text('city'); $city->setLabel('City')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $country = new Zend_Form_Element_Text('country'); $country->setLabel('Country')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $postal_code = new Zend_Form_Element_Text('postal_code'); $postal_code->setLabel('Postal code')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $observation = new Zend_Form_Element_Text('observation'); $observation->setLabel('Observation')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $submit = new Zend_Form_Element_Submit('submit'); $submit->setValue('Guardar')->setAttrib('id', 'submitbutton')->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_submit.phtml'))))->setAttrib('class', 'btn')->removeDecorator('label'); $this->addElements(array($id, $name, $fiscal_name, $company_types_id, $email, $telephone, $fax, $direction, $city, $country, $postal_code, $observation, $submit)); }
public function __construct($options = null) { parent::__construct($options); $this->setName('MintToRuler'); $reverseID = new Zend_Form_Element_Select('reverseID'); $reverseID->setLabel('Reverse type: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'))->setAttribs(array('class' => 'textInput')); $rulerID = new Zend_Form_Element_Hidden('rulerID'); $rulerID->removeDecorator('label')->removeDecorator('HtmlTag')->addValidator('Int'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60); $this->addElement($hash); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Add a reverse type for this ruler')->setAttribs(array('class' => 'large')); $this->addElements(array($reverseID, $rulerID, $submit)); $this->addDisplayGroup(array('reverseID'), 'details')->removeDecorator('HtmlTag'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('DtDdWrapper'); $this->details->removeDecorator('HtmlTag'); $this->details->setLegend('Add an active Mint'); $this->addDisplayGroup(array('submit'), 'submit'); $this->submit->removeDecorator('DtDdWrapper'); $this->submit->removeDecorator('HtmlTag'); $this->details->setLegend('Add an active reverse type'); }
public function init() { $this->setMethod('post'); $decoratorField = new My_Decorator_Field(); $elements = array(); //render our form elements and the "form" tag $this->setDecorators(array('FormElements', 'Form')); $this->setElementDecorators(array('ViewHelper', 'Label')); //Add id hidden field $input = new Zend_Form_Element_Hidden('product_id'); $min = new Zend_Validate_GreaterThan(self::MIN); $input->addValidators(array(new Zend_Validate_Digits(), $min, new Zend_Validate_NotEmpty())); $input->removeDecorator('HtmlTag'); $input->removeDecorator('Label'); $elements[] = $input; $this->addElements($elements); }
public function __construct($options = null) { $counties = new Counties(); $county_options = $counties->getCountyName2(); $crimes = new CrimeTypes(); $crimeoptions = $crimes->getTypes(); ZendX_JQuery::enableForm($this); parent::__construct($options); $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error')), array('Label'), array('HtmlTag', array('tag' => 'li'))); $this->setName('rally'); $crimeType = new Zend_Form_Element_Select('crimeType'); $crimeType->setLabel('Crime type: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must set crime type or no point entering it!')->addMultiOptions(array(NULL => 'Choose a crime type', 'Valid types' => $crimeoptions))->addValidator('inArray', false, array(array_keys($crimeoptions)))->setDecorators($decorators); $subject = new Zend_Form_Element_Text('subject'); $subject->setLabel('Title: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Alnum', false, array('allowWhiteSpace' => true))->setDecorators($decorators)->setAttrib('size', 50)->addErrorMessage('You must enter a subject for this crime'); $reporterID = new Zend_Form_Element_Hidden('reporterID'); $reporterID->removeDecorator('Label')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You do not appear to have chosen a reporter'); $reporter = new Zend_Form_Element_Text('reporter'); $reporter->setLabel('Source: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators)->setDescription('Name and address of person providing intelligence.')->addErrorMessage('You must enter a reporter name'); $reportingPerson = new Zend_Form_Element_Text('reportingPerson'); $reportingPerson->setLabel('Person making the report: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators)->setDescription('Name of person providing intelligence.')->addErrorMessage('You must enter a reporter name'); $reportSubject = new Zend_Form_Element_Text('reportSubject'); $reportSubject->setLabel('Subject of report: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Alnum', false, array('allowWhiteSpace' => true))->setDecorators($decorators)->setDescription('Name of suspect if known.')->addErrorMessage('You must enter a reporter name'); $county = new Zend_Form_Element_Select('county'); $county->setLabel('County: ')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => 'Choose a county', 'Valid counties' => $county_options))->addValidator('inArray', false, array(array_keys($county_options)))->setDecorators($decorators); $district = new Zend_Form_Element_Select('district'); $district->setLabel('District: ')->setDecorators($decorators)->addMultiOptions(array(NULL => 'Choose district after county')); $reliability = new Zend_Form_Element_Select('reliability'); $reliability->setLabel('Source Evaluation: ')->addMultiOptions(array('1' => 'Always reliable', '2' => 'Mostly reliable', '3' => 'Sometimes reliable', '4' => 'Unreliable', '5' => 'Don\'t know'))->setValue(1)->addFilters(array('StripTags', 'StringTrim'))->setOptions(array('separator' => ''))->setDecorators($decorators); $intellEvaluation = new Zend_Form_Element_Select('intellEvaluation'); $intellEvaluation->setLabel('Intelligence Evaluation: ')->addMultiOptions(array('1' => 'Known to be true', '2' => 'Known to be true by the source, but not by the person making the report', '3' => 'Not known, but is corroborated', '4' => 'Cannot be judged', '5' => 'Suspected to be false!'))->setValue(1)->addFilters(array('StripTags', 'StringTrim'))->setDescription('What you know about the intelligence itself.')->setOptions(array('separator' => ''))->setDecorators($decorators); $parish = new Zend_Form_Element_Select('parish'); $parish->setLabel('Parish: ')->setDecorators($decorators)->addMultiOptions(array(NULL => 'Choose parish after district'))->addFilters(array('StripTags', 'StringTrim')); $gridref = new Zend_Form_Element_Text('gridref'); $gridref->setLabel('Associated NGR: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidators(array('NotEmpty', 'ValidGridRef'))->setAttrib('maxlength', 16)->setDecorators($decorators); $description = new Pas_Form_Element_RTE('description'); $description->setLabel('Description of crime - Main report: ')->setRequired(false)->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars')); $subjectDetails = new Pas_Form_Element_RTE('subjectDetails'); $subjectDetails->setLabel('Subject details: ')->setRequired(false)->setDescription('DOB,address,description,etc if known.')->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars')); $evaluation = new Pas_Form_Element_RTE('evaluation'); $evaluation->setLabel('Offences: ')->setRequired(false)->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars')); $incidentDate = new ZendX_JQuery_Form_Element_DatePicker('incidentDate'); $incidentDate->setLabel('Date of incident: ')->setJQueryParam('dateFormat', 'yy-mm-dd')->addFilters(array('StripTags', 'StringTrim'))->addValidators(array('NotEmpty', 'Date'))->addErrorMessage('Come on it\'s not that hard, enter a title!')->setAttrib('size', 20)->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'li'))->removeDecorator('DtDdWrapper'); $sam = new Zend_Form_Element_Text('sam'); $sam->setLabel('Associated with scheduled monument: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators)->setAttrib('size', 35); $samID = new Zend_Form_Element_Hidden('samID'); $samID->removeDecorator('Label')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton')->removeDecorator('label')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->setAttrib('class', 'large'); $this->addElements(array($crimeType, $incidentDate, $samID, $sam, $reporter, $reporterID, $county, $district, $parish, $gridref, $description, $reliability, $evaluation, $subject, $reliability, $intellEvaluation, $subjectDetails, $reportSubject, $reportingPerson, $submit)); $this->addDisplayGroup(array('subject', 'crimeType', 'description', 'incidentDate', 'evaluation', 'reportingPerson', 'reporter', 'reporterID', 'reliability', 'intellEvaluation', 'reportSubject', 'subjectDetails', 'sam', 'samID', 'gridref', 'county', 'district', 'parish'), 'details'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('DtDdWrapper'); $this->details->setLegend('Crime details: '); $this->addDisplayGroup(array('submit'), 'submit'); }
public function __construct($options = null) { parent::__construct($options); $imageSrc = $options['imageSrc']; $dataId = $options['dataId']; $imgField = $options['imgField']; $isNewImage = $options['isNewImage']; $moduleName = $options['moduleName']; if ($dataId == '') { $pathTmp = "../../../../../data/images/" . $moduleName . "/tmp"; } else { $pathTmp = "../../../../../data/images/" . $moduleName . "/" . $dataId . "/tmp"; } // hidden specify if new image for the news $newImage = new Zend_Form_Element_Hidden('isNewImage', array('value' => $isNewImage)); $newImage->removeDecorator('Label'); $this->addElement($newImage); // Image for the product line $imageTmp = new Zend_Form_Element_Hidden($imgField . '_tmp'); $imageTmp->removeDecorator('Label'); $this->addElement($imageTmp); $imageOrg = new Zend_Form_Element_Hidden($imgField . '_original'); $imageOrg->removeDecorator('Label'); $this->addElement($imageOrg); // Name of the group of banner // Set the texte for the image $textDescription = new Zend_Form_Element_Textarea('BII_Text'); $textDescription->setLabel($this->_view->getCibleText('form_banner_image_text_label'))->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextarea'); $label = $textDescription->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $textUrl = new Zend_Form_Element_Text('BII_Url'); $textUrl->setLabel($this->_view->getCibleText('form_banner_image_texturl_label'))->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdText'); $label = $textUrl->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $groupImage = new Zend_Form_Element_Select('BI_GroupID'); $groupImage->setLabel($this->_view->getCibleText('form_banner_image_group'))->setAttrib('class', 'largeSelect'); $group = new GroupObject(); $groupArray = $group->groupCollection(); foreach ($groupArray as $group1) { $groupImage->addMultiOption($group1['BG_ID'], $group1['BG_Name']); } $label = $groupImage->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); // Image for the product line $imageView = new Zend_Form_Element_Image($imgField . '_preview', array('onclick' => 'return false;')); $imageView->setImage($imageSrc); $imagePicker = new Cible_Form_Element_ImagePicker($imgField, array('onchange' => "document.getElementById('imageView').src = document.getElementById('" . $imgField . "').value", 'associatedElement' => $imgField . '_preview', 'pathTmp' => $pathTmp, 'contentID' => $dataId)); $imagePicker->removeDecorator('Label'); $this->addElement($imageView); $this->addElement($imagePicker); $this->addElement($groupImage); $this->addElement($textDescription); $this->addElement($textUrl); }
public function __construct($options = null) { parent::__construct($options); // tinymce editor for the text of the text online $value = new Zend_Form_Element_Textarea('ST_Value'); $value->setLabel('Valeur:')->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => 'Vous devez saisir un texte')))->setAttrib('class', 'mediumEditor'); $this->addElement($value); $identifier = new Zend_Form_Element_Hidden('ST_Identifier'); $identifier->removeDecorator('DtDdWrapper'); $identifier->removeDecorator('label'); $this->addElement($identifier); $language = new Zend_Form_Element_Hidden('ST_LangID'); $language->removeDecorator('DtDdWrapper'); $language->removeDecorator('label'); $this->addElement($language); $type = new Zend_Form_Element_Hidden('ST_Type'); $type->removeDecorator('DtDdWrapper'); $type->removeDecorator('label'); $this->addElement($type); }
public function init() { $this->setMethod('post'); $elements = array(); //render our form elements and the "form" tag $this->setDecorators(array('FormElements', 'Form')); $this->setElementDecorators(array('ViewHelper', 'Label')); //Add id hidden field $input = new Zend_Form_Element_Hidden('id'); $input->addValidators(array(new Zend_Validate_Digits(), new Zend_Validate_NotEmpty())); $input->removeDecorator('HtmlTag'); $input->removeDecorator('Label'); $elements[] = $input; //Add submit button $input = new Zend_Form_Element_Submit('submit'); $input->removeDecorator('HtmlTag'); $input->removeDecorator('Label'); $input->removeDecorator('DtDdWrapper'); $elements[] = $input; $this->addElements($elements); }
public function __construct($options = null) { parent::__construct($options); $newsletterID = $options['newsletterID']; $imageSrc = $options['imageSrc']; $isNewImage = $options['isNewImage']; // Title $title = new Zend_Form_Element_Text('NA_Title'); $title->setLabel($this->getView()->getCibleText('form_label_title'))->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput'); $this->addElement($title); // article image if ($newsletterID == '') { $pathTmp = "../../../../../data/images/newsletter/tmp"; } else { $pathTmp = "../../../../../data/images/newsletter/{$newsletterID}/tmp"; } // hidden specify if new image for the news $newImage = new Zend_Form_Element_Hidden('isNewImage', array('value' => $isNewImage)); $newImage->removeDecorator('Label'); //$newImage->setDecorators(array('ViewHelper')); $this->addElement($newImage); $imageTmp = new Zend_Form_Element_Hidden('ImageSrc_tmp'); $imageTmp->removeDecorator('Label'); $this->addElement($imageTmp); $imageOrg = new Zend_Form_Element_Hidden('ImageSrc_original'); $imageOrg->removeDecorator('Label'); $this->addElement($imageOrg); $imageView = new Zend_Form_Element_Image('ImageSrc_preview', array('onclick' => 'return false;')); $imageView->setImage($imageSrc); $this->addElement($imageView); $imagePicker = new Cible_Form_Element_ImagePicker('ImageSrc', array('onchange' => "document.getElementById('imageView').src = document.getElementById('ImageSrc').value", 'associatedElement' => 'ImageSrc_preview', 'pathTmp' => $pathTmp, 'contentID' => $newsletterID)); $imagePicker->removeDecorator('Label'); $this->addElement($imagePicker); $imageAlt = new Zend_Form_Element_Text("NA_ImageAlt"); $imageAlt->setLabel($this->getView()->getCibleText('form_label_description_image'))->setAttrib('class', 'stdTextInput'); $this->addElement($imageAlt); // resume text $resume = new Cible_Form_Element_Editor('NA_Resume', array('mode' => Cible_Form_Element_Editor::ADVANCED)); $resume->setLabel($this->getView()->getCibleText('form_label_short_text'))->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => Cible_Translation::getCibleText('validation_message_empty_field')))); $resume->setAttrib('class', 'largeEditor'); $this->addElement($resume); $optionText = new Zend_Form_Element_Radio('NA_TextLink'); $optionText->setRequired(true)->addMultiOption('1', $this->getView()->getCibleText('extranet_newsletter_option_text_url_text'))->addMultiOption('2', $this->getView()->getCibleText('extranet_newsletter_option_text_url_url'))->addMultiOption('3', $this->getView()->getCibleText('extranet_newsletter_option_text_url_nothing')); // Text $text = new Cible_Form_Element_Editor('NA_Text', array('mode' => Cible_Form_Element_Editor::ADVANCED, 'class' => 'textAreaToMoveUp')); $text->setLabel($this->getView()->getCibleText('form_label_text'))->setAttrib('class', 'largeEditor'); $this->addElement($text); $url = new Zend_Form_Element_Text('NA_URL'); $url->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextInputNewsletterURL'); $this->addElement($optionText); $this->addElement($url); $this->addDisplayGroup(array('NA_TextLink', 'NA_URL'), 'linkTo', array('legend' => $this->getView()->getCibleText('extranet_newsletter_text_url'))); }
public function __construct($options = null) { if (isset($options['isXmlHttpRequest']) && $options['isXmlHttpRequest']) { $this->_disabledDefaultActions = true; } $this->_disabledLangSwitcher = true; if (!empty($options['object'])) { $this->_object = $options['object']; unset($options['object']); } parent::__construct($options); $id = new Zend_Form_Element_Hidden('MR_ID'); $id->removeDecorator('Label'); $id->removeDecorator('DtDdWrapper'); $this->addElement($id); $this->addDisplayGroup(array('MR_AssuMaladie', 'MR_ExpiracyDate'), 'assu'); $assu = $this->getDisplayGroup('assu'); $assu->setLegend('Assurance maladie')->setAttrib('class', 'infosFieldset assu')->removeDecorator('DtDdWrapper'); $assu->setOrder(1); $this->addDisplayGroup(array('MR_HasTravelInsur', 'MR_TravelInduranceName', 'MR_TravelIndurancePhone', 'MR_TravelInduranceNum', 'MR_TravelInduranceExpiracy'), 'travel'); $travel = $this->getDisplayGroup('travel'); $travel->setLegend('Assurance hors Québec')->setAttrib('class', 'infosFieldset travel')->removeDecorator('DtDdWrapper'); $travel->setOrder(2); $this->addDisplayGroup(array('MR_EmergyPhone', 'MR_OtherHouse', 'MR_OtherWork', 'MR_OtherCell'), 'emergency'); $emergency = $this->getDisplayGroup('emergency'); $emergency->setLegend("En cas d'urgence")->setAttrib('class', 'infosFieldset emergency')->removeDecorator('DtDdWrapper'); $emergency->setOrder(3); $this->addDisplayGroup(array('MR_Allergy', 'MR_AllergyOther', 'MR_AllergyMedic', 'MR_AllergyMedicName', 'MR_AllergyMedicQty', 'MR_AllowEmergencyCares'), 'allergy'); $allergy = $this->getDisplayGroup('allergy'); $allergy->setLegend("Allergies")->setAttrib('class', 'infosFieldset allergy')->removeDecorator('DtDdWrapper'); $allergy->setOrder(4); $this->addDisplayGroup(array('MR_Diseases'), 'diseases'); $dieases = $this->getDisplayGroup('diseases'); $dieases->setLegend("Maladies")->setAttrib('class', 'infosFieldset diseases')->removeDecorator('DtDdWrapper'); $dieases->setOrder(5); $this->addDisplayGroup(array('MR_HasGlasses', 'MR_HasLens', 'MR_Fracture', 'MR_Chirurgie', 'MR_Specific', 'MR_Notes'), 'others'); $other = $this->getDisplayGroup('others'); $other->setLegend("Informations complémentaires")->setAttrib('class', 'infosFieldset others clearBoth')->removeDecorator('DtDdWrapper'); $other->setOrder(99); }
public function __construct($options = null) { parent::__construct($options); $this->addElementPrefixPath('Pas_Validate', 'Pas/Validate/', 'validate'); $this->addPrefixPath('Pas_Form_Element', 'Pas/Form/Element/', 'element'); $this->addPrefixPath('Pas_Form_Decorator', 'Pas/Form/Decorator/', 'decorator'); $decorator = array('SimpleInput'); $decoratorSelect = array('SelectInput'); $decorators = array(array('ViewHelper'), array('Description', array('tag' => '', 'placement' => 'append')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label', array('separator' => ' ', 'requiredSuffix' => ' *')), array('HtmlTag', array('tag' => 'li'))); $this->setAttrib('accept-charset', 'UTF-8'); $this->setName('comments'); $comment_author_IP = new Zend_Form_Element_Hidden('user_ip'); $comment_author_IP->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->removeDecorator('Label')->addFilters(array('StripTags', 'StringTrim'))->setRequired(true)->addValidator('Ip')->setValue($_SERVER['REMOTE_ADDR']); $comment_agent = new Zend_Form_Element_Hidden('user_agent'); $comment_agent->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->removeDecorator('Label')->addFilters(array('StripTags', 'StringTrim'))->setValue($_SERVER['HTTP_USER_AGENT'])->setRequired(true); $comment_subject = new Zend_Form_Element_Hidden('comment_subject'); $comment_subject->removeDecorator('HtmlTag')->addFilters(array('StripTags', 'StringTrim'))->removeDecorator('DtDdWrapper')->removeDecorator('Label')->setRequired(true); $comment_findID = new Zend_Form_Element_Hidden('comment_findID'); $comment_findID->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidators(array('Int'))->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->removeDecorator('Label'); $comment_author = new Zend_Form_Element_Text('comment_author'); $comment_author->setLabel('Enter your name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter a valid name!')->setDecorators($decorators); $comment_author_email = new Zend_Form_Element_Text('comment_author_email'); $comment_author_email->setLabel('Enter your email address: ')->setDecorators($decorators)->setRequired(true)->setAttrib('size', 40)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'))->addValidator('EmailAddress')->addErrorMessage('Please enter a valid email address!')->setDescription('* This will not be displayed to the public'); $comment_type = new Zend_Form_Element_Select('comment_type'); $comment_type->setLabel('Error type: ')->setRequired(true)->setDecorators($decorators)->addMultiOptions(array(NULL => NULL, 'Choose error type' => array('Incorrect ID' => 'Incorrect identification', 'More info' => 'I have further information', 'Incorrect image' => 'Incorrect image', 'Incorrect parish' => 'Incorrect parish', 'Grid reference issues' => 'Grid reference wrong', 'Date found wrong' => 'Date of discovery wrong', 'Spelling errors' => 'Spelling errors', 'Duplicated record' => 'Duplicated record', 'Data problems apparent' => 'Data problems', 'Other' => 'Other reason')))->addErrorMessage('You must enter an error report type'); $comment_author_url = new Zend_Form_Element_Text('comment_author_url'); $comment_author_url->setLabel('Enter your web address: ')->setDecorators($decorators)->setRequired(false)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'))->addErrorMessage('Please enter a valid address!')->setDescription('* Not compulsory'); $comment_content = new Pas_Form_Element_RTE('comment_content'); $comment_content->setLabel('Enter your comment: ')->setRequired(true)->addFilter('StringTrim')->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Basic')->addFilter('StringTrim')->addFilter('WordChars')->addFilter('HtmlBody')->addFilter('EmptyParagraph')->addErrorMessage('Please enter something in the comments box!'); $config = Zend_registry::get('config'); $privateKey = $config->recaptcha->privatekey; $pubKey = $config->recaptcha->pubkey; $captcha = new Zend_Form_Element_Captcha('captcha', array('captcha' => 'ReCaptcha', 'label' => 'Prove you are not a robot you varmint!', 'captchaOptions' => array('captcha' => 'ReCaptcha', 'privKey' => $privateKey, 'pubKey' => $pubKey, 'theme' => 'clean'))); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60); $this->addElement($hash); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper'); $auth = Zend_Auth::getInstance(); if (!$auth->hasIdentity()) { $this->addElements(array($comment_findID, $comment_author_IP, $comment_agent, $comment_subject, $comment_author, $comment_author_email, $comment_content, $comment_author_url, $comment_type, $captcha, $submit)); $this->addDisplayGroup(array('comment_author', 'comment_author_email', 'comment_author_url', 'comment_type', 'comment_content', 'captcha', 'submit'), 'details'); } else { $this->addElements(array($comment_findID, $comment_subject, $comment_author_IP, $comment_agent, $comment_author, $comment_author_email, $comment_content, $comment_author_url, $comment_type, $submit)); $this->addDisplayGroup(array('comment_author', 'comment_author_email', 'comment_author_url', 'comment_type', 'comment_content', 'submit'), 'details'); } $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('HtmlTag'); $this->details->removeDecorator('DtDdWrapper'); $this->details->setLegend('Enter your error report: '); }