/** * Creates the form to edit a user profile. * @see Zend_Form::init() */ public function init() { $em = Zend_Registry::getInstance()->entitymanager; $defaultNamespace = new Zend_Session_Namespace('Default'); $this->setMethod('post'); $usernameElement = new Zend_Form_Element_Text('username'); $usernameElement->setLabel("Benutzername"); $usernameElement->addValidator(new Unplagged_Validate_NoRecordExists('Application_Model_Personnel', 'username')); $usernameElement->setIgnore(true); $emailElement = new Zend_Form_Element_Text('email'); $emailElement->setLabel("E-Mail"); $emailElement->addValidator(new Unplagged_Validate_NoRecordExists('Application_Model_Personnel', 'email')); $emailElement->setIgnore(true); $firstnameElement = new Zend_Form_Element_Text('firstname'); $firstnameElement->setLabel("Vorname"); $firstnameElement->addValidator('stringLength', false, array(2, 64)); $firstnameElement->setAttrib('maxLength', 64); $firstnameElement->setRequired(true); $lastnameElement = new Zend_Form_Element_Text('lastname'); $lastnameElement->setLabel("Nachname"); $lastnameElement->addValidator('stringLength', false, array(2, 64)); $lastnameElement->setAttrib('maxLength', 64); $lastnameElement->setRequired(true); $submitElement = new Zend_Form_Element_Submit('submit'); $submitElement->setLabel('Speichern'); $submitElement->setIgnore(true); $submitElement->setAttrib('class', 'submit'); $submitElement->removeDecorator('DtDdWrapper'); $this->addElements(array($emailElement, $usernameElement, $firstnameElement, $lastnameElement)); $this->addDisplayGroup(array('email', 'username', 'firstname', 'lastname'), 'personalGoup', array('legend' => 'Persönliche Informationen')); $this->addElements(array($submitElement)); }
/** * Creates the form to log in. * @see Zend_Form::init() */ public function init() { $this->setMethod('post'); $this->setAction("/auth/login/"); $usernameElement = new Zend_Form_Element_Text('username'); $usernameElement->setLabel("Benutzername"); $usernameElement->addValidator('regex', false, array('/^[a-z0-9]/i')); $usernameElement->addValidator('stringLength', false, array(2, 64)); $usernameElement->setAttrib('maxLength', 64); $usernameElement->setRequired(true); $passwordElement = new Zend_Form_Element_Password('password'); $passwordElement->setLabel("Passwort"); $passwordElement->addValidator('regex', false, array('/^[a-z0-9]/i')); $passwordElement->addValidator('stringLength', false, array(8, 32)); $passwordElement->setAttrib('maxLength', 32); $passwordElement->setRequired(true); $submitElement = new Zend_Form_Element_Submit('submit'); $submitElement->setLabel('Anmelden'); $submitElement->setIgnore(true); $submitElement->setAttrib('class', 'submit'); $submitElement->removeDecorator('DtDdWrapper'); $this->addElements(array($usernameElement, $passwordElement)); $this->addDisplayGroup(array('username', 'password'), 'credentialGroup', array('legend' => 'Zugangsdaten')); $this->addElements(array($submitElement)); }
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); }
function init() { // Set the method for the display form to POST $this->setMethod('post'); $this->addAttribs(array('id' => 'addGroup', 'class' => '')); $this->setEnctype(Zend_Form::ENCTYPE_MULTIPART); $control = new Zend_Form_Element_Hidden('control'); $control->setValue('addGroup'); $this->addElement($control); // begin inputs $name = new Zend_Form_Element_Text('name'); $name->setAttribs(array('class' => 'text validate[required] rightAdd', 'placeholder' => Zend_Registry::get('translate')->_('admin_category_name'))); $name->setRequired(true); $this->addElement($name); // begin inputs $color = new Zend_Form_Element_Text('color'); $color->setAttribs(array('class' => 'text validate[required] rightAdd', 'placeholder' => Zend_Registry::get('translate')->_('admin_color_for_charts'))); $color->setRequired(true); $this->addElement($color); // begin inputs $type = new Zend_Form_Element_Select('type'); $options = array('' => Zend_Registry::get('translate')->_('admin_category_select_type'), '0' => Zend_Registry::get('translate')->_('admin_expenses'), '1' => Zend_Registry::get('translate')->_('admin_income')); $type->setMultiOptions($options); $type->addValidator(new Zend_Validate_InArray(array_keys($options))); $type->setAttribs(array('class' => 'select', 'id' => 'type')); $type->setRequired(true); $this->addElement($type); $submit = new Zend_Form_Element_Submit('submit'); $submit->setValue(Zend_Registry::get('translate')->_('admin_add')); $submit->setAttribs(array('class' => 'submit')); $submit->setIgnore(true); $this->addElement($submit); }
function editUserPassword() { $this->setMethod('post'); $this->addAttribs(array('id' => 'formAccountEditPassword', 'class' => '')); $filters = array(new Zend_Filter_StringTrim(), new Zend_Filter_StripTags()); $control = new Zend_Form_Element_Hidden('control'); $control->setValue('editPassword'); $this->addElement($control); $oldPassword = new Zend_Form_Element_Password('oldPassword'); $oldPassword->setLabel('Old password'); $oldPassword->addValidator(new Zend_Validate_StringLength(6, 32)); $oldPassword->setAttribs(array('class' => 'text validate[required,minSize[6],maxSize[32]] rightAdd', 'minlenght' => '6', 'maxlenght' => '32', 'autocomplete' => 'off', 'oncontextmenu' => 'return false', 'data-prompt-position' => 'topLeft:0')); $oldPassword->setRequired(true); $this->addElement($oldPassword); $password = new Zend_Form_Element_Password('password'); $password->setLabel(Zend_Registry::get('translate')->_('admin_administrators_new_password')); $password->addValidator(new Zend_Validate_StringLength(6, 32)); $password->setAttribs(array('class' => 'text validate[required] rightAdd', 'maxlenght' => '32', 'autocomplete' => 'off', 'oncontextmenu' => 'return false', 'ondrop' => 'return false', 'onpaste' => 'return false')); $password->setRequired(true); $this->addElement($password); $retypePassword = new Zend_Form_Element_Password('retypePassword'); $retypePassword->setLabel(Zend_Registry::get('translate')->_('admin_administrators_retype_new_password')); $retypePassword->addValidator(new Zend_Validate_Identical('password')); $retypePassword->addValidator(new Zend_Validate_StringLength(6, 32)); $retypePassword->setAttribs(array('class' => 'text validate[required] rightAdd', 'maxlenght' => '32', 'autocomplete' => 'off', 'oncontextmenu' => 'return false', 'ondrop' => 'return false', 'onpaste' => 'return false')); $retypePassword->setRequired(true); $retypePassword->setIgnore(true); $this->addElement($retypePassword); $submit = new Zend_Form_Element_Submit('savePassword'); $submit->setValue(Zend_Registry::get('translate')->_('apply_password')); $submit->setAttribs(array('class' => 'submit tsSubmitLogin fL')); $submit->setIgnore(true); $this->addElement($submit); $this->setElementFilters($filters); }
/** * Creates the form to create a new case. * @see Zend_Form::init() */ public function init() { $em = Zend_Registry::getInstance()->entitymanager; $this->setMethod('post'); $sexElement = new Zend_Form_Element_Select('sex'); $sexElement->setLabel("Geschlecht"); $sexElement->addMultiOption("", "Bitte wählen"); $sexElement->addMultiOption("male", "männlich"); $sexElement->addMultiOption("female", "weiblich"); $sexElement->setRequired(true); $firstnameElement = new Zend_Form_Element_Text('firstname'); $firstnameElement->setLabel("Vorname"); $firstnameElement->addValidator('regex', false, array('/^[a-z0-9ßöäüâáàéèñ]/i')); $firstnameElement->addValidator('stringLength', false, array(2, 64)); $firstnameElement->setRequired(true); $lastnameElement = new Zend_Form_Element_Text('lastname'); $lastnameElement->setLabel("Nachname"); $lastnameElement->addValidator('regex', false, array('/^[a-z0-9ßöäüâáàéèñ]/i')); $lastnameElement->addValidator('stringLength', false, array(2, 64)); $lastnameElement->setRequired(true); $birthdayElement = new Zend_Form_Element_Text('birthday'); $birthdayElement->setLabel("Geburtstag"); $birthdayElement->addValidator(new Zend_Validate_Date()); $sizeElement = new Zend_Form_Element_Text('size'); $sizeElement->setLabel("Körpergröße in cm"); $sizeElement->addValidator('regex', false, array('/^[a-z0-9ßöäüâáàéèñ]/i')); $sizeElement->addValidator('stringLength', false, array(2, 64)); $weightElement = new Zend_Form_Element_Text('weight'); $weightElement->setLabel("Gewicht in kg"); $weightElement->addValidator('regex', false, array('/^[a-z0-9ßöäüâáàéèñ]/i')); $weightElement->addValidator('stringLength', false, array(2, 64)); $bloodGroupElement = new Zend_Form_Element_Text('bloodGroup'); $bloodGroupElement->setLabel("Blutgruppe"); $bloodGroupElement->addValidator('regex', false, array('/^[a-z0-9ßöäüâáàéèñ]/i')); $bloodGroupElement->addValidator('stringLength', false, array(2, 64)); $streetElement = new Zend_Form_Element_Text('street'); $streetElement->setLabel("Straße"); $streetElement->addValidator('regex', false, array('/^[a-z0-9ßöäüâáàéèñ]/i')); $streetElement->addValidator('stringLength', false, array(2, 64)); $zipcodeElement = new Zend_Form_Element_Text('zipcode'); $zipcodeElement->setLabel("Postleitzahl"); $zipcodeElement->addValidator('regex', false, array('/^[a-z0-9ßöäüâáàéèñ]/i')); $zipcodeElement->addValidator('stringLength', false, array(2, 64)); $cityElement = new Zend_Form_Element_Text('city'); $cityElement->setLabel("Stadt"); $cityElement->addValidator('regex', false, array('/^[a-z0-9ßöäüâáàéèñ]/i')); $cityElement->addValidator('stringLength', false, array(2, 64)); $submitElement = new Zend_Form_Element_Submit('submit'); $submitElement->setLabel('Speichern'); $submitElement->setIgnore(true); $submitElement->setAttrib('class', 'submit'); $submitElement->removeDecorator('DtDdWrapper'); $this->addElements(array($firstnameElement, $lastnameElement, $sizeElement, $weightElement, $bloodGroupElement, $streetElement, $zipcodeElement, $cityElement, $sexElement, $birthdayElement)); $this->addDisplayGroup(array('sex', 'firstname', 'lastname', 'birthday'), 'informationGroup', array('legend' => 'Allgemeine Informationen')); $this->addDisplayGroup(array('size', 'weight', 'bloodGroup'), 'vitalGroup', array('legend' => 'Vital Informationen')); $this->addDisplayGroup(array('street', 'zipcode', 'city'), 'addressGroup', array('legend' => 'Adresse')); $this->addElements(array($submitElement)); }
function init() { $this->setMethod('post'); $this->addAttribs(array('id' => 'addUser', 'class' => '')); $this->setEnctype(Zend_Form::ENCTYPE_MULTIPART); $action = new Zend_Form_Element_Hidden('action'); $action->setValue('add'); $this->addElement($action); // BEGIN: Name $name = new Zend_Form_Element_Text('name'); $name->setAttribs(array('class' => 'text large rightAdd', 'placeholder' => Zend_Registry::get('translate')->_('admin_full_name'), 'id' => 'name')); $name->setRequired(true); $this->addElement($name); // END: Name // BEGIN: Account Name $accountName = new Zend_Form_Element_Text('accountName'); $accountName->setAttribs(array('class' => 'text large rightAdd', 'placeholder' => Zend_Registry::get('translate')->_('admin_account_name'), 'id' => 'accountName')); $accountName->setRequired(true); $this->addElement($accountName); // END: Account Name // BEGIN: Email $email = new Zend_Form_Element_Text('email'); $email->setAttribs(array('class' => 'text large rightAdd', 'placeholder' => Zend_Registry::get('translate')->_('admin_email_address'), 'id' => 'email')); $validatorEmail = new Zend_Validate_Db_NoRecordExists('users', 'email'); $email->addValidator($validatorEmail); $email->setRequired(true); $this->addElement($email); // END: Email //BEGIN:Level $idLevel = new Zend_Form_Element_Select('idRole'); $options = array('' => Zend_Registry::get('translate')->_('admin_select_user_level')); $levels = new Default_Model_Role(); $select = $levels->getMapper()->getDbTable()->select()->where('id != ?', 1)->where('NOT deleted')->order('id DESC'); $result = $levels->fetchAll($select); if (NULL != $result) { foreach ($result as $value) { $options[$value->getId()] = $value->getName(); } } $idLevel->addMultiOptions($options); $idLevel->addValidator(new Zend_Validate_InArray(array_keys($options))); $idLevel->setAttribs(array('class' => 'rightAdd', 'id' => 'idRole')); $idLevel->setRequired(false); $this->addElement($idLevel); //END:Level $add = new Zend_Form_Element_Submit('add'); $add->setValue(Zend_Registry::get('translate')->_('admin_add_user')); $add->setAttribs(array('class' => 'submit', 'id' => '')); $add->setIgnore(true); $this->addElement($add); }
public function init() { $country_list = Application_Model_Preference::GetCountryList(); $isSass = Application_Model_Preference::GetPlanLevel() == 'disabled' ? false : true; $this->isSass = $isSass; $this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/support-setting.phtml', "isSaas" => $isSass)), array('File', array('viewScript' => 'form/support-setting.phtml', 'placement' => false)))); //Station name $this->addElement('text', 'stationName', array('class' => 'input_text', 'label' => 'Station Name', 'required' => true, 'filters' => array('StringTrim'), 'validator' => array('NotEmpty'), 'value' => Application_Model_Preference::GetStationName(), 'decorators' => array('ViewHelper'))); // Phone number $this->addElement('text', 'Phone', array('class' => 'input_text', 'label' => 'Phone:', 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetPhone(), 'decorators' => array('ViewHelper'))); //Email $this->addElement('text', 'Email', array('class' => 'input_text', 'label' => 'Email:', 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetEmail(), 'decorators' => array('ViewHelper'))); // Station Web Site $this->addElement('text', 'StationWebSite', array('label' => 'Station Web Site:', 'required' => false, 'class' => 'input_text', 'value' => Application_Model_Preference::GetStationWebSite(), 'decorators' => array('ViewHelper'))); // county list dropdown $this->addElement('select', 'Country', array('label' => 'Country:', 'required' => false, 'value' => Application_Model_Preference::GetStationCountry(), 'multiOptions' => $country_list, 'decorators' => array('ViewHelper'))); // Station city $this->addElement('text', 'City', array('label' => 'City:', 'required' => false, 'class' => 'input_text', 'value' => Application_Model_Preference::GetStationCity(), 'decorators' => array('ViewHelper'))); // Station Description $description = new Zend_Form_Element_Textarea('Description'); $description->class = 'input_text_area'; $description->setLabel('Station Description:')->setRequired(false)->setValue(Application_Model_Preference::GetStationDescription())->setDecorators(array('ViewHelper'))->setAttrib('ROWS', '2')->setAttrib('COLS', '58'); $this->addElement($description); // Station Logo $upload = new Zend_Form_Element_File('Logo'); $upload->setLabel('Station Logo:')->setRequired(false)->setDecorators(array('File'))->addValidator('Count', false, 1)->addValidator('Extension', false, 'jpg,jpeg,png,gif')->addFilter('ImageSize'); $upload->setAttrib('accept', 'image/*'); $this->addElement($upload); if (!$isSass) { //enable support feedback $this->addElement('checkbox', 'SupportFeedback', array('label' => 'Send support feedback', 'required' => false, 'value' => Application_Model_Preference::GetSupportFeedback(), 'decorators' => array('ViewHelper'))); // checkbox for publicise $checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise"); $checkboxPublicise->setLabel('Promote my station on Sourcefabric.org')->setRequired(false)->setDecorators(array('ViewHelper'))->setValue(Application_Model_Preference::GetPublicise()); if (Application_Model_Preference::GetSupportFeedback() == '0') { $checkboxPublicise->setAttrib("disabled", "disabled"); } $this->addElement($checkboxPublicise); // text area for sending detail $this->addElement('textarea', 'SendInfo', array('class' => 'sending_textarea', 'required' => false, 'filters' => array('StringTrim'), 'readonly' => true, 'cols' => 61, 'rows' => 5, 'value' => Application_Model_Preference::GetSystemInfo(false, true), 'decorators' => array('ViewHelper'))); // checkbox for privacy policy $checkboxPrivacy = new Zend_Form_Element_Checkbox("Privacy"); $checkboxPrivacy->setLabel("By checking this box, I agree to Sourcefabric's <a id=\"link_to_privacy\" href=\"http://www.sourcefabric.org/en/about/policy/\" onclick=\"window.open(this.href); return false;\">privacy policy</a>.")->setDecorators(array('ViewHelper')); $this->addElement($checkboxPrivacy); } // submit button $submit = new Zend_Form_Element_Submit("submit"); $submit->class = 'ui-button ui-state-default right-floated'; $submit->setIgnore(true)->setLabel("Save")->setDecorators(array('ViewHelper')); $this->addElement($submit); }
function init() { // Set the method for the display form to POST $this->setMethod('post'); $this->setAction(WEBROOT . 'logs'); $this->addAttribs(array('id' => 'searchLogs', 'class' => '')); $this->setEnctype(Zend_Form::ENCTYPE_MULTIPART); //BEGIN:Module $id = new Zend_Form_Element_Select('modul'); $options = array('' => 'Selectati modulul'); $module = new Default_Model_Logs(); $select = $module->getMapper()->getDbTable()->select()->group('modul')->order('created DESC'); $result = $module->fetchAll($select); if (NULL != $result) { foreach ($result as $value) { $options[$value->getModul()] = $value->getModul(); } } $id->addMultiOptions($options); $this->addElement($id); //END:Module //BEGIN:ActionType $id = new Zend_Form_Element_Select('actionType'); $options = array('' => 'Selectati tipul actiunii'); $module = new Default_Model_Logs(); $select = $module->getMapper()->getDbTable()->select()->group('actionType')->order('created DESC'); $result = $module->fetchAll($select); if (NULL != $result) { foreach ($result as $value) { $options[$value->getActionType()] = $value->getActionType(); } } $id->addMultiOptions($options); $this->addElement($id); //END:ActionType // BEGIN: data $data_inceput = new Zend_Form_Element_Text('data_inceput'); $data_inceput->setAttribs(array('class' => 'data_inceput', 'placeholder' => 'Data inceput')); $this->addElement($data_inceput); $data_sfarsit = new Zend_Form_Element_Text('data_sfarsit'); $data_sfarsit->setAttribs(array('class' => 'data_sfarsit', 'placeholder' => 'Data sfarsit')); $this->addElement($data_sfarsit); // END: data $submit = new Zend_Form_Element_Submit('submit'); $submit->setValue('Cauta'); $submit->setAttribs(array('class' => 'submit')); $submit->setIgnore(true); $this->addElement($submit); }
function init() { $this->setMethod('post'); $this->addAttribs(array('id' => 'intrebare_form', 'class' => '')); $nume = new Zend_Form_Element_Text('tabel'); $nume->setLabel('Nume Tabel'); $nume->setAttribs(array('class' => 'text_input validate[required]', 'placeholder' => trim(Zend_Registry::get('translate')->_('Nume Tabel')), 'data-prompt-position' => 'topRight:-187')); $nume->setRequired(true); $this->addElement($nume); $button = new Zend_Form_Element_Submit('button'); $button->setValue(trim(Zend_Registry::get('translate')->_('Generate Model'))); $button->setAttribs(array('class' => 'question_submit')); $button->setIgnore(true); $this->addElement($button); }
function init() { $this->setMethod('post'); $this->addAttribs(array('id' => 'comments_form', 'class' => '')); $description = new Zend_Form_Element_Textarea('description'); $description->setLabel('Comment text'); $description->setAttribs(array('class' => 'mess_textarea validate[required]', 'placeholder' => trim(Zend_Registry::get('translate')->_('Comment text')), 'data-prompt-position' => 'topLeft:6')); $description->setRequired(true); $this->addElement($description); $button = new Zend_Form_Element_Submit('button'); $button->setValue(trim(Zend_Registry::get('translate')->_('Send Comment'))); $button->setAttribs(array('class' => 'comments_submit')); $button->setIgnore(true); $this->addElement($button); }
function init() { // Set the method for the display form to POST $this->setMethod('post'); $this->addAttribs(array('id' => 'addExpense', 'class' => '')); $this->setEnctype(Zend_Form::ENCTYPE_MULTIPART); $control = new Zend_Form_Element_Hidden('control'); $control->setValue('addExpense'); $this->addElement($control); // begin inputs $name = new Zend_Form_Element_Text('name'); $name->setAttribs(array('class' => 'text validate[required] rightAdd', 'placeholder' => Zend_Registry::get('translate')->_('admin_recurrent_expense_description'))); $name->setRequired(true); $this->addElement($name); $price = new Zend_Form_Element_Text('price'); $price->setAttribs(array('class' => 'text validate[required] rightAdd', 'placeholder' => Zend_Registry::get('translate')->_('admin_price'))); $price->setRequired(true); $this->addElement($price); //BEGIN: Date $date = new Zend_Form_Element_Text('date'); $date->setAttribs(array('class' => 'rightAdd dateSearch w_315', 'placeholder' => 'Date')); $date->setLabel('Select day'); $this->addElement($date); // END: Date //BEGIN:Id Group $idGroup = new Zend_Form_Element_Select('idGroup'); $options = array(); $pm = new Default_Model_Groups(); $select = $pm->getMapper()->getDbTable()->select()->where('NOT deleted')->order('name ASC'); $result = $pm->fetchAll($select); if (NULL != $result) { foreach ($result as $value) { $options[$value->getId()] = $value->getName(); } } $idGroup->addMultiOptions($options); $idGroup->addValidator(new Zend_Validate_InArray(array_keys($options))); $idGroup->setAttribs(array('class' => 'select')); $idGroup->setRequired(false); $this->addElement($idGroup); //END:Id Group $submit = new Zend_Form_Element_Submit('submit'); $submit->setValue(Zend_Registry::get('translate')->_('admin_add_recurrent_expense')); $submit->setAttribs(array('class' => 'submit')); $submit->setIgnore(true); $this->addElement($submit); }
function init() { $this->setMethod('post'); $this->addAttribs(array('id' => 'filterForm', 'class' => '')); $this->setAction(WEBROOT . 'recurrent-expenses'); // BEGIN: nume text $nameSearch = new Zend_Form_Element_Text('nameSearch'); $nameSearch->setAttribs(array('class' => 'text large', 'placeholder' => Zend_Registry::get('translate')->_('admin_name'))); $nameSearch->setRequired(false); $this->addElement($nameSearch); // END: nume text // BEGIN: prenume text $idGroupSearch = new Zend_Form_Element_Select('idGroupSearch'); $options = array('' => Zend_Registry::get('translate')->_('admin_select_expense')); $groups = new Default_Model_Groups(); $select = $groups->getMapper()->getDbTable()->select()->where('type=?', 0)->where('NOT deleted')->order('name ASC'); $result = $groups->fetchAll($select); if (NULL != $result) { foreach ($result as $value) { $options[$value->getId()] = $value->getName(); } } $idGroupSearch->addMultiOptions($options); $idGroupSearch->addValidator(new Zend_Validate_InArray(array_keys($options))); $idGroupSearch->setAttribs(array('class' => 'select uniformSelect filter_selector')); $idGroupSearch->setRequired(false); $this->addElement($idGroupSearch); // END: prenume text // BEGIN: fromDate text $fromDate = new Zend_Form_Element_Text('fromDate'); $fromDate->setAttribs(array('class' => 'text large', 'placeholder' => Zend_Registry::get('translate')->_('admin_from_date'))); $fromDate->setRequired(false); $this->addElement($fromDate); // END: fromDate text // BEGIN: toDate text $toDate = new Zend_Form_Element_Text('toDate'); $toDate->setAttribs(array('class' => 'text large', 'placeholder' => Zend_Registry::get('translate')->_('admin_to_date'))); $toDate->setRequired(false); $this->addElement($toDate); // END: toDate text $search = new Zend_Form_Element_Submit('searchProduct'); $search->setValue(Zend_Registry::get('translate')->_('admin_filter')); $search->setAttribs(array('class' => 'submit')); $search->setIgnore(true); $this->addElement($search); }
function init() { $this->setMethod('post'); $this->addAttribs(array('id' => 'file-manager', 'class' => '')); $action = new Zend_Form_Element_Hidden('action'); $action->setValue('add'); $this->addElement($action); $description = new Zend_Form_Element_Textarea('description'); $description->setLabel('Description'); $description->setAttribs(array('class' => 'mess_textarea validate[required]', 'placeholder' => 'Description', 'style' => 'width:272px')); $this->addElement($description); $button = new Zend_Form_Element_Submit('rightSubmit'); $button->setValue('UPLOAD FILE'); $button->setAttribs(array('class' => 'comments_submit')); $button->setIgnore(true); $this->addElement($button); }
function init() { $this->setMethod('post'); $this->addAttribs(array('id' => 'filterForm', 'class' => '')); $this->setAction(WEBROOT . 'groups'); $this->setEnctype(Zend_Form::ENCTYPE_MULTIPART); // BEGIN: nume text $nameSearch = new Zend_Form_Element_Text('nameSearch'); $nameSearch->setAttribs(array('class' => 'text large', 'placeholder' => 'Name')); $nameSearch->setRequired(false); $this->addElement($nameSearch); // END: nume text $search = new Zend_Form_Element_Submit('searchGroup'); $search->setValue('Search'); $search->setAttribs(array('class' => 'submit')); $search->setIgnore(true); $this->addElement($search); }
/** * Creates the form to create a new case. * @see Zend_Form::init() */ public function init() { $this->setMethod('post'); $this->setAction("/rfid/create"); $tagElement = new Zend_Form_Element_Text('tag'); $tagElement->setLabel("Tag"); $tagElement->addValidator('regex', false, array('/^[a-z0-9ßöäüâáàéèñ]/i')); $tagElement->addValidator('stringLength', false, array(2, 64)); $tagElement->setRequired(true); $submitElement = new Zend_Form_Element_Submit('submit'); $submitElement->setLabel('Anlegen'); $submitElement->setIgnore(true); $submitElement->setAttrib('class', 'submit'); $submitElement->removeDecorator('DtDdWrapper'); $this->addElements(array($tagElement)); $this->addDisplayGroup(array('tag'), 'informationGroup', array('legend' => 'Tag Informationen')); $this->addElements(array($submitElement)); }
function init() { $this->setMethod('post'); $this->addAttribs(array('id' => 'filterForm', 'class' => '')); $action = new Zend_Form_Element_Hidden('action'); $action->setValue('search'); $this->addElement($action); $searchTxt = new Zend_Form_Element_Text('searchTxt'); $searchTxt->setLabel('Search text'); $searchTxt->setAttribs(array('class' => 'rightAdd validate[required]', 'placeholder' => 'File Name', 'style' => 'width:200px;')); $searchTxt->setRequired(true); $this->addElement($searchTxt); $search = new Zend_Form_Element_Submit('search'); $search->setValue('Filter'); $search->setAttribs(array('class' => 'submit', 'id' => '')); $search->setIgnore(true); $this->addElement($search); }
function init() { $this->setMethod('post'); $this->addAttribs(array('id' => 'share-file', 'class' => '')); $action = new Zend_Form_Element_Hidden('action'); $action->setValue('sharefile'); $this->addElement($action); $idFile = new Zend_Form_Element_Hidden('idFile'); $idFile->setValue(Zend_Controller_Front::getInstance()->getRequest()->getParam('id')); $this->addElement($idFile); //BEGIN:Users $idUserTo = new Zend_Form_Element_Select('idUserTo'); $idUserTo->setLabel('To: '); $options = array('' => 'Select user'); $shops = new Default_Model_Users(); $select = $shops->getMapper()->getDbTable()->select()->where('id != ?', Zend_Registry::get('user')->getId())->where('NOT deleted')->order('name DESC'); $result = $shops->fetchAll($select); if (NULL != $result) { foreach ($result as $value) { $options[$value->getId()] = $value->getName(); } } $idUserTo->addMultiOptions($options); $idUserTo->addValidator(new Zend_Validate_InArray(array_keys($options))); $idUserTo->setAttribs(array('class' => 'validate[required] form_selector_fm', 'id' => 'idUserTo')); $idUserTo->setRequired(true); $this->addElement($idUserTo); //END:Users $subject = new Zend_Form_Element_Text('subject'); $subject->setLabel('Subject'); $subject->setAttribs(array('class' => 'form_subject w_424 validate[required]', 'placeholder' => 'Subject')); $subject->setRequired(true); $this->addElement($subject); $message = new Zend_Form_Element_Textarea('message'); $message->setLabel('Observations'); $message->setAttribs(array('class' => 'form_textarea w_424 h_97 validate[required]', 'placeholder' => 'Observations', 'style' => 'width:290px')); $message->setRequired(true); $this->addElement($message); $button = new Zend_Form_Element_Submit('rightSubmit'); $button->setValue('SEND'); $button->setAttribs(array('class' => 'comments_submit')); $button->setIgnore(true); $this->addElement($button); }
function init() { $this->setMethod('post'); $this->addAttribs(array('id' => 'formDepartamentAdd', 'class' => '')); $this->setEnctype(Zend_Form::ENCTYPE_MULTIPART); $parentName = new Zend_Form_Element_Text('parentName'); $parentName->setLabel('Rol Parinte'); $parentName->setAttribs(array('class' => 'text large required', 'readonly' => 'readonly')); $this->addElement($parentName); $name = new Zend_Form_Element_Text('name'); $name->setLabel('Nume'); $name->setAttribs(array('class' => 'validate[required] text large required')); $name->setRequired(true); $this->addElement($name); $submit = new Zend_Form_Element_Submit('submit'); $submit->setValue('Adaugare'); $submit->setAttribs(array('class' => 'submit')); $submit->setIgnore(true); $this->addElement($submit); }
function init() { // Set the method for the display form to POST $this->setMethod('post'); $this->setAction(WEBROOT . 'statistics'); $this->addAttribs(array('id' => 'filterForm', 'class' => '')); $this->setEnctype(Zend_Form::ENCTYPE_MULTIPART); // BEGIN: data $dataStart = new Zend_Form_Element_Text('dataStart'); $dataStart->setAttribs(array('class' => 'data_inceput', 'placeholder' => Zend_Registry::get('translate')->_('admin_from_date'))); $this->addElement($dataStart); $dataEnd = new Zend_Form_Element_Text('dataEnd'); $dataEnd->setAttribs(array('class' => 'data_sfarsit', 'placeholder' => Zend_Registry::get('translate')->_('admin_to_date'))); $this->addElement($dataEnd); // END: data $submit = new Zend_Form_Element_Submit('submit'); $submit->setValue(Zend_Registry::get('translate')->_('admin_menu_form_search')); $submit->setAttribs(array('class' => 'submit')); $submit->setIgnore(true); $this->addElement($submit); }
/** * Creates the form to register a new user. * @see Zend_Form::init() */ public function init() { $this->setMethod('post'); $this->setAction("/personnel/register/"); $emailElement = new Zend_Form_Element_Text('email'); $emailElement->setLabel("E-Mail"); $emailElement->addValidator('regex', false, array('/^[a-z0-9ßöäüâáàéèñ]/i')); $emailElement->addValidator('stringLength', false, array(2, 64)); $emailElement->addValidator('EmailAddress', true); $emailElement->addValidator(new Unplagged_Validate_NoRecordExists('Application_Model_Personnel', 'email')); $emailElement->setAttrib('maxLength', 64); $emailElement->setRequired(true); $usernameElement = new Zend_Form_Element_Text('username'); $usernameElement->setLabel("Benutzername"); $usernameElement->addValidator('regex', false, array('/^[a-z0-9ßöäüâáàéèñ]/i')); $usernameElement->addValidator('stringLength', false, array(2, 64)); $usernameElement->addValidator(new Unplagged_Validate_NoRecordExists('Application_Model_Personnel', 'username')); $usernameElement->setAttrib('maxLength', 64); $usernameElement->setRequired(true); $passwordElement = new Zend_Form_Element_Password('password'); $passwordElement->setLabel("Passwort"); $passwordElement->addValidator('regex', false, array('/^[a-z0-9ßöäüâáàéèñ]/i')); $passwordElement->addValidator('stringLength', false, array(8, 32)); $passwordElement->setAttrib('maxLength', 32); $passwordElement->setRequired(true); $reenterPasswordElement = new Zend_Form_Element_Password('confirmedPassword'); $reenterPasswordElement->setLabel("Passwort erneut eingeben"); $reenterPasswordElement->setAttrib('maxLength', 32); $reenterPasswordElement->addValidator('Identical', false, array('token' => 'password')); $reenterPasswordElement->setRequired(true); $submitElement = new Zend_Form_Element_Submit('submit'); $submitElement->setLabel('Registrieren'); $submitElement->setIgnore(true); $submitElement->setAttrib('class', 'submit'); $submitElement->removeDecorator('DtDdWrapper'); $this->addElements(array($emailElement, $usernameElement, $passwordElement, $reenterPasswordElement)); $this->addDisplayGroup(array('username', 'email', 'password', 'confirmedPassword'), 'credentialGroup', array('legend' => 'Zugangsdaten')); $this->addElements(array($submitElement)); }
/** * Creates the form to create a new case. * @see Zend_Form::init() */ public function init() { $em = Zend_Registry::getInstance()->entitymanager; $this->setMethod('post'); $this->setAction("/patient/checkin/id/" . $this->getAttrib("patientId")); $isEmergencyElement = new Zend_Form_Element_Checkbox('isEmergency'); $isEmergencyElement->setLabel("Ist Notfall"); $icdElement = new Zend_Form_Element_Text('icd'); $icdElement->setLabel("ICD"); $icdElement->addValidator('regex', false, array('/^[a-z0-9ßöäüâáàéèñ]/i')); $icdElement->addValidator('stringLength', false, array(2, 64)); $icdElement->setRequired(true); $opsElement = new Zend_Form_Element_Text('ops'); $opsElement->setLabel("OPS"); $opsElement->addValidator('regex', false, array('/^[a-z0-9ßöäüâáàéèñ]/i')); $opsElement->addValidator('stringLength', false, array(2, 64)); $opsElement->setRequired(true); $rfidElement = new Zend_Form_Element_Select('rfid'); $rfidElement->setLabel("RFID-Tag"); $qb = $em->createQueryBuilder(); $qb->add('select', 'r')->add('from', 'Application_Model_Rfid r')->add('where', 'r.patient IS NULL'); $query = $qb->getQuery(); $rfids = $query->getResult(); $rfidElement->addMultiOption("", "Bitte wählen"); foreach ($rfids as $rfid) { $rfidElement->addMultiOption($rfid->getId(), $rfid->getTag()); } $rfidElement->addValidator('regex', false, array('/^[0-9]/i')); $rfidElement->setRequired(true); $submitElement = new Zend_Form_Element_Submit('submit'); $submitElement->setLabel('Einchecken'); $submitElement->setIgnore(true); $submitElement->setAttrib('class', 'submit'); $submitElement->removeDecorator('DtDdWrapper'); $this->addElements(array($isEmergencyElement, $rfidElement, $icdElement, $opsElement)); $this->addDisplayGroup(array('isEmergency', 'icd', 'ops', 'reason', 'rfid'), 'informationGroup', array('legend' => 'Allgemeine Informationen')); $this->addElements(array($submitElement)); }
function init() { $this->setMethod('post'); $this->addAttribs(array('id' => 'formNotificationsAddSearch', 'class' => '')); $this->setEnctype(Zend_Form::ENCTYPE_MULTIPART); // BEGIN: nume text $subject = new Zend_Form_Element_Text('subject'); $subject->setAttribs(array('class' => 'text large', 'placeholder' => 'Subiect')); $subject->setRequired(false); $this->addElement($subject); // END: nume text // BEGIN: nume text $message = new Zend_Form_Element_Text('message'); $message->setAttribs(array('class' => 'text large', 'placeholder' => 'Mesaj')); $message->setRequired(false); $this->addElement($message); // END: nume text $search = new Zend_Form_Element_Submit('searchNotifications'); $search->setValue('Cauta'); $search->setAttribs(array('class' => 'submit')); $search->setIgnore(true); $this->addElement($search); }
function init() { $this->setMethod('post'); $this->addAttribs(array('id' => 'formTemplateAdd', 'class' => '')); $formNumber = new Zend_Form_Element_Hidden('formNumber'); $this->addElement($formNumber); $const = new Zend_Form_Element_Hidden('const'); $this->addElement($const); $subject = new Zend_Form_Element_Text('subject'); $subject->setLabel(Zend_Registry::get('translate')->_('admin_email_templates_subject')); $subject->setAttribs(array('class' => 'text large validate[required]')); $subject->setRequired(true); $this->addElement($subject); $content = new Zend_Form_Element_Textarea('content'); $content->setLabel(Zend_Registry::get('translate')->_('admin_email_templates_content')); $content->setAttribs(array('class' => 'text large validate[required]')); $content->setRequired(true); $this->addElement($content); $submit = new Zend_Form_Element_Submit('submit'); $submit->setValue(''); $submit->setAttribs(array('class' => 'submit')); $submit->setIgnore(true); $this->addElement($submit); }
/** * Creates the form to edit a user profile. * @see Zend_Form::init() */ public function init() { $em = Zend_Registry::getInstance()->entitymanager; $defaultNamespace = new Zend_Session_Namespace('Default'); $this->setMethod('post'); $usernameElement = new Zend_Form_Element_Text('username'); $usernameElement->setLabel("Benutzername"); $usernameElement->setIgnore(true); $emailElement = new Zend_Form_Element_Text('email'); $emailElement->setLabel("E-Mail"); $emailElement->setIgnore(true); $firstnameElement = new Zend_Form_Element_Text('firstname'); $firstnameElement->setLabel("Vorname"); $firstnameElement->addValidator('stringLength', false, array(2, 64)); $firstnameElement->setAttrib('maxLength', 64); $lastnameElement = new Zend_Form_Element_Text('lastname'); $lastnameElement->setLabel("Nachname"); $lastnameElement->addValidator('stringLength', false, array(2, 64)); $lastnameElement->setAttrib('maxLength', 64); // professional group elements $academicTitleElement = new Zend_Form_Element_Text('academicTitle'); $academicTitleElement->setLabel("Akademischer Titel"); $academicTitleElement->addValidator('stringLength', false, array(2, 64)); $academicTitleElement->setAttrib('maxLength', 64); $positionElement = new Zend_Form_Element_Select('position'); $positionElement->setLabel("Position"); $qb = $em->createQueryBuilder(); $qb->add('select', 'p')->add('from', 'Application_Model_Personnel_Position p'); $query = $qb->getQuery(); $positions = $query->getResult(); $positionElement->addMultiOption("", "Bitte wählen"); foreach ($positions as $position) { $positionElement->addMultiOption($position->getId(), $position->getTitle()); } $positionElement->addValidator('regex', false, array('/^[0-9]/i')); $positionElement->setRequired(true); $degreeDateElement = new Zend_Form_Element_Text('degreeDate'); $degreeDateElement->setLabel("Abschluss am"); $degreeDateElement->addValidator(new Zend_Validate_Date()); $layedInElement = new Zend_Form_Element_Text('layedIn'); $layedInElement->setLabel("Angestellt am"); $layedInElement->addValidator(new Zend_Validate_Date()); $layedOutElement = new Zend_Form_Element_Text('layedOut'); $layedOutElement->setLabel("Ausgeschieden am"); $layedOutElement->addValidator(new Zend_Validate_Date()); // rights group elements $measurementsRightElement = new Zend_Form_Element_Checkbox('measurementsRight'); $measurementsRightElement->setLabel("Messungsverwaltung"); $hospitalsRightElement = new Zend_Form_Element_Checkbox('hospitalsRight'); $hospitalsRightElement->setLabel("Krankenhäuserverwaltung"); $personnelRightElement = new Zend_Form_Element_Checkbox('personnelRight'); $personnelRightElement->setLabel("Personalverwaltung"); $patientsRightElement = new Zend_Form_Element_Checkbox('patientsRight'); $patientsRightElement->setLabel("Patientenverwaltung"); $rfidsRightElement = new Zend_Form_Element_Checkbox('rfidsRight'); $rfidsRightElement->setLabel("RFID-Tag-Verwaltung"); $submitElement = new Zend_Form_Element_Submit('submit'); $submitElement->setLabel('Speichern'); $submitElement->setIgnore(true); $submitElement->setAttrib('class', 'submit'); $submitElement->removeDecorator('DtDdWrapper'); $this->addElements(array($emailElement, $usernameElement, $firstnameElement, $lastnameElement, $academicTitleElement, $positionElement, $degreeDateElement, $layedInElement, $layedOutElement, $measurementsRightElement, $hospitalsRightElement, $personnelRightElement, $patientsRightElement, $rfidsRightElement)); $this->addDisplayGroup(array('email', 'username', 'firstname', 'lastname'), 'personalGoup', array('legend' => 'Persönliche Informationen')); $this->addDisplayGroup(array('academicTitle', 'degreeDate', 'position', 'layedIn', 'layedOut'), 'professionalGoup', array('legend' => 'Professional Informationen')); $this->addDisplayGroup(array('measurementsRight', 'hospitalsRight', 'personnelRight', 'patientsRight', 'rfidsRight'), 'rightsGoup', array('legend' => 'Rechte')); $this->addElements(array($submitElement)); }
public function init() { /* $this->addElementPrefixPath('Application_Validate', '../application/validate', 'validate'); * */ $hidden = new Zend_Form_Element_Hidden('user_id'); $hidden->setDecorators(array('ViewHelper')); $this->addElement($hidden); $login = new Zend_Form_Element_Text('login'); $login->setLabel('Username:'******'class', 'input_text'); $login->setRequired(true); $login->addFilter('StringTrim'); //$login->addValidator('UserNameValidate'); $this->addElement($login); $password = new Zend_Form_Element_Password('password'); $password->setLabel('Password:'******'class', 'input_text'); $password->setRequired(true); $password->addFilter('StringTrim'); $password->addValidator('NotEmpty'); $this->addElement($password); $firstName = new Zend_Form_Element_Text('first_name'); $firstName->setLabel('Firstname:'); $firstName->setAttrib('class', 'input_text'); $firstName->setRequired(true); $firstName->addFilter('StringTrim'); $firstName->addValidator('NotEmpty'); $this->addElement($firstName); $lastName = new Zend_Form_Element_Text('last_name'); $lastName->setLabel('Lastname:'); $lastName->setAttrib('class', 'input_text'); $lastName->setRequired(true); $lastName->addFilter('StringTrim'); $lastName->addValidator('NotEmpty'); $this->addElement($lastName); $email = new Zend_Form_Element_Text('email'); $email->setLabel('Email:'); $email->setAttrib('class', 'input_text'); $email->addFilter('StringTrim'); $email->addValidator('EmailAddress'); $this->addElement($email); $skype = new Zend_Form_Element_Text('skype'); $skype->setLabel('Skype:'); $skype->setAttrib('class', 'input_text'); $skype->addFilter('StringTrim'); $this->addElement($skype); $jabber = new Zend_Form_Element_Text('jabber'); $jabber->setLabel('Jabber:'); $jabber->setAttrib('class', 'input_text'); $jabber->addFilter('StringTrim'); $jabber->addValidator('EmailAddress'); $this->addElement($jabber); $select = new Zend_Form_Element_Select('type'); $select->setLabel('User Type:'); $select->setAttrib('class', 'input_select'); $select->setAttrib('style', 'width: 40%'); $select->setMultiOptions(array("G" => "Guest", "H" => "DJ", "P" => "Program Manager", "A" => "Admin")); $select->setRequired(true); $this->addElement($select); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('class', 'ui-button ui-state-default right-floated'); $submit->setIgnore(true); $submit->setLabel('Submit'); $this->addElement($submit); }
public function init() { $this->addSubForm(new LandlordsReferencing_Form_Subforms_DataProtection(), 'subform_dataprotection'); $this->setMethod('post'); //Prospective landlord name $this->addElement('select', 'title', array('label' => 'Title *', 'required' => true, 'multiOptions' => array('Mr' => 'Mr', 'Ms' => 'Ms', 'Mrs' => 'Mrs', 'Miss' => 'Miss', 'Dr' => 'Dr', 'Prof' => 'Professor', 'Sir' => 'Sir'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select your title', 'notEmptyInvalid' => 'Please select a valid title')))))); //First name entry $this->addElement('text', 'first_name', array('label' => 'First Name *', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your first name')))), 'attribs' => array('data-ctfilter' => 'yes'))); //Last name entry $this->addElement('text', 'last_name', array('label' => 'Last Name *', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your last name')))), 'attribs' => array('data-ctfilter' => 'yes'))); //Prospective landlord address details. $hiddenElement = new Zend_Form_Element_Hidden('property_number_name'); $hiddenElement->setRequired(false); $hiddenElement->clearDecorators(); $this->addElement($hiddenElement); // Add postcode element $this->addElement('text', 'property_postcode', array('label' => 'Postcode *', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter a postcode', 'notEmptyInvalid' => 'Please enter a valid postcode'))), array('regex', true, array('pattern' => '/^[0-9a-z]{2,}\\ ?[0-9a-z]{2,}$/i', 'messages' => 'Postcode must be in postcode format'))), 'attribs' => array('data-ctfilter' => 'yes'))); // Add address select element $this->addElement('select', 'property_address', array('label' => 'Please select your address *', 'required' => true, 'multiOptions' => array('' => '--- please select ---'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select your property address', 'notEmptyInvalid' => 'Please select your property address')))), 'attribs' => array('data-ctfilter' => 'yes'))); //Phone number entry $this->addElement('text', 'phone_number', array('label' => 'Telephone Number *', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your phone number'))), array('regex', true, array('pattern' => '/^((\\+44\\s?\\(0\\)\\s?\\d{2,4})|(\\+44\\s?(01|02|03|07|08)\\d{2,3})|(\\+44\\s?(1|2|3|7|8)\\d{2,3})|(\\(\\+44\\)\\s?\\d{3,4})|(\\(\\d{5}\\))|((01|02|03|07|08)\\d{2,3})|(\\d{5}))(\\s|-|.)(((\\d{3,4})(\\s|-)(\\d{3,4}))|((\\d{6,7})))$/', 'messages' => 'Not a valid phone number'))), 'attribs' => array('data-ctfilter' => 'yes'))); //Fax number entry $this->addElement('text', 'fax_number', array('label' => 'Fax Number', 'required' => false, 'validators' => array(array('regex', true, array('pattern' => '/^((\\+44\\s?\\(0\\)\\s?\\d{2,4})|(\\+44\\s?(01|02|03|07|08)\\d{2,3})|(\\+44\\s?(1|2|3|7|8)\\d{2,3})|(\\(\\+44\\)\\s?\\d{3,4})|(\\(\\d{5}\\))|((01|02|03|07|08)\\d{2,3})|(\\d{5}))(\\s|-|.)(((\\d{3,4})(\\s|-)(\\d{3,4}))|((\\d{6,7})))$/', 'messages' => 'Not a valid phone number'))), 'attribs' => array('data-ctfilter' => 'yes'))); //Mobile number entry. We do not currently capture this, so WTF do we ask for it? $this->addElement('text', 'mobile_number', array('label' => 'Mobile Number *', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your mobile number'))), array('regex', true, array('pattern' => '/^07([\\d]{3})[(\\D\\s)]?[\\d]{3}[(\\D\\s)]?[\\d]{3}$/', 'messages' => 'Not a valid mobile phone number'))), 'attribs' => array('data-ctfilter' => 'yes'))); //The email elements. $emailElement = new Zend_Form_Element_Text('email'); $emailElement->setLabel('Email *'); $emailElement->setRequired(true); $emailElement->addFilter(new Zend_Filter_StringTrim()); $validator = new Zend_Validate_NotEmpty(); $validator->setMessage('Please enter your email address'); $emailElement->addValidator($validator); $validator = new Zend_Validate_EmailAddress(); $validator->setMessages(array(Zend_Validate_EmailAddress::INVALID_HOSTNAME => "Domain name invalid in email address", Zend_Validate_EmailAddress::INVALID_FORMAT => "Invalid email address")); $emailElement->addValidator($validator); $this->addElement($emailElement); //The password element. $passwordElement = new Zend_Form_Element_Password('password'); $passwordElement->setRequired(true); $passwordElement->setLabel('Password *'); $validator = new Zend_Validate_NotEmpty(); $validator->setMessage('Please set a password'); $passwordElement->addValidator($validator); $passwordElement->addValidator(new Zend_Validate_PasswordStrength()); $validator = new Zend_Validate_Identical(); $validator->setToken('confirm_password'); $validator->setMessage('Passwords are not the same', Zend_Validate_Identical::NOT_SAME); $passwordElement->addValidator($validator); $this->addElement($passwordElement); //The confirm password element. $confirmPasswordElement = new Zend_Form_Element_Password('confirm_password'); $confirmPasswordElement->setRequired(true); $confirmPasswordElement->setLabel('Confirm Password *'); $validator = new Zend_Validate_NotEmpty(); $validator->setMessage('Please confirm your password'); $confirmPasswordElement->addValidator($validator); $this->addElement($confirmPasswordElement); // Security question & answer $this->addElement('select', 'security_question', array('label' => 'Security Question *', 'required' => true, 'multiOptions' => array('' => 'Please select'), 'registerInArrayValidator' => false, 'decorators' => array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false))), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select your security question', 'notEmptyInvalid' => 'Please select your security question')))))); $this->addElement('text', 'security_answer', array('label' => 'Answer *', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your security answer')))))); $this->addElement('text', 'insurance_renewal_date', array('label' => 'Next Landlords Insurance Renewal Date (dd/mm/yyyy)', 'required' => false, 'filters' => array('StringTrim'))); $insuranceRenewalDate = $this->getElement('insurance_renewal_date'); $validator = new Zend_Validate_DateCompare(); $validator->minimum = new Zend_Date(mktime(0, 0, 0, date('m'), date('d'), date('Y'))); // $validator->maximum = new Zend_Date(mktime(0, 0, 0, date('m'), date('d'), date('Y')) + 60 * 60 * 24 * 30); $validator->setMessages(array('msgMinimum' => 'Insurance renewal date cannot be in the past')); $insuranceRenewalDate->addValidator($validator, true); //Grab view and add the date picker JavaScript files into the page head $view = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('view'); $view->headLink()->appendStylesheet('/assets/vendor/bootstrap-datepicker/css/bootstrap-datepicker.min.css', 'screen'); $view->headScript()->appendFile('/assets/vendor/jquery-date/js/date.js', 'text/javascript')->appendFile('/assets/vendor/bootstrap-datepicker/js/bootstrap-datepicker.min.js', 'text/javascript')->appendFile('/assets/landlords-referencing/js/referencingInsuranceRenewalDatePicker.js', 'text/javascript'); //The submit button $submitElement = new Zend_Form_Element_Submit('submit'); $submitElement->setIgnore(true); $this->addElement($submitElement); //Apply decorators. This has to be done unusually for t'ings to work. $this->setElementDecorators(array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false)))); $submitElement->removeDecorator('label'); $this->property_number_name->removeDecorator('HtmlTag'); //Grab view and add the address lookup JavaScript into the page head $view = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('view'); $view->headScript()->appendFile('/assets/common/js/addressLookup.js', 'text/javascript'); }