本文整理汇总了PHP中Zend_Form_Element_Textarea::setValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Textarea::setValue方法的具体用法?PHP Zend_Form_Element_Textarea::setValue怎么用?PHP Zend_Form_Element_Textarea::setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Textarea
的用法示例。
在下文中一共展示了Zend_Form_Element_Textarea::setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: FrmProCate
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;
}
示例2: FrmProCate
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;
}
示例3: renderFormElement
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;
}
示例4: Frm_table_type
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;
}
示例5: FrmProCate
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;
}
示例6: __construct
/**
*
* @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');
}
示例7: editlangAction
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);
}
示例8: getForm
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']) {
//.........这里部分代码省略.........
示例9: FrmMenu
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;
}
示例10: testPrepareRenderingAsView
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());
}
示例11: init
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');
//.........这里部分代码省略.........
示例12: getTextArea
/**
* 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;
}
示例13: __construct
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');
//.........这里部分代码省略.........
示例14: FrmTables
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;
//.........这里部分代码省略.........
示例15: getForm
/**
* 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;
}