本文整理汇总了PHP中input::listNames方法的典型用法代码示例。如果您正苦于以下问题:PHP input::listNames方法的具体用法?PHP input::listNames怎么用?PHP input::listNames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类input
的用法示例。
在下文中一共展示了input::listNames方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCode
/**
* Retrieves markup/code of databrowser to be embedded in view.
*
* @return string markup/code of databrowser
*/
public function getCode()
{
// get items to render in databrowser
try {
$this->processInput();
$items = $this->getItems();
} catch (\RuntimeException $e) {
return markup::paragraph(markup::emphasize(_L('Failed to query datasource for listing items.')));
}
// render table including related pager widget
if (count($items)) {
// fetch form to use optionally
$form = $this->getForm();
$volatiles = _A(config::get('databrowser.volatiles', array()))->elements;
$available = input::listNames();
foreach ($volatiles as $volatile) {
if (in_array($volatile, $available)) {
$form->setHidden($volatile, input::vget($volatile));
}
}
// split items into raw data and additionally delivered data per row
$rows = $extras = array();
foreach ($items as $key => $row) {
$rows[$key] = $row;
unset($rows[$key]['|extra']);
$extras[$key] = $row['|extra'];
}
// use local callback to wrap custom cell formatter for enriching
// with additional data per row
$browser = $this;
$cellFormatter = function ($value, $name, $item, $id) use($browser, $extras) {
return $browser->formatCell($value, $name, $item, $id, $extras[$id]);
};
// render table view
$id = $form ? null : $this->datasource->name();
$table = html::arrayToTable($rows, $id, $cellFormatter, array(&$this, 'formatHeader'), '', '', $this->className);
$code = $this->pager . $table;
// wrap rendered table view in form
if ($form && !$this->callerForm) {
$code = (string) $form->addContent($code);
}
// return code of rendered databrowser
return $code;
}
$text = $this->emptyText ? $this->emptyText : _L('There is no data to be listed here ...');
return markup::paragraph(markup::emphasize($text), trim($this->className . ' empty-text'));
}