예제 #1
0
 public function actionDelete($id = null, $parent_id = null)
 {
     if (null === $id || null === ($model = BackendMenu::findById($id))) {
         throw new NotFoundHttpException();
     }
     if (!$model->delete()) {
         Yii::$app->session->setFlash('success', Yii::t('app', 'The object is placed in the cart'));
     } else {
         Yii::$app->session->setFlash('success', Yii::t('app', 'Object has been removed'));
     }
     return $this->redirect(Url::to(['index', 'parent_id' => $model->parent_id]));
 }
예제 #2
0
파일: form.php 프로젝트: tqsq2005/dotplant2
<?php

use app\backend\widgets\BackendWidget;
use kartik\helpers\Html;
use kartik\icons\Icon;
use kartik\widgets\ActiveForm;
use yii\helpers\Url;
/**
 * @var $this \yii\web\View
 * @var $model \app\backend\models\BackendMenu
 */
$this->title = Yii::t('app', 'Backend menu item edit');
$this->params['breadcrumbs'][] = ['url' => ['/backend/backend-menu/index'], 'label' => Yii::t('app', 'Backend menu items')];
if ($model->parent_id > 0 && null !== ($parent = \app\backend\models\BackendMenu::findById($model->parent_id))) {
    $this->params['breadcrumbs'][] = ['url' => ['/backend/backend-menu/index', 'id' => $parent->id, 'parent_id' => $parent->parent_id], 'label' => $parent->name];
}
$this->params['breadcrumbs'][] = $this->title;
?>

<?php 
echo app\widgets\Alert::widget(['id' => 'alert']);
?>

<?php 
$this->beginBlock('submit');
?>
<div class="form-group no-margin">
    <?php 
echo Html::a(Icon::show('arrow-circle-left') . Yii::t('app', 'Back'), Yii::$app->request->get('returnUrl', ['/backend/backend-menu/index']), ['class' => 'btn btn-danger']);
?>
    <?php