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


PHP Zend_View::formText方法代码示例

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


在下文中一共展示了Zend_View::formText方法的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::formText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。