@param array $row_data
@param Linker $linker       - TableLinker
@param array $linker_array - array for TableLinker link builder

@return string
771160
protected function getParsedHref(array $row_data, Linker $linker, array $linker_array = []): string
    {
        if ($this->href) {
            return $this->replaceHrefParams($row_data);
        }

        return $linker->getHrefWithDoAppend($linker_array);
    }
697452
public function getCellView($cell_data, array $row_data = [])
    {
        if ($this->tooltip_field && $row_data) {
            $this->requireTooltipJavascript();
            $tooltip = $this->replaceTemplateVars($row_data, $this->tooltip_field);

            if ($tooltip) {
                return '<td' . $this->getAttributesView(0, $row_data) . ' tooltip="' . nl2br(htmlspecialchars($tooltip, ENT_QUOTES)) . '" onmouseover="cmsTooltip.show(this,' . $this->tooltip_field_colspan . ')" onmouseout="cmsTooltip.hide(this)">' . $cell_data . '</td>';
            }
        }

        // Order for drag-and-drop
        if ($this instanceof ColumnOrder && isset($row_data['order']) && $this->isDragable()) {
            $this->addDataAttribute('order', $row_data['order']);
        }

        // Cut long strings
        if ($this->cut_long_strings && $cell_data === strip_tags((string)$cell_data)) {
            $cell_data = Converter::cutLongStrings((string)$cell_data, $this->cut_long_strings_limit);
        }

        return '<td' . $this->getAttributesView(false, $row_data) . '>' . $cell_data . '</td>';
    }
1193519
protected function renderDataCellContent($row, $data)
    {
        if ($this->userId !== null) {
            echo TbHtml::linkButton(
                TbHtml::icon(TbHtml::ICON_REMOVE),
                array(
                    'color' => TbHtml::BUTTON_COLOR_LINK,
                    'size' => TbHtml::BUTTON_SIZE_MINI,
                    'url' => array('revoke', 'itemName' => $data['name'], 'userId' => $this->userId),
                    'rel' => 'tooltip',
                    'title' => Yii::t('AuthModule.main', 'Revoke'),
                )
            );
        }
    }
718667
function insertRow($row, $row_id = 0) {
        array_splice($this->_data, $row_id, 0, array($row));

        $this->_updateRowsCols($row);
    }
580831
protected function renderDataCellContent($row, $data)
	{
		$checked = $this->getCheckedState($row, $data);
		$label = $this->makeButtonLabel($checked);
		$icon = $this->makeButtonIcon($checked);
		$url = $this->makeButtonUrl($row, $data);

		if ($this->displayText)
			$this->renderButton($label, $icon, $url);
		else
			$this->renderLink($label, $icon, $url);
	}
674126
public function getRowAt($row_num)
    {
        if ($this->seek($row_num)) {
            $this->next();

            return $this->getCurrentRow();
        } else {
            return null;
        }
    }
574226
public function getValue($rowId, $columnId, $data = null)
    {
        $returnValue = null;

        
		if(!empty($data) && is_string($data) && common_Utils::isUri($data)){
			$data = new core_kernel_classes_Resource($data);
		}
		if($data instanceof core_kernel_classes_Resource){
			$returnValue = $data->getLabel();
		}else{
			$returnValue = $data;//return the data, unaltered
		}
        

        return $returnValue;
    }
254363
public static function viewArray($array_in) {
		if (is_array($array_in)) {
			$result = '
			<table border="1" cellpadding="1" cellspacing="0" bgcolor="white">';
			if (count($array_in) == 0) {
				$result .= '<tr><td><font face="Verdana,Arial" size="1"><strong>EMPTY!</strong></font></td></tr>';
			} else {
				foreach ($array_in as $key => $val) {
					$result .= '<tr>
						<td valign="top"><font face="Verdana,Arial" size="1">' . htmlspecialchars((string) $key) . '</font></td>
						<td>';
					if (is_array($val)) {
						$result .= self::viewArray($val);
					} elseif (is_object($val)) {
						$string = '';
						if (method_exists($val, '__toString')) {
							$string .= get_class($val) . ': ' . (string) $val;
						} else {
							$string .= print_r($val, TRUE);
						}
						$result .= '<font face="Verdana,Arial" size="1" color="red">' .
								   nl2br(htmlspecialchars($string)) .
								   '<br /></font>';
					} else {
						if (gettype($val) == 'object') {
							$string = 'Unknown object';
						} else {
							$string = (string) $val;
						}
						$result .= '<font face="Verdana,Arial" size="1" color="red">' .
								   nl2br(htmlspecialchars($string)) .
								   '<br /></font>';
					}
					$result .= '</td>
					</tr>';
				}
			}
			$result .= '</table>';
		} else {
			$result = '<table border="1" cellpadding="1" cellspacing="0" bgcolor="white">
				<tr>
					<td><font face="Verdana,Arial" size="1" color="red">' .
					  nl2br(htmlspecialchars((string) $array_in)) .
					  '<br /></font></td>
				</tr>
			</table>'; // Output it as a string.
		}
		return $result;
	}
1118185
public function map($linkTableName, $relation, $fields = '*', $where = []): Row
    {
        // 生成关联表模型对象
        $table = $this->makeTable($linkTableName);

        // 生成本表关联字段与关联表关联字段
        list ($field, $linkField) = $this->relation($relation);

        // 如果本表关联字段不存在
        if (!array_key_exists($field, $this->data)) {
            return $this;
        }

        // 生成本表关联字段的所有值
        $key = $this->data[$field];

        if (is_null($key)) {
            $linkRow = false;
        } else {
            // 生成关联表查询条件
            $where[$linkField] = $key;

            // 关联表查询结果
            $linkRow = $table->row($this->append($fields, $linkField), $where);
        }

        // 如果未能对应
        if (!$linkRow) {
            $fields = $this->table->createFields($fields);
            $this->data = $this->appendNull($this->data, $fields);
            return $this;
        }

        // 这里是对应的数据
        $linkRow = $linkRow->toArray();

        // 处理每一个关联的字段
        foreach ($linkRow as $k => $v) {
            // 如果本表已经有此字段,则不扩展
            if (!array_key_exists($k, $this->data)) {
                $this->data[$k] = $v;
            }
        }

        return $this;
    }
1060506
protected function getRowSql($data, $columnFields) {
        $args = [];
        foreach ($data as $key => $item) {
            if (is_null($item)) {
                $args[] = 'NULL';
                continue;
            }
            if (array_key_exists($key, $columnFields) && $columnFields[$key]) {
                $args[] = $item;
                continue;
            }
            $args[] = sprintf('\'%s\'',
                str_replace(
                    ["\r\n", "\r", "\n", '\\\'', '\''],
                    ["\n", '\r\n', '\r\n', '\'', '\\\''], $item));
        }
        return implode(',',$args);
    }
1168106
protected function linksForJson($uri, $links, $arrayLinkRels)
    {
        $data = array();
        if (!is_null($uri)) {
            $data['self'] = array('href' => $uri);
        }
        foreach ($links as $rel => $links) {
            if (count($links) === 1 && $rel !== 'curies' && !in_array($rel, $arrayLinkRels)) {
                $data[$rel] = array('href' => $links[0]->getUri());
                foreach ($links[0]->getAttributes() as $attribute => $value) {
                    $data[$rel][$attribute] = $value;
                }
            } else {
                $data[$rel] = array();
                foreach ($links as $link) {
                    $item = array('href' => $link->getUri());
                    foreach ($link->getAttributes() as $attribute => $value) {
                        $item[$attribute] = $value;
                    }
                    $data[$rel][] = $item;
                }
            }
        }

        return $data;
    }
423748
public function renderRow($row, array $data = [])
    {
        if (is_string($row)) {
            if (null === $element = $this->editor->getRepository()->findRowByName($row)) {
                $this->persist($element = $this->editor->getRowManager()->create($row, $data));
            }
            $row = $element;
        }

        if ($row instanceof EM\RowInterface) {
            $this->tagManager->addTags($row->getEntityTag());

            $row = $this->editor->getViewBuilder()->buildRow($row);
        }

        if (!$row instanceof View\RowView) {
            throw new Exception\InvalidArgumentException(
                'Expected string or instance of ' .
                EM\RowInterface::class . ' or ' .
                View\RowView::class
            );
        }

        /** @noinspection PhpInternalEntityUsedInspection */
        return $this->getTemplate()->renderBlock('cms_row', [
            'row' => $row,
        ]);
    }
109369
private function getRow($row_number, array $row)
    {
        $message = '';
        foreach ($row as $cell_number => $player) {
            $withBackground = $this->drawCellBackground($row_number, $cell_number);
            $message .= ($withBackground ? "|<bg={$this->background_color}> " : '| ')
                        . $this->getPlayerChar($player, $withBackground)
                        . ($withBackground ? " </bg={$this->background_color}>" : ' ')
            ;
        }
        $message .= "|\n";
        $message .= $this->getLineSeparator();

        return $message;
    }
1316314
public function buildList(array $router_data)
    {
        if (!empty($this->nodes)) {
            return $this->nodes;
        }

        $this->nodes = [];

        if ($router_data['http_method'] == 'GET') {
            $cache_key = md5('cms_node_list'.serialize($router_data));
            if (false == $this->nodes = $this->tagcache->get($cache_key)) {
                $this->nodes = [];
            } else {
                return $this->nodes;
            }
        }

        \Profiler::start('buildNodesList');

        $used_nodes = [];
        $lockout_nodes = [   // @todo блокировку нод.
            'single'  => [], // Блокировка нод в папке, без наследования.
            'inherit' => [], // Блокировка нод в папке, с наследованием.
            'except'  => []  // Блокировка всех нод в папке, кроме заданных.
        ];

        /** @var $folder \SmartCore\Bundle\CMSBundle\Entity\Folder */
        foreach ($router_data['folders'] as $folder) {
            // @todo блокировку нод.
            // Режим 'single' каждый раз сбрасывается и устанавливается заново для каждой папки.
            /*
            $lockout_nodes['single'] = [];
            if (isset($parsed_uri_value['lockout_nodes']['single']) and !empty($parsed_uri_value['lockout_nodes']['single'])) {
                //$lockout_nodes['single'] = $parsed_uri_value['lockout_nodes']['single'];
                $tmp = explode(',', $parsed_uri_value['lockout_nodes']['single']);
                foreach ($tmp as $single_value) {
                    $t = trim($single_value);
                    if (!empty($t)) {
                        $lockout_nodes['single'][trim($single_value)] = 'blocked'; // ставлю тупо 'blocked', но главное в массиве с блокировками, это индексы.
                    }
                }
            }

            // Блокировка нод в папке, с наследованием.
            if (isset($parsed_uri_value['lockout_nodes']['inherit']) and !empty($parsed_uri_value['lockout_nodes']['inherit'])) {
                $tmp = explode(',', $parsed_uri_value['lockout_nodes']['inherit']);
                foreach ($tmp as $inherit_value) {
                    $t = trim($inherit_value);
                    if (!empty($t)) {
                        $lockout_nodes['inherit'][trim($inherit_value)] = 'blocked'; // ставлю тупо 'blocked', но главное в массиве с блокировками, это индексы.
                    }
                }
            }

            // Блокировка всех нод в папке, кроме заданных.
            if (isset($parsed_uri_value['lockout_nodes']['except']) and !empty($parsed_uri_value['lockout_nodes']['except'])) {
                $tmp = explode(',', $parsed_uri_value['lockout_nodes']['except']);
                foreach ($tmp as $except_value) {
                    $t = trim($except_value);
                    if (!empty($t)) {
                        $lockout_nodes['except'][trim($except_value)] = 'blocked'; // ставлю тупо 'blocked', но главное в массиве с блокировками, это индексы.
                    }
                }
            }
            */

            if ($folder->getId() == $this->context->getCurrentFolderId()) { // Обработка текущей папки.
                $result = $this->repository->getInFolder($folder, $used_nodes);
            } elseif ($folder->getRegions()->count() > 0) { // В этой папке есть ноды, которые наследуются...
                $result = $this->repository->getInheritedInFolder($folder);
            } else { // В папке нет нод для сборки.
                continue;
            }

            while ($node_id = $result->fetchColumn(0)) {
                // @todo права доступа к ноде.
                /*if ($this->Permissions->isAllowed('node', 'read', $row->permissions) == 0) {
                    continue;
                }*/

                // Создаётся список нод, которые уже в включены.
                if ($folder->getRegions()->count() > 0) {
                    $used_nodes[] = $node_id;
                }

                $this->nodes[$node_id] = $node_id;
            }
        }

        foreach ($lockout_nodes['single'] as $node_id) {
            unset($this->nodes[$node_id]);
        }

        foreach ($lockout_nodes['inherit'] as $node_id) {
            unset($this->nodes[$node_id]);
        }

        if (!empty($lockout_nodes['except'])) {
            foreach ($this->nodes as $node_id) {
                if (!array_key_exists($node_id, $lockout_nodes['except'])) {
                    unset($this->nodes[$node_id]);
                }
            }
        }

        // Заполнение массива с нодами сущностями нод.
        foreach ($this->repository->findIn($this->nodes) as $node) {
            if (isset($router_data['node_routing']['controller'])
                and $router_data['node_routing']['node_id'] == $node->getId()
            ) {
                $node->setController($router_data['node_routing']['controller']);
                $node->setPriority(255);
            }

            $this->nodes[$node->getId()] = $node;
        }

        // @todo продумать в каком месте лучше кешировать ноды, также продумать инвалидацию.
        /*
        $is_cached = true;
        $cache = $this->container->get('cms.cache');
        $nodes = [];
        $list = '';
        foreach ($this->nodes as $node_id) {
            $list .= $node_id . ',';

            if ($cache->hasNode($node_id)) {
                $nodes[] = $cache->getNode($node_id);
            } else {
                $is_cached = false;
            }
        }

        if (strlen($list)) {
            if (!$is_cached) {
                $em = $this->container->get('doctrine')->getManager();
                $list = substr($list, 0, strlen($list)-1);
                $query = $em->createQuery("
                    SELECT n
                    FROM CMSBundle:Node n
                    WHERE n.node_id IN({$list})
                    ORDER BY n.position ASC
                ");
                $nodes = $query->getResult();
            }

            // Приведение массива в вид с индексами в качестве ID нод.
            foreach ($nodes as $node) {
                if (!$is_cached) {
                    $cache->setNode($node);
                }

                if (isset($router_data['node_route']['response']) and $router_data['node_route']['id'] == $node->getId()) {
                    $node->setRouterResponse($router_data['node_route']['response']);
                }

                $this->nodes[$node->getId()] = $node;
            }
        }
        */

        \Profiler::end('buildNodesList');

        if ($router_data['http_method'] == 'GET') {
            $this->tagcache->set($cache_key, $this->nodes, ['folder', 'node']);
        }

        return $this->nodes;
    }
810288
public function getView(int $row, array $row_data, Linker $linker): string
    {
        $cell = '';
        $id = $this->getCellData($row_data, $this->id_column);
        $for_show = $this->getCellData($row_data, $this->show_key);

        if ($this->href) {
            $for_show = '<a class="nounderline" href="' . $this->getParsedHref($row_data, new Linker((\defined('P') ? P : ''), $_GET['do'] ?? '')) . '">' . $for_show . '</a>';
        }

        if ($this->ajax) {
            // Check that we have child data
            if (!isset($row_data['ajax_tree_leaf'])) {
                throw new RuntimeException('If you are using ColumnTree with ajax and table contains data array not sql, please add following column to select:
                    ",IF ((SELECT `' . $this->id_column . '` FROM `YOUR_TABLE` WHERE `' . $this->pid_column . '` = `YOUR_TABLE_ALIAS`.`' . $this->id_column . '` LIMIT 1) IS NULL, 1, 0) AS `ajax_tree_leaf`"');
            }

            $cell = '<div style="padding-left: '
                . (($this->getRowLevel($id) + (isset($_GET['ajax_tree_node_lvl']) ? (int)$_GET['ajax_tree_node_lvl'] : 0)) * $this->child_padding)
                . 'px">'
                . (!$row_data['ajax_tree_leaf']
                    ? '<a href="" class="nounderline" style="font-family: monospace;" id="toggle_'
                        . $id
                        . '" onclick="'
                        . $this->js_object_name
                        . '.toggleAjax(\'' . $id . '\'); return false;">+</a>&nbsp;'
                    : '<span style="visibility: hidden; style="font-family: monospace;">+</span>&nbsp;'
                )
                . $for_show . '</div>';
        } else {
            $cell = '<div style="padding-left: '
                . ($this->getRowLevel($id) * $this->child_padding)
                . 'px">'
                . (isset($this->child_ids[$id]) && $this->child_ids[$id]['children']
                    ? '<a href="" class="nounderline" style="font-family: monospace;" id="toggle_'
                        . $id
                        . '" onclick="'
                        . $this->js_object_name
                        . '.toggle(\'' . $id . '\'); return false;">+</a>&nbsp;'
                    : '<span style="visibility: hidden; style="font-family: monospace;">+</span>&nbsp;'
                ) . $for_show . '</div>';
        }

        return $this->getCellView($cell, $row_data);
    }
1115330
protected function renderRowCells(PHPRtfLite_Table_Row $row)
    {
        $rowIndex = $row->getRowIndex();

        foreach ($this->getColumns() as $columnIndex => $column) {
            $cell = $this->getCell($rowIndex, $columnIndex + 1);
            if (!$cell->isHorizontalMerged()) {
                $cell->render();
            }
        }
    }
1120314
protected function getLink($linkData): string
    {
        $link = '';
        if (\is_array($linkData)) {
            $link = $linkData['link'] ?? '';
        } elseif (\is_string($linkData)) {
            $link = $linkData;
        }
        return $link;
    }