<?php


class AboutRootType implements INodeType
{

    public function getName()
    {
        return 'Раздел “О компании”';
    }

    public function isRootNode()
    {
        return true;
    }

    public function getNestedTypes()
    {
        return array(
            'aboutSection',
            'jobsSection',
            'partnersSection',
        );
    }


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

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

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


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