當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_View::formRadio方法代碼示例

本文整理匯總了PHP中Zend_View::formRadio方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_View::formRadio方法的具體用法?PHP Zend_View::formRadio怎麽用?PHP Zend_View::formRadio使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_View的用法示例。


在下文中一共展示了Zend_View::formRadio方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getFieldHtml

 public function getFieldHtml($NewFieldData, $section)
 {
     if (!Mage::helper('fieldsmanager')->getStoredDatafor('enable')) {
         return false;
     }
     $BackEndValue = '';
     $StoreId = Mage::app()->getStore()->getId();
     $NewFieldId = 'fm_' . $NewFieldData['attribute_code'];
     $TextFields = new Zend_View();
     $Label = $this->getFieldLabel($NewFieldData['attribute_id']);
     $class = ' t1 ' . $NewFieldData['frontend_class'];
     $NewFieldName = $section . '[fm_' . $NewFieldData['attribute_code'] . ']';
     if (Mage::getSingleton('core/session')->getParentOrderId() && Mage::getSingleton('core/session')->getParentOrderId() != 0) {
         $BackEndValue = $this->getSavedFieldData(Mage::getSingleton('core/session')->getParentOrderId(), $NewFieldData['attribute_code'], 'orders');
     } elseif ($NewFieldData['fme_customer_account'] > 0 && $this->getCustomer()) {
         $customerId = 0;
         if ($this->getCustomer()) {
             $customerId = $this->getCustomer()->getId();
         }
         $BackEndValue = $this->getSavedFieldData($customerId, $NewFieldData['attribute_code'], 'customers');
     }
     $BackEndValue = $BackEndValue != '' ? $BackEndValue : $NewFieldData['default_value'];
     if ($NewFieldData['is_required']) {
         if (in_array($NewFieldData['frontend_input'], array('text', 'textarea', 'date'))) {
             $class .= ' required-entry';
         } elseif (in_array($NewFieldData['frontend_input'], array('select', 'multiselect', 'boolean'))) {
             $class .= ' validate-select';
         } else {
             $class .= ' validate-one-required-by-name';
         }
     }
     $TextInputExtra = array('id' => $NewFieldId, 'class' => $class, 'title' => $Label);
     $OptionsList = array();
     $html = '';
     switch ($NewFieldData['frontend_input']) {
         case 'text':
             $TextInputExtra['class'] .= ' t1 input-text';
             $html .= $TextFields->formText($NewFieldName, $BackEndValue, $TextInputExtra);
             break;
         case 'textarea':
             $TextInputExtra['class'] .= ' t1 input-text';
             $TextInputExtra['style'] = 'height:50px;';
             $html .= $TextFields->formTextarea($NewFieldName, $BackEndValue, $TextInputExtra);
             break;
         case 'select':
             $OptionsList1 = array();
             if ($NewFieldData['is_used_for_price_rules'] == 1) {
                 $OptionsList1[-1] = array('value' => '', 'label' => ' ');
             }
             $OptionsList = $this->getOptionslist($NewFieldData['attribute_id']);
             $OptionsList = array_merge($OptionsList1, $OptionsList);
             $select = Mage::getModel('core/layout')->createBlock('adminhtml/html_select')->setData(array('id' => $NewFieldId, 'class' => $class, 'value' => $BackEndValue))->setName($NewFieldName)->setOptions($OptionsList);
             $html .= $select->getHtml();
             break;
         case 'multiselect':
             if (!is_array($BackEndValue)) {
                 $BackEndValue = explode(',', $BackEndValue);
             }
             $OptionsList = $this->getOptionslist($NewFieldData['attribute_id']);
             $select = Mage::getModel('core/layout')->createBlock('adminhtml/html_select')->setData(array('id' => $NewFieldId, 'class' => $class, 'value' => $BackEndValue))->setExtraParams('multiple')->setName($NewFieldName . '[]')->setOptions($OptionsList);
             $html .= $select->getHtml();
             break;
         case 'checkbox':
             $OptionsList = $this->getOptionslist($NewFieldData['attribute_id']);
             if ($OptionsList) {
                 $newOPtions = array();
                 foreach ($OptionsList as $option) {
                     $newOPtions[$option['value']] = $option['label'];
                 }
                 $class .= ' checkbox';
                 if (!is_array($BackEndValue)) {
                     $BackEndValue = explode(',', $BackEndValue);
                 }
                 $attribs = array('id' => $NewFieldId, 'class' => $class, 'title' => $Label);
                 $html .= $TextFields->formMultiCheckbox($NewFieldName, $BackEndValue, $attribs, $newOPtions, "<br />\n");
             }
             break;
         case 'radio':
             $OptionsList = $this->getOptionslist($NewFieldData['attribute_id']);
             if ($OptionsList) {
                 $OptionsList1 = array();
                 if (!$NewFieldData['is_required']) {
                     $OptionsList1[-1] = array('value' => '', 'label' => Mage::helper('catalog')->__('None'));
                 }
                 $OptionsList = array_merge($OptionsList1, $OptionsList);
                 $newOPtions = array();
                 foreach ($OptionsList as $option) {
                     $newOPtions[$option['value']] = $option['label'];
                 }
                 $class .= ' radio';
                 if (!is_array($BackEndValue)) {
                     $BackEndValue = explode(',', $BackEndValue);
                 }
                 $attribs = array('id' => $NewFieldId, 'class' => $class, 'title' => $Label);
                 $html .= $TextFields->formRadio($NewFieldName, $BackEndValue, $attribs, $newOPtions);
             }
             break;
         case 'boolean':
             if ($BackEndValue == 'No') {
                 $BackEndValue = '0';
//.........這裏部分代碼省略.........
開發者ID:cnglobal-sl,項目名稱:caterez,代碼行數:101,代碼來源:Fieldsmanager.php


注:本文中的Zend_View::formRadio方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。