MenuController::actionCreate PHP Method

actionCreate() public method

If creation is successful, the browser will be redirected to the 'view' page.
public actionCreate ( )
    public function actionCreate()
    {
        $model = new Menu();
        // Uncomment the following line if AJAX validation is needed
        // $this->performAjaxValidation($model);
        if (isset($_POST['Menu'])) {
            $model->attributes = $_POST['Menu'];
            $parent_node = $_POST['Menu']['node'];
            if ($parent_node != 0) {
                $node = Menu::model()->findByPk($parent_node);
                $model->appendTo($node);
                //            print_r($_POST['DealMenu']);
                //            exit;
            }
            if ($model->saveNode()) {
                $this->redirect(array('admin'));
            }
        }
        $this->render('create', array('model' => $model));
    }