<?php


class AboutSectionType implements INodeType
{

    public function getName()
    {
        return 'Текстовый подраздел';
    }

    public function isRootNode()
    {
        return false;
    }

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


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

    public function actionLabels(){
        return array(
            'editAboutSection'=>'Данные страницы',
        );
    }

    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 'editAboutSection';
    }


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