public function init() { $menu_items_model = new Admin_Model_MenuItems(); $name = new Zend_Form_Element_Text('name'); $name->setLabel('Usergroup name')->setRequired(true)->setAttrib("class", "form-control")->setAttrib("style", "width:200px"); $menu_items = new Zend_Form_Element_Multiselect('admin_menu_item_id'); $menu_items->addValidator(new Zend_Validate_Digits(), true); $menu_items->setLabel('Menu Items: '); $menu_items->setAttrib("class", "select2"); $menu_items->setAttrib("data-placeholder", "Choose..."); $menu_items->setAttrib("style", "width:200px"); $menu_items->addMultiOptions($menu_items_model->getForDropDown()); $permit = new Zend_Form_Element_MultiCheckbox('permit'); $permit->setLabel('Available resources '); $resources_table = new Admin_Model_Resources(); foreach ($resources_table->getAll() as $resource) { $permit->addMultiOption((string) $resource->id, ' ' . $resource->name); } $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+'/admin/admin-usersgroups/'"); $submit = new Zend_Form_Element_Submit('save'); $submit->setAttrib('class', 'btn btn-primary'); $submit->setLabel('Confirm'); $this->setAction('')->setMethod('post')->addElement($name)->addElement($menu_items)->addElement($permit)->addElement($cancel)->addElement($submit); }
public function init() { $this->setMethod(self::METHOD_POST); $this->setName('fillTest'); $questions = $this->_test->getQuestions(); foreach ($questions as $q) { $options = $q->getOptions(); if (count($options) == 0) { // otevrena odpoved $text = $this->createElement('textarea', $q->getid_otazka()); $text->addFilter('StringTrim'); $text->setRequired(true); $text->setLabel($q->getobsah()); $text->setDecorators(array(array('ViewScript', array('viewScript' => 'TextArea.php', 'languageId' => $q->getid_jazyk())))); $this->addElement($text); } else { // multicheckbox $multicheck = new Zend_Form_Element_MultiCheckbox($q->getid_otazka()); $multicheck->setLabel($q->getobsah()); $multicheck->setRequired(true); foreach ($options as $o) { $multicheck->addMultiOption($o->getid_moznost(), $o->getobsah()); } $multicheck->setDecorators(array(array('ViewScript', array('viewScript' => 'MultiCheckbox.php', 'languageId' => $q->getid_jazyk())))); $this->addElement($multicheck); } } //submit button $button = $this->createElement('submit', 'Submit'); $button->setAttrib('class', 'btn btn-success btn-lg dd-test'); $this->addElement($button); }
public function __construct($options = null, $groupsData = array()) { // variable parent::__construct($options); $baseDir = $options['baseDir']; // html text $textAdministratorGroup = new Cible_Form_Element_Html('htmlAdministratorGroup', array('value' => $this->getView()->getCibleText('label_administrator_actives'))); $this->addElement($textAdministratorGroup); $checkBox = new Zend_Form_Element_MultiCheckbox('groups'); $checkBox->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'checkbox_list')))); //$checkBox->setDescription('<em>Example:</em> mydomain.com') //->addDecorator('Description', array('escape' => false)); //show administrator group (first level) $groupAdmin = Cible_FunctionsAdministrators::getAdministratorGroupData(1)->toArray(); $checkBox->addMultiOption("1", $groupAdmin['EGI_Name'] . " (" . $groupAdmin['EGI_Description'] . ")"); $i = 0; foreach ($groupsData as $group) { if ($group['EG_Status'] == 'active') { $checkBox->addMultiOption($group['EG_ID'], $group['EGI_Name'] . " (" . $group['EGI_Description'] . ")"); } $i++; } $this->addElement($checkBox); }
/** * create the form to change permission * * in this form we can set the acl roles, which are allowed or denied * for this action * * @param Admin_Model_DbRow_Controller $controller * @param Admin_Model_DbRow_Action $action * @param array $roles array of Admin_Model_DbTable_Acl_Role Objects * @param array $rulesAllow * @param array $rulesDeny */ public function __construct(Admin_Model_DbRow_Controller $controller, Admin_Model_DbRow_Action $action, array $roles, array $rulesAllow, array $rulesDeny) { parent::__construct($controller); $rolesAllow = new Zend_Form_Element_MultiCheckbox('rolesallow', array('label' => 'Allow access', 'order' => 7)); $rolesDeny = new Zend_Form_Element_MultiCheckbox('rolesdeny', array('label' => 'Explicit Deny Access', 'order' => 8)); foreach ($roles as $role) { $rolesAllow->addMultiOption($role->get('id'), $role->get('name')); $rolesDeny->addMultiOption($role->get('id'), $role->get('name')); } $rolesAllow->setValue($rulesAllow); $rolesDeny->setValue($rulesDeny); $this->addElements(array($rolesAllow, $rolesDeny, new Zend_Form_Element_Hidden('id', array('required' => true, 'value' => $action->get('id'), 'order' => 11)))); // remove description element (from base form) $this->removeElement('description'); $this->getElement('action')->setValue($action->get('actionName')); }
/** * */ public function getmodulesForm() { $this->setName('safinstancesModules'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbuttonc'); $safinstancesSafmodules = new Zend_Form_Element_MultiCheckbox('SafinstancesSafmodules'); $safinstancesSafmodules->setLabel('SafinstancesSafmodules'); $options = new Safmodules(); // AND isalwaysactive != 1 foreach ($options->fetchAll("istechnical != 1 AND name LIKE 'admin%' ", 'label') as $k) { $safinstancesSafmodules->addMultiOption($k->id, $k->label); } $this->addElements(array($this->idb, $this->hashb, $safinstancesSafmodules)); $this->addElements(array($submit)); return $this; }
public function init() { /* Form Elements & Other Definitions Here ... */ /* $tablaOpcion = new Encuesta_Model_DbTable_Opcion; $rowsetOpciones = $tablaOpcion->fetchAll(); //$eOpciones = new Zend_Form_Element_Multiselect("opciones"); $eOpciones = new Zend_Form_Element_MultiCheckbox("opciones"); $eOpciones->setLabel("Opciones Disponibles:"); //$eOpciones->setAttrib("class", "form-control"); foreach ($rowsetOpciones as $opcion) { $eOpciones->addMultiOption($opcion->idOpcion, $opcion->opcion); } $eSubmit = new Zend_Form_Element_Submit("submit"); $eSubmit->setLabel("Guardar Opciones"); $eSubmit->setAttrib("class", "btn btn-success"); $this->addElement($eOpciones); $this->addElement($eSubmit); */ $categoriaDAO = new Encuesta_DAO_Categoria(); $opcionDAO = new Encuesta_DAO_Opcion(); $modelCategorias = $categoriaDAO->obtenerCategorias(); foreach ($modelCategorias as $modelCategoria) { $sub = new Zend_Form_SubForm(); $sub->setLegend($modelCategoria->getCategoria() . " :: " . $modelCategoria->getDescripcion()); $modelOpciones = $categoriaDAO->obtenerOpciones($modelCategoria->getIdCategoria()); $eElement = new Zend_Form_Element_MultiCheckbox($modelCategoria->getIdCategoria()); foreach ($modelOpciones as $modelOpcion) { $eElement->addMultiOption($modelOpcion->getIdOpcion(), $modelOpcion->getOpcion()); } $sub->addElement($eElement); $this->addSubForm($sub, $modelCategoria->getIdCategoria()); } $eSubmit = new Zend_Form_Element_Submit("submit"); $eSubmit->setLabel("Guardar Opciones"); $eSubmit->setAttrib("class", "btn btn-success"); $this->addElement($eSubmit); }
public function init() { $this->setMethod('post'); $this->setAttrib('action', DOMAIN . 'empscreening/add'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'empscreening'); $id = new Zend_Form_Element_Hidden('id'); $employee = new Zend_Form_Element_Select('employee'); $employee->setLabel('employee'); $employee->setRequired(true)->addErrorMessage('Please select employee.'); $employee->setAttrib('onchange', 'getemployeeData(this)'); $employee->setRegisterInArrayValidator(false); $bgcheck_status = new Zend_Form_Element_Select('bgcheck_status'); $bgcheck_status->setLabel('employee'); $bgcheck_status->setRequired(true)->addErrorMessage('Please select bgcheck status.'); $bgcheck_status->addMultiOption('0', 'Select status'); $bgcheck_status->addMultiOption('In process', 'In process'); $bgcheck_status->addMultiOption('On hold', 'On hold'); $bgcheck_status->addMultiOption('Complete', 'Complete'); $bgcheck_status->setRegisterInArrayValidator(false); $checktype = new Zend_Form_Element_MultiCheckbox('checktype'); $checktype->setAttrib('onclick', 'displayAgencyList()'); $bgcheckModal = new Default_Model_Bgscreeningtype(); $checktypesData = $bgcheckModal->fetchAll('isactive=1', 'type'); foreach ($checktypesData->toArray() as $data) { $checktype->addMultiOption($data['id'], $data['type']); } $checktype->setSeparator(PHP_EOL); $checkagency = new Zend_Form_Element_Hidden('checkagency'); $agency = new Zend_Form_Element_Hidden('agencyids'); $agencyData = Zend_Controller_Front::getInstance()->getRequest()->getParam('checkagency', null); if ($agencyData == 'checked') { $agency->setRequired(true); $agency->addValidator('NotEmpty', false, array('messages' => 'Please select agency.')); } $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $employee, $bgcheck_status, $checkagency, $checktype, $agency, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $this->setMethod('post'); $this->setAttrib('action', DOMAIN . 'empconfiguration'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'empconfiguration'); $empConfigureArray = array('emp_leaves' => 'Employee Leaves', 'emp_holidays' => 'Employee Holidays', 'emp_salary' => 'Salary Details', 'emppersonaldetails' => 'Personal Details', 'empcommunicationdetails' => 'Contact Details', 'emp_skills' => 'Employee Skills', 'emp_jobhistory' => 'Employee Job History', 'experience_details' => 'Experience Details', 'education_details' => 'Education Details', 'trainingandcertification_details' => 'Training & Certification Details', 'medical_claims' => 'Medical Claims', 'disabilitydetails' => 'Disability Details', 'dependency_details' => 'Dependency Details', 'visadetails' => 'Visa and Immigration Details', 'creditcarddetails' => 'Corporate Card Details', 'workeligibilitydetails' => 'Work Eligibility Details', 'emp_additional' => 'Additional Details', 'emp_renumeration' => 'Remuneration Details', 'emp_security' => 'Security Credentials', 'emp_performanceappraisal' => 'Performance Appraisal', 'emp_payslips' => 'Pay slips', 'emp_benifits' => 'Benefits'); $checktype = new Zend_Form_Element_MultiCheckbox('checktype'); foreach ($empConfigureArray as $key => $val) { $checktype->addMultiOption($key, $val); } $checktype->setRequired(true); $checktype->addValidator('NotEmpty', false, array('messages' => 'Please select atleast one employee configuration.')); $checktype->setOptions(array('class' => 'empconfigcheckbox')); $checktype->setSeparator(PHP_EOL); $checkall = new Zend_Form_Element_Checkbox('checkall'); $checkall->setLabel('Check All'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($checktype, $checkall, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function agregarPregunta(Zend_Form $contenedor, Encuesta_Model_Pregunta $pregunta) { $ePregunta = null; if ($pregunta->getTipo() == "AB") { $ePregunta = new Zend_Form_Element_Text($pregunta->getIdPregunta()); $ePregunta->setAttrib("class", "form-control"); } else { //Obtenemos las Opciones $opciones = $this->opcionDAO->obtenerOpcionesPregunta($pregunta->getIdPregunta()); if ($pregunta->getTipo() == "SS") { $ePregunta = new Zend_Form_Element_Radio($pregunta->getIdPregunta()); } elseif ($pregunta->getTipo() == "MS") { $ePregunta = new Zend_Form_Element_MultiCheckbox($pregunta->getIdPregunta()); } foreach ($opciones as $opcion) { $ePregunta->addMultiOption($opcion->getIdOpcion(), $opcion->getOpcion())->setSeparator(""); } } $ePregunta->setLabel($pregunta->getPregunta()); //$ePregunta->setAttrib("class", "form-control"); $ePregunta->setDecorators($this->decoratorsPregunta); $contenedor->addElement($ePregunta); return $contenedor; }
public function __construct($options = null) { Zend_Dojo::enableForm($this); parent::__construct(); $cust = new settings_Model_Customization(); $sample = $cust->fetchcustomized(); foreach ($sample as $cust1) { switch ($cust1['feild_type']) { case "text": $Instance = new Zend_Form_Element_Text($cust1['feild_name']); $Instance->setLabel($cust1['display_name']); $Instance->setAttrib('size', '8'); if ($cust1['feild_name']) { $Instance->setRequired(true)->setDecorators(array('ViewHelper', array('Description', array('tag' => '', 'escape' => false)), 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td', 'requiredSuffix' => ' *')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); } break; case "radio": $Instance = new Zend_Form_Element_Radio($cust1['feild_name']); $Instance->setLabel($cust1['display_name']); $appliesTo = $cust->getTableInfo($cust1['table_name']); foreach ($appliesTo as $appliesTo1) { foreach ($appliesTo as $key => $value) { $i = 1; foreach ($value as $key1 => $value1) { if ($i % 2 == 0) { //faltu start $f2 = $appliesTo1[$key1]; } else { $f1 = $appliesTo1[$key1]; } $Instance->addMultiOption($f1, $f2); $i++; } //faltu end } } if ($cust1['feild_name']) { $Instance->setRequired(true)->addValidators(array(array('NotEmpty')))->setDecorators(array('ViewHelper', array('Description', array('tag' => '', 'escape' => false)), 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td', 'requiredSuffix' => ' *')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); } break; case "select": $Instance = new Zend_Form_Element_Select($cust1['feild_name']); $Instance->setLabel($cust1['display_name']); $appliesTo = $cust->getTableInfo($cust1['table_name']); foreach ($appliesTo as $appliesTo1) { foreach ($appliesTo as $key => $value) { $i = 1; foreach ($value as $key1 => $value1) { if ($i % 2 == 0) { //faltu start $f2 = $appliesTo1[$key1]; } else { $f1 = $appliesTo1[$key1]; } $Instance->addMultiOption($f1, $f2); $i++; } //faltu end } } if ($cust1['feild_name']) { $Instance->setRequired(true)->addValidators(array(array('NotEmpty')))->setDecorators(array('ViewHelper', array('Description', array('tag' => '', 'escape' => false)), 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td', 'requiredSuffix' => ' *')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); } break; case "description": $Instance = new Zend_Form_Element_Textarea($cust1['feild_name'], array('rows' => 3, 'cols' => 20)); $Instance->setLabel($cust1['display_name']); if ($cust1['feild_name']) { $Instance->setRequired(true)->addValidators(array(array('NotEmpty')))->setDecorators(array('ViewHelper', array('Description', array('tag' => '', 'escape' => false)), 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td', 'requiredSuffix' => ' *')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); } break; case "checkbox": $Instance = new Zend_Form_Element_MultiCheckbox($cust1['feild_name']); $Instance->setLabel($cust1['display_name']); $appliesTo = $cust->getTableInfo($cust1['table_name']); foreach ($appliesTo as $appliesTo1) { foreach ($appliesTo as $key => $value) { $i = 1; foreach ($value as $key1 => $value1) { if ($i % 2 == 0) { //faltu starta $f2 = $appliesTo1[$key1]; } else { $f1 = $appliesTo1[$key1]; } $Instance->addMultiOption($f1, $f2); $i++; } //faltu end } } if ($cust1['feild_name']) { $Instance->setRequired(true)->addValidators(array(array('NotEmpty')))->setDecorators(array('ViewHelper', array('Description', array('tag' => '', 'escape' => false)), 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td', 'requiredSuffix' => ' *')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); } break; } $this->addElements(array($Instance)); } }
public function __construct($options = null, $groupsData = array()) { // variable parent::__construct($options); $baseDir = $options['baseDir']; if (array_key_exists('profile', $options)) { $profile = $options['profile']; } else { $profile = false; } // lastname $lname = new Zend_Form_Element_Text('EU_LName'); $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')->setAttrib('escape', false); $this->addElement($lname); // firstname $fname = new Zend_Form_Element_Text('EU_FName'); $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); // email $regexValidate = new Cible_Validate_Email(); $regexValidate->setMessage($this->getView()->getCibleText('validation_message_emailAddressInvalid'), 'regexNotMatch'); $email = new Zend_Form_Element_Text('EU_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); // username $username = new Zend_Form_Element_Text('EU_Username'); $username->setLabel($this->getView()->getCibleText('form_label_username'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput')->setAttrib('autocomplete', 'off'); $this->addElement($username); // new password $password = new Zend_Form_Element_Password('EU_Password'); $password->setLabel($this->getView()->getCibleText('form_label_newPwd'))->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextInput')->setAttrib('autocomplete', 'off'); $this->addElement($password); // password confirmation $passwordConfirmation = new Zend_Form_Element_Password('PasswordConfirmation'); $passwordConfirmation->setLabel($this->getView()->getCibleText('form_label_confirmNewPwd'))->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextInput'); if (!empty($_POST['EU_Password'])) { $passwordConfirmation->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('error_message_password_isEmpty')))); $Identical = new Zend_Validate_Identical($_POST['EU_Password']); $Identical->setMessages(array('notSame' => $this->getView()->getCibleText('error_message_password_notSame'))); $passwordConfirmation->addValidator($Identical); } $this->addElement($passwordConfirmation); if ($profile != true) { // html text $textAdministratorGroup = new Cible_Form_Element_Html('htmlAdministratorGroup', array('value' => $this->getView()->getCibleText('label_administrator_actives'))); $this->addElement($textAdministratorGroup); $checkBox = new Zend_Form_Element_MultiCheckbox('groups'); $checkBox->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'checkbox_list')))); //$checkBox->setDescription('<em>Example:</em> mydomain.com') //->addDecorator('Description', array('escape' => false)); //show administrator group (first level) $groupAdmin = Cible_FunctionsAdministrators::getAdministratorGroupData(1)->toArray(); $checkBox->addMultiOption("1", $groupAdmin['EGI_Name'] . " (" . $groupAdmin['EGI_Description'] . ")"); $i = 0; foreach ($groupsData as $group) { if ($group['EG_Status'] == 'active') { $checkBox->addMultiOption($group['EG_ID'], $group['EGI_Name'] . " (" . $group['EGI_Description'] . ")"); } $i++; } $this->addElement($checkBox); } }
public function init() { /* * * Settings * */ $this->setName('holidayhome'); $this->setMethod('post'); /* * * Elements * */ $element = new Zend_Form_Element_Select('hm_geo_city_id'); $element->setLabel('Plaats')->addMultiOption('', '...')->setRequired(true); $geo = Doctrine_Query::create()->from('Model_Hm_Geo_City c')->leftJoin('c.Region r, r.Country y, y.Translation tr')->where('tr.lang = ?', Model_Lang::getCurrent())->orderBy('tr.name, r.name, c.name')->execute(); foreach ($geo as $city) { $element->addMultiOption($city->id, $city->Region->Country->translationHandler()->name . " - " . $city->Region->name . " - " . $city->name); } $this->addElement($element); $element = new Zend_Form_Element_Select('hm_owner_id'); $element->setLabel('Eigenaar')->addMultiOption('', '...')->setRequired(true); $owners = Doctrine_Query::create()->from('Model_Hm_Owner o')->leftJoin('o.User u')->orderBy('u.surname')->select('o.id')->execute(); foreach ($owners as $owner) { $label = $owner->User->surname . ', ' . $owner->User->initials . ' ' . $owner->User->insertion . ' - (' . $owner->debtor_no . ')'; $element->addMultiOption($owner->id, $label); } $this->addElement($element); $element = new Zend_Form_Element_Select('active'); $element->setLabel('Actief')->setRequired(true)->addMultiOption('', '...')->addMultiOption('true', 'Actief')->addMultiOption('false', 'Niet actief'); $this->addElement($element); $element = new Zend_Form_Element_Text('name'); $element->setLabel('Naam')->setValidators(array(array('stringLength', null, array('min' => 4, 'max' => 128))))->setAttrib('maxlength', 128)->setRequired(true); $this->addElement($element); $element = new Zend_Form_Element_Text('address'); $element->setLabel('Straat')->setValidators(array(array('stringLength', null, array('min' => 4, 'max' => 128))))->setAttrib('maxlength', 128)->setRequired(true); $this->addElement($element); $element = new Zend_Form_Element_Text('number'); $element->setLabel('Huisnummer')->setValidators(array(array('stringLength', null, array('max' => 128))))->setAttrib('maxlength', 128)->setRequired(true); $this->addElement($element); $element = new Zend_Form_Element_Text('code'); $element->setLabel('Code')->setValidators(array(array('stringLength', null, array('max' => 128))))->setAttrib('maxlength', 128)->setRequired(true); $this->addElement($element); $element = new Zend_Form_Element_Text('zipcode'); $element->setLabel('Postcode')->setValidators(array(array('stringLength', null, array('min' => 2, 'max' => 8))))->setAttrib('maxlength', 8)->setRequired(true); $this->addElement($element); $element = new Zend_Form_Element_Text('surface_lot'); $element->setLabel('Kavel')->setValidators(array(array('digits')))->setFilters(array(array('int')))->setAttrib('maxlength', 6); $this->addElement($element); $element = new Zend_Form_Element_Text('surface_build'); $element->setLabel('Bebouwd')->setValidators(array(array('digits')))->setFilters(array(array('int')))->setAttrib('maxlength', 6); $this->addElement($element); $element = new Zend_Form_Element_Text('persons'); $element->setLabel('Personen')->setValidators(array(array('digits')))->setFilters(array(array('int')))->setAttrib('maxlength', 6)->setRequired(true); $this->addElement($element); $element = new Zend_Form_Element_Text('bedrooms'); $element->setLabel('Slaapkamers')->setValidators(array(array('digits')))->setFilters(array(array('int')))->setAttrib('maxlength', 6)->setRequired(true); $this->addElement($element); $element = new Zend_Form_Element_Text('toilets'); $element->setLabel('Toiletten')->setValidators(array(array('digits')))->setFilters(array(array('int')))->setAttrib('maxlength', 6)->setRequired(true); $this->addElement($element); $element = new Zend_Form_Element_Text('showers'); $element->setLabel('Badkamers')->setValidators(array(array('digits')))->setFilters(array(array('int')))->setAttrib('maxlength', 6)->setRequired(true); $this->addElement($element); $element = new Zend_Form_Element_Text('coordinate'); $element->setLabel('Coordinaat')->setValidators(array(array('stringLength', null, array('min' => 8, 'max' => 32))))->setAttrib('maxlength', 32)->setRequired(true); $this->addElement($element); $element = new Zend_Form_Element_Text('price'); $element->setLabel('Basisprijs')->setAttrib('maxlength', 20)->setRequired(true); $this->addElement($element); $element = new Zend_Form_Element_Text('extra_percentage'); $element->setLabel('Gebroken week percentage')->setAttrib('maxlength', 20)->setRequired(true); $this->addElement($element); $element = new Zend_Form_Element_Text('maintenance_central_heating'); $element->setLabel('Onderhoud centrale verwarming')->setValidators(array(array('stringLength', null, array('max' => 128))))->setAttrib('maxlength', 128); $this->addElement($element); $element = new Zend_Form_Element_Text('maintenance_garden'); $element->setLabel('Onderhoud tuin')->setValidators(array(array('stringLength', null, array('max' => 128))))->setAttrib('maxlength', 128); $this->addElement($element); $element = new Zend_Form_Element_Text('insurance_name'); $element->setLabel('Verzekerinig')->setValidators(array(array('stringLength', null, array('max' => 128))))->setAttrib('maxlength', 128); $this->addElement($element); $element = new Zend_Form_Element_Text('wifi_password'); $element->setLabel('Wifi wachtwoord')->setValidators(array(array('stringLength', null, array('max' => 128))))->setAttrib('maxlength', 128); $this->addElement($element); $element = new Zend_Form_Element_Text('insurance_policy_no'); $element->setLabel('Polisnummer')->setValidators(array(array('stringLength', null, array('max' => 128))))->setAttrib('maxlength', 128); $this->addElement($element); $element = new Zend_Form_Element_Text('insurance_agent'); $element->setLabel('Contactpersoon')->setValidators(array(array('stringLength', null, array('max' => 128))))->setAttrib('maxlength', 128); $this->addElement($element); $element = new Zend_Form_Element_Text('insurance_phone_no'); $element->setLabel('Telefoonnummer')->setValidators(array(array('stringLength', null, array('max' => 128))))->setAttrib('maxlength', 128); $this->addElement($element); $element = new Zend_Form_Element_Select('vat_publish'); $element->setLabel('Belasting plichtig')->addMultiOption(null, '..')->addMultiOption('true', 'Ja')->addMultiOption('false', 'Nee')->setRequired(true); $this->addElement($element); $element = new Zend_Form_Element_Select('vat_outside'); $element->setLabel('Belasting buitenland')->addMultiOption(null, '..')->addMultiOption('true', 'Ja')->addMultiOption('false', 'Nee')->setRequired(true); $this->addElement($element); $element = new Zend_Form_Element_MultiCheckbox('Categories'); $element->setLabel('Categorieen waar woning in hoort'); $categories = Model_Hm_Category::listAll()->execute(); foreach ($categories as $category) { $element->addMultiOption($category->id, $category->translationHandler()->name); } $this->addElement($element); $element = new Zend_Form_Element_MultiCheckbox('Options'); $element->setLabel('Kenmerken van deze woning'); $options = Model_Hm_Op_Option::listAll()->execute(); foreach ($options as $option) { $element->addMultiOption($option->id, $option->Category->translationHandler()->name . ' - ' . $option->translationHandler()->name); } $this->addElement($element); $element = new Zend_Form_Element_Submit('holidayhome_submit'); $element->setLabel('Verwerken')->setAttrib('class', 'submit'); $this->addElement($element); /* * * Translations * */ // Create new translations subform $subForm = new Zend_Form_SubForm('Translation'); // Run all languages foreach (Model_Hm_Lang::listAll() as $lang) { // Create subform for language $subSubForm = new Zend_Form_SubForm($lang->code); // Create description field $element = new Zend_Form_Element_Textarea('description'); $element->setLabel('Omschrijving')->setAttrib('class', 'autoexpand')->setAttrib('rows', 2)->setAttrib('cols', 24)->setRequired(true)->setValidators(array(array('stringLength', false, array('min' => 40)))); $subSubForm->addElement($element); // Add description field to language subform // Put each language in different fieldset $subSubForm->addDisplayGroup(array('description'), $lang->code, array('class' => 'textarea', 'legend' => 'Vertaling - ' . $lang->name)); // Add language subform to Translation subform $subForm->addSubForm($subSubForm, $lang->code); } // Add Translation subform to normal form $this->addSubForm($subForm, 'Translation', 19); /* * * Display groups * */ $this->addDisplayGroup(array('Options'), 'OptionsGroup', array('class' => 'checkboxes', 'legend' => 'Kenmerken', 'order' => 17)); $this->addDisplayGroup(array('address', 'number', 'zipcode', 'code', 'hm_geo_city_id'), 'Adres', array('legend' => 'Adres', 'order' => 2)); $this->addDisplayGroup(array('persons', 'bedrooms', 'toilets', 'showers'), 'Indeling', array('legend' => 'Indeling', 'order' => 3)); $this->addDisplayGroup(array('surface_lot', 'surface_build'), 'Oppervlakte', array('legend' => 'Oppervlakte', 'order' => 6)); $this->addDisplayGroup(array('vat_publish', 'vat_outside'), 'Belasting', array('legend' => 'Belasting', 'order' => 5)); $this->addDisplayGroup(array('price', 'extra_percentage'), 'Prijscalculatie', array('legend' => 'Prijscalculatie', 'order' => 4)); $this->addDisplayGroup(array('maintenance_central_heating', 'maintenance_garden', 'wifi_password'), 'hulpdiensten', array('legend' => 'Overige', 'order' => 11)); $this->addDisplayGroup(array('insurance_name', 'insurance_policy_no', 'insurance_agent', 'insurance_phone_no'), 'verzekering', array('legend' => 'Verzekering', 'order' => 10)); $this->addDisplayGroup(array('Categories'), 'categoriesgroup', array('legend' => 'Categorieen', 'class' => 'checkboxes', 'order' => 12)); $this->addDisplayGroup(array('hm_owner_id', 'active', 'name', 'coordinate'), 'algemeen', array('legend' => 'Algemeen', 'order' => 1)); $this->addDisplayGroup(array('holidayhome_submit'), 'submit', array('order' => 20, 'class' => 'submit')); /* * * Decorators * */ $decorators = array('FormElements', 'Form'); $displayGroupDecorators = array('Description', 'FormElements', 'Fieldset'); $elementDecorators = array('Description', 'ViewHelper', 'Errors', array(array('p' => 'HtmlTag'), array('tag' => 'p')), array('Label', array('tag' => 'p'))); $subDecorators = array('FormElements'); $subDisplayGroupDecorators = array('Description', 'FormElements', 'Fieldset', array('HtmlTag', array('tag' => 'div'))); $subElementDecorators = array('Description', 'ViewHelper', 'Errors', array(array('p' => 'HtmlTag'), array('tag' => 'p')), array('Label', array('tag' => 'p'))); /* * * Set decorators * */ $this->setDecorators($decorators)->setElementDecorators($elementDecorators)->setDisplayGroupDecorators($displayGroupDecorators); $translation = $this->getSubForm('Translation')->setDecorators($subDecorators)->setDisplayGroupDecorators($subDisplayGroupDecorators)->setElementDecorators($subElementDecorators); $subsubforms = $translation->getSubForms(); foreach ($subsubforms as $subsubform) { $subsubform->setDecorators($subDecorators)->setDisplayGroupDecorators($subDisplayGroupDecorators)->setElementDecorators($subElementDecorators); } $submit = $this->getElement('holidayhome_submit'); $submit->setDecorators(array('ViewHelper')); }