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);
 }
Example #2
0
 public function __construct($minimumDeposit)
 {
     parent::__construct($minimumDeposit);
     $date1 = new ZendX_JQuery_Form_Element_DatePicker('date1', array('label' => 'Date:'));
     $date1->setAttrib('class', 'txt_put');
     $date1->setJQueryParam('dateFormat', 'yy-mm-dd');
     $date1->setRequired(true);
     $period = new Zend_Form_Element_Select('period');
     $period->addMultiOption('', 'Select...');
     $period->setAttrib('class', 'txt_put');
     $period->setRequired(true)->addValidators(array(array('NotEmpty')));
     $period->setAttrib('onchange', 'getInterests(this.value)');
     $interest = new Zend_Form_Element_Text('interest');
     $interest->setAttrib('class', 'txt_put');
     $recuringamount = new Zend_Form_Element_Text('recuringamount');
     $recuringamount->setAttrib('class', 'txt_put');
     $amount = new Zend_Form_Element_Text('amount');
     $amount->addValidators(array(array('Float'), array('GreaterThan', false, array($minimumDeposit - 0.0001, 'messages' => array('notGreaterThan' => 'Minimum 
                                   Amount To open a savings account =' . $minimumDeposit)))));
     $amount->setAttrib('class', 'txt_put');
     $amount->setRequired(true);
     $amount->setAttrib('onchange', 'calculateTotalAmount(this.value)');
     $memberfirstname = new Zend_Form_Element_MultiCheckbox('memberfirstname');
     $memberfirstname->setAttrib('class', 'textfield');
     $memberfirstname->setRequired(true);
     $memberId = new Zend_Form_Element_Hidden('memberId');
     $productId = new Zend_Form_Element_Hidden('productId');
     $typeId = new Zend_Form_Element_Hidden('typeId');
     $memberTypeIdv = new Zend_Form_Element_Hidden('memberTypeIdv');
     $submit = new Zend_Form_Element_Submit('Submit');
     $Yes = new Zend_Form_Element_Submit('Yes');
     $back = new Zend_Form_Element_Submit('Back');
     $this->addElements(array($submit, $amount, $period, $interest, $recuringamount, $memberfirstname, $memberId, $date1, $productId, $typeId, $memberTypeIdv, $back, $Yes));
 }
 public function addFileIdElement()
 {
     $oFileId = new Zend_Form_Element_MultiCheckbox("file_id");
     $oFileId->setLabel("Załączniki:");
     $oFileId->setRequired(FALSE);
     $oFileId->addMultiOptions(array());
     $this->addElement($oFileId);
 }
 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);
     $oNotificationTypeId = new Zend_Form_Element_MultiCheckbox("notification_type_id");
     $oNotificationTypeId->setLabel("Typ:");
     $oNotificationTypeId->setRequired(FALSE);
     $oNotificationTypeId->addMultiOptions($this->_aAllNotificationType);
     $this->addElement($oNotificationTypeId);
     $oNotificationStatusId = new Zend_Form_Element_MultiCheckbox("notification_status_id");
     $oNotificationStatusId->setLabel("Status:");
     $oNotificationStatusId->setRequired(FALSE);
     $oNotificationStatusId->addMultiOptions($this->_aAllNotificationStatus);
     $this->addElement($oNotificationStatusId);
     $oNotificationPriorityId = new Zend_Form_Element_MultiCheckbox("notification_priority_id");
     $oNotificationPriorityId->setLabel("Priorytet:");
     $oNotificationPriorityId->setRequired(FALSE);
     $oNotificationPriorityId->addMultiOptions($this->_aAllNotificationPriority);
     $this->addElement($oNotificationPriorityId);
     $oNotificationCategoryId = new Zend_Form_Element_Select("search_notification_category_id");
     $oNotificationCategoryId->setLabel("Kategoria pytania:");
     $oNotificationCategoryId->setRequired(FALSE);
     $oNotificationCategoryId->addMultiOptions($this->_aAllNotificationCategory);
     $this->addElement($oNotificationCategoryId);
     $oUserId = new Zend_Form_Element_Select("search_notification_user_id");
     $oUserId->setLabel("Konsultant:");
     $oUserId->setRequired(FALSE);
     $oUserId->addMultiOptions($this->_aAllUser);
     $this->addElement($oUserId);
     $oInitDate = new Zend_Form_Element_Text("init_date");
     $oInitDate->setLabel("Data rozpoczęcia:");
     $oInitDate->setRequired(FALSE);
     $oInitDate->setFilters($this->_aFilters);
     $this->addElement($oInitDate);
     $oBlankNotificationUserId = new Zend_Form_Element_Checkbox("search_blank_notification_user_id");
     $oBlankNotificationUserId->setLabel("Pokaż nieprzydzielone zgłoszenia:");
     $this->addElement($oBlankNotificationUserId);
     $this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 7200));
     $this->getElement("csrf_token")->removeDecorator("Label");
     $oSubmit = $this->createElement("submit", "search_notification");
     $oSubmit->setLabel("Szukaj");
     $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");
     }
 }
Example #5
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'feedforwardinit');
     $id = new Zend_Form_Element_Hidden('id');
     $postid = Zend_Controller_Front::getInstance()->getRequest()->getParam('id');
     $appraisal_mode = new Zend_Form_Element_Select('appraisal_mode');
     $appraisal_mode->setLabel("Appraisal");
     $appraisal_mode->setMultiOptions(array('' => 'Select Appraisal'));
     $appraisal_mode->setAttrib('class', 'selectoption');
     $appraisal_mode->setRequired(true);
     $appraisal_mode->addValidator('NotEmpty', false, array('messages' => 'Please select appraisal.'));
     $status = new Zend_Form_Element_Select('status');
     $status->setLabel("Status");
     $status->setAttrib('class', 'selectoption');
     $status->setMultiOptions(array('1' => 'Open'));
     //,'2' => 'Close'
     $status->setRegisterInArrayValidator(false);
     $status->setRequired(true);
     $status->addValidator('NotEmpty', false, array('messages' => 'Please select status.'));
     $employee_name_view = new Zend_Form_Element_Radio('employee_name_view');
     $employee_name_view->setLabel("Employee Details");
     $employee_name_view->addMultiOptions(array('1' => 'Show', '0' => 'Hide'));
     $employee_name_view->setSeparator('');
     $employee_name_view->setValue(0);
     $employee_name_view->setRegisterInArrayValidator(false);
     $enable_to = new Zend_Form_Element_MultiCheckbox('enable_to');
     $enable_to->setLabel("Enable To");
     $enable_to->addMultiOptions(array('0' => 'Appraisal Employees', '1' => 'All Employees'));
     $enable_to->setSeparator('');
     $enable_to->setValue(0);
     $enable_to->setRequired(true);
     $enable_to->setRegisterInArrayValidator(false);
     $enable_to->addValidator('NotEmpty', false, array('messages' => 'Please check enable to.'));
     $ff_due_date = new Zend_Form_Element_Text('ff_due_date');
     $ff_due_date->setLabel("Due Date");
     $ff_due_date->setOptions(array('class' => 'brdr_none'));
     $ff_due_date->setRequired(true);
     $ff_due_date->addValidator('NotEmpty', false, array('messages' => 'Please select due date.'));
     $save = new Zend_Form_Element_Submit('submit');
     $save->setAttrib('id', 'submitbutton');
     $save->setLabel('Save & Initialize');
     $save_later = new Zend_Form_Element_Submit('submit');
     $save_later->setAttrib('id', 'submitbutton1');
     $save_later->setLabel('Save & Initialize Later');
     $this->addElements(array($id, $appraisal_mode, $status, $employee_name_view, $ff_due_date, $save, $save_later, $enable_to));
     $this->setElementDecorators(array('ViewHelper'));
 }
 public function init()
 {
     // profissional_beleza_nome
     $profissional_beleza_nome = new Zend_Form_Element_Text("profissional_beleza_nome");
     $profissional_beleza_nome->setLabel("Nome: ");
     $profissional_beleza_nome->setAttribs(array('class' => 'form-control'));
     $profissional_beleza_nome->setRequired();
     $profissional_beleza_nome->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
     // profissional_beleza_email
     $profissional_beleza_email = new Zend_Form_Element_Text("profissional_beleza_email");
     $profissional_beleza_email->setLabel("E-mail: ");
     $profissional_beleza_email->setValidators(array('EmailAddress'));
     $profissional_beleza_email->addValidator(new App_Validate_ProfissionalBeleza());
     $profissional_beleza_email->setAttribs(array('class' => 'form-control'));
     $profissional_beleza_email->setRequired();
     $profissional_beleza_email->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
     /**
      * profisional_beleza_sexo
      */
     $profissional_beleza_sexo = new Zend_Form_Element_Radio("profissional_beleza_sexo");
     $profissional_beleza_sexo->setLabel("Sexo:");
     $profissional_beleza_sexo->setRequired();
     $profissional_beleza_sexo->setDecorators(App_Forms_Decorators::$checkboxElementDecorators);
     $profissional_beleza_sexo->setMultiOptions(array('M' => ' Masculino', 'F' => ' Feminino'));
     // profissional_beleza_avatar
     $profissional_beleza_avatar = new Zend_Form_Element_File("profissional_beleza_avatar");
     $profissional_beleza_avatar->setLabel(" \n            Foto: \n        ");
     $profissional_beleza_avatar->addDecorators(App_Forms_Decorators::$ElementDecoratorFile);
     $profissional_beleza_avatar->setAttribs(array('class' => 'filestyle', 'data-buttonText' => 'Selecione a foto', 'data-iconName' => 'fa fa-user'));
     $profissional_beleza_avatar->setRequired();
     $profissional_beleza_avatar->setDestination(Zend_Registry::get('config')->profissional->avatar->path);
     $profissional_beleza_avatar->addValidators(array(array('Extension', false, 'jpg,jpeg,png')));
     $profissional_beleza_avatar->addFilter(new Skoch_Filter_File_Resize(array('width' => 160, 'keepRatio' => true)));
     // especialidade_id
     $especialidade_id = new Zend_Form_Element_MultiCheckbox("especialidade_id");
     $especialidade_id->setLabel("Selecione as especialidades: ");
     $especialidade_id->setAttribs(array('class' => ''));
     $especialidade_id->setRequired();
     $especialidade_id->setDecorators(App_Forms_Decorators::$checkboxElementDecorators);
     $especialidade_id->setSeparator(' ');
     $especialidade_id->setMultiOptions($this->getEspecialidades());
     // addElements
     $this->addElements(array($profissional_beleza_nome, $profissional_beleza_email, $profissional_beleza_sexo, $profissional_beleza_avatar, $especialidade_id));
     parent::init();
 }
Example #7
0
 public function init($subadmin_id)
 {
     global $mySession;
     $db = new Db();
     $first_name_value = "";
     $last_name_value = "";
     $emailID_value = "";
     $username_value = "";
     $password_value = "";
     $status_value = '1';
     if ($subadmin_id != "") {
         $SubsData = $db->runQuery("select * from " . SUBADMIN . " where subadmin_id='" . $subadmin_id . "'");
         $first_name_value = $SubsData[0]['first_name'];
         $last_name_value = $SubsData[0]['last_name'];
         $emailID_value = $SubsData[0]['emailID'];
         $username_value = $SubsData[0]['username'];
         $password_value = $SubsData[0]['password'];
         $status_value = $SubsData[0]['status'];
         $priv = $SubsData[0]['priviledges'];
         $priv = explode(",", $priv);
     }
     $first_name = new Zend_Form_Element_Text('first_name');
     $first_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Subadmin first name is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("style", "text-input medium-input")->setValue($first_name_value);
     $last_name = new Zend_Form_Element_Text('last_name');
     $last_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Subadmin last name is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "text-input medium-input")->setValue($last_name_value);
     $emailID = new Zend_Form_Element_Text('emailID');
     $emailID->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Subadmin email address is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "text-input medium-input")->setValue($emailID_value);
     $username = new Zend_Form_Element_Text('username');
     $username->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Subadmin username is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "text-input medium-input")->setValue($username_value);
     $password = new Zend_Form_Element_Password('password');
     $password->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Subadmin password is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "text-input medium-input")->setValue($password_value);
     $StatusArr = array();
     $StatusArr[0]['key'] = "0";
     $StatusArr[0]['value'] = "Disable";
     $StatusArr[1]['key'] = "1";
     $StatusArr[1]['value'] = "Enable";
     $status = new Zend_Form_Element_Select('status');
     $status->addMultiOptions($StatusArr)->setAttrib("class", "textInput")->setValue($status_value);
     $priviledges = new Zend_Form_Element_MultiCheckbox('priviledges');
     $priviledges->setRequired(true)->addMultiOption('configuration', 'Configuration')->addMultiOption('emailtemplates', 'Email Templates')->addMultiOption('generalsettings', 'General Settings')->addMultiOption('cmspages', 'CMS Pages')->addMultiOption('subscription', 'Subscription')->addMultiOption('calender', 'Calender')->addMultiOption('users', 'Users')->addMultiOption('blogs', 'Blogs')->addMultiOption('documents', 'Documents')->addMultiOption('action', 'Action Management')->addMultiOption('products', 'Products Management')->addMultiOption('messages', 'Messages')->addMultiOption('changepass', 'Change Password')->setValue($priv);
     $this->addElements(array($first_name, $last_name, $emailID, $username, $password, $status, $priviledges));
 }
Example #8
0
 public function __construct($beginDate, $matureDate, $minimumDeposit, $maxmDeposit, $app)
 {
     Zend_Dojo::enableForm($this);
     parent::__construct($beginDate, $matureDate, $minimumDeposit, $maxmDeposit);
     $memberfirstname = new Zend_Form_Element_MultiCheckbox('memberfirstname');
     $memberfirstname->setAttrib('class', 'txt_put');
     $memberfirstname->setRequired(true);
     $savingAccount = new Zend_Form_Element_multiCheckbox('savingAccount');
     $savingAccount->setAttrib('class', 'txt_put');
     //         $savingAccount->setRequired(true);
     $startdate = new ZendX_JQuery_Form_Element_DatePicker('loanAccountdate', array('label' => 'Date:'));
     $startdate->setJQueryParam('dateFormat', 'yy-mm-dd');
     $startdate->setAttrib('size', '8');
     $startdate->setAttrib('class', 'txt_put');
     $startdate->setRequired(true);
     $amount = new Zend_Form_Element_Text('amount');
     $amount->setRequired(true);
     $amount->addValidator('Float');
     $amount->setAttrib('size', '8');
     $amount->setAttrib('class', 'txt_put');
     $amount->setAttrib('onchange', 'calculateTotalAmount(this.value)');
     $loanInstallements = new Zend_Form_Element_Select('loanInterest');
     $loanInstallements->addMultiOption('', 'Select...');
     $loanInstallements->setAttrib('class', 'txt_put');
     $loanInstallements->setAttrib('id', 'loanInterest');
     $loanInstallements->setRequired(true);
     $loanInstallements->setAttrib('onchange', 'getInterests(this.value,"' . $app . '")');
     $interest = new Zend_Form_Element_Text('interest');
     $interest->setAttrib('class', 'txt_put');
     $interest->setAttrib('id', 'interest');
     $interest->setAttrib('size', '8');
     $this->addElements(array($memberfirstname, $interest, $startdate, $amount, $loanInstallements));
     $submit = new Zend_Form_Element_Submit('Submit');
     $memberId = new Zend_Form_Element_Hidden('memberId');
     $productId = new Zend_Form_Element_Hidden('productId');
     $typeId = new Zend_Form_Element_Hidden('typeId');
     $Type = new Zend_Form_Element_Hidden('Type');
     $back = new Zend_Form_Element_Submit('Back');
     $Yes = new Zend_Form_Element_Submit('Yes');
     $this->addElements(array($submit, $memberId, $productId, $savingAccount, $typeId, $Type, $back, $Yes));
 }
 public function init()
 {
     // username
     $this->addElement('text', 'username', array('required' => true, 'validators' => array(array('Alnum', false, false), array('StringLength', false, array(6, 16)))));
     // email
     $EmailValidate = new My_Validator_Email();
     $this->addElement('text', 'email', array('required' => true, 'validators' => array(array('EmailAddress', false), array($EmailValidate, false))));
     // add checkboxes with user groups.
     // Perform translation here. (could as well have been titles from a DB
     // so it's not something the renderer should do, as opposed to labels
     // and error messages)
     $lang = new My_LanguagePack();
     $groupIds = array(1, 2, 3, 4);
     $groupOptions = array();
     foreach ($groupIds as $id) {
         $groupOptions[$id] = $lang->get('group.label.' . $id);
     }
     $elmGroup = new Zend_Form_Element_MultiCheckbox('group');
     $elmGroup->setMultiOptions($groupOptions);
     $elmGroup->setRequired(true);
     $this->addElement($elmGroup);
 }
Example #10
0
 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'));
 }
Example #11
0
 public function init()
 {
     // 		$category_id = new Zend_Form_Element_Select('category_id');
     // 		$category_id->addMultiOption('','Select...');
     // 		$category_id->setAttrib('class', 'txt_put')
     // 					->setLabel('Credit Line');
     // 		$category_id->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'))));
     $sectortname = new Zend_Form_Element_Text('productname');
     $sectortname->addValidator(new Zend_Validate_Db_NoRecordExists('ourbank_productdetails', 'productname'));
     $sectortname->setAttrib('class', 'txt_put')->setLabel('Sector Name');
     $sectortname->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'))));
     $product_id = new Zend_Form_Element_Hidden('product_id');
     $product_id->setAttrib('class', 'txt_put');
     $sectorshortname = new Zend_Form_Element_Text('productshortname');
     $sectorshortname->setAttrib('class', 'txt_put')->setLabel('Sector Short Name');
     $sectorshortname->setRequired(true)->addValidators(array(array('NotEmpty'), array('stringLength', false, array(1, 3))))->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'))));
     $sector_description = new Zend_Form_Element_Textarea('product_description', array('rows' => 3, 'cols' => 20));
     $sector_description->setAttrib('class', '')->setLabel('Sector description');
     $sector_description->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'))));
     $bank_id = new Zend_Form_Element_MultiCheckbox('bank_id');
     $bank_id->setAttrib('class', 'txt_put')->setLabel('Bank  Name');
     $bank_id->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'))));
     $this->addElements(array($category_id, $sectortname, $sectorshortname, $sector_description, $product_id, $bank_id));
     // 			$cust = new settings_Model_Customization();
     // 			$sample = $cust->fetchcustomized("ourbank_customizingform",9);
     // 			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 $gracePeriodRow) {
     // 							$radioValues[current($gracePeriodRow)] = end($gracePeriodRow);
     // 						}
     // 						$Instance->setMultiOptions($radioValues);
     // 						unset($radioValues);
     // 						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 "select" : $Instance = new Zend_Form_Element_Select($cust1['feild_name']);
     // 						$Instance->setLabel($cust1['display_name']);
     // 						$appliesTo = $cust->getTableInfo($cust1['table_name']);
     // 						foreach ($appliesTo as $gracePeriodRow) {
     // 							$radioValues[current($gracePeriodRow)] = end($gracePeriodRow);
     // 						}
     // 						$Instance->setMultiOptions($radioValues);
     // 						unset($radioValues);
     // 						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 "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)
     // 									->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 $gracePeriodRow) {
     // 							$radioValues[current($gracePeriodRow)] = end($gracePeriodRow);
     // 						}
     // 						$Instance->setMultiOptions($radioValues);
     // 						unset($radioValues);
     // 						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;
     // 				}
     // 				$this->addElements(array($Instance));
     // 			}
     $submit = new Zend_Form_Element_Submit('Submit');
     $submit->setAttrib('id', 'save')->setDecorators(array('ViewHelper', array('Description', array('tag' => '', 'escape' => false)), 'Errors', array(array('data' => 'HtmlTag'), array('colspan' => '8 ')), array(array('data' => 'HtmlTag'), array('tag' => 'td ', 'colspan' => '8')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $this->addElements(array($submit));
 }
Example #12
0
 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));
     }
 }