本文整理汇总了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;
}
示例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();
}