本文整理匯總了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'));
}