本文整理汇总了PHP中Zend_Form_Element_Select::render方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Select::render方法的具体用法?PHP Zend_Form_Element_Select::render怎么用?PHP Zend_Form_Element_Select::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Select
的用法示例。
在下文中一共展示了Zend_Form_Element_Select::render方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public function render(Zend_View_Interface $view = null)
{
if (!count($this->getMultiOptions())) {
$this->addMultiOption(0, $this->getView()->translate('message.noResult.short'));
}
return parent::render($view);
}
示例2: render
public function render(Zend_View_Interface $view = null)
{
if (count($this->getMultiOptions()) == 0) {
$this->setMultiOptions();
}
return parent::render($view);
}
示例3: getlibellesbyidcategorieAction
function getlibellesbyidcategorieAction()
{
$oMapper = new Application_Model_Mapper_RefItems();
$oSelect = new Zend_Form_Element_Select(Form_AjoutProduit::LIBELLE);
$oSelect->setMultiOptions($oMapper->getLibelleByIdCategorie($this->_getParam('idCategorie')))->setDecorators(array('ViewHelper'));
$this->view->element = $oSelect->render();
}
示例4: render
public function render(Zend_View $view = null)
{
if ($view) {
$view->addHelperPath(Dfi_View_Helper_FormSelectChained::getPath(), 'Dfi_View_Helper');
} else {
$this->getView()->addHelperPath(Dfi_View_Helper_FormSelectChained::getPath(), 'Dfi_View_Helper');
}
return parent::render($view);
}
示例5: render
public function render(Zend_View_Interface $view = null)
{
$this->getView()->setEncoding('cp1251');
return parent::render($view);
}
示例6: testMultiOptionsPassedToViewHelperAreTranslated
public function testMultiOptionsPassedToViewHelperAreTranslated()
{
require_once 'Zend/Form/Element/Select.php';
require_once 'Zend/Translate.php';
$element = new Zend_Form_Element_Select('foo');
$options = array('foo' => 'This Foo Will Not Be Displayed', 'bar' => 'This Bar Will Not Be Displayed', 'baz' => 'This Baz Will Not Be Displayed');
$element->setMultiOptions($options);
$translations = array('This Foo Will Not Be Displayed' => 'This is the Foo Value', 'This Bar Will Not Be Displayed' => 'This is the Bar Value', 'This Baz Will Not Be Displayed' => 'This is the Baz Value');
$translate = new Zend_Translate('array', $translations, 'en');
$translate->setLocale('en');
$element->setTranslator($translate);
$test = $element->render($this->getView());
foreach ($options as $key => $value) {
$this->assertNotContains($value, $test);
$this->assertContains($translations[$value], $test);
}
}
示例7: generateList
/**
* @todo : description
* @return mixed
* @throws Centurion_Exception
*/
public function generateList()
{
$select = $this->getSelectFiltred();
//TODO: move all of this in a view helper (except pagination, )
$headCol = array();
foreach ($this->_displays as $key => $col) {
if (is_string($col)) {
$label = $col;
} else {
if (is_array($col) && isset($col['label'])) {
$label = $col['label'];
} else {
throw new Centurion_Exception(sprintf('Col %s have no label', $key));
}
}
$params = array('page' => 0, 'sort' => $key, 'order' => $this->_sort !== $key || $this->_order === Zend_Db_Select::SQL_DESC ? Zend_Db_Select::SQL_ASC : Zend_Db_Select::SQL_DESC);
$params += $this->getFilter()->getValuesForUrl();
if (!isset($col['sortable']) || $col['sortable'] !== false) {
$link = $this->view->url($params);
} else {
$link = null;
}
$headCol[$key] = array('label' => $label, 'link' => $link);
}
$this->_headCol = $headCol;
$this->_preGenerateList();
$paginator = $this->getPaginator($select);
$this->_postGenerateList($paginator);
$result = array();
foreach ($paginator as $row) {
$temp = array();
if ($this->_showCheckbox) {
//TODO : id en dur, utiliser la pk du model
$temp['checkbox'] = '<input type="checkbox" value="' . $row->id . '" name="rowId[]">';
}
foreach ($this->_displays as $key => $options) {
if (is_string($options) || !isset($options['type'])) {
$value = $row->{$key};
} else {
if ($options['type'] === self::COLS_ROW_COL) {
if (isset($options['col'])) {
$col = $options['col'];
} else {
$col = $key;
}
$value = $row->{$col};
} else {
if ($options['type'] === self::COLS_ROW_FUNCTION) {
if (isset($options['function'])) {
$function = $options['function'];
} else {
$function = $key;
}
$value = $row->{$function}();
} else {
if ($options['type'] === self::COLS_CALLBACK) {
if (!isset($options['callback'])) {
$options['callback'] = array($this, $key);
}
$params = array_merge(array($row), isset($options['callbackParams']) ? (array) $options['callbackParams'] : array());
$value = call_user_func_array($options['callback'], $params);
} else {
if ($options['type'] === self::COLS_TYPE_PREVIEW) {
$value = '<a href="' . $this->view->url(array('object' => $row), $options['param']['route']) . '">' . $this->view->translate('Preview') . '</a>';
} else {
if ($options['type'] === self::COL_TYPE_FIRSTCOL) {
$value = $this->view->renderToString('centurion/_first_col.phtml', array('extraParam' => $this->_extraParam, 'row' => $row, 'first' => $options['param'], 'controller' => $this->_request->getControllerName(), 'module' => $this->_request->getModuleName()));
} else {
if ($options['type'] === self::COL_TYPE_ONOFF) {
if (isset($options['onoffLabel']) && count($options['onoffLabel']) === 2) {
$onLabel = $options['onoffLabel'][0];
$offLabel = $options['onoffLabel'][1];
} else {
$onLabel = $this->view->translate('On');
$offLabel = $this->view->translate('Off');
}
if (isset($options['column'])) {
$column = $options['column'];
} else {
$column = $key;
}
//TODO : id en dur, utiliser la pk du model
$element = new Zend_Form_Element_Select(array('disableTranslator' => true, 'name' => $key . '_' . $row->id, 'class' => 'field-switcher'));
$element->addMultiOption('1', $onLabel);
$element->addMultiOption('0', $offLabel);
$element->removeDecorator('Label');
$element->setValue($row->{$column});
$value = $element->render();
} else {
//TODO: more explicit (add type, ...)
throw new Centurion_Exception(sprintf('I don\'t now what to do with the col %s', $key));
}
}
}
}
//.........这里部分代码省略.........
示例8: listAction
public function listAction()
{
$listcount = new LookupType();
$listcount->setName("LIST_ITEM_COUNT_OPTIONS");
$values = $listcount->getOptionValues();
asort($values, SORT_NUMERIC);
$session = SessionWrapper::getInstance();
$dropdown = new Zend_Form_Element_Select('itemcountperpage', array('multiOptions' => $values, 'view' => new Zend_View(), 'decorators' => array('ViewHelper'), 'class' => array('form-control', 'width75', 'inline', 'input-sm', 'perpageswitcher')));
if (isEmptyString($this->_getParam('itemcountperpage'))) {
if (!isEmptyString($session->getVar('itemcountperpage'))) {
$dropdown->setValue($session->getVar('itemcountperpage'));
if ($session->getVar('itemcountperpage') == 'ALL') {
$session->setVar('itemcountperpage', '');
$dropdown->setValue('50');
}
} else {
$dropdown->setValue('50');
}
} else {
$session->setVar('itemcountperpage', $this->_getParam('itemcountperpage'));
$dropdown->setValue($session->getVar('itemcountperpage'));
}
$this->view->listcountdropdown = '<span>Per page: ' . $dropdown->render() . '</span>';
}
示例9: getListCountDropDown
/**
* @return String
*/
public function getListCountDropDown()
{
$listcount = new LookupType();
$listcount->setName("LIST_ITEM_COUNT_OPTIONS");
$values = $listcount->getOptionValues();
asort($values, SORT_NUMERIC);
$session = SessionWrapper::getInstance();
$dropdown = new Zend_Form_Element_Select('itemcountperpage', array('multiOptions' => $values, 'view' => new Zend_View(), 'decorators' => array('ViewHelper'), 'class' => array('form-control', 'width75', 'inline', 'input-sm')));
if (isEmptyString($this->getItemCountPerPage())) {
$dropdown->setValue($session->getVar('itemcountperpage'));
} else {
$session->setVar('itemcountperpage', $this->getItemCountPerPage());
$dropdown->setValue($this->getItemCountPerPage());
}
$selectobj = '<span>Per page: ' . $dropdown->render() . '</span>';
return $selectobj;
}