<?php


class WarrantyRootType implements INodeType
{

    public function getName()
    {
        return 'Гарантии';
    }

    public function isRootNode()
    {
        return true;
    }

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


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

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

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


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