isActiveRotation(); $noBody = ! empty($noBody); $noEmpty = ! empty($noEmpty); $nestedSetsTree = ! empty($this->nestedSetsTree) ? $this->nestedSetsTree : false; $attrRowCallable = null; $actionsRowCallable = null; $columnsVisible = 0; foreach ($this->columns as &$c) { $visible = true; if ($c['showIf'] !== false && ! call_user_func($c['showIf'], $c)) { $visible = false; } $c['visible'] = $visible; if ($visible) { $columnsVisible++; } if (isset($c['attrRow']) && is_callable($c['attrRow'])) { $attrRowCallable = $c['attrRow']; } if (isset($c['actionsRow']) && is_callable($c['actionsRow'])) { $actionsRowCallable = $c['actionsRow']; } if (isset($c['title']) && $c['title'] instanceof Closure) { $c['title'] = call_user_func($c['title'], $this); } } unset($c); if ( ! empty($rowActions)) { $columnsVisible++; func::sortByPriority($rowActions); } $cntRowActionsMore = 0; if (! empty($rowActionsMore)) { foreach ($rowActionsMore as $v) { if (isset($rowActions[$v])) { $cntRowActionsMore++; } } } if ($columnsVisible > 0 && $rotationEnabled) { $columnsVisible++; } func::sortByPriority($this->columns); $massEnabled = $this->isMassActions(); $massKey = $massEnabled ? $this->massActions()->idKey() : false; $massAll = $massEnabled ? $this->massActions()->selectAll() : false; if ($columns && $this->showHeader) { ?> 0) { ?>
columns as $id=>$c) { if ( ! $c['visible']) continue; $attr = &$c['attr.head']; $attr['data-id'] = $id; Block::attrAdd($attr, 'class', 'j-list-column'); if ( ! empty($c['width'])) { $attr['width'] = $c['width']; } if ($c['align'] !== false) { switch ($c['align']) { case BlockList::COLUMN_ALIGN_LEFT: Block::attrAdd($attr, 'class', 'text-left'); break; case BlockList::COLUMN_ALIGN_RIGHT: Block::attrAdd($attr, 'class', 'text-right'); break; case BlockList::COLUMN_ALIGN_CENTER: Block::attrAdd($attr, 'class', 'text-center'); break; } } ?> > rows) && $columnsVisible > 0) { foreach ($this->columns as $key=>&$column) { if ( ! $column['visible']) continue; if ($column['align'] !== false) { switch ($column['align']) { case BlockList::COLUMN_ALIGN_LEFT: Block::attrAdd($column['attr.cell'], 'class', ['text-left', 'c-shadow-overflow']); break; case BlockList::COLUMN_ALIGN_RIGHT: Block::attrAdd($column['attr.cell'], 'class', ['text-right', 'c-shadow-overflow']); break; case BlockList::COLUMN_ALIGN_CENTER: Block::attrAdd($column['attr.cell'], 'class', ['text-center', 'c-shadow-overflow']); break; } } } unset($column); foreach ($this->rows as $row) { if ( ! array_key_exists($this->rowsIdKey, $row)) { continue; } if ($this->rowsFilter !== null && call_user_func($this->rowsFilter, $row) === false) { continue; } $id = $row[$this->rowsIdKey]; $attrRow = array('class'=>['j-list-row']); $attrRow['data-id'] = $id; if ($rotationEnabled || $nestedSetsTree) { $attrRow['id'] = $this->dndID.$id; } if ($nestedSetsTree) { if (isset($row[ $nestedSetsTree['fieldPID'] ])) { $attrRow['data-pid'] = $row[ $nestedSetsTree['fieldPID'] ]; } if (isset($row[ $nestedSetsTree['fieldNumlevel'] ])) { $attrRow['data-numlevel'] = $row[ $nestedSetsTree['fieldNumlevel'] ]; } } if ($this->isPaginationMore()) { Block::attrAdd($attrRow, 'class', 'j-more-item'); } if ($attrRowCallable && is_callable($attrRowCallable)) { $attrRow = call_user_func_array($attrRowCallable, [ 'attr' => $attrRow, 'row' => & $row ]); } ?>> columns as $key => $column) { if ( ! $column['visible']) continue; if (array_key_exists('render', $column)) { $isFullRow = false; $html = ''; Block::obCallable($html, $column['render'], function($callable) use(& $row, $key, & $isFullRow, & $column) { return call_user_func_array($callable, array( 'value' => (array_key_exists($key, $row) ? $row[$key] : null), 'row' => &$row, 'options' => ['full'=>&$isFullRow, 'column'=>&$column], )); }); $row[$key] = $html; if ($isFullRow) { echo $row[$key]; continue; } else { $column['type'] = $this::COLUMN_TYPE_CUSTOM; } } ?>>
rowActionsAttr, 'class', ['l-table-actions', 'j-mob-table-menu']); ?> rowActionsAttr) ?>> $v, 'row' => &$row, )); } tpl::start(); switch ($v['key']) { case $this::ACTION_EMPTY: { ?> $v['callable']]; } $html = ''; Block::obCallable($html, $v['callable'], function($callable) use (& $row) { return call_user_func($callable, $row); }); echo $html; } break; } $actionHtml = tpl::stop(); if (empty($rowActionsMore) || ! in_array($v['key'], $rowActionsMore)) { echo $actionHtml; } else { $actionsMore[] = $actionHtml; } } if (! empty($actionsMore)) { ?>