<?php


class PartnersSectionType implements INodeType
{

    public function getName()
    {
        return 'Подраздел “Партнеры”';
    }

    public function isRootNode()
    {
        return false;
    }

    public function getNestedTypes()
    {
        return array(
        );
    }


    public function getActions()
    {
        return array(
            'editPartnersSection',
            'aboutPartner',
            'aboutBrand'
        );
    }

    public function actionLabels(){
        return array(
            'editPartnersSection'=>'Данные страницы',
            'aboutPartner'=>'Партнеры',
            'aboutBrand'=>'Бренды',
        );
    }

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


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