public function actionDelete($id)
{
Product::model()->findByPk($id)->deleteNode();
if(!isset($_GET['ajax']))
$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('index'));
}
class DeleteTreeAction extends CAction{
function run(){
$controller = $this->getController();
$modelClass = ucfirst($controller->getId());
$model = new $modelClass();
if(empty($_GET['id']))
throw new CHttpException('Кода нет !!!!!!!!');
if($_GET['id'] != 1){
$model->findByPk((int)$_GET['id']);
$model->deleteNode();
if(!isset($_GET['ajax']))
$this->controller->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('index'));
}
else
throw new Exception('Нельзя удалить корневой узел');
}
}