Система управления «Сайт PRO»
Версия 20240107

Класс Row

Объект $Row: Cms\Root\Table\Row наследует Cms\Site\Base

Объект «Строка таблицы»

Исходный код
class Row extends \Cms\Site\Base { … }

Свойства

$row

$Row->row
Исходный код
    var $row;

$Item

$Row->Item
Исходный код
    var $Item;

$class

$Row->class = array();
Исходный код
    var $class = array();

$style

$Row->style = array();
Исходный код
    var $style = array();

$attrs

$Row->attrs = array();
Исходный код
    var $attrs = array();

Методы

init()

$Row->init($row=null, $item=true);
Исходный код
    function init($row = null, $item = true) {
        $Main = $this->Main();
        if ($item) {
            if (is_array($row)) $Item = $Main->load($row);
            elseif (is_object($row)) $Item = $row;
            if ($Item) $Item->open();
            $this->Item = $Item;
        } else {
            $this->row = $row;
        }
    }

get()

$Row->get($name, $default=null);
Исходный код
    function get($name, $default = null) {
        if (isset($this->Item)) return $this->Item->get($name);
        else return $this->row[$name];
    }

href()

$Row->href();
Исходный код
    function href() {
        if (isset($this->Item)) return $this->Item->href();
    }

getPanel()

$Row->getPanel();
Исходный код
    function getPanel() {
        if (isset($this->Item)) return $this->Item->getPanel();
    }

displayPanel()

$Row->displayPanel($panel=null);
Исходный код
    function displayPanel($panel = null) {
        return $this->Main()->callTemplate('display', 'table_panel', $this->Item, array( 'panel' => ($panel === null ? $this->getPanel() : $panel) ));
    }

getClass()

$Row->getClass();
Исходный код
    function getClass() {
        $r = is_array($this->class) ? $this->class : array($this->class);
        if ($class = $this->get('class')) $r[] = $class;
        return $r;
    }

getStyle()

$Row->getStyle();
Исходный код
    function getStyle() {
        $r = is_array($this->style) ? $this->style : array($this->style);
        if ($style = $this->get('style')) $r[] = $style;
        return $r;
    }

getAttrs()

$Row->getAttrs();
Исходный код
    function getAttrs() {
        $r = is_array($this->attrs) ? $this->attrs : array($this->attrs);
        if ($id = $this->get('method')) $r['data-id'] = $id;
        return $r;
    }

displayClass()

$Row->displayClass();
Исходный код
    function displayClass() {
        $html = $this->getClass();
        if (!empty($html)) return ' class="' . htmlspecialchars(implode(' ', $html)) . '"';
    }

displayStyle()

$Row->displayStyle();
Исходный код
    function displayStyle() {
        $html = array();
        foreach ($this->getStyle() as $k => $v) if (isset($v)) $html[] = (is_int($k) ? '' : $k . ':') . $v . ';';
        if (!empty($html)) return ' style="' . htmlspecialchars(implode('', $html)) . '"';
    }

displayAttrs()

$Row->displayAttrs();
Исходный код
    function displayAttrs() {
        $html = array();
        foreach ($this->getAttrs() as $k => $v) if (isset($v)) $html[] = is_int($k) ? htmlspecialchars($v) : htmlspecialchars($k) . '="' . htmlspecialchars($v) . '"';
        if (!empty($html)) return ' ' . implode(' ', $html);
    }