/**
  * See {@link PHPUnit_Framework_TestCase::setUp()} for details.
  */
 protected function setUp()
 {
     parent::setUp();
     $this->relationValidator = $this->createRelationValidator();
     $this->element = new Zend_Form_Element_Text('name');
     $this->element->setLabel('Your name');
     $this->validator = new Mol_Validate_Form_ElementRelation($this->relationValidator, $this->element);
 }
Example #2
0
 public function init()
 {
     /* Form Elements & Other Definitions Here ... */
     $this->setName('album');
     $id = new Zend_Form_Element_Hidden('id');
     $id->addFilter('Int');
     $artist = new Zend_Form_Element_Text('artist');
     $artist->setLabel('Artist')->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty');
     $title = new Zend_Form_Element_Text('title');
     $artist->setLabel('Title')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $this->addElements(array($id, $artist, $title, $submit));
 }
 public function init()
 {
     $languageFile = Zend_Registry::get('languageFile');
     $translate = new Zend_Translate('array', $languageFile, 'zh_CN');
     $this->setTranslator($translate);
     $this->setMethod('POST');
     $this->setName('contactForm');
     $element = new Zend_Form_Element_Text('name');
     $element->setLabel('怎么称呼您');
     $this->addElement($element);
     $element = new Zend_Form_Element_Text('email');
     $element->setLabel('您的Email');
     //$element->setRequired(true);
     $this->addElement($element);
     $element = new Elements();
     $element->addReCaptcha($this);
     $this->addDisplayGroup(array('name', 'email', 'captcha'), 'leftSection');
     $this->getDisplayGroup('leftSection')->removeDecorator('DtDdWrapper');
     $element = new Zend_Form_Element_Textarea('body');
     $element->setLabel('想要开通城市地区和找房贴士,关于您的简单介绍');
     $element->addPrefixPath('My_Validator', 'My/Validator/', 'validate');
     $element->addValidator('FormValueNotNull', true);
     //$element->setRequired(true);
     $element->setAttrib('rows', 13);
     $this->addElement($element);
     $this->addDisplayGroup(array('body'), 'rightSection');
     $this->getDisplayGroup('rightSection')->removeDecorator('DtDdWrapper');
     $element = new Zend_Form_Element_Submit('post');
     $element->removeDecorator('Label');
     $this->addElement($element);
 }
Example #4
0
 public function init()
 {
     $this->clearDecorators()->addDecorator('FormElements')->addDecorator('Form')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'search'))->addDecorator('HtmlTag2', array('tag' => 'div', 'class' => 'clear'));
     $this->setAttribs(array('id' => 'filter_form', 'class' => 'global_form_box'))->setMethod('GET');
     $displayname = new Zend_Form_Element_Text('displayname');
     $displayname->setLabel('Display Name')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'));
     $username = new Zend_Form_Element_Text('username');
     $username->setLabel('Username')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'));
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('Email')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'));
     $levels = Engine_Api::_()->getDbtable('levels', 'authorization')->getLevelsAssoc();
     $levelMultiOptions = array(0 => ' ');
     foreach ($levels as $key => $value) {
         $levelMultiOptions[$key] = $value;
     }
     $level_id = new Zend_Form_Element_Select('level_id');
     $level_id->setLabel('Level')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions($levelMultiOptions);
     $enabled = new Zend_Form_Element_Select('enabled');
     $enabled->setLabel('Approved')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions(array('-1' => '', '0' => 'Not Approved', '1' => 'Approved'))->setValue('-1');
     $submit = new Zend_Form_Element_Button('search', array('type' => 'submit'));
     $submit->setLabel('Search')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'buttons'))->addDecorator('HtmlTag2', array('tag' => 'div'));
     $this->addElement('Hidden', 'order', array('order' => 10001));
     $this->addElement('Hidden', 'order_direction', array('order' => 10002));
     $this->addElement('Hidden', 'user_id', array('order' => 10003));
     $this->addElements(array($displayname, $username, $email, $level_id, $enabled, $submit));
     // Set default action without URL-specified params
     $params = array();
     foreach (array_keys($this->getValues()) as $key) {
         $params[$key] = null;
     }
     $this->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble($params));
 }
Example #5
0
 /** the constructor
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     $periods = new Periods();
     $period_options = $periods->getCoinsPeriod();
     parent::__construct($options);
     $this->setName('moneyers');
     $name = new Zend_Form_Element_Text('name');
     $name->setLabel('Moneyer\'s name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->addErrorMessage('Enter a moneyer\'s name');
     $period = new Zend_Form_Element_Select('period');
     $period->setLabel('Broad period: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setRequired(true)->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('You must enter a period for this type')->addMultioptions(array(null => 'Choose a period', 'Available Options' => $period_options));
     $date_1 = new Zend_Form_Element_Text('date_1');
     $date_1->setLabel('Issued coins from: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a date for the start of moneyer period');
     $date_2 = new Zend_Form_Element_Text('date_2');
     $date_2->setLabel('Issued coins until: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a date for the end of moneyer period');
     $appear = new Zend_Form_Element_Text('appear');
     $appear->setLabel('Appearance on coins: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'));
     $RRC = new Zend_Form_Element_Text('RRC');
     $RRC->setLabel('RRC ID number: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'));
     $bio = new Pas_Form_Element_CKEditor('bio');
     $bio->setLabel('Biography: ')->setRequired(true)->addFilters(array('StringTrim', 'WordChars', 'BasicHtml', 'EmptyParagraph'))->setAttribs(array('rows' => 10, 'cols' => 40, 'Height' => 400))->setAttrib('ToolbarSet', 'Finds')->addErrorMessage('You must enter a biography');
     $valid = new Zend_Form_Element_Checkbox('valid');
     $valid->setLabel('Is this term valid?: ');
     $submit = new Zend_Form_Element_Submit('submit');
     $this->addElements(array($period, $name, $date_1, $date_2, $bio, $appear, $RRC, $valid, $submit));
     $this->addDisplayGroup(array('name', 'period', 'date_1', 'date_2', 'appear', 'RRC', 'bio', 'valid', 'submit'), 'details');
     parent::init();
 }
Example #6
0
 public function init()
 {
     $this->setName('shipping_address');
     $id = new Zend_Form_Element_Hidden('id');
     $id->addFilter('Int');
     $customerid = new Zend_Form_Element_Hidden('customerid');
     $customerid->addFilter('Int');
     $address1 = new Zend_Form_Element_Text('shipping_address1');
     $address1->setLabel('Street Address')->setAttrib('id', 'address1')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $address2 = new Zend_Form_Element_Text('shipping_address2');
     $address2->setLabel('')->setAttrib('id', 'address2')->addFilter('StripTags')->addFilter('StringTrim');
     $address3 = new Zend_Form_Element_Text('shipping_address3');
     $address3->setLabel('')->setAttrib('id', 'address3')->addFilter('StripTags')->addFilter('StringTrim');
     $postcode = new Zend_Form_Element_Text('shipping_postcode');
     $postcode->setLabel('Postcode')->setAttrib('id', 'postcode')->addFilter('StripTags')->addFilter('StringTrim');
     $country = new Zend_Form_Element_Text('shipping_country');
     $country->setLabel('Country')->setAttrib('id', 'country')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $city = new Zend_Form_Element_Text('shipping_city');
     $city->setLabel('City')->setAttrib('id', 'city')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $phone = new Zend_Form_Element_Text('shipping_phone');
     $phone->setLabel('Phone')->setAttrib('id', 'phone')->addFilter('StripTags')->addFilter('StringTrim');
     $fax = new Zend_Form_Element_Text('shipping_fax');
     $fax->setLabel('Fax')->setAttrib('id', 'fax')->addFilter('StripTags')->addFilter('StringTrim');
     $email = new Zend_Form_Element_Text('shipping_email');
     $email->setLabel('E-Mail')->setAttrib('id', 'email')->addFilter('StripTags')->addFilter('StringTrim');
     $internet = new Zend_Form_Element_Text('shipping_internet');
     $internet->setLabel('Internet')->setAttrib('id', 'internet')->addFilter('StripTags')->addFilter('StringTrim');
     $submit = new Zend_Form_Element_Button('shipping_submit');
     $submit->setAttrib('onclick', 'addAddress()');
     $this->addElements(array($id, $customerid, $address1, $address2, $address3, $postcode, $city, $country, $phone, $fax, $email, $internet, $submit));
 }
Example #7
0
 public function init()
 {
     $this->clearDecorators()->addDecorator('FormElements')->addDecorator('Form')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'search'))->addDecorator('HtmlTag2', array('tag' => 'div', 'class' => 'clear'));
     $this->setAttribs(array('id' => 'filter_form', 'class' => 'global_form_box'));
     $username = new Zend_Form_Element_Text('username');
     $username->setLabel('Username')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'));
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('Email')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'));
     $levelMultiOptions = array(0 => ' ');
     /*      $table = $this->_helper->api()->getItemTable('user');
           $select = $viewer->membership()->getMembersSelect('user_id');
           $friends = $table->fetchAll($select);*/
     $levels = Engine_Api::_()->getDbtable('levels', 'authorization')->fetchAll();
     foreach ($levels as $row) {
         $levelMultiOptions[$row->level_id] = $row->getTitle();
     }
     $level_id = new Zend_Form_Element_Select('level_id');
     $level_id->setLabel('Level')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions($levelMultiOptions);
     $enabled = new Zend_Form_Element_Select('enabled');
     $enabled->setLabel('Approved')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions(array('-1' => '', '0' => 'Not Approved', '1' => 'Approved'))->setValue('-1');
     $submit = new Zend_Form_Element_Button('search', array('type' => 'submit'));
     $submit->setLabel('Search')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'buttons'))->addDecorator('HtmlTag2', array('tag' => 'div'));
     $this->addElement('Hidden', 'order', array('order' => 10001));
     $this->addElement('Hidden', 'order_direction', array('order' => 10002));
     $this->addElements(array($username, $email, $level_id, $enabled, $submit));
     // Set default action
     $this->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array()));
 }
Example #8
0
    public function init()
    {
        $tr = Zend_Registry::get('tr');
        
        $handle = new Zend_Form_Element_Text('handle');
        $handle->setLabel($tr->_('HANDLE'));
        $handle->setRequired(true);
        $handle->addValidator('NotEmpty', true, array('messages' => $tr->_('GENERAL_MISSING_TEXT_VALUE')));
        $this->addElement($handle);

        $password = new Zend_Form_Element_Password('password');
        $password->setLabel($tr->_('PASSWORD'));
        $password->setRequired(true);
        $password->addValidator('NotEmpty', true, array('messages' => $tr->_('GENERAL_MISSING_TEXT_VALUE')));
        $this->addElement($password);

        $password1 = new Zend_Form_Element_Password('password_again');
        $password1->setLabel($tr->_('RETYPE') . ' ' . $tr->_('PASSWORD'));
        $password1->setRequired(true);
        $password1->addValidator('NotEmpty', true, array('messages' => $tr->_('GENERAL_MISSING_TEXT_VALUE')));
        $this->addElement($password1);

        $this->addElement(new Zend_Form_Element_Submit($tr->_('SUBMIT')));

        parent::init();
    }
 public function init()
 {
     $this->setMethod('post');
     //$this->setAttrib('action',DOMAIN.'language/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'servicedeskdepartment');
     $id = new Zend_Form_Element_Hidden('id');
     $servicedeskdepartment = new Zend_Form_Element_Text("service_desk_name");
     $servicedeskdepartment->setLabel("Category");
     $servicedeskdepartment->setAttrib('maxLength', 30);
     $servicedeskdepartment->addFilter(new Zend_Filter_StringTrim());
     $servicedeskdepartment->setRequired(true);
     $servicedeskdepartment->addValidator('NotEmpty', false, array('messages' => 'Please enter category.'));
     $servicedeskdepartment->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9\\- ]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid category.')));
     $servicedeskdepartment->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_sd_depts', 'field' => 'service_desk_name', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" AND isactive=1')));
     $servicedeskdepartment->getValidator('Db_NoRecordExists')->setMessage('Category name already exists.');
     $description = new Zend_Form_Element_Textarea('description');
     $description->setLabel("Description");
     $description->setAttrib('rows', 10);
     $description->setAttrib('cols', 50);
     $description->setAttrib('maxlength', '200');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $servicedeskdepartment, $description, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
Example #10
0
 protected function _periodo_submissao_fim()
 {
     $e = new Zend_Form_Element_Text('periodo_submissao_fim');
     $e->setLabel(_('Submission ends in') . ":")->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'form-control date');
     $e->setDecorators(array('ViewHelper', 'Description', 'Errors', array('HtmlTag', ''), array('Label', '')));
     return $e;
 }
Example #11
0
 public function init()
 {
     $country_code = new Zend_Form_Element_Text('country_code');
     $country_code->setLabel('Country code');
     $country_code->setDescription('List of codes you can see here: http://framework.zend.com/manual/1.12/en/zend.locale.appendix.html');
     $country_code->setRequired(true);
     $this->addElement($country_code);
     $name = new Zend_Form_Element_Text('name');
     $name->setLabel('Name');
     $name->setRequired(true);
     $this->addElement($name);
     $is_active = new Zend_Form_Element_Checkbox('is_active');
     $is_active->setLabel('Active');
     $is_active->setRequired(true);
     $this->addElement($is_active);
     $cancel = new Zend_Form_Element_Button('cancel');
     $cancel->setLabel('Cancel');
     $cancel->setAttrib('class', 'btn btn-gold')->setAttrib('style', 'color:black');
     $cancel->setAttrib("onClick", "window.location = window.location.origin+'/locale/languages/'");
     $this->addElement($cancel);
     $submit = new Zend_Form_Element_Submit('save');
     $submit->setAttrib('class', 'btn btn-primary');
     $submit->setLabel('Confirm');
     $this->setAction('')->setMethod('post')->addElement($submit);
 }
Example #12
0
 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->setAttrib('accept-charset', 'UTF-8');
     $this->setName('applog');
     $id = new Zend_Form_Element_Hidden('id');
     $hash = new Zend_Form_Element_Hash('no_csrf_foo', array('salt' => '4s564evzaSD64sf'));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $timestamp = new Zend_Form_Element_Text('timestamp');
     $timestamp->setLabel('timestamp');
     $priorityName = new Zend_Form_Element_Text('priorityName');
     $priorityName->setLabel('priorityName');
     $priority = new Zend_Form_Element_Text('priority');
     $priority->setLabel('priority');
     $className = new Zend_Form_Element_Text('className');
     $className->setLabel('className');
     $message = new Zend_Form_Element_Textarea('message');
     $message->setLabel('message');
     $identity = new Zend_Form_Element_Text('identity');
     $identity->setLabel('identity');
     $httpReferer = new Zend_Form_Element_Textarea('HTTP_REFERER');
     $httpReferer->setLabel('HTTP_REFERER');
     $remoteAddr = new Zend_Form_Element_Text('REMOTE_ADDR');
     $remoteAddr->setLabel('REMOTE_ADDR');
     $requestMethod = new Zend_Form_Element_Text('REQUEST_METHOD');
     $requestMethod->setLabel('REQUEST_METHOD');
     $requestTime = new Zend_Form_Element_Text('REQUEST_TIME');
     $requestTime->setLabel('REQUEST_TIME');
     $mysqltimestamp = new Zend_Form_Element_Text('mysqltimestamp');
     $mysqltimestamp->setLabel('mysqltimestamp');
     $elements = array($id, $hash, $timestamp, $priorityName, $priority, $className, $message, $identity, $httpReferer, $remoteAddr, $requestMethod, $requestTime, $mysqltimestamp);
     $this->addElements($elements);
     $this->addElements(array($submit));
 }
 /**
  * Initializing form
  */
 public function init()
 {
     parent::init();
     $element = new Zend_Form_Element_Select('year');
     $element->setLabel('Jaar')->addMultiOption('', '...')->setDescription('Percentages zijn van toepassing op dit jaartal')->setRequired(true);
     $entries = Model_Hm_Week_Percentage::findAllByHomeId($this->getHomeId())->select('wp.year, wp.id, wp.hm_home_id')->execute(null, Doctrine_Core::HYDRATE_ARRAY);
     $availableYears = new Model_Hm_AvailableYears($entries);
     foreach ($availableYears->toArray() as $year) {
         $element->addMultiOption($year, $year);
     }
     $this->addElement($element);
     $this->addDisplayGroup(array('year'), 'year-group', array('legend' => 'Algemeen', 'class' => 'width100'));
     for ($weekNo = 01; $weekNo <= 53; $weekNo++) {
         $elementName = 'week_' . $weekNo;
         $elements[] = $elementName;
         $element = new Zend_Form_Element_Text($elementName);
         $element->setLabel('Percentage')->setValidators(array(array('Float')))->setAttribs(array('maxlength' => 6))->setRequired(true);
         $this->addElement($element);
         $this->addDisplayGroup(array($elementName), $elementName . 'group', array('class' => 'weekpercentage', 'legend' => 'Week ' . $weekNo));
     }
     $element = new Zend_Form_Element_Submit('submit_percentageweek');
     $element->setLabel('Verwerken')->setAttrib('class', 'submit');
     $this->addElement($element);
     $this->addDisplayGroup(array('submit_percentageweek'), 'submit', array('class' => 'submit'));
     $this->bhvkDecorators();
     $this->bhvkDecorateSubmitElement($this->getElement('submit_percentageweek'));
 }
Example #14
0
 public function init()
 {
     $this->setName(strtolower(get_class()));
     $this->setMethod("post");
     $oFormName = new Zend_Form_Element_Hidden("form_name");
     $oFormName->setValue(get_class());
     $oFormName->setIgnore(FALSE)->removeDecorator("Label");
     $this->addElement($oFormName);
     $oFormSliderEditId = new Zend_Form_Element_Hidden("slider_edit_id");
     $oFormSliderEditId->setValue(0);
     $oFormSliderEditId->setIgnore(FALSE)->removeDecorator("Label");
     $this->addElement($oFormSliderEditId);
     $oSliderName = new Zend_Form_Element_Text("name");
     $oSliderName->setLabel("Nazwa slidera:");
     $oSliderName->addValidator(new Zend_Validate_StringLength(array("min" => 3, "max" => 45)));
     $oSliderName->setRequired(TRUE);
     $oSliderName->setAttrib("class", "valid");
     $this->addElement($oSliderName);
     $this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 7200));
     $this->getElement("csrf_token")->removeDecorator("Label");
     $oSubmit = $this->createElement("submit", "submit");
     $oSubmit->setLabel("Zapisz");
     $this->addElement($oSubmit);
     $oViewScript = new Zend_Form_Decorator_ViewScript();
     $oViewScript->setViewModule("admin");
     $oViewScript->setViewScript("_forms/_defaultform.phtml");
     $this->clearDecorators();
     $this->setDecorators(array(array($oViewScript)));
     $oElements = $this->getElements();
     foreach ($oElements as $oElement) {
         $oElement->setFilters($this->_aFilters);
         $oElement->removeDecorator("Errors");
     }
 }
 public function init()
 {
     /* Form Elements & Other Definitions Here ... */
     // TODO setMethod
     $element = new Zend_Form_Element_Text('prenom');
     $element->setLabel('Prénom')->setRequired();
     $validator = new Zend_Validate_NotEmpty();
     $validator->setMessage('Le prénom est obligatoire', Zend_Validate_NotEmpty::IS_EMPTY);
     $element->addValidator($validator);
     $validator = new Zend_Validate_StringLength();
     $validator->setMax(40);
     $element->addValidator($validator);
     $filter = new Zend_Filter_StringTrim();
     $element->addFilter($filter);
     $this->addElement($element);
     $element = new Zend_Form_Element_Text('nom');
     $element->setLabel('Nom')->setRequired();
     $validator = new Zend_Validate_NotEmpty();
     $validator->setMessage('Le nom est obligatoire', Zend_Validate_NotEmpty::IS_EMPTY);
     $element->addValidator($validator);
     $this->addElement($element);
     $element = new Zend_Form_Element_Text('email');
     $element->setLabel('Email');
     $this->addElement($element);
     $element = new Zend_Form_Element_Text('telephone');
     $element->setLabel('Téléphone');
     $this->addElement($element);
 }
Example #16
0
 public function init()
 {
     $this->setName('f2')->setAttrib('enctype', 'multipart/form-data')->setMethod('post');
     $this->addElement('Hidden', 'search', array('value' => 1));
     $tieu_de = new Zend_Form_Element_Text('tieu_de');
     $tieu_de->setLabel('Tiêu đề (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input');
     $noi_dung = new Zend_Form_Element_Textarea('noi_dung');
     $noi_dung->setLabel('Nội dung (*)')->setRequired(true)->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'noi_dung', 'class' => 'text-input textarea'));
     $soundcloud_embed = new Zend_Form_Element_Text('soundcloud_embed');
     $soundcloud_embed->setLabel('Embed SoundCloud')->setDescription('How to get SoundCloud embed code? <a href="http://help.soundcloud.com/customer/portal/articles/243751-how-can-i-put-my-track-or-playlist-on-my-site-or-blog-" target="_blank">Click here</a>')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'div', 'escape' => false, 'placement' => 'append')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input');
     $youtube_embed = new Zend_Form_Element_Text('youtube_embed');
     $youtube_embed->setLabel('Embed Youtube')->setDescription('How to get Youtube embed code? <a href="https://support.google.com/youtube/answer/171780?hl=en" target="_blank">Click here</a>')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'div', 'escape' => false, 'placement' => 'append')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input');
     $link_nct = new Zend_Form_Element_Text('link_nct');
     $link_nct->setLabel('Nhac cua tui')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input');
     $link_mp3 = new Zend_Form_Element_Text('link_mp3');
     $link_mp3->setLabel('Mp3')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input');
     $statusOptions = array("multiOptions" => Default_Model_Constraints::trang_thai());
     $trang_thai = new Zend_Form_Element_Radio('trang_thai', $statusOptions);
     $trang_thai->setRequired(true)->setLabel('Trạng thái')->setValue('1')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $noi_bat = new Zend_Form_Element_Select('noi_bat');
     $noi_bat->setLabel('Nổi Bật')->setRequired(true)->setValue(0)->addMultiOptions(array(0 => 'Không', 1 => 'Có'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $photo = new Zend_Form_Element_File('photo');
     $photo->setLabel('Upload hình')->setDescription('(*.jgp, *.gif, *.png , < 10MB )')->setDestination(BASE_PATH . '/upload/files/bai_giang')->addValidator(new Zend_Validate_File_Extension(array('jpg,gif,png')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $submitCon = new Zend_Form_Element_Submit('submitCon');
     $submitCon->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $submitExit = new Zend_Form_Element_Submit('submitExit');
     $submitExit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $cancel = new Zend_Form_Element_Button('cancel');
     $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $_SERVER['HTTP_REFERER'] . '"'));
     $this->addElements(array($tieu_de, $noi_dung, $soundcloud_embed, $youtube_embed, $link_nct, $link_mp3, $trang_thai, $noi_bat, $photo, $submitCon, $submitExit, $cancel));
     $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td')))));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form'));
 }
Example #17
0
 public function init()
 {
     /*
     		$this->setDecorators(array(
     			array('Description', array('tag' => 'p', 'class' => 'description','escape' => false)),
     			'formElements',
     			'fieldset',
     			array('form',array('class' => 'formdefault'))
     		));
     		$this->setElementDecorators(array(
     			'ViewHelper',
     			'Description',
     			'Label',
     			'Errors',
     			array(array('tipo' => 'HtmlTag'), array('tag' => 'div'))
     		));*/
     //$this->setAttrib('class','formdefault consumidorForm');
     //$this->setLegend('Enviar Arquivos');
     $this->setName('upload');
     $this->setAttrib('enctype', 'multipart/form-data');
     $description = new Zend_Form_Element_Text('description');
     $description->setLabel('Description')->setRequired(true)->addValidator('NotEmpty');
     $file = new Zend_Form_Element_File('arquivo');
     $file->setLabel('Selecione os arquivos EDI"s Zipados')->setDestination('temp/arquivos/zip')->setRequired(true)->addValidator('Extension', false, 'zip');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Enviar');
     $this->addElements(array($file, $submit));
 }
Example #18
0
 public function init()
 {
     $this->setName('f2')->setAttrib('enctype', 'multipart/form-data')->setMethod('post');
     $this->addElement('Hidden', 'search', array('value' => 1));
     $tieu_de = new Zend_Form_Element_Text('tieu_de');
     $tieu_de->setLabel('Tiêu đề (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input');
     $quan_trong = new Zend_Form_Element_Select('quan_trong');
     $quan_trong->setLabel('Quan Trọng')->setRequired(true)->setValue(0)->addMultiOptions(array(0 => 'Không', 1 => 'Có'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $noi_bat = new Zend_Form_Element_Select('noi_bat');
     $noi_bat->setLabel('Nổi Bật')->setRequired(true)->setValue(0)->addMultiOptions(array(0 => 'Không', 1 => 'Có'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $photo = new Zend_Form_Element_File('photo');
     $photo->setLabel('Upload hình')->setDescription('(*.jgp, *.gif, *.png , < 10MB )')->setDestination(BASE_PATH . '/upload/files/tin_tuc')->addValidator(new Zend_Validate_File_Extension(array('jpg,gif,png')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $image = new Zend_Form_Element_Image('image');
     $image->setLabel('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $statusOptions = array("multiOptions" => Default_Model_Constraints::trang_thai());
     $trang_thai = new Zend_Form_Element_Radio('trang_thai', $statusOptions);
     $trang_thai->setRequired(true)->setLabel('Trạng thái')->setValue('1')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $mo_ta_tom_tat = new Zend_Form_Element_Textarea('mo_ta_tom_tat');
     $mo_ta_tom_tat->setLabel('Mô tả tóm tắt')->addFilter('StripTags')->addFilter('StringTrim')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'mo_ta_tom_tat', 'class' => 'textarea', 'rows' => '4'));
     $mo_ta_chi_tiet = new Zend_Form_Element_Textarea('mo_ta_chi_tiet');
     $mo_ta_chi_tiet->setLabel('Mô tả chi tiết (*)')->setRequired(true)->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'mo_ta_chi_tiet', 'class' => 'text-input textarea'));
     $pdf = new Zend_Form_Element_File('pdf');
     $pdf->setLabel('Upload PDF')->setDescription('(*.pdf < 10MB )')->setDestination(BASE_PATH . '/upload/files/tin_tuc')->addValidator(new Zend_Validate_File_Extension(array('pdf')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $submitCon = new Zend_Form_Element_Submit('submitCon');
     $submitCon->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $submitExit = new Zend_Form_Element_Submit('submitExit');
     $submitExit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $url = new Zend_View_Helper_Url();
     $link = $url->url(array('module' => 'admin', 'controller' => 'tin-tuc', 'action' => 'index'), null, true);
     $cancel = new Zend_Form_Element_Button('cancel');
     $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $link . '"'));
     $this->addElements(array($tieu_de, $quan_trong, $noi_bat, $photo, $image, $pdf, $trang_thai, $mo_ta_tom_tat, $mo_ta_chi_tiet, $submitCon, $submitExit, $cancel));
     $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td')))));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'tin_tuc')), 'Form'));
 }
Example #19
0
 /** The constructor
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     $periods = new Periods();
     $period_options = $periods->getPeriodFrom();
     parent::__construct($options);
     $this->setName('period');
     $term = new Zend_Form_Element_Text('term');
     $term->setLabel('Period name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToUpper'))->addValidator('Alpha', false, array('allowWhiteSpace' => true))->setAttrib('size', 60)->addErrorMessage('You must enter a period name');
     $fromdate = new Zend_Form_Element_Text('fromdate');
     $fromdate->setLabel('Date period starts: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int')->addErrorMessage('You must enter a start date');
     $todate = new Zend_Form_Element_Text('todate');
     $todate->setLabel('Date period ends: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int')->addErrorMessage('You must enter an end date');
     $notes = new Pas_Form_Element_CKEditor('notes');
     $notes->setLabel('Period notes: ')->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars'));
     $valid = new Zend_Form_Element_Checkbox('valid');
     $valid->setLabel('Period is currently in use: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int')->addErrorMessage('You must enter a status');
     $parent = new Zend_Form_Element_Select('parent');
     $parent->setLabel('Period belongs to: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose period to', 'Available periods' => $period_options))->addValidator('InArray', false, array(array_keys($period_options)))->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int');
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_salt)->setTimeout(4800);
     //Submit button
     $submit = new Zend_Form_Element_Submit('submit');
     $this->addElements(array($term, $fromdate, $todate, $valid, $notes, $parent, $submit, $hash));
     $this->addDisplayGroup(array('term', 'fromdate', 'todate', 'parent', 'notes', 'valid'), 'details');
     $this->details->setLegend('Period details: ');
     $this->addDisplayGroup(array('submit'), 'buttons');
     parent::init();
 }
 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));
 }
Example #21
0
 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));
 }
 /** The constructor
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     parent::__construct($options);
     $this->setName('comments');
     $commentType = new Zend_Form_Element_Hidden('comment_type');
     $commentType->addFilters(array('StripTags', 'StringTrim'));
     $comment_findID = new Zend_Form_Element_Hidden('contentID');
     $comment_findID->addFilters(array('StripTags', 'StringTrim'));
     $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!');
     $comment_author_email = new Zend_Form_Element_Text('comment_author_email');
     $comment_author_email->setLabel('Enter your email address: ')->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: ')->addFilters(array('StripTags', 'StringTrim', 'StringToLower'))->addErrorMessage('Please enter a valid address!')->addValidator('Url')->setDescription('* Not compulsory');
     $comment_content = new Pas_Form_Element_CKEditor('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');
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_salt)->setTimeout(4800);
     $status = new Zend_Form_Element_Radio('commentStatus');
     $status->setLabel('Message status:')->addMultiOptions(array('isspam' => 'Set as spam', 'isham' => 'Submit ham?', 'notspam' => 'Spam free'))->setValue('notSpam')->addFilters(array('StripTags', 'StringTrim', 'StringToLower'))->setOptions(array('separator' => ''));
     $commentApproval = new Zend_Form_Element_Radio('comment_approved');
     $commentApproval->setLabel('Approval:')->addMultiOptions(array('moderation' => 'Moderation', 'approved' => 'Approved'))->setValue('approved')->addFilters(array('StripTags', 'StringTrim', 'StringToLower'))->setOptions(array('separator' => ''));
     $this->addElements(array($comment_author, $comment_author_email, $comment_content, $comment_author_url, $comment_findID, $commentApproval, $commentType, $status, $hash, $submit));
     $this->addDisplayGroup(array('comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'commentStatus', 'comment_approved', 'contentID', 'comment_type'), 'details');
     $this->details->setLegend('Enter your comments: ');
     $this->addDisplayGroup(array('submit'), 'buttons');
     parent::init();
 }
 public function __construct(array $dataBusinessId, $options = null)
 {
     parent::__construct($options);
     $this->setName('frmEmployee');
     $this->setMethod('post');
     $name = new Zend_Form_Element_Text('name');
     $name->setLabel('Employee name');
     $name->setAttrib('maxlength', 80);
     $name->setRequired(true);
     $name->addValidator(new Zend_Validate_NotEmpty());
     $this->addElement($name);
     $age = new Zend_Form_Element_Text('age');
     $age->setLabel('Employee age');
     $age->addValidator(new Zend_Validate_Int());
     $this->addElement($age);
     $businessId = new Zend_Form_Element_Select('business_id');
     $businessId->setLabel('Business');
     $businessId->setRequired(true);
     $businessId->addValidator(new Zend_Validate_NotEmpty());
     $businessId->addValidator(new Zend_Validate_Int());
     $businessId->addMultiOptions($dataBusinessId);
     $this->addElement($businessId);
     $submit = new Zend_Form_Element_Submit('bt_submit');
     $submit->setLabel('Save');
     $this->addElement($submit);
 }
 public function __construct($options = null)
 {
     parent::__construct($options);
     // salutation
     $salutation = new Zend_Form_Element_Select('salutation');
     $salutation->setLabel('Salutation :')->setAttrib('class', 'largeSelect');
     $categoriesData = $this->getView()->getAllSalutation();
     foreach ($categoriesData as $categoryData) {
         $salutation->addMultiOption($categoryData['C_ID'], $categoryData['CI_Title']);
     }
     $this->addElement($salutation);
     // fName
     $fname = new Zend_Form_Element_Text('firstName');
     $fname->setLabel($this->getView()->getCibleText('form_label_fname'))->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($fname);
     // lName
     $lname = new Zend_Form_Element_Text('lastName');
     $lname->setLabel($this->getView()->getCibleText('form_label_lname'))->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($lname);
     // email
     $regexValidate = new Cible_Validate_Email();
     $regexValidate->setMessage($this->getView()->getCibleText('validation_message_emailAddressInvalid'), 'regexNotMatch');
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel($this->getView()->getCibleText('form_label_email'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->addValidator($regexValidate)->setAttrib('class', 'stdTextInput');
     $this->addElement($email);
 }
 public function init()
 {
     $this->setMethod('post');
     $this->addElement('text', 'fullname', array('label' => 'Name', 'required' => false, 'filters' => array('StringTrim', 'StripTags'), 'class' => 'title'));
     $this->addElement('text', 'nickname', array('label' => 'Nickname', 'required' => false, 'filters' => array('StringTrim', 'StripTags'), 'class' => 'text'));
     $this->addElement('text', 'email', array('label' => 'Email', 'required' => false, 'validators' => array('emailAddress'), 'filters' => array('StringTrim', 'StripTags'), 'class' => 'text'));
     $this->addElement('select', 'gender', array('label' => 'Gender', 'required' => false, 'validators' => array(array('inArray', false, array(array('M', 'F')))), 'multiOptions' => array('' => 'Not specified', 'M' => 'Male', 'F' => 'Female')));
     $this->addElement('text', 'dob', array('label' => 'Date of birth (dd/mm/yyyy)', 'required' => false, 'class' => 'text', 'validators' => array(array('date', false, array('d/m/Y'))), 'filters' => array('StringTrim', 'StripTags')));
     // get the list of countries
     $countries = Zend_Locale::getTranslationList('Territory', 'en', 2);
     asort($countries, SORT_LOCALE_STRING);
     $country = new Zend_Form_Element_Select('country');
     $country->setLabel('Country')->addMultiOption('', 'Not specified')->addMultiOption('GB', 'United Kingdom')->addMultiOptions($countries)->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim');
     $postcode = new Zend_Form_Element_Text('postcode');
     $postcode->setLabel('Postcode')->setAttrib("class", "text")->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $languages = Zend_Locale::getTranslationList('Language', 'en');
     asort($languages, SORT_LOCALE_STRING);
     $language = new Zend_Form_Element_Select('language');
     $language->setLabel('Language')->addMultiOption('', 'Not specified')->addMultiOption('en_GB', 'British English')->addMultiOptions($languages)->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim');
     $timeZone = new Zend_Form_Element_Text('timezone');
     $timeZone->setLabel('Timezone')->setAttrib("class", "text")->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $this->addElements(array($country, $postcode, $language, $timeZone));
     $this->addElement('submit', 'submit', array('ignore' => true, 'label' => 'Save'));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'fieldset')), array('Description', array('placement' => 'prepend', 'class' => 'error')), 'Form'));
 }
Example #26
0
 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->setAttrib('accept-charset', 'UTF-8');
     $this->setName('safcontrollers');
     $id = new Zend_Form_Element_Hidden('id');
     $hash = new Zend_Form_Element_Hash('no_csrf_foo', array('salt' => '4s564evzaSD64sf'));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $label = new Zend_Form_Element_Text('label');
     $label->setLabel('label');
     $name = new Zend_Form_Element_Text('name');
     $name->setLabel('name');
     $image = new Zend_Form_Element_Textarea('image');
     $image->setLabel('image');
     $description = new Zend_Form_Element_Textarea('description');
     $description->setLabel('description');
     $safmodulesId = new Zend_Form_Element_Select('safmodules_id');
     $options = new Safmodules();
     $safmodulesId->addMultiOption('', '----------');
     foreach ($options->fetchAlltoFlatArray() as $k => $v) {
         $safmodulesId->addMultiOption($k, $v['mlabel']);
     }
     $safmodulesId->setLabel('safmodules_id');
     $this->addElements(array($id, $hash, $label, $name, $image, $description, $safmodulesId));
     $this->addElements(array($submit));
 }
 public function init()
 {
     parent::init();
     if (!$this->getHmHomeId()) {
         throw new Exception();
     }
     $element = new Zend_Form_Element_Select('year');
     $element->setLabel('Jaar')->setRequired(true)->addMultiOption('', '...');
     $percentages = Model_Hm_Day_Percentage::findAllByHomeId($this->_hmHomeId)->execute(null, Doctrine_Core::HYDRATE_ARRAY);
     $availableYears = new Model_Hm_AvailableYears($percentages, 5);
     foreach ($availableYears->toArray() as $year) {
         $element->addMultiOption($year, $year);
     }
     $this->addElement($element);
     $elements[] = 'year';
     for ($i = 1; $i <= 7; $i++) {
         $elementName = $this->_labelTemplates[$i];
         $elements[] = 'day_' . $i;
         $element = new Zend_Form_Element_Text('day_' . $i);
         $element->setLabel($elementName)->setRequired(true)->setAttribs(array('maxlength' => 6))->setValidators(array(array('float'), array('stringLength', false, array('max' => 6))));
         $this->addElement($element);
     }
     $this->addDisplayGroup($elements, 'days', array('legend' => 'Percentage'));
     $element = new Zend_Form_Element_Submit('submit_percentageday');
     $element->setLabel('Verwerken')->setAttrib('class', 'submit');
     $this->addElement($element);
     $this->addDisplayGroup(array('submit_percentageday'), 'submit', array('class' => 'submit'));
     $this->bhvkDecorators();
     $this->bhvkDecorateSubmitElement($this->getElement('submit_percentageday'));
 }
Example #28
0
 public function __construct($options = null)
 {
     $projecttypes = new ProjectTypes();
     $projectype_list = $projecttypes->getTypes();
     $periods = new Periods();
     $period_options = $periods->getPeriodFrom();
     parent::__construct($options);
     $this->setName('suggested');
     $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')));
     $level = new Zend_Form_Element_Select('level');
     $level->setLabel('Level of research: ')->setRequired(true)->addMultiOptions(array('Please choose a level' => NULL, 'Research levels' => $projectype_list))->addValidator('InArray', false, array(array_keys($projectype_list)))->addFilters(array('StringTrim', 'StripTags'))->setDecorators($decorators);
     $period = new Zend_Form_Element_Select('period');
     $period->setLabel('Broad research period: ')->setRequired(true)->addMultiOptions(array('Please choose a period' => NULL, 'Periods available' => $period_options))->addValidator('InArray', false, array(array_keys($period_options)))->addFilters(array('StringTrim', 'StripTags'))->setDecorators($decorators);
     $title = new Zend_Form_Element_Text('title');
     $title->setLabel('Project title: ')->setRequired(true)->setAttrib('size', 60)->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('Choose title for the project.')->setDecorators($decorators);
     $description = $this->addElement('Textarea', 'description', array('label' => 'Short description of project: '));
     $description = $this->getElement('description')->setRequired(false)->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars'))->setAttribs(array('cols' => 80, 'rows' => 10))->addDecorator('HtmlTag', array('tag' => 'li'));
     $valid = new Zend_Form_Element_Checkbox('taken');
     $valid->setLabel('Is the topic taken: ')->setRequired(true)->setDecorators($decorators)->addValidator('Int');
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(4800);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submit')->removeDecorator('label')->removeDecorator('HtmlTag')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper');
     $this->addElements(array($title, $level, $period, $description, $valid, $submit, $hash));
     $this->addDisplayGroup(array('title', 'level', 'period', 'description', 'taken'), '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');
 }
Example #29
0
 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);
 }
Example #30
0
 public function init()
 {
     $this->setName('send-tweet');
     $e = new Zend_Form_Element_Text('latitude');
     $e->setLabel('Latitude');
     $e->addFilter('StringTrim');
     $e->setAttrib('onblur', 'setMarkerFromForm()');
     $e->addValidator(new Zend_Validate_Regex('/[-+0-9.]/'));
     $e->setTranslator(new Zend_Translate_Adapter_Array(array('regexNotMatch' => 'Latitude is not valid'), 'en'));
     $this->addElement($e);
     $e = new Zend_Form_Element_Text('longitude');
     $e->setLabel('Longitude');
     $e->addFilter('StringTrim');
     $e->setAttrib('onblur', 'setMarkerFromForm()');
     $e->addValidator(new Zend_Validate_Regex('/[-+0-9.]/'));
     $e->setTranslator(new Zend_Translate_Adapter_Array(array('regexNotMatch' => 'Longitude is not valid'), 'en'));
     $this->addElement($e);
     $e = new Zend_Form_Element_Textarea('tweet');
     $e->setLabel('Tweet');
     $e->setRequired(true);
     $e->addFilter('StripTags');
     $e->addFilter('StringTrim');
     $e->addValidator(new Zend_Validate_StringLength(array('max' => 140)));
     $e->setTranslator(new Zend_Translate_Adapter_Array(array('isEmpty' => 'Please supply the message to be tweeted', 'stringLengthTooLong' => 'No more than 140 characters please!'), 'en'));
     $this->addElement($e);
     $e = new Zend_Form_Element_Submit('send');
     $e->setIgnore(true);
     $e->setLabel('Tweet!');
     $this->addElement($e);
 }