本文整理汇总了PHP中DataGrid::hasActions方法的典型用法代码示例。如果您正苦于以下问题:PHP DataGrid::hasActions方法的具体用法?PHP DataGrid::hasActions怎么用?PHP DataGrid::hasActions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataGrid
的用法示例。
在下文中一共展示了DataGrid::hasActions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateContentRow
/**
* Generates datagrid row content.
* @param DibiRow data
* @return Html
*/
protected function generateContentRow($data)
{
$form = $this->dataGrid->getForm(TRUE);
$row = $this->getWrapper('row.content container');
if ($this->dataGrid->hasOperations() || $this->dataGrid->hasActions()) {
$primary = $this->dataGrid->keyName;
if (!isset($data[$primary])) {
throw new InvalidArgumentException("Invalid name of key for group operations or actions. Column '" . $primary . "' does not exist in data source.");
}
}
// checker
if ($this->dataGrid->hasOperations()) {
$value = $form['checker'][$data[$primary]]->getControl();
$cell = $this->getWrapper('row.content cell container')->setHtml((string) $value);
$cell->addClass('checker');
$row->add($cell);
}
// content
foreach ($this->dataGrid->getColumns() as $column) {
$cell = $this->getWrapper('row.content cell container');
$cell->attrs = $column->getCellPrototype()->attrs;
if ($column instanceof ActionColumn) {
$value = '';
foreach ($this->dataGrid->getActions() as $action) {
$html = $action->getHtml();
$html->title($this->dataGrid->translate($html->title));
$action->generateLink(array($primary => $data[$primary]));
$this->onActionRender($html, $data);
$value .= $html->render() . ' ';
}
$cell->addClass('actions');
} else {
if (!array_key_exists($column->getName(), $data)) {
throw new InvalidArgumentException("Non-existing column '" . $column->getName() . "' in datagrid '" . $this->dataGrid->getName() . "'");
}
$value = $column->formatContent($data[$column->getName()], $data);
}
$cell->setHtml((string) $value);
$this->onCellRender($cell, $column->getName(), !$column instanceof ActionColumn ? $data[$column->getName()] : $data);
$row->add($cell);
}
unset($form, $primary, $cell, $value, $action);
$this->onRowRender($row, $data);
return $row;
}