本文整理汇总了PHP中Zend\View\Renderer\PhpRenderer::table方法的典型用法代码示例。如果您正苦于以下问题:PHP PhpRenderer::table方法的具体用法?PHP PhpRenderer::table怎么用?PHP PhpRenderer::table使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\View\Renderer\PhpRenderer
的用法示例。
在下文中一共展示了PhpRenderer::table方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderFieldset
/** {@inheritdoc} */
public function renderFieldset(\Zend\View\Renderer\PhpRenderer $view, \Zend\Form\Fieldset $fieldset)
{
$headers = array('Id' => 'ID', 'Name' => $view->translate('Name'), 'NetworkInterface.MacAddress' => $view->translate('MAC address'), 'Serial' => $view->translate('Serial number'), 'AssetTag' => $view->translate('Asset tag'), 'LastContactDate' => $view->translate('Last contact'));
$renderCriteria = function ($view, $client, $property) {
$value = $client[$property];
if ($value === null) {
// NULL values are never considered for duplicates and cannot be blacklisted.
return;
}
if ($property == 'NetworkInterface.MacAddress') {
$property = 'MacAddress';
}
// Hyperlink to blacklist form
return $view->htmlElement('a', $view->escapeHtml($value), array('href' => $view->consoleUrl('duplicates', 'allow', array('criteria' => $property, 'value' => $value))), true);
};
$renderCallbacks = array('Id' => function ($view, $client) {
// Display ID and a checkbox. Render checkbox manually because
// ZF's MultiCheckbox element does not handle duplicate values.
// $_POST['clients'] will become an array of selected
// (possibly duplicate) IDs.
return sprintf('<input type="checkbox" name="clients[]" value="%d">%d', $client['Id'], $client['Id']);
}, 'Name' => function ($view, $client) {
// Hyperlink to "customfields" page of given client.
// This allows for easy review of the information about to be merged.
return $view->htmlElement('a', $view->escapeHtml($client['Name']), array('href' => $view->consoleUrl('client', 'customfields', array('id' => $client['Id']))), true);
}, 'NetworkInterface.MacAddress' => $renderCriteria, 'Serial' => $renderCriteria, 'AssetTag' => $renderCriteria);
$formContent = $view->table($this->getOption('clients'), $headers, array('order' => $this->getOption('order'), 'direction' => $this->getOption('direction')), $renderCallbacks);
$formContent .= "<div>\n";
foreach ($this as $element) {
$formContent .= $view->formRow($element, 'append') . "\n";
}
$formContent .= "</div>\n";
return $formContent;
}