Table::renderBodyColumn

@param Element                                   $td
@param array                                     $column
@param \O2System\Database\DataObjects\Result\Row $row
775600
protected function renderBodyColumn($td, array $column, Result\Row $row)
    {
        switch ($column[ 'format' ]) {
            default:
                if (is_callable($column[ 'format' ])) {
                    if (is_array($column[ 'field' ])) {
                        foreach ($column[ 'field' ] as $field) {
                            $args[ $field ] = $row->offsetGet($field);
                        }
                        $textContent = call_user_func_array($column[ 'format' ], $args);
                    } elseif ($row->offsetExists($column[ 'field' ])) {
                        $textContent = call_user_func_array($column[ 'format' ],
                            [$row->offsetGet($column[ 'field' ])]);
                    }

                    $td->textContent->push($textContent);

                } elseif (strpos($column[ 'format' ], '{{') !== false) {
                    $textContent = str_replace(['{{', '}}'], '', $column[ 'format' ]);
                    if (is_array($column[ 'field' ])) {
                        foreach ($column[ 'field' ] as $field) {
                            if ($row->offsetExists($field)) {
                                $textContent = str_replace('$' . $field, $row->offsetGet($field), $textContent);
                            } else {
                                $textContent = str_replace('$' . $field, '', $textContent);
                            }
                        }
                    } elseif ($row->offsetExists($column[ 'field' ])) {
                        $textContent = str_replace('$' . $column[ 'field' ], $row->offsetGet($column[ 'field' ]),
                            $textContent);
                    }

                    $td->textContent->push($textContent);
                }
                break;

            case 'checkbox':
                $checkbox = new Ui\Components\Form\Elements\Checkbox([
                    'data-role' => 'table-crud-checkbox',
                ]);
                $td->childNodes->push($checkbox);
                break;

            case 'number':
            case 'txt':
            case 'text':
            case 'price':
            case 'number':
                if ($row->offsetExists($column[ 'field' ])) {
                    $td->textContent->push($row->offsetGet($column[ 'field' ]));
                }
                break;
            case 'date':
                if ($row->offsetExists($column[ 'field' ])) {
                    print_out('date');
                }
                break;

            case 'status':
                if ($row->offsetExists($column[ 'field' ])) {
                    $options = [
                        'PUBLISH'   => 'success',
                        'UNPUBLISH' => 'warning',
                        'DRAFT'     => 'default',
                        'ARCHIVE'   => 'info',
                        'DELETE'    => 'danger',
                    ];

                    $badge = new Ui\Components\Badge(
                        language()->getLine('TABLE_OPTION_' . $row->offsetGet($column[ 'field' ])),
                        $options[ $row->offsetGet($column[ 'field' ]) ]
                    );

                    $td->childNodes->push($badge);
                }

                break;

            case 'actions':

                $buttons = new Ui\Components\Buttons\Group();

                foreach ($this->actions as $key => $action) {

                    if ($action[ 'show' ] === false) {
                        continue;
                    }

                    if ($action[ 'label' ] === true) {
                        $button = $buttons->createButton(language()->getLine('TABLE_BUTTON_' . strtoupper($key)));
                        if ( ! empty($action[ 'icon' ])) {
                            $button->setIcon($action[ 'icon' ]);
                        }
                    } else {
                        $button = $buttons->createButton(new Ui\Contents\Icon($action[ 'icon' ]));
                        $button->attributes->addAttribute('data-toggle', 'tooltip');
                        $button->attributes->addAttribute('title',
                            language()->getLine('TABLE_BUTTON_' . strtoupper($key)));
                    }

                    if (isset($action[ 'attr' ])) {
                        foreach ($action[ 'attr' ] as $name => $value) {
                            $button->attributes->addAttribute($name, $value);
                        }
                    }

                    $button->setContextualClass($action[ 'contextual' ]);
                    $button->smallSize();
                    $button->attributes->addAttribute('data-action', $key);
                }

                $td->childNodes->push($buttons);

                break;
        }
    }
468233
protected function _render(array $row, $widths, $options = [])
    {
        if (count($row) === 0) {
            return;
        }

        $out = '';
        foreach (array_values($row) as $i => $column) {
            $pad = $widths[$i] - $this->_cellWidth($column);
            if (!empty($options['style'])) {
                $column = $this->_addStyle($column, $options['style']);
            }
            $out .= '| ' . $column . str_repeat(' ', $pad) . ' ';
        }
        $out .= '|';
        $this->_io->out($out);
    }
594758
public function pre(Column\Pre $column, array $row)
    {
        $html = html('pre', [],$column->getValue($row));
        return $this->post($html, $column, $row);
    }
580351
private function renderHeaderCell($column)
    {
        if ($column->isHiddenInput()) {
            return null;
        }

        $options = $column->headerOptions;
        Html::addCssClass($options, 'list-cell__' . $column->name);

        return Html::tag('th', $column->title, $options);
    }
972338
protected function displayGroupHeader($row)
    {
        $tr_tag = new SwatHtmlTag('tr');
        $tr_tag->class = 'swat-table-view-group';
        $tr_tag->open();

        $td_tag = new SwatHtmlTag('td', $this->getTdAttributes());
        $td_tag->colspan = $this->view->getXhtmlColspan();
        $td_tag->open();
        $this->displayRenderersInternal($row);
        $td_tag->close();

        $tr_tag->close();
    }
706840
public function renderRowDefinition(PHPRtfLite_Table_Row $row)
    {
        $rowIndex = $row->getRowIndex();
        $stream = $this->getRtf()->getWriter();
        $stream->write('\trowd');

        if ($this->_alignment) {
            switch ($this->_alignment) {
                case self::ALIGN_CENTER:
                    $stream->write('\trqc');
                    break;

                case self::ALIGN_RIGHT:
                    $stream->write('\trqr');
                    break;

                default:
                    $stream->write('\trql');
                    break;
            }
        }

        $rowHeight = $row->getHeight();
        if ($rowHeight) {
            $stream->write('\trrh' . PHPRtfLite_Unit::getUnitInTwips($rowHeight));
        }

        if ($this->isPreventPageBreak()) {
            $stream->write('\trkeep ');
        }

        if ($this->isFirstRowHeader() && $rowIndex == 1) {
            $stream->write('\trhdr ');
        }

        if ($this->getLeftPosition() != '') {
            $stream->write('\trleft' . PHPRtfLite_Unit::getUnitInTwips($this->getLeftPosition()) . ' ');
        }

        $width = 0;
        foreach ($this->getColumns() as $columnIndex => $column) {
            $cell = $this->getCell($rowIndex, $columnIndex + 1);

            // render cell definition
            if (!$cell->isHorizontalMerged()) {
                $cell->renderDefinition();

                // cell width
                $width += PHPRtfLite_Unit::getUnitInTwips($cell->getWidth());
                $stream->write('\cellx' . $width);
            }
        }
    }
1023505
private function renderRowContent($index = null, $item = null)
    {
        $elements = [];

        $columnIndex = 0;
        foreach ($this->columns as $column) {
            /* @var $column BaseColumn */
            $column->setModel($item);
            $elements[] = $this->renderCellContent($column, $index, $columnIndex++);
        }

        $content = [];
        $content[] = Html::tag('td', implode("\n", $elements));
        if ($this->max !== $this->min) {
            $content[] = $this->renderActionColumn($index);
        }

        if ($this->cloneButton) {
            $content[] = $this->renderCloneColumn();
        }

        $content = Html::tag('tr', implode("\n", $content), $this->prepareRowOptions($index, $item));

        if ($index !== null) {
            $content = str_replace('{' . $this->getIndexPlaceholder() . '}', $index, $content);
        }

        return $content;
    }
168176
function makeBody(col, row, data) {
  let body = '<tbody>';
  let index = col;

  for (let irow = 0; irow < row; irow += 1) {
    body += '<tr>';

    for (let icol = 0; icol < col; icol += 1) {
      body += '<td>';

      if (data) {
        body += data[index];
        index += 1;
      }

      body += '</td>';
    }

    body += '</tr>';
  }

  body += '</tbody>';

  return body;
}
1008875
protected function renderColumn($column, $index)
    {
        if (is_string($this->template)) {
            return strtr($this->template, [
                '{label}' => $column->renderHeaderCell(),
                '{value}' => $column->renderDataCell($this->model, $this->model->getPrimaryKey(), 0),
            ]);
        }

        return call_user_func($this->template, $column, $index, $this);
    }
270498
public function render(Varien_Object $row)
    {
        $renderActions = [];

        $actions = $this->getColumn()->getActions();
        if (is_array($actions)) {
            foreach ($actions as $action) {
                if (isset($action['checks'])) {
                    $fail = false;
                    $checks = array_filter(array_map('trim', explode(',', $action['checks'])));
                    foreach ($checks as $check) {
                        $negativeCheck = (substr($check, 0, 1) === '!');
                        $check = ($negativeCheck ? substr($check, 1) : $check);
                        $value = (strpos($check, '/') === false ? $row->getDataUsingMethod($check) : $row->getData($check));
                        if ((bool)$value === $negativeCheck) {
                            $fail = true;
                            break;
                        }
                    }
                    if ($fail) {
                        continue;
                    }
                }
                $renderActions[] = $action;
            }
        }

        if (empty($renderActions)) {
            return '&nbsp;';
        }

        $linkLimit = ($this->getColumn()->getNoLink() ? 0 : max(intval($this->getColumn()->getLinkLimit()), 1));

        $out = '';

        if (count($renderActions) <= $linkLimit) {
            foreach ($renderActions as $action) {
                if (is_array($action)) {
                    $out .= $this->_toLinkHtml($action, $row);
                }
            }
        } else {
            $out .= '<select class="action-select" onchange="varienGridAction.execute(this);">';
            $out .= '<option value=""></option>';
            foreach ($renderActions as $action) {
                if (is_array($action)) {
                    $out .= $this->_toOptionHtml($action, $row);
                }
            }
            $out .= '</select>';
        }

        return $out;
    }
1092983
public function renderRow()
    {
        $this->t_row->set($this->model);

        if ($this->use_html_tags) {
            // Prepare row-specific HTML tags.
            $html_tags = [];

            foreach ($this->hook('getHTMLTags', [$this->model]) as $ret) {
                if (is_array($ret)) {
                    $html_tags = array_merge($html_tags, $ret);
                }
            }

            foreach ($this->columns as $name => $columns) {
                if (!is_array($columns)) {
                    $columns = [$columns];
                }
                $field = $this->model->hasElement($name);
                foreach ($columns as $column) {
                    if (!method_exists($column, 'getHTMLTags')) {
                        continue;
                    }
                    $html_tags = array_merge($column->getHTMLTags($this->model, $field), $html_tags);
                }
            }

            // Render row and add to body
            $this->t_row->setHTML($html_tags);
            $this->t_row->set('_id', $this->model->id);
            $this->template->appendHTML('Body', $this->t_row->render());
            $this->t_row->del(array_keys($html_tags));
        } else {
            $this->template->appendHTML('Body', $this->t_row->render());
        }
    }
423418
public function code(Column\Code $column, array $row)
    {
        $html = html('code', [],$column->getValue($row));
        return $this->post($html, $column, $row);
    }
907610
protected function displayRenderers($row)
    {
        $offset = $this->offset;

        if ($this->title != '') {
            if ($offset === 0) {
                $offset = 1;
            }

            $th_tag = new SwatHtmlTag('th', $this->getThAttributes());
            $th_tag->colspan = $offset;
            $th_tag->setContent(
                sprintf(Swat::_('%s:'), $this->title),
                $this->title_content_type
            );
            $th_tag->display();
        } elseif ($offset > 0) {
            $td_tag = new SwatHtmlTag('td');
            $td_tag->colspan = $offset;
            $td_tag->setContent('&nbsp;', 'text/xml');
            $td_tag->display();
        }

        $td_tag = new SwatHtmlTag('td', $this->getTdAttributes());
        $td_tag->colspan = $this->view->getXhtmlColspan() - $offset;

        $td_tag->open();
        $this->displayRenderersInternal($row);
        $td_tag->close();
    }
377418
public function render(Row $row)
	{
		if (!$this->shouldBeRendered($row)) {
			return null;
		}

		try {
			// Renderer function may be used
			return $this->useRenderer($row);
		} catch (DataGridColumnRendererException $e) {
			// Do not use renderer
		}

		$link = $this->createLink(
			$this->grid,
			$this->href,
			$this->getItemParams($row, $this->params) + $this->parameters
		);

		$a = Html::el('a')->href($link);

		$this->tryAddIcon($a, $this->getIcon($row), $this->getName());

		if (!empty($this->data_attributes)) {
			foreach ($this->data_attributes as $key => $value) {
				$a->data($key, $value);
			}
		}

		if (!empty($this->attributes)) {
			$a->addAttributes($this->attributes);
		}

		$a->addText($this->translate($this->getName()));

		if ($this->title) {
			$a->title($this->translate($this->getTitle($row)));
		}

		if ($this->class) {
			$a->class($this->getClass($row));
		}

		if ($confirm = $this->getConfirm($row)) {
			$a->data(static::$data_confirm_attribute_name, $confirm);
		}

		if ($this->open_in_new_tab) {
			$a->addAttributes(['target' => '_blank']);
		}

		return $a;
	}
441633
protected function renderDataCellContent($row, $data)
    {
        /* @var $am CAuthManager|AuthBehavior */
        $am = Yii::app()->getAuthManager();

        /* @var $controller AssignmentController */
        $controller = $this->grid->getController();

        $assignments = $am->getAuthAssignments($data->{$this->idColumn});
        $permissions = $am->getItemsPermissions(array_keys($assignments));
        foreach ($permissions as $itemPermission) {
            echo $itemPermission['item']->description;
            echo ' <small>' . $controller->getItemTypeText($itemPermission['item']->type, false) . '</small><br />';
        }
    }
1011936
public static function renderTable(
        array $head = [], 
        array $body = [], 
        array $attributes = []
    ) : string 
    {
        $strHead = "";
        $strBody = "";
        
        foreach ($head as $thRow) {
            $strHead .= self::renderTableHeaderRow($thRow);
        }
        if ($strHead != "") {
            $strHead = self::thead($strHead);
        }
        
        foreach ($body as $tr) {
            $strBody .= self::renderTableRow($tr);
        }
        if ($strBody != "") {
            $strBody = self::tbody($strBody);
        }
        
        return self::tag("table", $strHead.$strBody, $attributes);
    }
815523
protected function renderTableBodyJSON($rows)
	{
		$tbody = array(
			'headers' => array(),
			'rows' => array(),
			'keys' => array(),
			'summary' => array()
		);
		foreach ($this->columns as $column) {
			$tbody['headers'][] = $column->renderHeaderCell();
		}

		if ($rows > 0) {
			for ($row = 0; $row < $rows; ++$row) {
				$tbody['rows'][] = $this->renderTableRowJSON($row);
			}

			foreach ($this->dataProvider->getKeys() as $key) {
				$tbody['keys'][] = CHtml::encode($key);
			}

		} else {
			ob_start();
			$this->renderEmptyText();
			$content = ob_get_contents();
			ob_end_clean();

			$tbody['rows'][0]['cols'][] = array(
				'attrs' => "colspan=\"" . count($this->columns) . "\"",
				'content' => $content
			);
			$tbody['rows'][0]['class'] = " ";
		}
		$tbody['pager'] = $this->renderPager();
		$tbody['url'] = Yii::app()->getRequest()->getUrl();
		$tbody['summary'] = $this->renderSummary();
		return $tbody;
	}