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


PHP Zend_Form_Element_Select::renderViewHelper方法代码示例

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


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

示例1: formMultiLevel2

    public function formMultiLevel2($name, $value = null, $attributes = array())
    {
        $xhtml = array();
        // CODE HERE
        $xhtml[] = '<input type="hidden" name="' . $name . '" value="' . $value . '" id="id_' . $name . '" />
			
		';
        $model_class = $attributes['model'];
        $module = $attributes['module'];
        if (!$model_class) {
            throw new Exception('model is requirement');
        }
        $isSearch = isset($attributes['isSearch']) ? (int) $attributes['isSearch'] : 0;
        $model = new $model_class();
        $item = $model->find((int) $value)->current();
        $level = 0;
        $lastname = '';
        $onchange = isset($attributes['onchange']) ? $attributes['onchange'] : "en4.ynevent.changeCategory(\$(this),'{$name}','{$model_class}','{$module}',{$isSearch},0)";
        if (!is_object($item)) {
            $options = $model->getMultiOptions(0);
            $i = 0;
            $lastname = sprintf("%s_%s", $name, 0);
            $element = new Zend_Form_Element_Select($lastname, array('multiOptions' => $options, 'onchange' => $onchange));
            $xhtml[] = '<div id="id_wrapper_' . $name . '_' . $i . '">' . $element->renderViewHelper() . '</div>';
            $i = 1;
        } else {
            $nodes = $item->getBreadCrumNode();
            $i = 0;
            foreach ($nodes as $node) {
                $lastname = sprintf("%s_%s", $name, $i);
                $options = $model->getMultiOptions($node->parent_id);
                $element = new Zend_Form_Element_Select($lastname, array('multiOptions' => $options, 'onchange' => $onchange, 'value' => $node->getIdentity()));
                $style = 'style="margin-top: 8px;"';
                $xhtml[] = '<div ' . $style . ' id="id_wrapper_' . $name . '_' . $i . '" >' . $element->renderViewHelper() . '</div>';
                ++$i;
            }
        }
        $level = $model->getMaxLevel();
        for (; $i < $level; ++$i) {
            $xhtml[] = '<div id="id_wrapper_' . $name . '_' . $i . '" style = "display: none">' . '<!-- wrapper at level ' . $i . '-->' . '</div>';
        }
        $xhtml[] = '<script type="text/javascript">' . 'window.addEvent("domready",function(){' . "en4.{$module}.changeCategory(\$('{$lastname}'),'{$name}','{$model_class}','{$module}',{$isSearch},1)});" . '</script>';
        $xhtml = implode(PHP_EOL, $xhtml);
        return $xhtml;
    }
开发者ID:hoalangoc,项目名称:ftf,代码行数:45,代码来源:FormMultiLevel2.php

示例2: changeAction

 public function changeAction()
 {
     $category_id = $this->_getParam('id');
     $model_class = $this->_getParam('model');
     $name = $this->_getParam('name');
     $level = $this->_getParam('level');
     $isSearch = (int) $this->_getParam('isSearch', 0);
     $model = new $model_class();
     $item = $model->find((string) $category_id)->current();
     if ($category_id == '' || $category_id == '0') {
         return '';
     }
     $options = $model->getMultiOptions($item->getIdentity());
     if (count($options) < 2) {
         return;
     }
     $route = 'book';
     $element = new Zend_Form_Element_Select(sprintf("%s_%s", $name, $level + 1), array('multiOptions' => $options, 'required' => false, 'onchange' => "en4.book.changeCategory(\$(this),'" . $name . "','" . $model_class . "','" . $route . "',{$isSearch},0)"));
     echo $element->renderViewHelper();
 }
开发者ID:HiLeo1610,项目名称:tumlumsach,代码行数:20,代码来源:MultiLevelController.php


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