<?php


class AlbumsSectionType implements INodeType
{

    public function getName()
    {
        return 'Фото и видео';
    }

    public function isRootNode()
    {
        return false;
    }

    public function getNestedTypes()
    {
        return array(
//            'textPage',
        );
    }


    public function getActions()
    {
        return array(
            'editAlbumsSection',
            'album',
        );
    }

    public function actionLabels(){
        return array(
            'editAlbumsSection'=>'Данные страницы',
            'album'=>'Альбомы',
        );
    }

    public function createAction($name, $controller, $id = null)
    {
        if($id===null)$id = $name;
        require __DIR__ . '/actions/' . ucfirst($name) . 'Action.php';
        $actionClass = ucfirst($name) . 'Action';
        return new $actionClass($controller, $id);
    }

    /**
     * @return string
     */
    public function getDefaultAction()
    {
        return 'editAlbumsSection';
    }


    public function deleteData($id)
    {
        $model = AlbumsSection::model()->findByPk($id);
        if($model != null) $model->delete();
    }
}
