public function FrmProCate($frm = null) { $db = new Application_Model_DbTable_DbGlobal(); $id_code = new Zend_Form_Element_Text('id_code'); $id_code->setAttribs(array('class' => 'form-control', "readonly" => "")); $code = table_Model_DbTable_DbTable::getCallteralCode(); $id_code->setValue($code); $cat_name_en = new Zend_Form_Element_Text("name_en"); $cat_name_en->setAttribs(array('class' => 'validate[required]', 'placeholder' => 'Name In English', "OnChange" => "GetCatName(1)")); $cat_name_km = new Zend_Form_Element_Text("name_km"); $cat_name_km->setAttribs(array('class' => 'validate[required]', 'placeholder' => 'Name In Khmer', "OnChange" => "GetCatName(2)")); $status = new Zend_Form_Element_Select('status'); $_arr_status = array(1 => $this->tr->translate("ACTIVE"), 0 => $this->tr->translate("DACTIVE")); $status->setMultiOptions($_arr_status); $status->setAttribs(array('class' => 'form-control validate[required]')); $icon = new Zend_Form_Element_File("icon"); $description = new Zend_Form_Element_Textarea("description"); $this->addElements(array($icon, $status, $cat_name_en, $cat_name_km, $id_code, $description)); if ($frm != "") { $id_code->setValue($frm["code"]); $cat_name_en->setValue($frm["name_en"]); $cat_name_km->setValue($frm["name_km"]); $status->setValue($frm["status"]); $description->setValue($frm["description"]); } return $this; }
public function FrmProCate($frm = null) { $vendor_name = new Zend_Form_Element_Text("vendor_name"); $vendor_name->setAttribs(array('class' => 'validate[required]', 'placeholder' => 'ឈ្មោះអ្នផ្ឌត់ផ្ឌង់')); $phone = new Zend_Form_Element_Text("phone"); $phone->setAttribs(array('class' => 'validate[required]', 'placeholder' => '')); $contact = new Zend_Form_Element_Text("contact"); $contact->setAttribs(array('class' => 'validate[required]', 'placeholder' => '')); $email = new Zend_Form_Element_Text("email"); $email->setAttribs(array('class' => 'validate[required]', 'placeholder' => '')); $address = new Zend_Form_Element_Textarea("address"); $address->setAttribs(array('class' => '', 'placeholder' => '')); $status = new Zend_Form_Element_Select('status'); $_arr_status = array(1 => $this->tr->translate("ACTIVE"), 0 => $this->tr->translate("DACTIVE")); $status->setMultiOptions($_arr_status); $status->setAttribs(array('class' => 'form-control validate[required]')); $this->addElements(array($vendor_name, $phone, $contact, $email, $address, $status)); if ($frm != "") { $vendor_name->setValue($frm["v_name"]); $phone->setValue($frm["phone"]); $contact->setValue($frm["contact_name"]); $email->setValue($frm["email"]); $address->setValue($frm["vendor_remark"]); $status->setValue($frm["is_active"]); } return $this; }
public function renderFormElement() { $elm = new Zend_Form_Element_Textarea($this->getName(), array('label' => $this->getLabel() . ':')); $elm->setDescription($this->getDescription()); $elm->setValue($this->getValue()); $elm->setRequired($this->getRequired()); return $elm; }
public function Frm_table_type($data = null) { $menu_code = new Zend_Form_Element_Text('type_code'); $menu_code->setAttribs(array('class' => 'form-control', 'required' => true)); $description = new Zend_Form_Element_Text('description'); $description->setAttribs(array('class' => 'form-control')); $lang_1 = new Zend_Form_Element_Text('lang_1'); $lang_1->setAttribs(array('class' => 'form-control')); $lang_2 = new Zend_Form_Element_Text('lang_2'); $lang_2->setAttribs(array('checked' => 'checked', 'class' => 'form-control')); $lang_3 = new Zend_Form_Element_Text('lang_3'); $lang_3->setAttribs(array('checked' => 'checked', 'class' => 'form-control')); if ($data != null) { // print_r($data); } $show_description = new Zend_Form_Element_Select('show_description'); $show_description->setAttribs(array('class' => 'form-control')); $description_opt = array("" => $this->tr->translate("SELECT_DESCRIPTION")); $show_description->setMultiOptions($description_opt); $photo = new Zend_Form_Element_File('photo'); $background = new Zend_Form_Element_Text('background'); $background->setAttribs(array('class' => 'form-control color-picker-rgba')); $font_color = new Zend_Form_Element_Text('font_color'); $font_color->setAttribs(array('class' => 'form-control', 'id' => "selected-color1")); $font_size = new Zend_Form_Element_Text('demo3'); $font_size->setAttribs(array('class' => 'form-control', 'id' => "demo3", 'value' => 12, 'placeholder' => '12')); $apply = new Zend_Form_Element_Select('apply'); $apply->setAttribs(array('class' => 'form-control')); $apply_opt = array("" => $this->tr->translate("SELECT_APPLY_TO_COMPANY")); $apply->setMultiOptions($apply_opt); $combo = new Zend_Form_Element_Checkbox('combo'); $combo->setAttribs(array('class' => 'red')); $active = new Zend_Form_Element_Checkbox('active'); $active->setAttribs(array('class' => 'red')); $format = new Zend_Form_Element_Text('demo4'); $format->setAttribs(array('class' => 'form-control', 'id' => "demo4", 'value' => 12, 'placeholder' => '12')); $setting = new Zend_Form_Element_Select('setting'); $setting->setAttribs(array('class' => 'form-control')); $setting_opt = array("" => $this->tr->translate("SELECT_SETTING")); $setting->setMultiOptions($setting_opt); $arrange = new Zend_Form_Element_Text('arrange'); $arrange->setAttribs(array('class' => 'form-control')); $resize = new Zend_Form_Element_Text('resize'); $resize->setAttribs(array('class' => 'form-control', 'id' => "resize", 'value' => 12, 'placeholder' => '12')); $note = new Zend_Form_Element_Textarea('note'); $note->setAttribs(array('class' => 'form-control', 'style' => "margin-top: 0px; margin-bottom: 0px; height: 100px;")); $id = new Zend_Form_Element_Hidden('id'); if ($data != null) { $id->setValue($data['id']); $menu_code->setValue($data['code']); $description->setValue($data['description']); $lang_1->setValue($data['lang1']); $lang_2->setValue($data['lang2']); $note->setValue($data['note']); } $this->addElements(array($id, $apply, $active, $combo, $menu_code, $description, $lang_1, $lang_2, $lang_3, $show_description, $background, $font_color, $font_size, $format, $setting, $arrange, $resize, $note)); return $this; }
public function FrmProCate($frm = null) { $db = new Application_Model_DbTable_DbGlobal(); $status = new Zend_Form_Element_Select('status'); $_arr_status = array(1 => $this->tr->translate("ACTIVE"), 0 => $this->tr->translate("DACTIVE")); $status->setMultiOptions($_arr_status); $status->setAttribs(array('class' => 'form-control validate[required]')); $id_code = new Zend_Form_Element_Text('id_code'); $id_code->setAttribs(array('class' => 'form-control', "readonly" => "")); $code = product_Model_DbTable_DbProduct::getCallteralCode(); $id_code->setValue($code); $cat_id = new Zend_Form_Element_Select("cat_id"); $cat_id->setAttribs(array('class' => 'select', 'style' => 'width:100%')); $category = $db->getAllProCategories(); $option_category = array(0 => 'Choose Category'); foreach ($category as $row_cat) { $option_category[$row_cat["cat_id"]] = $row_cat["cat_name_km"] . " - " . $row_cat["cat_name_en"]; } $cat_id->setMultiOptions($option_category); $cat_name_en = new Zend_Form_Element_Text("name_en"); $cat_name_en->setAttribs(array('class' => 'validate[required]', 'placeholder' => 'Name In English', "OnChange" => "GetCatName(1)")); $currency = new Zend_Form_Element_Select("currency"); $currency->setAttribs(array('class' => 'form-control validate[required]')); $dbp = new product_Model_DbTable_DbProduct(); $currencys = $dbp->getAllPro(); $option_currency = array(0 => 'Choose Currency'); foreach ($currencys as $row_currency) { $option_currency[$row_currency["cu_id"]] = $row_currency["cu_name_km"] . " - " . $row_currency["cu_name_en"]; } $currency->setMultiOptions($option_currency); $price = new Zend_Form_Element_Text("price"); $price->setAttribs(array('class' => 'validate[required]')); $description = new Zend_Form_Element_Textarea("description"); $cat_name_km = new Zend_Form_Element_Text("name_km"); $cat_name_km->setAttribs(array('class' => 'validate[required]', 'placeholder' => 'Name In Khmer', "OnChange" => "GetCatName(2)")); $icon = new Zend_Form_Element_File("icon"); $this->addElements(array($description, $price, $icon, $status, $cat_name_en, $cat_name_km, $cat_id, $id_code, $currency)); if ($frm != "") { $cat_id->setValue($frm["cat_id"]); $cat_name_en->setValue($frm["pro_name_en"]); $cat_name_km->setValue($frm["pro_name_km"]); $status->setValue($frm["status"]); $currency->setValue($frm["cu_id"]); $price->setValue($frm["price_out"]); $description->setValue($frm["description"]); } return $this; }
/** * * @param array $options Options to build the form */ public function __construct($options = null) { // Disable the defaults buttons if (isset($options['disableAction'])) { $this->_disabledDefaultActions = $options['disableAction']; } if (isset($options['recipients'])) { $recipients = $options['recipients']; $recipientsList = $this->_setRecipientList($recipients); unset($options['recipients']); } parent::__construct($options); // Title $title = new Zend_Form_Element_Text('FI_Title'); $title->setLabel($this->getView()->getCibleText('form_label_title'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput'); $this->addElement($title); // Notification $notification = new Zend_Form_Element_Checkbox('F_Notification'); $notification->setLabel($this->getView()->getCibleText('form_label_has_notification')); $notification->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $this->addElement($notification); $emailList = new Zend_Form_Element_Textarea('FN_Email'); $emailList->setAttrib('title', $this->getView()->getCibleText('form_notification_emails_info')); if (!empty($recipientsList)) { $emailList->setValue($recipientsList); } $emailList->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'formRecipientsEmail')))); $this->addElement($emailList); // isSercure // $hasProfil = new Zend_Form_Element_Checkbox('F_Profil'); // $hasProfil->setLabel($this->getView()->getCibleText( // 'form_label_has_profil')); // $hasProfil->setDecorators(array( // 'ViewHelper', // array('label', array('placement' => 'append')), // array( // array('row' => 'HtmlTag'), // array('tag' => 'dd', 'class' => 'label_after_checkbox')), // )); // // $this->addElement($hasProfil); //hasCaptcha $hasCaptcha = new Zend_Form_Element_Checkbox('F_Captcha'); $hasCaptcha->setLabel($this->getView()->getCibleText('form_label_has_captcha'))->setValue(true)->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $this->addElement($hasCaptcha); $this->setAttrib('id', 'Form'); }
public function editlangAction() { $dirs = $this->dirs; $this->toTpl('hasForm', 1); $data = $this->_request->getParams(); $this->addToBreadcrumb(array('languagelist', $this->t('Languages'))); $this->addToBreadcrumb(array('editlang', $this->t('Edit Language'), $data['id'])); $this->addToBreadcrumb($this->t($data['id'])); $this->tpl->assign('theInclude', 'form'); Zend_Registry::set('module', 'Languages'); $xml = readLangFile(APPL_PATH . $dirs['structure']['languages'] . DIR_SEP . $data['id'] . DIR_SEP . "language.xml"); $user = readLangFile(APPL_PATH . $dirs['structure']['languages'] . DIR_SEP . $data['id'] . DIR_SEP . "user.xml"); $lang = buildLanguage($xml, $user); //lets get the autotranslate feature to work $xml = readLangFile($dirs['structure']['languages'] . DIR_SEP . "autotranslate.xml"); $autotranslate = cleanAutoTranslate($xml, $data['id']); $autotranslate = buildLanguage($autotranslate, array()); $lang = array_merge($autotranslate, $lang); $form = new Zend_Form(); $form = $this->addCSRF($form); $form->setView($this->tpl); $form->setAttrib('class', 'form'); //$form->removeDecorator('dl'); $form->setAction($this->config->host->folder . '/admin/savelanguage')->setMethod('post'); $contentid = new Zend_Form_Element_Hidden('langid'); $contentid->setValue($data['id']); $form->addElement($contentid); foreach ($lang as $k => $v) { $o = $k; $k = $this->normalizeForForm($k, 1); $element = new Zend_Form_Element_Textarea($k); $element->setValue($v); $element->setLabel(ucfirst($o)); $element->setAttrib("class", "span12"); $element->setAttrib("style", "height:70px"); $form->addElement($element); } //we need something to move the buttons down... $form->addElement('hidden', 'dummy', array('required' => false, 'ignore' => true, 'autoInsertNotEmptyValidator' => false, 'decorators' => array(array('HtmlTag', array('tag' => 'hr', 'id' => 'wmd-button-bar', 'class' => 'divider'))))); $form->dummy->clearValidators(); $newval = new Zend_Form_Element_Text('qoolnewval'); $newval->setLabel($this->t("New Language Value")); $newtranslate = new Zend_Form_Element_Textarea('qoolnewtranslate'); $newtranslate->setLabel($this->t("New Language Translation")); $newtranslate->setAttrib("class", "span12"); $newtranslate->setAttrib("style", "height:70px"); $form->addDisplayGroup(array($newval, $newtranslate), 'newval'); $form->addElement('hidden', 'dummy1', array('required' => false, 'ignore' => true, 'autoInsertNotEmptyValidator' => false, 'decorators' => array(array('HtmlTag', array('tag' => 'hr', 'id' => 'wmd-button-bar', 'class' => 'divider'))))); $form->dummy1->clearValidators(); $submit = new Zend_Form_Element_Submit('save'); $submit->setAttrib('class', 'btn btn-large btn-primary'); $submit->setLabel($this->t("Save")); $form->addElement($submit); $this->toTpl('formTitle', $this->t("Edit Language")); $this->toTpl('theForm', $form); }
public function getForm($data, $protection = 0) { $elementDecorators = array(array('Label'), array('ViewHelper'), array('Errors')); $form = new Zend_Form(); $form->setAction('/user/registration/first-form/')->setMethod('post'); //firstname field $firstName = new Zend_Form_Element_Text('firstname', array('maxLength' => '30', 'id' => 'name', 'validators' => array(array('stringLength', false, array(3, 100)), array('Alpha')))); if (isset($data['u_name'])) { $firstName->setValue($data['u_name']); } if ($protection) { $firstName->setAttrib('readonly', 'true'); } $firstName->setDecorators($elementDecorators); //lastname field $lastName = new Zend_Form_Element_Text('lastname', array('maxLength' => '30', 'id' => 'lname', 'validators' => array(array('stringLength', false, array(3, 100)), array('Alpha')))); $lastName->setDecorators($elementDecorators); if (isset($data['u_family_name'])) { $lastName->setValue($data['u_family_name']); } if ($protection) { $lastName->setAttrib('readonly', 'true'); } //selecting gender: Male (1) or Female (0) $gender = new Zend_Form_Element_Radio('sex', array('separator' => '', 'multiOptions' => array('1' => 'זכר ', '0' => 'נקבה'))); $gender->setDecorators($elementDecorators); $gender->setValue($data['u_sex_id']); if (isset($data['u_sex_id'])) { $gender->setValue($data['u_sex_id']); } if ($protection) { $gender->setAttrib('readonly', 'true'); } //birthday field: validation for yyyy-mm-dd input $birthday = new Zend_Form_Element_Text('datepicker', array('size' => 10)); $birthday->setDecorators($elementDecorators); if (isset($data['u_date_of_birth'])) { $birthday->setValue(date("d/m/Y", strtotime($data['u_date_of_birth']))); } if ($protection) { $birthday->setAttrib('readonly', 'true'); } //heigth $heigth = new Zend_Form_Element_Select('heigth', array()); for ($i = 120; $i <= 300; $i++) { $heigth->addMultiOption($i, $i); } $heigth->setDecorators($elementDecorators); if (isset($data['uht_height'])) { $heigth->setValue($data['uht_height']); } if ($protection) { $heigth->setAttrib('disabled', 'true'); } //weight $weight = new Zend_Form_Element_Select('weight', array('label' => '')); for ($i = 20; $i <= 300; $i++) { $weight->addMultiOption($i, $i); } $weight->setDecorators($elementDecorators); if (isset($data['uht_weight'])) { $weight->setValue($data['uht_weight']); } //email field with validation $email = new Zend_Form_Element_Text('email', array()); $email->addValidator(new Zend_Validate_EmailAddress()); $email->setDecorators($elementDecorators); if (isset($data['u_email'])) { $email->setValue($data['u_email']); } if ($protection) { $email->setAttrib('readonly', 'true'); } // password field $password1 = new Zend_Form_Element_Password('password1', array('id' => 'pass')); $password1->setDecorators($elementDecorators); // password confirmation field $password2 = new Zend_Form_Element_Password('password2', array('id' => 'c_pass')); $password2->addValidator(new User_Form_UserFirstFormPasswordValidator('password1')); $password2->setDecorators($elementDecorators); $state = new Zend_Form_Element_Select('state', array('requred' => true)); $state->setMultiOptions(array('1' => 'מדינה:')); $state->setDecorators($elementDecorators); if (isset($data['u_state'])) { $state->setValue($data['u_state']); } $address = new Zend_Form_Element_Text('address', array('required' => false, 'id' => 'full_adr')); $address->setDecorators($elementDecorators); if (isset($data['u_address'])) { $address->setValue($data['u_address']); } $pregnant = new Zend_Form_Element_Radio('pregnant', array('separator' => '', 'multioptions' => array('Yes' => 'לא', 'No' => 'כן'))); $pregnant->setDecorators($elementDecorators); if ($data['uht_pregnant']) { $pregnant->setValue($data['uht_pregnant']); } $pregnantSince = new Zend_Form_Element_Select('pregnantsince', array('id' => 'hz1')); $pregnantSince->setMultiOptions(array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9')); $pregnantSince->setDecorators($elementDecorators); if ($data['uht_pregnant']) { $pregnant->setValue($data['uht_pregnant']); } if ($data['uht_pregnant_since']) { $pregnantSince->setValue($data['uht_pregnant_since']); } $objectives = new Zend_Form_Element_Textarea('objectives', array('id' => 'obj', 'rows' => '20', 'cols' => '20')); if ($data['u_objectives']) { $objectives->setValue($data['u_objectives']); } $terms = new Zend_Form_Element_Checkbox('terms', array('required' => 'true,')); $heartPressure = new Zend_Form_Element_Checkbox('heartpressure', array()); $heartPressure->setDecorators($elementDecorators); if ($data['uht_heart_or_pb']) { $heartPressure->setChecked(true); } $diabetes = new Zend_Form_Element_Checkbox('diabetes', array()); $diabetes->setDecorators($elementDecorators); if ($data['uht_diabetes']) { $diabetes->setChecked(true); } $migrene = new Zend_Form_Element_Checkbox('migrene', array()); $migrene->setDecorators($elementDecorators); if ($data['uht_migrene']) { $migrene->setChecked(true); } $babies = new Zend_Form_Element_Checkbox('babies', array()); $babies->setDecorators($elementDecorators); if ($data['uht_babies']) { $babies->setChecked(true); } $nosleep = new Zend_Form_Element_Checkbox('nosleep', array()); $nosleep->setDecorators($elementDecorators); if ($data['uht_nosleep']) { $nosleep->setChecked(true); } $digestion = new Zend_Form_Element_Checkbox('digestion', array()); $digestion->setDecorators($elementDecorators); if ($data['uht_digestion']) { $digestion->setChecked(true); } $menopause = new Zend_Form_Element_Checkbox('menopause', array()); $menopause->setDecorators($elementDecorators); if ($data['uht_menopause']) { $menopause->setChecked(true); } $sclorosies = new Zend_Form_Element_Checkbox('sclorosies', array()); $sclorosies->setDecorators($elementDecorators); if ($data['uht_sclorosies']) { $sclorosies->setChecked(true); } $epilepsy = new Zend_Form_Element_Checkbox('epilepsy', array()); $epilepsy->setDecorators($elementDecorators); if ($data['uht_epilepsy']) { $epilepsy->setChecked(true); } $cancer = new Zend_Form_Element_Checkbox('cancer', array()); $cancer->setDecorators($elementDecorators); if ($data['uht_cancer']) { $cancer->setChecked(true); } $asthma = new Zend_Form_Element_Checkbox('asthma', array()); $asthma->setDecorators($elementDecorators); if ($data['uht_asthma']) { $asthma->setChecked(true); } $artritis = new Zend_Form_Element_Checkbox('artritis', array()); $artritis->setDecorators($elementDecorators); if ($data['uht_Artritis']) { $artritis->setChecked(true); } $hernia = new Zend_Form_Element_Checkbox('hernia', array()); $hernia->setDecorators($elementDecorators); if ($data['uht_hernia']) { $hernia->setChecked(true); } $depression = new Zend_Form_Element_Checkbox('depression', array()); $depression->setDecorators($elementDecorators); if ($data['uht_depression_or_anxiety']) { $depression->setChecked(true); } $headaches = new Zend_Form_Element_Checkbox('headaches', array()); $headaches->setDecorators($elementDecorators); if ($data['uht_headaches']) { $headaches->setChecked(true); } $fatigue = new Zend_Form_Element_Checkbox('fatigue', array()); $fatigue->setDecorators($elementDecorators); if ($data['uht_fatigue']) { $fatigue->setChecked(true); } $injury = new Zend_Form_Element_Checkbox('injury', array()); $injury->setDecorators($elementDecorators); if ($data['uht_injury']) { $injury->setChecked(true); } $injuryText = new Zend_Form_Element_Textarea('injurytext', array('id' => 'obj', 'rows' => '20', 'cols' => '20')); if ($data['uht_injury_text']) { $injuryText->setValue($data['uht_injury_text']); } $medication = new Zend_Form_Element_Checkbox('medication', array()); $medication->setDecorators($elementDecorators); if ($data['uht_medication']) { $medication->setChecked(true); } $medicationText = new Zend_Form_Element_Textarea('medicationtext', array('id' => 'obj', 'rows' => '20', 'cols' => '20')); if ($data['uht_which_medication']) { $medicationText->setValue($data['uht_which_medication']); } $walk = new Zend_Form_Element_Radio('walk', array('label' => '', 'separator' => '', 'multiOptions' => array('Yes' => 'כן', 'No' => 'לא'))); if ($data['uht_walk']) { $walk->setValue($data['uht_walk']); } $walk->setDecorators($elementDecorators); $hands = new Zend_Form_Element_Radio('hands', array('label' => '', 'separator' => '', 'multiOptions' => array('Yes' => 'כן', 'No' => 'לא'))); if ($data['uht_hands']) { $hands->setValue($data['uht_hands']); } $hands->setDecorators($elementDecorators); $legs = new Zend_Form_Element_Radio('legs', array('label' => '', 'separator' => '', 'multiOptions' => array('Yes' => 'כן', 'No' => 'לא'))); if ($data['uht_sit']) { $legs->setValue($data['uht_sit']); } $legs->setDecorators($elementDecorators); $backashes = new Zend_Form_Element_Radio('backashes', array('label' => '', 'separator' => '', 'multiOptions' => array('Yes' => 'כן', 'No' => 'לא'))); if ($data['uht_backashes']) { $backashes->setValue($data['uht_backashes']); } $backashes->setDecorators($elementDecorators); if ($protection) { $backashes->setAttrib('disabled', 'true'); } $slippedDisk = new Zend_Form_Element_Radio('disc', array('label' => '', 'separator' => '', 'multiOptions' => array('Yes' => 'כן', 'No' => 'לא'))); if ($protection) { $slippedDisk->setAttrib('disabled', 'true'); } if ($data['uht_slipped_disk']) { $slippedDisk->setValue($data['uht_slipped_disk']); } $slippedDisk->setDecorators($elementDecorators); $generalQuestionsText1 = new Zend_Form_Element_Text('general1', array('id' => 'f_1')); $generalQuestionsText2 = new Zend_Form_Element_Text('general2', array('id' => 'f_2')); $generalQuestionsText3 = new Zend_Form_Element_Text('general3', array('id' => 'f_3')); $generalQuestionsText1->setDecorators($elementDecorators); if ($protection) { $generalQuestionsText1->setAttrib('readonly', 'true'); $generalQuestionsText2->setAttrib('readonly', 'true'); $generalQuestionsText3->setAttrib('readonly', 'true'); } $generalQuestionsText2->setDecorators($elementDecorators); $generalQuestionsText3->setDecorators($elementDecorators); if (isset($data['uht_general1'])) { $generalQuestionsText1->setValue($data['uht_general1']); } if (isset($data['uht_general2'])) { $generalQuestionsText2->setValue($data['uht_general2']); } if (isset($data['uht_general3'])) { $generalQuestionsText3->setValue($data['uht_general3']); } $lowerback = new Zend_Form_Element_Checkbox('lowerback', array()); $lowerback->setDecorators($elementDecorators); if ($data['uht_lower_back']) { $lowerback->setChecked(true); } $upperback = new Zend_Form_Element_Checkbox('upperback', array()); $upperback->setDecorators($elementDecorators); if ($data['uht_upper_back']) { $upperback->setChecked(true); } $feet = new Zend_Form_Element_Checkbox('feet', array()); $feet->setDecorators($elementDecorators); if ($data['uht_ankles_and_feet']) { $feet->setChecked(true); } $neck = new Zend_Form_Element_Checkbox('neck', array()); $neck->setDecorators($elementDecorators); if ($data['uht_neck_and_shoulders']) { $neck->setChecked(true); } $breath = new Zend_Form_Element_Checkbox('breath', array()); $breath->setDecorators($elementDecorators); if ($data['uht_breath']) { $breath->setChecked(true); } $pelvis = new Zend_Form_Element_Checkbox('pelvis', array()); $pelvis->setDecorators($elementDecorators); if ($data['uht_thighs_or_pelvis']) { $pelvis->setChecked(true); } $knees = new Zend_Form_Element_Checkbox('knees', array()); $knees->setDecorators($elementDecorators); if ($data['uht_thighs_or_pelvis']) { $knees->setChecked(true); } $wrists = new Zend_Form_Element_Checkbox('wrists', array()); $wrists->setDecorators($elementDecorators); if ($data['uht_wrists']) { $wrists->setChecked(true); } $head = new Zend_Form_Element_Checkbox('head', array()); $head->setDecorators($elementDecorators); if ($data['uht_head']) { $head->setChecked(true); } $ankles = new Zend_Form_Element_Checkbox('ankles', array()); $ankles->setDecorators($elementDecorators); if ($data['uht_ankles']) { $ankles->setChecked(true); } $externalMails = new Zend_Form_Element_Checkbox('external', array()); $externalMails->setDecorators($elementDecorators); if ($data['u_external_emails']) { $externalMails->setChecked(true); } $moreInfo = new Zend_Form_Element_Textarea('moreinfo', array('id' => 'obj', 'rows' => '20', 'cols' => '20')); if ($data['uht_more_info']) { $moreInfo->setValue($data['uht_more_info']); } $form->addElements(array($firstName, $lastName, $gender, $birthday, $heigth, $weight, $email, $password1, $password2, $state, $address, $pregnant, $pregnantSince, $objectives, $terms, $heartPressure, $diabetes, $migrene, $babies, $nosleep, $digestion, $menopause, $sclorosies, $epilepsy, $cancer, $asthma, $artritis, $hernia, $depression, $fatigue, $headaches, $injury, $injuryText, $medication, $medicationText, $walk, $hands, $legs, $backashes, $slippedDisk, $generalQuestionsText1, $generalQuestionsText2, $generalQuestionsText3, $lowerback, $upperback, $feet, $neck, $breath, $pelvis, $knees, $wrists, $head, $ankles, $moreInfo, $externalMails)); return $form; }
public function FrmMenu($data = null) { $combo_code = new Zend_Form_Element_Text('combo_code'); $combo_code->setAttribs(array('class' => 'form-control', 'onkeyup' => 'displayPhoto()')); $description = new Zend_Form_Element_Text('description'); $description->setAttribs(array('class' => 'form-control', 'onchange' => 'displayPhoto()')); $lang_1 = new Zend_Form_Element_Text('lang_1'); $lang_1->setAttribs(array('class' => 'form-control', 'onchange' => 'displayPhoto()')); $lang_2 = new Zend_Form_Element_Text('lang_2'); $lang_2->setAttribs(array('checked' => 'checked', 'class' => 'form-control', 'onchange' => 'displayPhoto()')); $lang_3 = new Zend_Form_Element_Text('lang_3'); $lang_3->setAttribs(array('checked' => 'checked', 'class' => 'form-control')); if ($data != null) { } $db = new Application_Model_DbTable_DbGlobal(); $show_description = new Zend_Form_Element_Select('show_description'); $show_description->setAttribs(array('class' => 'form-control', 'required' => 'true', 'onchange' => 'displayPhoto()')); $opt = $db->getVewOptoinTypeByType(1, 1, null, 1); $show_description->setMultiOptions($opt); //$photo = new Zend_Form_Element_File('photo'); $background = new Zend_Form_Element_select('background'); $background->setAttribs(array('class' => 'form-control color-picker-rgba')); $otp = array('0' => 'apply to company', '1' => 'A', '2' => 'B', '3' => 'C'); $background->setMultiOptions($otp); $font_color = new Zend_Form_Element_Text('font_color'); $font_color->setAttribs(array('class' => 'form-control', 'id' => "selected-color1")); $font_size = new Zend_Form_Element_Text('demo3'); $font_size->setAttribs(array('class' => 'form-control', 'id' => "demo3", 'value' => 12, 'placeholder' => '12')); $apply_to_company = new Zend_Form_Element_Select('apply_to_company'); $apply_to_company->setAttribs(array('class' => 'form-control')); $apply_opt = array("" => $this->tr->translate("SELECT_APPLY_TO_COMPANY")); $apply_to_company->setMultiOptions($apply_opt); $combo_item = new Zend_Form_Element_Checkbox('combo_item'); $combo_item->setAttribs(array('class' => 'red')); $active = new Zend_Form_Element_Checkbox('active'); $active->setAttribs(array('class' => 'red', 'checked' => 'checked')); $user_activate = new Zend_Form_Element_Checkbox('user_activate'); $user_activate->setAttribs(array('class' => 'red', 'onclick' => 'setDefaulTime()')); $note = new Zend_Form_Element_Textarea('note'); $note->setAttribs(array('class' => 'form-control', 'id' => "demo4", 'value' => 12, 'placeholder' => '12')); $setting = new Zend_Form_Element_Select('setting'); $setting->setAttribs(array('class' => 'form-control')); $setting_opt = array("" => $this->tr->translate("SELECT_SETTING")); $setting->setMultiOptions($setting_opt); $arrange = new Zend_Form_Element_Text('arrange'); $arrange->setAttribs(array('class' => 'form-control')); $resize = new Zend_Form_Element_Text('resize'); $resize->setAttribs(array('class' => 'form-control', 'id' => "resize", 'value' => 12, 'placeholder' => '12')); $backgroun_color = new Zend_Form_Element_Text('backgroun_color'); $backgroun_color->setAttribs(array('class' => 'colorpicker-rgba form-control', 'onclick' => 'displayPhoto()')); $font_site = new Zend_Form_Element_text('font_size'); $font_site->setAttribs(array('class' => ' spinner-input form-control', 'onkeyup' => 'displayPhoto()', 'onclick' => 'displayPhoto()')); $font_site->setValue(18); $apply = new Zend_Form_Element_Select('apply'); $apply->setAttribs(array('class' => 'form-control')); $font_color = new Zend_Form_Element_text('font_color'); $font_color->setAttribs(array('class' => 'colorpicker-default form-control', 'onclick' => 'displayPhoto()')); $note = new Zend_Form_Element_Textarea('note'); $note->setAttribs(array('class' => 'form-control', 'style' => "margin-top: 0px; margin-bottom: 0px; height: 100px;")); $from_time = new Zend_Form_Element_Text('from_time'); $from_time->setAttribs(array('class' => 'form-control clockface-open', 'id' => 'clockface_1')); $to_time = new Zend_Form_Element_Text('to_time'); $to_time->setAttribs(array('class' => 'form-control clockface-open', 'id' => 'clockface_2')); $id = new Zend_Form_Element_Hidden('id'); if (!empty($data)) { $id->setValue($data['id']); $combo_code->setValue($data['menu_code']); $description->setValue($data['desc']); $lang_1->setValue($data['lang1']); $lang_2->setValue($data['lang2']); $show_description->setValue($data['display_by']); $backgroun_color->setValue($data['background_color']); $font_color->setValue($data['font_color']); $font_site->setValue($data['font_size']); $from_time->setValue($data['date']); $note->setValue($data['note']); $active->setValue($data['status']); $combo_item->setValue($data['is_combo']); $apply_to_company->setValue($data['apply_company']); } $this->addElements(array($apply, $active, $description, $lang_1, $lang_2, $lang_3, $show_description, $background, $font_color, $font_size, $note, $combo_code, $combo_item, $id, $note, $backgroun_color, $font_site, $font_color, $apply_to_company, $user_activate, $from_time, $to_time)); return $this; }
public function testPrepareRenderingAsView() { $form = $this->form; // Elemente hinzufügen, ein leeres, ein nicht leeres $form->addElement(new Zend_Form_Element_Text('textempty')); $element = new Zend_Form_Element_Textarea('textareaempty'); $element->setValue(' '); // leerer String $form->addElement($element); $element = new Zend_Form_Element_Text('textfull'); $element->setValue('Mit Text'); $form->addElement($element); $form->addElement(new Zend_Form_Element_Checkbox('checkboxfalse')); // wird entfernt $element = new Zend_Form_Element_Checkbox('checkboxtrue'); // wird nicht entfernt $element->setChecked(true); $form->addElement($element); $form->addElement(new Zend_Form_Element_Submit('save')); // wird entfernt $form->addElement(new Zend_Form_Element_Button('cancel')); // wird entfernt $element = new Zend_Form_Element_Select('select'); $element->addMultiOption('option1'); $element->setValue('option1'); $form->addElement($element); // wird nicht entfernt // Unterformulare hinzufügen, ein leeres, ein nicht leeres $subform = $this->getForm(); // Leeres Unterformular $form->addSubForm($subform, 'subformempty'); $subform2 = $this->getForm(); // Nicht leeres Unterformular $element = new Zend_Form_Element_Text('subformtextfull'); $element->setValue('Im SubForm mit Text'); $subform2->addElement($element); $form->addSubForm($subform2, 'subformnotempty'); $form->prepareRenderingAsView(); $this->assertTrue($form->isViewModeEnabled()); $this->assertEquals(3, count($form->getElements())); // Leere Elemente wurden entfernt $this->assertArrayHasKey('textfull', $form->getElements()); $this->assertArrayHasKey('checkboxtrue', $form->getElements()); $this->assertArrayHasKey('select', $form->getElements()); $this->assertEquals(1, count($form->getSubForms())); // Leeres Unterformular wurde entfernt $this->assertArrayHasKey('subformnotempty', $form->getSubForms()); // Decorators ueberpruefen $decorators = $form->getElement('textfull')->getDecorators(); $this->assertEquals(5, count($decorators)); $this->assertArrayHasKey('Application_Form_Decorator_ViewHelper', $decorators); $this->assertTrue($form->getElement('textfull')->getDecorator('ViewHelper')->isViewOnlyEnabled()); $decorators = $form->getElement('checkboxtrue')->getDecorators(); $this->assertEquals(5, count($decorators)); $this->assertArrayHasKey('Application_Form_Decorator_ViewHelper', $decorators); $this->assertTrue($form->getElement('checkboxtrue')->getDecorator('ViewHelper')->isViewOnlyEnabled()); $decorators = $form->getElement('select')->getDecorators(); $this->assertEquals(5, count($decorators)); $this->assertArrayHasKey('Application_Form_Decorator_ViewHelper', $decorators); $this->assertTrue($form->getElement('select')->getDecorator('ViewHelper')->isViewOnlyEnabled()); }
public function init() { if (isset($this->advertisement)) { $user = Advertisement::getUser($this->advertisement->id); $element = new Zend_Form_Element_Hidden('id'); $element->setValue($this->advertisement->id); $this->addElement($element); $element = new Zend_Form_Element_Hidden('password'); $element->setValue($this->password); $this->addElement($element); $this->setAction('/' . strtolower($this->city->name) . '/bulletin/update'); } else { $this->setAction('/' . strtolower($this->city->name) . '/bulletin/create'); } $element = new Zend_Form_Element_Hidden('city'); $element->setValue($this->city->id); $this->addElement($element); $this->setMethod('POST'); $this->setName('createAdForm'); $element = new Zend_Form_Element_Text('name'); $element->setLabel('怎么称呼您'); $element->setDescription('必填,中英文都可,2到30个字'); $element->setRequired(true); //$element->addValidator(new Zend_Validate_StringLength(2,30)); if (isset($user)) { $element->setValue($user->name); } $this->addElement($element); $element = new Zend_Form_Element_Text('email'); $element->setLabel('您的Email'); $element->setRequired(true); $element->addValidator(new Zend_Validate_EmailAddress()); $element->addValidator('NotEmpty'); $element->setDescription('必填,将不会显示在您的帖子里'); if (isset($user)) { $element->setValue($user->email); } $this->addElement($element); $element = new Zend_Form_Element_Text('mobile'); $element->setLabel('您的手机号'); $element->addFilter(new Zend_Filter_HtmlEntities()); $element->addFilter(new Zend_Filter_StripTags()); $element->setDescription('方便其他用户联系您'); if (isset($user)) { $element->setValue($user->mobile); } $this->addElement($element); $this->addDisplayGroup(array('name', 'email', 'mobile'), 'aboutYou'); $this->getDisplayGroup('aboutYou')->removeDecorator('DtDdWrapper'); // radio box $element = new Zend_Form_Element_Radio('type'); $element->addMultiOptions(array('lease' => '供', 'want' => '求'))->removeDecorator('Label'); $element->setSeparator('')->setValue(Advertisement::LEASE); if (isset($this->advertisement)) { $element->setValue($this->advertisement->type); } $this->addElement($element); // category $element = new Zend_Form_Element_Checkbox("isBusiness"); $element->setLabel('是商铺/店面吗?'); if (isset($this->advertisement) && $this->advertisement->category_id == Category::SHOP) { $element->setValue(1); } else { $element->setValue(0); } $this->addElement($element); $element = new Zend_Form_Element_Text('title'); $element->setLabel('帖子标题'); $element->setRequired(true); $element->addValidator('NotEmpty'); //$element->addValidator(new Zend_Validate_StringLength(10,30)); $element->setDescription('必填,5-100字,概括题目,突出重点'); if (isset($this->advertisement)) { $element->setValue($this->advertisement->title); } $this->addElement($element); $element = new Zend_Form_Element_Text('address'); $element->setLabel('房子的住址'); $element->setDescription('必填,以便用户在地图上方便的找到'); if (isset($this->advertisement)) { $element->setValue($this->advertisement->address); } $this->addElement($element); $element = new Zend_Form_Element_Text('rent'); $element->setLabel('租金'); if (isset($this->advertisement)) { $element->setValue($this->advertisement->rent); } $this->addElement($element); $element = new Zend_Form_Element_Select('currency'); //$element->setLabel("货币"); $element->addMultiOptions(Currency::getAvailableCurrencyAsArray()); if (isset($this->advertisement)) { $element->setValue(Advertisement::getCurrency($this->advertisement)->id); } else { $element->setValue(127); } $this->addElement($element); $element = new Zend_Form_Element_Radio('rent_measurement'); $element->addMultiOptions(array('month' => '每月', 'day' => '每日'))->setSeparator('')->setDescription('必填')->removeDecorator('Label'); $element->setSeparator('')->setValue(Advertisement::RENT_MONTHLY); if (isset($this->advertisement)) { if ($this->advertisement->rent_measurement == Advertisement::RENT_MONTHLY) { $element->setValue('month'); } else { if ($this->advertisement->rent_measurement == Advertisement::RENT_DAILY) { $element->setValue('day'); } } } $element->setRequired(true); $element->addValidator('NotEmpty'); $element->addValidator(new Zend_Validate_Alnum()); $this->addElement($element); // start date and stop date $element = new Zend_Form_Element_Text('start_date'); $element->setRequired(true); $element->addValidator('NotEmpty'); $element->setLabel('开始日期'); $element->setDescription('必填,格式为2010-09-11'); if (isset($this->advertisement)) { $element->setValue($this->advertisement->start_date); } $this->addElement($element); $element = new Zend_Form_Element_Text('stop_date'); $element->setLabel('结束日期'); $element->setDescription('同上,留空则为长期'); if (isset($this->advertisement)) { $element->setValue($this->advertisement->stop_date); } $this->addElement($element); $element = new Zend_Form_Element_Text('area'); $element->setLabel('面积(平方米)'); $element->addValidator(new Zend_Validate_Alnum()); if (isset($this->advertisement)) { $element->setValue($this->advertisement->area); } $this->addElement($element); $element = new Zend_Form_Element_Text('num_of_room'); $element->setLabel('房间数'); $element->addValidator(new Zend_Validate_Alnum()); $element->setDescription('卧房数'); if (isset($this->advertisement)) { $element->setValue($this->advertisement->num_of_room); } $this->addElement($element); $element = new Zend_Form_Element_Textarea('description'); $element->setLabel('其他描述'); $element->setDescription('更多详细信息,例如: 交通是否方便? 是否有独立卫生间和厨房? 是否仅限女生? 是否有家具? 月租是否包括网费? 您的个人习惯等等。'); $element->setAttrib('rows', 4); if (isset($this->advertisement)) { $element->setValue($this->advertisement->description); } $this->addElement($element); $element = new Elements(); $element->addReCaptcha($this); $element = new Zend_Form_Element_Submit('post'); $element->setValue('提交')->removeDecorator('Label'); $this->addElement($element); $this->addDisplayGroup(array('isBusiness', 'type', 'title', 'address', 'rent', 'currency', 'rent_measurement', 'start_date', 'stop_date', 'area', 'num_of_room', 'description', 'challenge', 'post'), 'aboutRoom'); $this->getDisplayGroup('aboutRoom')->removeDecorator('DtDdWrapper'); }
/** * Get textarea * @param string $id * @param string $value * @param array $elementequired * @return Zend_Form_Element_Textarea */ public function getTextArea($id, $value = "", $elementequired = false, $disable = false) { $element = new Zend_Form_Element_Textarea($id); $element->removeDecorator('HtmlTag'); $element->removeDecorator('DtDdWrapper'); $element->removeDecorator('Label'); $element->setValue($value); if ($elementequired) { $element->setAttribs(array('class' => 'validate[required]')); } if ($disable) { $element->setAttrib('disabled', 'disabled'); } return $element; }
public function __construct($options = null, $data = null, $contentId = 0, $contentType = 'problem', $lang = 'en') { parent::__construct($options); $translate = Zend_Registry::get('Zend_Translate'); $baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl(); $this->setDisableLoadDefaultDecorators(true); $this->addDecorator('FormElements')->addDecorator('HtmlTag', array('tag' => 'div'))->addDecorator('Form')->removeDecorator('DtDdWrapper'); $this->setName('add_content_form'); $this->setAction($baseUrl . '/' . $lang . '/content/edit/' . $contentId); $this->addElementPrefixPath('Oibs_Decorators', 'Oibs/Decorators/', 'decorator'); $this->setAttrib('enctype', 'multipart/form-data'); // Content header input form element $header = new Zend_Form_Element_Text('content_header'); $header->setValue($data['content_header'])->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 140, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'content-add-field-too-long')))))->setLabel($translate->_("content-add-header"))->setDecorators(array('FormElementDecorator')); // if ($data['published_cnt']) { // Disable editing of header if data is already published // $header->setAttrib('readonly', true); // } // Content keywords input form element $keywords = new Zend_Form_Element_Text('content_keywords'); $keywords->addFilter('StringtoLower')->setValue($data['content_keywords'])->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 120, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'content-add-field-too-long'))), array('Regex', true, array('/^[\\p{L}0-9, ]*$/'))))->setLabel($translate->_("content-add-keywords"))->setDescription($translate->_("content-add-keywords-help-text"))->setDecorators(array('FormElementDecorator')); $content_type = new Zend_Form_Element_Hidden('content_type'); $content_type->setValue($data['content_type'])->setDecorators(array('FormHiddenElementDecorator')); // Content lead text input form element $textlead = new Zend_Form_Element_Textarea('content_textlead'); $textlead->setValue($data['content_textlead'])->setRequired(true)->setAttrib('class', 'textlead')->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 320, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'content-add-field-too-long')))))->setLabel($translate->_("content-add-textlead"))->setDescription($translate->_("content-add-textlead-help-text"))->setDecorators(array('FormElementDecorator')); // Content text input form element $text = new Zend_Form_Element_Textarea('content_text'); $text->setValue($data['content_text'])->setAttrib('class', 'textbody')->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(0, 4000, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooShort' => 'content-add-field-too-short', 'stringLengthTooLong' => 'content-add-field-too-long')))))->setLabel($translate->_("content-add-text"))->setDescription($translate->_('content-add-' . $contentType . '-textbody-help-text'))->setDecorators(array('FormOptionalElementDecorator')); // Content keywords input form element $related_companies = new Zend_Form_Element_Text('content_related_companies'); $related_companies->setRequired(false)->addValidators(array(array('StringLength', true, array(0, 120, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'content-add-field-too-long')))))->setLabel($translate->_("content-add-related_companies"))->setDescription($translate->_("content-add-related_companies-help-text"))->setDecorators(array('FormOptionalElementDecorator')); // Problem research question input form element $research = new Zend_Form_Element_Text('content_research'); $research->setValue($data['content_research'])->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 120, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'field-too-long')))))->setLabel($translate->_("content-add-research"))->setDescription($translate->_("content-add-research-help-text"))->setDecorators(array('FormElementDecorator')); // Future info opportunity $opportunity = new Zend_Form_Element_Text('content_opportunity'); $opportunity->setValue($data['content_opportunity'])->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 120, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'field-too-long')))))->setLabel($translate->_("content-add-opportunity"))->setDescription($translate->_("content-add-opportunity-help-text"))->setDecorators(array('FormElementDecorator')); // Future info threat $threat = new Zend_Form_Element_Text('content_threat'); $threat->setValue($data['content_threat'])->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 120, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'field-too-long')))))->setLabel($translate->_("content-add-threat"))->setDescription($translate->_("content-add-threat-help-text"))->setDecorators(array('FormElementDecorator')); // Idea/solution in one sentence $solution = new Zend_Form_Element_Text('content_solution'); $solution->setValue($data['content_solution'])->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 120, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'field-too-long')))))->setLabel($translate->_("content-add-solution"))->setDecorators(array('FormElementDecorator')); // File upload $file = new Zend_Form_Element_File('content_file_upload'); $file->setDestination('../www/upload')->removeDecorator('DtDdWrapper')->addValidator('Size', false, 2097152)->addValidator('Extension', false, 'png,gif,jpg,jpeg,doc,zip,xls,mpp,pdf,wmv,avi,mkv,mov,mpeg,mp4,divx,flv,ogg,3gp'); $file->setLabel($translate->_("content-add-upload-file"))->setDescription($translate->_("content-add-file-upload-help-text"))->setDecorators(array('UploadDecorator'))->setAttrib("onchange", "multiFile(this, '" . $translate->_("content-add-file-delete-file-button") . "');"); $uploadedFilesBoxes = new Zend_Form_Element_MultiCheckbox('uploadedFiles'); $uploadedFilesBoxes->setMultiOptions($data['filenames'])->setRequired(false)->setDecorators(array('FormElementDecorator'))->setLabel($translate->_('content-add-file-delete-files-label')); // References $references = new Zend_Form_Element_Textarea('content_references'); $references->setValue($data['content_references'])->setAttrib('class', 'textlead')->addValidators(array(array('StringLength', true, array(0, 2000, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'field-too-long')))))->setLabel($translate->_("content-add-references"))->setDescription($translate->_("content-add-references-help-text"))->setDecorators(array('FormOptionalElementDecorator')); // Language select form element $language = new Zend_Form_Element_Select('content_language'); $language->addFilter('StringtoLower')->setLabel($translate->_("content-add-language"))->setDecorators(array('FormElementDecorator'))->setMultiOptions($data['languages']); // Future info classification $finfoClasses = new Zend_Form_Element_Select('content_finfo_class'); $finfoClasses->setLabel($translate->_("content-add-finfo-classification"))->setDecorators(array('FormElementDecorator'))->setMultiOptions($data['FutureinfoClasses']); /* // Industry select form element $industry = new Zend_Form_Element_Select('content_industry'); $industry->addFilter('StringtoLower') ->setValue($data['industryIds'][0]) ->setLabel($translate->_("content-view-industry-classification")) ->setDecorators(array('FormElementDecorator')) ->setAttrib('onchange', "getItems('".$baseUrl."/".$lang."/content/division/industry/'+this.value, 'content_division_div', this.value);") ->setMultiOptions($data['Industries']); $division = new Zend_Form_Element_Select('content_division'); $division->addFilter('StringtoLower') ->setValue($data['industryIds'][1]) ->setDecorators(array('FormElementDecorator')) ->setAttrib('onchange', "getItems('".$baseUrl."/".$lang."/content/group/division/'+this.value, 'content_group_div', this.value);") ->setMultiOptions($data['Divisions']) ->setRegisterInArrayValidator(false); $group = new Zend_Form_Element_Select('content_group'); $group->addFilter('StringtoLower') ->setValue($data['industryIds'][2]) ->setDecorators(array('FormElementDecorator')) ->setAttrib('onchange', "getItems('".$baseUrl."/".$lang."/content/class/group/'+this.value, 'content_class_div', this.value);") ->setMultiOptions($data['Groups']) ->setRegisterInArrayValidator(false); $class = new Zend_Form_Element_Select('content_class'); $class->addFilter('StringtoLower') ->setValue($data['industryIds'][3]) ->setDecorators(array('FormElementDecorator')) ->setMultiOptions($data['Classes']) ->setRegisterInArrayValidator(false); */ $innovation = new Zend_Form_Element_Select('innovation_type'); $innovation->setLabel($translate->_("content-view-innovationtype-classification"))->setDecorators(array('FormElementDecorator'))->setMultiOptions($data['InnovationTypes']); // Used for track button clicks $hidden_content_publish = new Zend_Form_Element_Hidden('content_publish'); $hidden_content_publish->setDecorators(array('FormHiddenElementDecorator')); $hidden_content_save = new Zend_Form_Element_Hidden('content_save'); $hidden_content_save->setDecorators(array('FormHiddenElementDecorator')); // Form buttons $publish = new Zend_Form_Element_Button('content_publish_button'); $publish->setLabel($translate->_("content-add-publish"))->setAttrib('class', 'content_manage_button')->removeDecorator('DtDdWrapper'); $save = new Zend_Form_Element_Button('content_save_button'); $save->setLabel($translate->_("content-add-save"))->setAttrib('class', 'content_manage_button')->removeDecorator('DtDdWrapper'); $preview = new Zend_Form_Element_Button('content_preview_button'); $preview->setLabel($translate->_("content-add-preview"))->setAttrib('class', 'content_manage_button')->removeDecorator('DtDdWrapper'); // Add elements to form $elements = array($header, $keywords, $content_type, $textlead, $text, $related_companies); if ($contentType == "problem") { array_push($elements, $research); } else { if ($contentType == "finfo") { array_push($elements, $opportunity, $threat); } else { if ($contentType == "idea") { array_push($elements, $solution); } } } array_push($elements, $file); if (count($data['filenames'])) { array_push($elements, $uploadedFilesBoxes); } array_push($elements, $references, $language, $hidden_content_save, $hidden_content_publish); /* if($contentType == "finfo") { array_push($elements, $finfoClasses); } array_push($elements, $industry, $division, $group, $class); if($contentType == "idea") { array_push($elements, $innovation); } */ // If data is published dont draw the publish button if ($data['published_cnt'] == false) { array_push($elements, $publish, $save, $preview); } else { $save->setLabel("Publish changes"); array_push($elements, $save, $preview); } // Set custom form layout $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/contentAddForm.phtml', 'placement' => false)))); $this->addElements($elements); /*$this->addElements(array($innovation, $industry, $division, $group, $class, $header, $keywords, $content_type, $content_relatesto_id, $textlead, $text, $submit, $preview, $publish));*/ }
public function FrmTables($data = null) { $table_code = new Zend_Form_Element_Text('table_code'); $table_code->setAttribs(array('class' => 'form-control', 'required' => true, 'onkeyup' => 'displayPhoto()')); $db = new Application_Model_DbTable_DbGlobal(); $g_code = new Zend_Form_Element_Select('group_code'); $g_code->setAttribs(array('class' => 'form-control select2me', 'onchange' => 'displayDescriptions()')); $option = $db->getGroupCode(); $g_code->setMultiOptions($option); $g_code1 = new Zend_Form_Element_Text('g_code1'); $g_code1->setAttribs(array('class' => 'form-control')); $est_time = new Zend_Form_Element_Text('est_time'); $est_time->setAttribs(array('class' => 'form-control clockface_1 clockface-open', 'data-format' => "hh:mm A", 'id' => 'mask_number')); $price = new Zend_Dojo_Form_Element_NumberTextBox('price'); $price->setAttribs(array('class' => 'form-control')); $max_seat = new Zend_Form_Element_Text('max_seat'); $max_seat->setAttribs(array('class' => 'form-control', 'id' => 'mask_number')); $time = new Zend_Form_Element_Text('time'); $time->setAttribs(array('class' => 'form-control')); $time->setValue('00:00'); $description = new Zend_Form_Element_Text('description'); $description->setAttribs(array('class' => 'form-control', 'required' => true, 'onkeyup' => 'displayPhoto()')); $lang_1 = new Zend_Form_Element_Text('lang_1'); $lang_1->setAttribs(array('class' => 'form-control', 'onkeyup' => 'displayPhoto()')); $lang_2 = new Zend_Form_Element_Text('lang_2'); $lang_2->setAttribs(array('checked' => 'checked', 'class' => 'form-control', 'onkeyup' => 'displayPhoto()')); $lang_3 = new Zend_Form_Element_Text('lang_3'); $lang_3->setAttribs(array('checked' => 'checked', 'class' => 'form-control')); if ($data != null) { // print_r($data); } $db = new Application_Model_DbTable_DbGlobal(); $description_opt = array("" => $this->tr->translate("SELECT_DESCRIPTION")); $show_description1 = new Zend_Form_Element_Select('show_description'); $show_description1->setAttribs(array('class' => 'form-control', 'onchange' => 'displayPhoto()')); $opt = $db->getVewOptoinTypeByType(1, 1, null, 1); $show_description1->setMultiOptions($opt); $type_of_table = new Zend_Form_Element_Select('type_of_table'); $type_of_table->setAttribs(array('class' => 'form-control select2me', 'onchange' => 'popoupTableType()')); $opt_type_table = $db->getTypeOfTable(); $type_of_table->setMultiOptions($opt_type_table); $apply_to_company = new Zend_Form_Element_Select('apply_to_company'); $apply_to_company->setAttribs(array('class' => 'form-control')); $opt = array('0' => 'select company', '1' => 'A', '2' => 'B', '3' => 'C'); $apply_to_company->setMultiOptions($opt); $photo = new Zend_Form_Element_File('photo'); $background = new Zend_Form_Element_Text('background'); $background->setAttribs(array('class' => 'form-control color-picker-rgba')); $backgroun_color = new Zend_Form_Element_Text('backgroun_color'); $backgroun_color->setAttribs(array('class' => 'colorpicker-rgba form-control', 'onclick' => 'displayPhoto()')); $apply = new Zend_Form_Element_Select('apply'); $apply->setAttribs(array('class' => 'form-control')); $apply_opt = array("" => $this->tr->translate("SELECT_APPLY_TO_COMPANY")); $apply->setMultiOptions($apply_opt); $combo = new Zend_Form_Element_Checkbox('combo'); $combo->setAttribs(array('class' => 'red')); $active = new Zend_Form_Element_Checkbox('active'); $active->setAttribs(array('class' => 'red', 'checked' => 'checked')); $time_ck = new Zend_Form_Element_Checkbox('time_ck'); $time_ck->setAttribs(array('class' => 'red')); $dicount_ck = new Zend_Form_Element_Checkbox('dicount_ck'); $dicount_ck->setAttribs(array('class' => 'red')); $format = new Zend_Form_Element_Text('demo4'); $format->setAttribs(array('class' => 'form-control', 'id' => "demo4", 'value' => 12, 'placeholder' => '12')); $font_color = new Zend_Form_Element_text('font_color'); $font_color->setAttribs(array('class' => 'colorpicker-default form-control', 'onclick' => 'displayPhoto()')); $font_site = new Zend_Form_Element_text('font_size'); $font_site->setAttribs(array('class' => ' spinner-input form-control', 'onkeyup' => 'displayPhoto()', 'onclick' => 'displayPhoto()')); $font_site->setValue(20); $resize = new Zend_Form_Element_Text('resize'); $resize->setAttribs(array('class' => 'form-control', 'id' => "resize", 'value' => 12, 'placeholder' => '12')); $note = new Zend_Form_Element_Textarea('note'); $note->setAttribs(array('class' => 'form-control', 'style' => "margin-top: 0px; margin-bottom: 0px; height: 150px;")); $note1 = new Zend_Form_Element_Textarea('note1'); $note1->setAttribs(array('class' => 'form-control', 'style' => "margin-top: 0px; margin-bottom: 0px; height: 150px;")); $id = new Zend_Form_Element_Hidden('id'); if ($data != null) { //print_r($data);exit(); $id->setValue($data['id']); $table_code->setValue($data['code']); $description->setValue($data['description']); $lang_1->setValue($data['lang1']); $lang_2->setValue($data['lang2']); $g_code->setValue($data['tbl_groupid']); $type_of_table->setValue($data['tbl_type']); $show_description1->setValue($data['display_by']); $max_seat->setValue($data['max_sit']); $apply_to_company->setValue($data['compid']); $active->setValue($data['active']); $time_ck->setValue($data['time_charge_id']); $dicount_ck->setValue($data['is_discound']); $price->setValue($data['price']); $est_time->setValue($data['est_time']); $backgroun_color->setValue($data['backgroud_color']); $font_color->setValue($data['font_color']); $font_site->setValue($data['font_size']); $note->setValue($data['note']); } $this->addElements(array($id, $photo, $dicount_ck, $time_ck, $type_of_table, $est_time, $price, $max_seat, $time, $g_code, $apply, $active, $combo, $table_code, $description, $lang_1, $lang_2, $lang_3, $note1, $backgroun_color, $g_code1, $show_description1, $apply_to_company, $background, $font_color, $format, $font_color, $font_site, $resize, $note)); return $this; }
/** * Returns the Zend_Form for creating/updating product records * @param array $values * @return Zend_Form */ private function getForm(array $values = null) { $form = new Zend_Form(); $form->setAction('/products/save')->setMethod('post'); $productId = new Zend_Form_Element_Text('product_id'); $productId->setAttrib('disabled', 'disabled')->setLabel('Product ID'); $sku = new Zend_Form_Element_Text('sku'); $sku->setLabel('SKU'); $name = new Zend_Form_Element_Text('name'); $name->setLabel('Product Name')->setRequired(true); $desc = new Zend_Form_Element_Textarea('description'); $desc->setLabel('Description')->setRequired(true); $price = new Zend_Form_Element_Text('unit_price'); $price->setLabel('Unit Price')->setRequired(true)->addValidator(new Zend_Validate_Float()); $submit = new Zend_Form_Element_Submit('submit'); if (isset($values)) { $productId->setValue($values['product_id']); $name->setValue($values['name']); $desc->setValue($values['description']); $price->setValue($values['unit_price']); } $form->addElement($productId)->addElement($sku)->addElement($name)->addElement($desc)->addElement($price)->addElement($submit); return $form; }
/** account form */ public function createAccountForm($defaultValue = array()) { $form = new Zend_Form(); $form->setAction($this->webroot . '/user/settings')->setMethod('post'); $email = new Zend_Form_Element_Text('email'); $email->setRequired(true)->addValidator('NotEmpty', true)->setAttrib('maxLength', 255)->addValidator('EmailAddress'); $firstname = new Zend_Form_Element_Text('firstname'); $firstname->setRequired(true)->addValidator('NotEmpty', true)->setAttrib('maxLength', 255); $lastname = new Zend_Form_Element_Text('lastname'); $lastname->setRequired(true)->addValidator('NotEmpty', true)->setAttrib('maxLength', 255); $company = new Zend_Form_Element_Text('company'); $company->setAttrib('maxLength', 255); $city = new Zend_Form_Element_Text('city'); $city->setAttrib('maxLength', 100); $country = new Zend_Form_Element_Text('country'); $country->setAttrib('maxLength', 100); $validator = new Zend_Validate_Callback(array('Zend_Uri', 'check')); $website = new Zend_Form_Element_Text('website'); $website->setAttrib('maxLength', 255)->addValidator($validator); $biography = new Zend_Form_Element_Textarea('biography'); $biography->addValidator(new Zend_Validate_Alnum()); $submit = new Zend_Form_Element_Submit('modifyAccount'); $submit->setLabel($this->t('Modify')); $privacy = new Zend_Form_Element_Radio('privacy'); $privacy->addMultiOptions(array(MIDAS_USER_PUBLIC => $this->t('Public (Anyone can see my information, excluding email address)'), MIDAS_USER_PRIVATE => $this->t('Private (User information will be hidden)')))->setRequired(true)->setValue(MIDAS_COMMUNITY_PUBLIC); if (isset($defaultValue['email'])) { $email->setValue($defaultValue['email']); } if (isset($defaultValue['firstname'])) { $firstname->setValue($defaultValue['firstname']); } if (isset($defaultValue['lastname'])) { $lastname->setValue($defaultValue['lastname']); } if (isset($defaultValue['company'])) { $company->setValue($defaultValue['company']); } if (isset($defaultValue['privacy'])) { $privacy->setValue($defaultValue['privacy']); } if (isset($defaultValue['city'])) { $city->setValue($defaultValue['city']); } if (isset($defaultValue['country'])) { $country->setValue($defaultValue['country']); } if (isset($defaultValue['website'])) { $website->setValue($defaultValue['website']); } if (isset($defaultValue['biography'])) { $biography->setValue($defaultValue['biography']); } $form->addElements(array($email, $website, $city, $country, $biography, $firstname, $lastname, $company, $privacy, $submit)); return $form; }
function setForm() { $form = new Zend_Form; $form->setMethod('post')->setAction(''); $comment_name = new Zend_Form_Element_Text('comment_name'); $comment_name->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Vui lòng nhập tên người gửi !')); $comment_name->setAttrib('class','n'); $comment_name->setAttrib("onfocus","if (this.value == 'Nhập tên của bạn') {this.value = '';}"); $comment_name->setAttrib("onblur","if (this.value == '') {this.value = 'Nhập tên của bạn';}"); $comment_name->setValue("Nhập tên của bạn"); $comment_email = new Zend_Form_Element_Text('comment_email'); $comment_email->addValidator('EmailAddress',true,array('messages'=>'Địa chỉ email không hợp lệ')); $comment_email->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Vui lòng nhập địa chỉ email !')); $comment_email->setAttrib('class','e'); $comment_email->setAttrib('onfocus',"if (this.value == 'Nhập địa chỉ email của bạn') {this.value = '';}"); $comment_email->setAttrib('onblur',"if (this.value == '') {this.value = 'Nhập địa chỉ email của bạn';}"); $comment_email->setValue('Nhập địa chỉ email của bạn'); $comment_content = new Zend_Form_Element_Textarea('comment_content'); $comment_content->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Vui lòng nhập nội dung bình luận!')); $comment_content->setAttrib('class','m'); $comment_content->setAttrib('onfocus',"if (this.value == 'Nhập nội dung bình luận') {this.value = '';}"); $comment_content->setAttrib('onblur',"if (this.value == '') {this.value = 'Nhập nội dung bình luận';}"); $comment_content->setValue('Nhập nội dung bình luận'); $comment_captcha = new Zend_Form_Element_Captcha('comment_captcha',array( 'label' => 'Captcha_image', 'captcha' => array( 'captcha' => 'Image', 'wordLen' => 6, 'timeout' => 300, 'font' => APPLICATION_PATH.'/templates/front/fonts/tiennd.TTF', 'imgDir' => APPLICATION_PATH.'/templates/front/captcha/', 'imgUrl' => $this->view->baseUrl().'/application/templates/front/captcha/', 'height' => 100, 'width' => 200, 'fontSize' => 50, ), )); $comment_captcha->setAttrib('class','captcha_image1'); $comment_captcha->setAttrib('onfocus',"if (this.value == 'Nhập hình ảnh xác nhận') {this.value = '';}"); $comment_captcha->setAttrib('onblur',"if (this.value == '') {this.value = 'Nhập hình ảnh xác nhận';}"); $comment_captcha->setValue('Nhập hình ảnh xác nhận'); $comment_name->removeDecorator('HtmlTag')->removeDecorator('Label'); $comment_email->removeDecorator('HtmlTag')->removeDecorator('Label'); $comment_content->removeDecorator('HtmlTag')->removeDecorator('Label'); $comment_captcha->removeDecorator('HtmlTag')->removeDecorator('Label'); $form->addElements(array($comment_name,$comment_email,$comment_content,$comment_captcha)); return $form; }
public function FrmMenu($data = null) { //item_code $item_code = new Zend_Form_Element_Text('item_code'); $item_code->setAttribs(array('class' => 'form-control', 'onkeyup' => 'displayPhoto()')); $menu_code = new Zend_Form_Element_Text('menu_code'); $menu_code->setAttribs(array('class' => 'form-control')); //menu_group $menu_group = new Zend_Form_Element_Select('menu_group'); $menu_group->setAttribs(array('class' => 'form-control input-xlarge select2me', 'onClick' => 'FuncMenuGroup()')); $db = new Menu_Model_DbTable_DbMenu(); $opt = $db->getAllGroupMenu(); $menu_group->setMultiOptions($opt); $root_code = new Zend_Form_Element_Select('root_code'); $root_code->setAttribs(array('class' => 'form-control', 'onClick' => 'FuncRootMenuCode()')); $select_root_code_opt = array("" => $this->tr->translate("SELECT_GROUP_CODE"), -1 => $this->tr->translate("ADD_NEW")); $root_code->setMultiOptions($select_root_code_opt); //root_menu $root_menu = new Zend_Form_Element_Select('root_menu'); $root_menu->setAttribs(array('class' => 'form-control input-xlarge select2me', 'onClick' => 'FuncRootMenuCode()')); $db = new Menu_Model_DbTable_DbMenu(); $opt = $db->getAllRootMenu(); $root_menu->setMultiOptions($opt); $root_menus = new Zend_Form_Element_Select('root_menus'); $root_menus->setAttribs(array('class' => 'form-control', 'onClick' => 'FuncRootMenuCode()')); $root_menu_opt = array("" => $this->tr->translate("SELECT_ROOT_MENU"), -1 => $this->tr->translate("ADD_NEW")); $root_menus->setMultiOptions($root_menu_opt); $print_code = new Zend_Form_Element_Select('print_code'); $print_code->setAttribs(array('class' => 'form-control input-xlarge select2me', 'onClick' => 'FuncRootMenuCode()')); $select_print_code_opt = array("" => $this->tr->translate("SELECT_PRINT_CODE"), -1 => $this->tr->translate("ADD_NEW")); $print_code->setMultiOptions($select_print_code_opt); $description = new Zend_Form_Element_Text('description'); $description->setAttribs(array('class' => 'form-control', 'onchange' => 'displayPhoto()')); $lang_1 = new Zend_Form_Element_Text('lang_1'); $lang_1->setAttribs(array('class' => 'form-control', 'onchange' => 'displayPhoto()')); $lang_2 = new Zend_Form_Element_Text('lang_2'); $lang_2->setAttribs(array('checked' => 'checked', 'class' => 'form-control', 'onchange' => 'displayPhoto()')); $lang_3 = new Zend_Form_Element_Text('lang_3'); $lang_3->setAttribs(array('checked' => 'checked', 'class' => 'form-control')); $note = new Zend_Form_Element_Text('note'); $note->setAttribs(array('checked' => 'checked', 'class' => 'form-control')); if ($data != null) { // print_r($data); } $db = new Application_Model_DbTable_DbGlobal(); $show_description = new Zend_Form_Element_Select('show_description'); $show_description->setAttribs(array('class' => 'form-control', 'onchange' => 'displayPhoto()')); $opt = $db->getVewOptoinTypeByType(1, 1, null, 1); $show_description->setMultiOptions($opt); $photo = new Zend_Form_Element_File('photo'); $background = new Zend_Form_Element_Text('background'); $background->setAttribs(array('class' => 'form-control color-picker-rgba')); $font_color = new Zend_Form_Element_Text('font_color'); $font_color->setAttribs(array('class' => 'form-control', 'id' => "selected-color1")); $font_size = new Zend_Form_Element_Text('demo3'); $font_size->setAttribs(array('class' => 'form-control', 'id' => "demo3", 'value' => 12, 'placeholder' => '0')); $font_size = new Zend_Form_Element_Select('demo3'); $font_size->setAttribs(array('class' => 'form-control')); $description_opt = array("" => $this->tr->translate("\$600"), -1 => $this->tr->translate("\$500")); $font_size->setMultiOptions($description_opt); $photo = new Zend_Form_Element_File('photo'); $background = new Zend_Form_Element_Text('background'); $background->setAttribs(array('class' => 'form-control color-picker-rgba')); $apply = new Zend_Form_Element_Select('apply'); $apply->setAttribs(array('class' => 'form-control')); $apply_opt = array("" => $this->tr->translate("SELECT_APPLY_TO_COMPANY"), -1 => $this->tr->translate("ADD_NEW")); $apply->setMultiOptions($apply_opt); $combo = new Zend_Form_Element_Checkbox('combo'); $combo->setAttribs(array('class' => 'red')); $print_to = new Zend_Form_Element_Checkbox('print_to'); $print_to->setAttribs(array('class' => 'red')); $show_screen = new Zend_Form_Element_Checkbox('show_screen'); $show_screen->setAttribs(array('class' => 'red')); $discount = new Zend_Form_Element_Checkbox('discount'); $discount->setAttribs(array('class' => 'red')); $time = new Zend_Form_Element_Checkbox('time'); $time->setAttribs(array('class' => 'red')); $is_root = new Zend_Form_Element_Checkbox('$is_root'); $is_root->setAttribs(array('class' => 'red')); $require_qty = new Zend_Form_Element_Checkbox('require_qty'); $require_qty->setAttribs(array('class' => 'red')); $is_service = new Zend_Form_Element_Checkbox('is_service'); $is_service->setAttribs(array('class' => 'red')); $active = new Zend_Form_Element_Checkbox('active'); $active->setAttribs(array('class' => 'red', 'Checked' => 'Checked')); $format = new Zend_Form_Element_Text('demo4'); $format->setAttribs(array('class' => 'form-control', 'id' => "demo4", 'value' => 12, 'placeholder' => '0')); $setting = new Zend_Form_Element_Select('setting'); $setting->setAttribs(array('class' => 'form-control')); $setting_opt = array("" => $this->tr->translate("SELECT_SETTING")); $setting->setMultiOptions($setting_opt); $arrange = new Zend_Form_Element_Text('arrange'); $arrange->setAttribs(array('class' => 'form-control')); $resize = new Zend_Form_Element_Text('resize'); $resize->setAttribs(array('class' => 'form-control', 'id' => "resize", 'value' => 12, 'placeholder' => '12')); $note = new Zend_Form_Element_Textarea('note'); $note->setAttribs(array('class' => 'form-control', 'style' => "margin-top: 0px; margin-bottom: 0px; height: 100px;")); $backgroun_color = new Zend_Form_Element_Text('backgroun_color'); $backgroun_color->setAttribs(array('class' => 'colorpicker-rgba form-control', 'onclick' => 'displayPhoto()')); $font_site = new Zend_Form_Element_text('font_size'); $font_site->setAttribs(array('class' => ' spinner-input form-control', 'onkeyup' => 'displayPhoto()', 'onclick' => 'displayPhoto()')); $font_site->setValue(18); $apply = new Zend_Form_Element_Select('apply'); $apply->setAttribs(array('class' => 'form-control')); $font_color = new Zend_Form_Element_text('font_color'); $font_color->setAttribs(array('class' => 'colorpicker-default form-control', 'onclick' => 'displayPhoto()')); $select_apply = new Zend_Form_Element_Select('select_apply'); $select_apply->setAttribs(array('class' => 'form-control', 'onClick' => 'FuncApplyCompany()')); $select_apply_opt = array("" => $this->tr->translate("SELECT_APPLY_TO_COMPANY"), -1 => $this->tr->translate("ADD_NEW")); $select_apply->setMultiOptions($select_apply_opt); $photo = new Zend_Form_Element_file('photo'); $id = new Zend_Form_Element_Hidden('id'); if (!empty($data)) { $id->setValue($data['id']); $item_code->setValue($data['bar_code']); $description->setValue($data['desc']); $lang_1->setValue($data['lang1']); $lang_2->setValue($data['lang2']); $font_size->setValue($data['price']); $show_description->setValue($data['display_by']); $menu_group->setValue($data['category_id']); $root_menu->setValue($data['root_menuid']); $print_code->setValue($data['print_code']); $print_to->setValue($data['printto_print']); $is_service->setValue($data['is_service']); $backgroun_color->setValue($data['background_color']); $font_color->setValue($data['font_color']); $font_site->setValue($data['font_size']); $active->setValue($data['status']); $note->setValue($data['note']); $show_screen->setValue($data['showscreen']); $is_root->setValue($data['is_root']); $time->setValue($data['time']); $discount->setValue($data['is_discound']); $require_qty->setValue($data['is_reqty']); } $this->addElements(array($select_apply, $require_qty, $root_code, $menu_group, $item_code, $apply, $active, $combo, $menu_code, $description, $lang_1, $lang_2, $lang_3, $print_code, $print_to, $show_screen, $time, $discount, $show_description, $background, $font_color, $font_size, $format, $setting, $arrange, $resize, $note, $is_root, $root_menu, $root_menus, $id, $photo, $note, $backgroun_color, $font_site, $font_color, $is_service)); return $this; }
private function getNewInvoiceForm(array $values = null) { $customersTable = new Customers(); $customers = $customersTable->fetchAll(); $customerList = array(); if ($customers->count() > 0) { foreach ($customers as $c) { $customerList[$c->customer_id] = $c->company; } } $form = new Zend_Form(); $form->setAction('/invoices/save')->setMethod('post'); $customer = new Zend_Form_Element_Select('customer'); $customer->addMultiOptions($customerList)->setLabel('Customer'); $invoiceDate = new Zend_Form_Element_Text('invoice_date'); $invoiceDate->setRequired(true)->setLabel('Invoice Date')->addValidator(new Zend_Validate_Date())->setAttrib('class', 'date')->setValue(date('Y-m-d')); $dueDate = new Zend_Form_Element_Text('due_date'); $dueDate->setRequired(true)->setLabel('Due Date')->addValidator(new Zend_Validate_Date())->setAttrib('class', 'date')->setValue(date('Y-m-d', strtotime('+1 month'))); $notes = new Zend_Form_Element_Textarea('notes'); $notes->setLabel('Notes'); $submit = new Zend_Form_Element_Submit('submit'); if (isset($values)) { $customer->setValue($values['customer_id']); $invoiceDate->setValue($values['invoice_date']); $dueDate->setValue($values['due_date']); $notes->setValue($values['notes']); } $form->addElement($customer)->addElement($invoiceDate)->addElement($dueDate)->addElement($notes)->addElement($submit); return $form; }
public function FrmProduct($frm = null) { $db = new Application_Model_DbTable_DbGlobal(); $status = new Zend_Form_Element_Select('status'); $_arr_status = array(1 => $this->tr->translate("ACTIVE"), 0 => $this->tr->translate("DACTIVE")); $status->setMultiOptions($_arr_status); $status->setAttribs(array('class' => 'form-control validate[required]')); $pro_code = new Zend_Form_Element_Text("pro_code"); $pro_code->setAttribs(array('class' => 'form-control validate[required]', 'placeholder' => $this->tr->translate("P_CODE"), "OnChange" => "GetCatName(3)")); $row_pro_code = $db->getProductCode(); $pro_code->setValue($row_pro_code); $measure = new Zend_Form_Element_Select("measure"); $measure->setAttribs(array('class' => 'select', 'style' => 'width:100%')); $row_measure = $db->getMeasure(); //$option_measure = array(0=>$this->tr->translate("CHOOSE_MEASURE")); foreach ($row_measure as $rs) { $option_measure[$rs["id"]] = $rs["name_kh"]; } $measure->setMultiOptions($option_measure); $stock_type = new Zend_Form_Element_Select("stock_type"); $stock_type->setAttribs(array('class' => '', 'style' => 'width:100%')); $option_st_type = array(1 => $this->tr->translate("CALCULATE_STOCK")); $stock_type->setMultiOptions($option_st_type); $pro_size = new Zend_Form_Element_Text("pro_size"); $pro_size->setAttribs(array('class' => 'form-control validate[required]', 'placeholder' => $this->tr->translate("SIZE"))); $qty_unit = new Zend_Form_Element_Text("qty_unit"); $qty_unit->setAttribs(array('class' => 'form-control validate[required]', 'placeholder' => $this->tr->translate("QTY_UNIT"), 'readonly' => true)); $qty_unit->setValue(1); $qty_per_unit = new Zend_Form_Element_Text("qty_per_unit"); $qty_per_unit->setValue(1); $qty_per_unit->setAttribs(array('class' => 'form-control validate[required]', 'placeholder' => $this->tr->translate("QTY_PER_UNIT"))); $label = new Zend_Form_Element_Text("label"); $label->setAttribs(array('class' => '', 'placeholder' => $this->tr->translate("LABEL"))); $cat_id = new Zend_Form_Element_Select("cat_id"); $cat_id->setAttribs(array('class' => 'select', 'style' => 'width:100%')); $category = $db->getAllProCategories(); $option_category = array(0 => $this->tr->translate("CHOOSE_CATEGORY")); foreach ($category as $row_cat) { $option_category[$row_cat["cat_id"]] = $row_cat["cat_name_km"] . " - " . $row_cat["cat_name_en"]; } $cat_id->setMultiOptions($option_category); $brand = new Zend_Form_Element_Select("brand"); $brand->setAttribs(array('class' => 'select', 'style' => 'width:100%')); $row_brand = $db->getAllBrand(); $option_brand = array(0 => $this->tr->translate("CHOOSE_BRAND")); foreach ($row_brand as $rs) { $option_brand[$rs["brand_id"]] = $rs["name_kh"] . " - " . $rs["name_en"]; } $brand->setMultiOptions($option_brand); $name_en = new Zend_Form_Element_Text("name_en"); $name_en->setAttribs(array('class' => 'validate[required]', 'placeholder' => $this->tr->translate("NAME_EN"), "OnChange" => "")); $currency = new Zend_Form_Element_Select("currency"); $currency->setAttribs(array('class' => 'form-control validate[required]', 'readonly' => 'readonly')); $currencys = $db->getAllCurrency(); $option_currency = array(0 => $this->tr->translate("CHOOSE_CURRENCY")); foreach ($currencys as $row_currency) { $option_currency[$row_currency["cu_id"]] = $row_currency["cu_name_km"] . " - " . $row_currency["cu_name_en"]; } $currency->setMultiOptions($option_currency); $currency->setValue(1); $price = new Zend_Form_Element_Text("price"); $price->setAttribs(array('class' => 'validate[required]', 'placeholder' => $this->tr->translate("PRICE"))); $description = new Zend_Form_Element_Textarea("description"); $description->setAttribs(array('class' => '', 'placeholder' => $this->tr->translate("DESCRIPTION"))); $name_km = new Zend_Form_Element_Text("name_km"); $name_km->setAttribs(array('class' => 'validate[required]', 'placeholder' => $this->tr->translate("NAME_KM"), "OnChange" => "")); $icon = new Zend_Form_Element_File("icon"); $unit_price = new Zend_Form_Element_Text("unit_price"); $unit_price->setAttribs(array('class' => 'validate[required]', 'placeholder' => $this->tr->translate("UNIT_PRICE"))); $unit_price->setValue(0); $qty_price = new Zend_Form_Element_Text("qty_price"); $qty_price->setAttribs(array('class' => 'validate[required]', 'placeholder' => $this->tr->translate("PRICE_PER_QTY"))); $qty_price->setValue(0); $qty_onhand = new Zend_Form_Element_Text("qty_onhand"); $qty_onhand->setAttribs(array('placeholder' => $this->tr->translate("QTY"))); $qty_onhand->setValue(0); $qty_unit_onhand = new Zend_Form_Element_Text("qty_unit_onhand"); $qty_unit_onhand->setAttribs(array('placeholder' => $this->tr->translate("QTY"))); $qty_unit_onhand->setValue(0); $this->addElements(array($qty_unit_onhand, $description, $price, $icon, $status, $name_en, $name_km, $cat_id, $pro_code, $currency, $brand, $qty_per_unit, $qty_unit, $label, $stock_type, $measure, $pro_size, $unit_price, $qty_onhand, $qty_price)); if ($frm != "") { $cat_id->setValue($frm["cate_id"]); $name_en->setValue($frm["name_en"]); $name_km->setValue($frm["name_kh"]); $status->setValue($frm["status"]); $currency->setValue($frm["cu_id"]); $brand->setValue($frm["brand_id"]); $label->setValue($frm["label"]); $pro_code->setValue($frm["item_code"]); $measure->setValue($frm["measure_id"]); $stock_type->setValue($frm["stock_type"]); //$qty_->setValue($frm["qty_onhand"]); $qty_unit->setValue(1); $qty_per_unit->setValue($frm["qty_perunit"]); //$qty_unit_onhand->setValue($frm[""]); $pro_size->setValue($frm["item_size"]); $unit_price->setValue($frm["unit_sale_price"]); $qty_price->setValue($frm["price_per_qty"]); $description->setValue($frm["description"]); } return $this; }
public function FrmTable($data = null) { $menu_code = new Zend_Form_Element_Text('group_code'); $menu_code->setAttribs(array('class' => 'form-control', 'required' => 'true', 'onkeyup' => 'displayPhoto()')); $description = new Zend_Form_Element_Text('description'); $description->setAttribs(array('class' => 'form-control', 'onkeyup' => 'displayPhoto()')); $lang_1 = new Zend_Form_Element_Text('lang_1'); $lang_1->setAttribs(array('class' => 'form-control', 'onkeyup' => 'displayPhoto()')); $font_color = new Zend_Form_Element_text('font_color'); $font_color->setAttribs(array('class' => 'colorpicker-default form-control', 'onclick' => 'displayPhoto()')); $lang_2 = new Zend_Form_Element_Text('lang_2'); $lang_2->setAttribs(array('checked' => 'checked', 'class' => 'form-control', 'onkeyup' => 'displayPhoto()')); $lang_3 = new Zend_Form_Element_Text('lang_3'); $lang_3->setAttribs(array('checked' => 'checked', 'class' => 'form-control')); if ($data != null) { // print_r($data); } $db = new Application_Model_DbTable_DbGlobal(); $show_description = new Zend_Form_Element_Select('show_description'); $show_description->setAttribs(array('class' => 'form-control', 'required' => 'true', 'onchange' => 'displayPhoto()')); $opt = $db->getVewOptoinTypeByType(1, 1, null, 1); $show_description->setMultiOptions($opt); $apply_to = new Zend_Form_Element_Select('apply_to_company'); $apply_to->setAttribs(array('class' => 'form-control')); $otp = array('0' => 'apply to company', '1' => 'A', '2' => 'B', '3' => 'C'); $apply_to->setMultiOptions($otp); $photo = new Zend_Form_Element_File('photo'); $backgroun_color = new Zend_Form_Element_Text('backgroun_color'); $backgroun_color->setAttribs(array('class' => 'colorpicker-rgba form-control', 'onclick' => 'displayPhoto()')); $font_site = new Zend_Form_Element_text('font_size'); $font_site->setAttribs(array('class' => ' spinner-input form-control', 'onkeyup' => 'displayPhoto()', 'onclick' => 'displayPhoto()')); $font_site->setValue(18); $apply = new Zend_Form_Element_Select('apply'); $apply->setAttribs(array('class' => 'form-control')); $apply_opt = array("" => $this->tr->translate("SELECT_APPLY_TO_COMPANY")); $apply->setMultiOptions($apply_opt); $combo = new Zend_Form_Element_Checkbox('combo'); $combo->setAttribs(array('class' => 'red')); $active = new Zend_Form_Element_Checkbox('active'); $active->setAttribs(array('class' => 'checker', 'checked' => 'checked')); $format = new Zend_Form_Element_Text('demo4'); $format->setAttribs(array('class' => 'form-control', 'id' => "demo4", 'value' => 12, 'placeholder' => '12')); $setting = new Zend_Form_Element_Select('setting'); $setting->setAttribs(array('class' => 'form-control')); $setting_opt = array("" => $this->tr->translate("SELECT_SETTING")); $setting->setMultiOptions($setting_opt); $arrange = new Zend_Form_Element_Text('arrange'); $arrange->setAttribs(array('class' => 'form-control')); $resize = new Zend_Form_Element_Text('resize'); $resize->setAttribs(array('class' => 'form-control', 'id' => "resize", 'value' => 12, 'placeholder' => '12')); $note = new Zend_Form_Element_Textarea('note'); $note->setAttribs(array('class' => 'form-control', 'style' => "margin-top: 0px; margin-bottom: 0px; height: 100px;")); $location = new Zend_Form_Element_Textarea('location'); $location->setAttribs(array('class' => 'form-control', 'style' => "margin-top: 0px; margin-bottom: 0px; height: 100px;")); $photo = new Zend_Form_Element_File('photo'); $id = new Zend_Form_Element_Hidden('id'); if ($data != null) { //print_r($data);exit(); $dbs = $id->setValue($data['id']); $menu_code->setValue($data['CODE']); $description->setValue($data['description']); $lang_1->setValue($data['lang1']); $lang_2->setValue($data['lang2']); $show_description->setValue($data['display_by']); $apply_to->setValue($data['compid']); $note->setValue($data['note']); $backgroun_color->setValue($data['background_color']); $font_color->setValue($data['font_color']); $font_site->setValue($data['font_size']); $active->setValue($data['status']); $id->setValue($data['id']); } $this->addElements(array($id, $photo, $location, $apply, $active, $combo, $menu_code, $description, $lang_1, $lang_2, $apply_to, $show_description, $backgroun_color, $font_color, $font_site, $format, $setting, $arrange, $resize, $note)); return $this; }
function getFormElement($v, $value = '') { $this->toTpl('hasForm', 1); $v = $this->doQoolHook('front_pre_getformelement_element', $v); $value = $this->doQoolHook('front_pre_getformelement_value', $value); switch ($v['value']) { case "editor": $this->loadEditorBtns(); $this->toTpl("loadEditor", 1); $this->toTpl("isEditor", 1); $element = new Zend_Form_Element_Textarea($v['name']); $element->setAttrib('class', 'editor span12'); if ($value != '') { $element->setValue($value); } break; case "fileinput": $element = new Zend_Form_Element_File($v['name']); $element->setAttrib('class', 'input-file'); break; case "captcha": $element = new Zend_Form_Element_Captcha($v['name'], array('label' => $this->t("Please verify you are a human"), 'captcha' => $config->site->captcha_adapter, 'captchaOptions' => array('captcha' => $config->site->captcha_adapter, 'wordLen' => 6, 'timeout' => 300))); return $element; break; case "multifileinputs": $element = new Zend_Form_Element_File($v['name']); $element->setAttrib('class', 'input-file'); $element->setMultiFile(10); break; case "multifileinput": $name = $v['name'] . "[]"; $element = new Zend_Form_Element_File($name); $element->setAttrib('class', 'input-file'); $element->setAttrib('multiple', 'multiple'); $element->setMultiFileForQool(1); $this->toTpl('filelist', true); break; case "checkbox": $element = new Zend_Form_Element_Checkbox($v['name']); $element->setAttrib('class', 'checkbox'); $element->setValue($value); break; case "editarea": $this->toTpl('editarea', 1); $element = new Zend_Form_Element_Textarea($v['name']); $element->setAttrib('class', 'editarea span12'); $element->setAttrib('id', 'editarea'); $element->setAttrib('style', 'height:500px'); if ($value != '') { $element->setValue($value); } break; case "password": $element = new Zend_Form_Element_Password($v['name']); break; case "textarea": $element = new Zend_Form_Element_Textarea($v['name']); $element->setAttrib('class', 'span9'); $element->setAttrib('style', 'height:80px'); if ($value != '') { $element->setValue($value); } break; case "hidden": $element = new Zend_Form_Element_Hidden($v['name']); $element->setValue($value); $element->setDecorators(array("ViewHelper")); break; case "textinput": $element = new Zend_Form_Element_Text($v['name']); if ($value != '') { $element->setValue($value); } break; case "selectbox": $element = new Zend_Form_Element_Select($v['name']); if ($v['use_pool'] && method_exists($this, $v['use_pool'])) { if ($v['pool_type'] != '0') { $this->pool_type = $v['pool_type']; } if ($v['novalue']) { $element->addMultiOption(0, $this->t('No Selection')); } foreach ($this->{$v}['use_pool']() as $ko => $vo) { if ($v['noself'] && $vo['id'] == $v['noself']) { } else { $element->addMultiOption($vo['id'], $vo['title']); } } if ($value != '') { $element->setValue($value); } } break; case "multiselectbox": $element = new Zend_Form_Element_Multiselect($v['name']); if ($v['use_pool'] && method_exists($this, $v['use_pool'])) { if ($v['pool_type'] != '0') { $this->pool_type = $v['pool_type']; } if ($v['novalue']) { $element->addMultiOption(0, $this->t('No Selection')); } foreach ($this->{$v}['use_pool']() as $ko => $vo) { if ($v['noself'] && $vo['id'] == $v['noself']) { } else { $element->addMultiOption($vo['id'], $vo['title']); } } if (is_array($value)) { foreach ($value as $a) { $vals[] = $a['selected_value']; } $element->setValue($vals); } } break; case "treeselectbox": $element = new Zend_Form_Element_Select($v['name']); if ($v['use_pool'] && method_exists($this, $v['use_pool'])) { if ($v['pool_type'] != '0') { $this->pool_type = $v['pool_type']; } if ($v['novalue']) { $element->addMultiOption(0, $this->t('No Selection')); } if ($value != '') { $element->setValue($value); } //x10 times nested support. Needs fix foreach ($this->{$v}['use_pool']() as $vo) { $element->addMultiOption($vo['id'], $vo['title']); foreach ($vo['kids'] as $a) { $element->addMultiOption($a['id'], "|_" . $a['title']); foreach ($a['kids'] as $b) { $element->addMultiOption($b['id'], "|__" . $b['title']); foreach ($b['kids'] as $c) { $element->addMultiOption($c['id'], "|___" . $c['title']); foreach ($c['kids'] as $d) { $element->addMultiOption($d['id'], "|____" . $d['title']); foreach ($d['kids'] as $e) { $element->addMultiOption($e['id'], "|_____" . $e['title']); foreach ($e['kids'] as $f) { $element->addMultiOption($f['id'], "|______" . $f['title']); foreach ($f['kids'] as $g) { $element->addMultiOption($g['id'], "|______" . $g['title']); foreach ($g['kids'] as $h) { $element->addMultiOption($h['id'], "|_______" . $h['title']); foreach ($h['kids'] as $i) { $element->addMultiOption($i['id'], "|________" . $i['title']); foreach ($i['kids'] as $j) { $element->addMultiOption($j['id'], "|_________" . $j['title']); foreach ($j['kids'] as $l) { $element->addMultiOption($l['id'], "|__________" . $l['title']); } } } } } } } } } } } } } break; } if ($v['required']) { $element->setRequired(true); } if ($v['title']) { $element->setLabel($v['title']); } else { $element->setLabel($this->t(ucfirst(str_replace("_", " ", $v['name'])))); } if ($v['attributes']) { foreach ($v['attributes'] as $k => $r) { $element->setAttrib($k, $r); } } //$element->setDecorators(array("ViewHelper")); $element = $this->doQoolHook('front_post_getformelement_object', $element); return $element; }
/** * Accepts an array with parameters and mixed values and returns a Zend Form Element to be used by a Zend Form object * * @param array $v * @param mixed $value * @return object */ function getFormElement($v, $value = '') { $config = $this->config; $this->toTpl('hasForm', 1); $v = $this->doQoolHook('pre_getformelement_element', $v); $value = $this->doQoolHook('pre_getformelement_value', $value); switch ($v['value']) { case "editor": $this->loadEditorBtns(); $this->toTpl("loadEditor", 1); $this->toTpl("isEditor", 1); $element = new Zend_Form_Element_Textarea($v['name']); $element->setAttrib('class', 'editor span12'); if ($value != '') { $element->setValue($value); } break; case "rte": $element = new Zend_Form_Element_Textarea($v['name']); $element->setAttrib('class', 'cleditor span12'); $this->toTpl("isRTE", 1); if ($value != '') { $element->setValue($value); } break; case "fileinput": $element = new Zend_Form_Element_File($v['name']); $element->setAttrib('class', 'input-file'); break; case "dropboxchooser": $element = new Zend_Form_Element_Dropbox($v['name']); $element->setAttrib('style', 'visibility:hidden'); $element->setAttrib('data-multiselect', true); break; case "captcha": if ($config->site->captcha_adapter == 'ReCaptcha') { //Do whats needed for recaptcha to work with form } $element = new Zend_Form_Element_Captcha($v['name'], array('label' => $this->t("Please verify you are a human"), 'captcha' => $config->site->captcha_adapter, 'captchaOptions' => array('captcha' => $config->site->captcha_adapter, 'wordLen' => 6, 'timeout' => 300))); return $element; break; case "multifileinputs": $element = new Zend_Form_Element_File($v['name']); $element->setAttrib('class', 'input-file'); $element->setMultiFile(10); break; case "multifileinput": $name = $v['name'] . "[]"; $element = new Zend_Form_Element_File($name); $element->setAttrib('class', 'input-file'); $element->setAttrib('multiple', 'multiple'); $element->setMultiFileForQool(1); $this->toTpl('filelist', true); break; case "checkbox": $element = new Zend_Form_Element_Checkbox($v['name']); $element->setAttrib('class', 'checkbox'); $element->setValue($value); break; case "editarea": $this->toTpl('editarea', 1); $element = new Zend_Form_Element_Textarea($v['name']); $element->setAttrib('class', 'editarea span12'); $element->setAttrib('id', 'editarea'); $element->setAttrib('style', 'height:500px'); if ($value != '') { $element->setValue($value); } break; case "password": $element = new Zend_Form_Element_Password($v['name']); break; case "textarea": $element = new Zend_Form_Element_Textarea($v['name']); $element->setAttrib('class', 'span9'); $element->setAttrib('style', 'height:80px'); if ($value != '') { $element->setValue($value); } break; case "hidden": $element = new Zend_Form_Element_Hidden($v['name']); $element->setValue($value); $element->setDecorators(array("ViewHelper")); break; case "textinput": $element = new Zend_Form_Element_Text($v['name']); if ($value != '') { $element->setValue($value); } break; case "datepicker": $element = new Zend_Form_Element_Text($v['name']); $element->setAttrib('class', 'input-xlarge datepicker'); if ($value != '') { $element->setValue($value); } break; case "imageselect": $element = new Zend_Form_Element_Text($v['name']); $element->setAttrib('class', 'imageselector'); $this->toTpl("hiddenEditor", 1); if ($value != '') { $element->setValue($value); } break; case "selectbox": $element = new Zend_Form_Element_Select($v['name']); if ($v['use_pool'] && method_exists($this, $v['use_pool'])) { if ($v['pool_type'] != '0') { $this->pool_type = $v['pool_type']; } if ($v['novalue']) { $element->addMultiOption(0, $this->t('No Selection')); } foreach ($this->{$v}['use_pool']() as $ko => $vo) { if ($v['noself'] && $vo['id'] == $v['noself']) { } else { $element->addMultiOption($vo['id'], $vo['title']); } } if ($value != '') { $element->setValue($value); } } elseif (is_array($v['use_pool'])) { if ($v['novalue']) { $element->addMultiOption(0, $this->t('No Selection')); } foreach ($v['use_pool'] as $ko => $vo) { if ($v['noself'] && $vo['id'] == $v['noself']) { } else { $element->addMultiOption($vo['id'], $vo['title']); } } if ($value != '') { $element->setValue($value); } } elseif ($v['use_pool']) { //the pools might have been assigned by an addon //include the file and run it. require_once $this->dirs['structure']['addons'] . DIR_SEP . Zend_Registry::get('controller') . DIR_SEP . "func.php"; if ($v['novalue']) { $element->addMultiOption(0, $this->t('No Selection')); } foreach ($v['use_pool']($this) as $ko => $vo) { if ($v['noself'] && $vo['id'] == $v['noself']) { } else { $element->addMultiOption($vo['id'], $vo['title']); } } if ($value != '') { $element->setValue($value); } } break; case "multiselectbox": $element = new Zend_Form_Element_Multiselect($v['name']); $element->setAttrib('data-rel', 'chosen'); if ($v['use_pool'] && method_exists($this, $v['use_pool'])) { if ($v['pool_type'] != '0') { $this->pool_type = $v['pool_type']; } if ($v['novalue']) { $element->addMultiOption(0, $this->t('No Selection')); } foreach ($this->{$v}['use_pool']() as $ko => $vo) { if ($v['noself'] && $vo['id'] == $v['noself']) { } else { $element->addMultiOption($vo['id'], $vo['title']); } } if (is_array($value)) { foreach ($value as $a) { $vals[] = $a['selected_value']; } $element->setValue($vals); } } else { //the pools might have been assigned by an addon //include the file and run it. require_once $this->dirs['structure']['addons'] . DIR_SEP . Zend_Registry::get('controller') . DIR_SEP . "func.php"; if ($v['novalue']) { $element->addMultiOption(0, $this->t('No Selection')); } foreach ($v['use_pool']($this) as $ko => $vo) { if ($v['noself'] && $vo['id'] == $v['noself']) { } else { $element->addMultiOption($vo['id'], $vo['title']); } } if ($value != '') { $element->setValue($value); } } break; case "treeselectbox": $element = new Zend_Form_Element_Select($v['name']); if ($v['use_pool'] && method_exists($this, $v['use_pool'])) { if ($v['pool_type'] != '0') { $this->pool_type = $v['pool_type']; } if ($v['novalue']) { $element->addMultiOption(0, $this->t('No Selection')); } if ($value != '') { $element->setValue($value); } //x10 times nested support. Needs fix foreach ($this->{$v}['use_pool']() as $vo) { $element->addMultiOption($vo['id'], $vo['title']); foreach ($vo['kids'] as $a) { $element->addMultiOption($a['id'], "|_" . $a['title']); foreach ($a['kids'] as $b) { $element->addMultiOption($b['id'], "|__" . $b['title']); foreach ($b['kids'] as $c) { $element->addMultiOption($c['id'], "|___" . $c['title']); foreach ($c['kids'] as $d) { $element->addMultiOption($d['id'], "|____" . $d['title']); foreach ($d['kids'] as $e) { $element->addMultiOption($e['id'], "|_____" . $e['title']); foreach ($e['kids'] as $f) { $element->addMultiOption($f['id'], "|______" . $f['title']); foreach ($f['kids'] as $g) { $element->addMultiOption($g['id'], "|______" . $g['title']); foreach ($g['kids'] as $h) { $element->addMultiOption($h['id'], "|_______" . $h['title']); foreach ($h['kids'] as $i) { $element->addMultiOption($i['id'], "|________" . $i['title']); foreach ($i['kids'] as $j) { $element->addMultiOption($j['id'], "|_________" . $j['title']); foreach ($j['kids'] as $l) { $element->addMultiOption($l['id'], "|__________" . $l['title']); } } } } } } } } } } } } } break; } if ($v['required']) { $element->setRequired(true); } if ($v['title']) { $element->setLabel($v['title']); } else { $element->setLabel($this->t(ucfirst(str_replace("_", " ", $v['name'])))); } if ($v['attributes']) { foreach ($v['attributes'] as $k => $r) { $element->setAttrib($k, $r); } } //$element->setDecorators(array("ViewHelper")); $element = $this->doQoolHook('post_getformelement_object', $element); return $element; }