本文整理汇总了PHP中Zend_Form_Element_Checkbox::setCheckedValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Checkbox::setCheckedValue方法的具体用法?PHP Zend_Form_Element_Checkbox::setCheckedValue怎么用?PHP Zend_Form_Element_Checkbox::setCheckedValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Checkbox
的用法示例。
在下文中一共展示了Zend_Form_Element_Checkbox::setCheckedValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
/* Form Elements & Other Definitions Here ... */
//<input type="text" name="name">
$product_name = new Zend_Form_Element_Text('name');
$product_name->setRequired(true);
$product_name->addFilter(new Zend_Filter_StripTags());
$product_name->setLabel('Product Name : ');
//<input type="text" name="price">
$product_price = new Zend_Form_Element_Text('price');
$product_price->setRequired();
$product_price->setLabel('Product Price : ');
$catName = new Zend_Form_Element_Select('catid');
$catName->setLabel('Category :');
// $user_model = new Application_Model_Category();
// $allcats = $user_model->listCategory();
//
//
// echo' <select id="selectcats" name="cats"> ';
//
// for ($i = 0; $i < count($allcats); $i++) {
// $name = $allcats[$i]['name'];
// $id = $allcats[$i]['id'];
//
// echo" <option value='<?php echo $id ;
//<!--//// echo $name;
//// echo '</option>';
//// }
//// echo' </select>'; -->
//picture
$product_picture = new Zend_Form_Element_File('picture');
$product_picture->setLabel('Image');
// $product_picture->addValidator('Extension', true, 'jpg,png,gif');
//$product_picture->
$product_state = new Zend_Form_Element_Checkbox('state');
$product_state->setRequired();
$product_state->setLabel('Product exists');
$product_state->setCheckedValue(1);
$product_state->setUncheckedValue(0);
//$product_state->setChecked(true);
$submit = new Zend_Form_Element_Submit("Submit");
$this->setMethod('post');
$this->setAttrib('enctype', 'multipart/form-data');
//$this->setAction('');
$this->addElements(array($product_name, $product_picture, $product_price, $catName, $product_state, $submit));
}
示例2: init
//.........这里部分代码省略.........
$this->numeroDormitorios->removeDecorator('Label');
// Número de baños
$dbBanyo = new Application_Model_DbTable_TipoBanyo();
$banyos = $dbBanyo->getBanyosList();
$this->addElement('select', 'numeroBanyos', array('label' => ' ', 'required' => false, 'filters' => array('stringTrim')));
/* foreach($banyos as $key => $value){
$this->numeroBanyos->addMultiOption($key,$value);
}*/
$this->numeroBanyos->addMultiOptions($banyos);
//$this->numeroBanyos->removeDecorator('Errors');
$this->numeroBanyos->setAttrib('class', 'form_select_bit');
$this->numeroBanyos->removeDecorator('HtmlTag');
$this->numeroBanyos->removeDecorator('Label');
// Titulo anuncio
$this->addElement('text', 'titulo', array('label' => 'Titulo (*)', 'required' => true, 'filters' => array('stringTrim')));
$this->titulo->addValidator('NotEmpty', true, array('messages' => array(Zend_Validate_NotEmpty::IS_EMPTY => 'Ingresar titulo del anuncio.')));
$this->titulo->setDecorators($this->decoradores);
$this->titulo->setAttrib('class', 'form_input_contact');
//$this->titulo->removeDecorator('Errors');
$this->titulo->removeDecorator('HtmlTag');
$this->titulo->removeDecorator('Label');
// Descripcion completa
$this->addElement('textarea', 'descripcion', array('label' => 'Descripción completa', 'required' => false, 'filters' => array('stringTrim')));
//$this->descripcion->setDecorators($this->decoradores);
$this->descripcion->setAttrib('class', 'form_input_contact');
$this->descripcion->removeDecorator('Errors');
$this->descripcion->removeDecorator('HtmlTag');
$this->descripcion->removeDecorator('Label');
// Alta de suministros
/* Versión para la web*/
$altaSuministros = new Zend_Form_Element_Checkbox('altaSuministros');
$altaSuministros->setLabel('Alta de suministros')->setRequired(FALSE);
$altaSuministros->setUncheckedValue(0);
$altaSuministros->setCheckedValue(1);
$altaSuministros->setAttrib('class', 'form_input_contact_very_small');
$altaSuministros->removeDecorator('Errors');
$altaSuministros->removeDecorator('HtmlTag');
$altaSuministros->removeDecorator('Label');
$this->addElement($altaSuministros);
/*
$this->addElement(
'checkBox',
'altaSuministros',
array (
'label' => 'Alta de suministros',
'required' => false,
'checkedValue' => '1',
'uncheckedValue' => '0',
)
);
$this->altaSuministros->setAttrib('class','form_input_contact_very_small');
$this->altaSuministros->removeDecorator('Errors');
$this->altaSuministros->removeDecorator('HtmlTag');
$this->altaSuministros->removeDecorator('Label');
*/
// Ascensor
/*
$ascensor = new Zend_Form_Element_Checkbox('ascensor');
$ascensor->setLabel('Ascensor')
->setRequired(FALSE);
$ascensor->setUncheckedValue(0);
$ascensor->setCheckedValue(1);
$ascensor->setAttrib('class','form_input_contact_very_small');
$ascensor->removeDecorator('Errors');
示例3: init
public function init($planId)
{
global $mySession;
$db = new Db();
$plan_name_value = "";
$old_plan_image_value = "";
$nof_images_value = "0";
$plan_price_value = "";
$plan_validity_value = "";
$Isfree_value = "0";
$des_box_value = "1";
$featured_business_value = "0";
$offer_coupons_value = "0";
if ($planId != "") {
$planData = $db->runQuery("select * from " . SUBSCRIPTIONS . " where plan_id='" . $planId . "'");
$plan_name_value = $planData[0]['plan_name'];
$old_plan_image_value = $planData[0]['plan_image'];
$nof_images_value = $planData[0]['nof_images'];
$Isfree_value = $planData[0]['is_free'];
$plan_price_value = $planData[0]['plan_price'];
$plan_validity_value = $planData[0]['plan_validity'];
$des_box_value = $planData[0]['des_box'];
$featured_business_value = $planData[0]['featured_business'];
$offer_coupons_value = $planData[0]['offer_coupons'];
}
$plan_name = new Zend_Form_Element_Text('plan_name');
$plan_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Plan Name is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setValue($plan_name_value);
$this->addElement($plan_name);
$plan_image = new Zend_Form_Element_File('plan_image');
$plan_image->setDestination(SITE_ROOT . 'images/planimg/')->addValidator('Extension', false, 'jpg,jpeg,png,gif')->addDecorator('Errors', array('class' => 'error'));
$this->addElement($plan_image);
$old_plan_image = new Zend_Form_Element_Hidden('old_plan_image');
$old_plan_image->setValue($old_plan_image_value);
$this->addElement($old_plan_image);
$nof_images = new Zend_Form_Element_Text('nof_images');
$nof_images->setAttrib("class", "textInput")->setAttrib("onkeypress", "return checknummsp(event);")->setValue($nof_images_value);
$this->addElement($nof_images);
$Isfree = new Zend_Form_Element_Checkbox('Isfree');
$Isfree->setCheckedValue('1')->setUncheckedValue('0')->setAttrib("onclick", "SetFreeorPaid();")->setValue($Isfree_value);
$this->addElement($Isfree);
$plan_price = new Zend_Form_Element_Text('plan_price');
$plan_price->setAttrib("class", "textInput")->setAttrib("onkeypress", "return checknummsp(event);")->setValue($plan_price_value);
$this->addElement($plan_price);
if ($_REQUEST['Isfree'] == '0') {
$plan_price->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Plan price is required.'))->addDecorator('Errors', array('class' => 'error'));
}
$ValidityArr = array();
for ($i = 0; $i <= 11; $i++) {
$valueI = $i + 1;
$ValidityArr[$i]['key'] = $valueI;
$ValidityArr[$i]['value'] = $valueI . " Month";
}
$plan_validity = new Zend_Form_Element_Select('plan_validity');
$plan_validity->addMultiOptions($ValidityArr)->setAttrib("class", "textInput")->setValue($plan_validity_value);
$this->addElement($plan_validity);
$desBoxArr = array();
$desBoxArr[0]['key'] = "1";
$desBoxArr[0]['value'] = "Textbox";
$desBoxArr[1]['key'] = "2";
$desBoxArr[1]['value'] = "HTML Editor";
$des_box = new Zend_Form_Element_Radio('des_box');
$des_box->addMultiOptions($desBoxArr)->setValue($des_box_value);
$this->addElement($des_box);
$featured_business = new Zend_Form_Element_Checkbox('featured_business');
$featured_business->setCheckedValue('1')->setUncheckedValue('0')->setValue($featured_business_value);
$this->addElement($featured_business);
$offer_coupons = new Zend_Form_Element_Checkbox('offer_coupons');
$offer_coupons->setCheckedValue('1')->setUncheckedValue('0')->setValue($offer_coupons_value);
$this->addElement($offer_coupons);
}