当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Form_Element_Radio::addDecorator方法代码示例

本文整理汇总了PHP中Zend_Form_Element_Radio::addDecorator方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Radio::addDecorator方法的具体用法?PHP Zend_Form_Element_Radio::addDecorator怎么用?PHP Zend_Form_Element_Radio::addDecorator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Form_Element_Radio的用法示例。


在下文中一共展示了Zend_Form_Element_Radio::addDecorator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 public function init($specId)
 {
     global $mySession;
     $db = new Db();
     $amenity_value = "";
     $description_value = "";
     $no_of_options_value = "";
     $mandatory_value = "";
     if ($specId != "") {
         $specData = $db->runQuery("select * from " . SPECIFICATION . " as s \n\t\t\t                         left join " . SPEC_CHILD . " as sc on\tsc.spec_id = s.spec_id\n\t\t\t\t\t\t\t\t\t inner join " . PROPERTY_SPEC_CAT . " as psc on\tpsc.cat_id = s.cat_id\n\t\t\t\t\t\t\t\t\t where s.spec_id ='" . $specId . "' ");
         $question_value = $specData[0]['question'];
         $input_type_value = $specData[0]['spec_type'];
         $spec_status_value = $specData[0]['status'];
         $category_value = $specData[0]['cat_id'];
         $no_of_options_value = count($specData);
         $mandatory_value = $specData[0]['mandatory'];
         if ($input_type_value == '1' || $input_type_value == '0' || $input_type_value == '4') {
             $i = 1;
             foreach ($specData as $value) {
                 $options_value[$i] = $value['option'];
                 $i++;
             }
         }
     }
     $categoryArr[0]['key'] = "";
     $categoryArr[0]['value'] = "- - Select - -";
     $catArr = $db->runQuery("select * from " . PROPERTY_SPEC_CAT . "  ");
     $i = 1;
     foreach ($catArr as $values) {
         $categoryArr[$i]['key'] = $values['cat_id'];
         $categoryArr[$i]['value'] = $values['cat_name'];
         $i++;
     }
     $category = new Zend_Form_Element_Select('category');
     $category->setRequired(true)->addMultiOptions($categoryArr)->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput")->setValue($category_value);
     $question = new Zend_Form_Element_Text('question');
     $question->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Question is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setAttrib("tabindex", '1')->setValue($question_value);
     $typeArr[0]['key'] = "";
     $typeArr[0]['value'] = '- - Select --';
     $typeArr[1]['key'] = '0';
     $typeArr[1]['value'] = 'Radio';
     $typeArr[2]['key'] = '1';
     $typeArr[2]['value'] = 'Selectbox';
     $typeArr[3]['key'] = '2';
     $typeArr[3]['value'] = 'Textarea';
     $typeArr[4]['key'] = '3';
     $typeArr[4]['value'] = 'Textbox';
     $typeArr[5]['key'] = '4';
     $typeArr[5]['value'] = 'Checkbox';
     $input_type = new Zend_Form_Element_Select('input_type');
     $input_type->setRequired(true)->addMultiOptions($typeArr)->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput")->setAttrib("onchange", "displayoption(this.value)")->setValue($input_type_value);
     /** no of options code **/
     $numberArr[0]['key'] = "";
     $numberArr[0]['value'] = "- - select - -";
     for ($i = 1, $k = 2; $k <= 54; $i++, $k++) {
         $numberArr[$i]['key'] = $k;
         $numberArr[$i]['value'] = $k;
     }
     $no_of_options = new Zend_Form_Element_Select('no_of_options');
     $no_of_options->addMultiOptions($numberArr)->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setAttrib("onchange", "addoptions(this.value)")->setValue($no_of_options_value);
     $this->addElement($no_of_options);
     /* options code **/
     for ($j = 1; $j <= 54; $j++) {
         $options_add[$j] = new Zend_Form_Element_Text('options_add' . $j);
         $options_add[$j]->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setAttrib("tabindex", '1')->setValue($options_value[$j]);
         $this->addElement($options_add[$j]);
     }
     $statusArr[0]['key'] = '0';
     $statusArr[0]['value'] = 'Disable';
     $statusArr[1]['key'] = '1';
     $statusArr[1]['value'] = 'Enable';
     $spec_status = new Zend_Form_Element_Select('spec_status');
     $spec_status->addDecorator('Errors', array('class' => 'error'))->addMultiOptions($statusArr)->setAttrib("class", "mws-textinput required")->setValue($spec_status_value);
     $mandatoryArr[0]['key'] = '0';
     $mandatoryArr[0]['value'] = 'Not Mandatory';
     $mandatoryArr[1]['key'] = '1';
     $mandatoryArr[1]['value'] = 'Mandatory';
     $mandatory = new Zend_Form_Element_Radio('mandatory');
     $mandatory->addDecorator('Errors', array('class' => 'error'))->addMultiOptions($mandatoryArr)->setAttrib("class", "mws-textinput required")->setValue($mandatory_value);
     $this->addElements(array($question, $category, $input_type, $spec_status, $mandatory));
 }
开发者ID:ankuradhey,项目名称:dealtrip,代码行数:81,代码来源:Specification.php


注:本文中的Zend_Form_Element_Radio::addDecorator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。