PHP Class skeeks\cms\models\Tree

Inheritance: extends Core, use trait skeeks\cms\models\behaviors\traits\HasRelatedPropertiesTrait
Exibir arquivo Open project: skeeks-cms/cms Class Usage Examples

Public Methods

Method Description
afterDeleteTree ( Event $event ) После удаления нужно родителя пересчитать
afterUpdateTree ( yii\db\AfterSaveEvent $event ) Изменился код
attributeLabels ( )
beforeDeleteTree ( Event $event ) Если есть дети для начала нужно удалить их всех
beforeSaveTree ( $event ) Проверки и дополнения перед сохранением раздела
behaviors ( ) Шаг приоритета
findRoots ( ) : ActiveQuery Корневые разделы дерева.
generateCode ( ) Автоматическая генерация code по названию
generateName ( ) Автоматическая генерация названия раздела
getAbsoluteUrl ( ) : string
getChildren ( ) : ActiveQuery
getCmsContentElementTrees ( ) : ActiveQuery
getCmsContentElements ( ) : ActiveQuery
getCmsSiteRelation ( ) : ActiveQuery
getCmsTreeFiles ( ) : ActiveQuery
getCmsTreeImages ( ) : ActiveQuery
getCmsTreeProperties ( ) : ActiveQuery
getDescendants ( ) : ActiveQuery
getFiles ( ) : ActiveQuery
getFullImage ( ) : ActiveQuery
getImage ( ) : ActiveQuery
getImages ( ) : ActiveQuery
getNext ( ) : ActiveQuery
getParent ( ) : ActiveQuery
getParents ( integer | null $depth = null ) : ActiveQuery
getParentsIds ( null $depth = null ) : array
getPrev ( ) : ActiveQuery
getRedirectTree ( ) : ActiveQuery
getRelatedProperties ( ) : array | ActiveRecord[]
getRoot ( ) : ActiveQuery To get root of a node:
getSite ( ) : CmsSite
getTreeType ( ) : ActiveQuery
getUrl ( $scheme = false ) : string
init ( )
isRoot ( ) : boolean
processAddNode ( Tree $target ) Процесс вставки ноды одна в другую.
processCreateNode ( Tree $target ) : Tree Создание дочерней ноды
processNormalize ( ) Обновление всего дерева ниже, и самого элемента.
rules ( )
setAttributesForFutureParent ( Tree $parent ) Установка атрибутов если родителем этой ноды будет новый, читаем родителя, и обновляем необходимые данные у себя
tableName ( )

Protected Methods

Method Description
isValidCode ( ) : boolean

Method Details

afterDeleteTree() public method

После удаления нужно родителя пересчитать
public afterDeleteTree ( Event $event )
$event yii\base\Event

afterUpdateTree() public method

Изменился код
public afterUpdateTree ( yii\db\AfterSaveEvent $event )
$event yii\db\AfterSaveEvent

attributeLabels() public method

public attributeLabels ( )

beforeDeleteTree() public method

Если есть дети для начала нужно удалить их всех
public beforeDeleteTree ( Event $event )
$event yii\base\Event

beforeSaveTree() public method

Проверки и дополнения перед сохранением раздела
public beforeSaveTree ( $event )
$event

behaviors() public method

Шаг приоритета
public behaviors ( )

findRoots() public static method

Корневые разделы дерева.
public static findRoots ( ) : ActiveQuery
return yii\db\ActiveQuery

generateCode() public method

Автоматическая генерация code по названию
public generateCode ( )

generateName() public method

Автоматическая генерация названия раздела
public generateName ( )

getAbsoluteUrl() public method

public getAbsoluteUrl ( ) : string
return string

getChildren() public method

public getChildren ( ) : ActiveQuery
return yii\db\ActiveQuery

getCmsContentElementTrees() public method

public getCmsContentElementTrees ( ) : ActiveQuery
return yii\db\ActiveQuery

getCmsContentElements() public method

public getCmsContentElements ( ) : ActiveQuery
return yii\db\ActiveQuery

getCmsSiteRelation() public method

public getCmsSiteRelation ( ) : ActiveQuery
return yii\db\ActiveQuery

getCmsTreeFiles() public method

public getCmsTreeFiles ( ) : ActiveQuery
return yii\db\ActiveQuery

getCmsTreeImages() public method

public getCmsTreeImages ( ) : ActiveQuery
return yii\db\ActiveQuery

getCmsTreeProperties() public method

public getCmsTreeProperties ( ) : ActiveQuery
return yii\db\ActiveQuery

getDescendants() public method

public getDescendants ( ) : ActiveQuery
return yii\db\ActiveQuery

getFiles() public method

public getFiles ( ) : ActiveQuery
return yii\db\ActiveQuery

getFullImage() public method

public getFullImage ( ) : ActiveQuery
return yii\db\ActiveQuery

getImage() public method

public getImage ( ) : ActiveQuery
return yii\db\ActiveQuery

getImages() public method

public getImages ( ) : ActiveQuery
return yii\db\ActiveQuery

getNext() public method

public getNext ( ) : ActiveQuery
return yii\db\ActiveQuery

getParent() public method

public getParent ( ) : ActiveQuery
return yii\db\ActiveQuery

getParents() public method

public getParents ( integer | null $depth = null ) : ActiveQuery
$depth integer | null
return yii\db\ActiveQuery

getParentsIds() public method

public getParentsIds ( null $depth = null ) : array
$depth null
return array

getPrev() public method

public getPrev ( ) : ActiveQuery
return yii\db\ActiveQuery

getRedirectTree() public method

public getRedirectTree ( ) : ActiveQuery
return yii\db\ActiveQuery

getRelatedProperties() public method

public getRelatedProperties ( ) : array | ActiveRecord[]
return array | yii\db\ActiveRecord[]

getRoot() public method

To get root of a node:
public getRoot ( ) : ActiveQuery
return yii\db\ActiveQuery

getSite() public method

public getSite ( ) : CmsSite
return CmsSite

getTreeType() public method

public getTreeType ( ) : ActiveQuery
return yii\db\ActiveQuery

getUrl() public method

public getUrl ( $scheme = false ) : string
return string

init() public method

public init ( )

isRoot() public method

public isRoot ( ) : boolean
return boolean

isValidCode() protected method

protected isValidCode ( ) : boolean
return boolean

processAddNode() public method

Можно вставлять как уже сохраненную модель с дочерними элементами, так и еще не сохраненную.
public processAddNode ( Tree $target )
$target Tree

processCreateNode() public method

Создание дочерней ноды
public processCreateNode ( Tree $target ) : Tree
$target Tree
return Tree

processNormalize() public method

Если найти всех рутов дерева и запустить этот метод, то дерево починиться в случае поломки правильно переустановятся все dir, pids и т.д.
public processNormalize ( )

rules() public method

public rules ( )

setAttributesForFutureParent() public method

Установка атрибутов если родителем этой ноды будет новый, читаем родителя, и обновляем необходимые данные у себя
public setAttributesForFutureParent ( Tree $parent )
$parent Tree

tableName() public static method

public static tableName ( )