Esempio n. 1
0
 /**
  * Updates an existing Menu model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         Yii::$app->getSession()->setFlash('success', Yii::t('app', 'Menu has been updated.'));
         return $this->redirect(['view', 'id' => $model->id, 'ru' => ReturnUrl::getRequestToken()]);
     } elseif (!Yii::$app->request->isPost) {
         $model->load(Yii::$app->request->get());
     }
     return $this->render('update', compact('model'));
 }
Esempio n. 2
0
use cornernote\returnurl\ReturnUrl;
/**
 * @var yii\web\View $this
 * @var app\models\Menu $model
 * @var yii\bootstrap\ActiveForm $form
 */
?>

<div class="menu-form">

    <?php 
$form = ActiveForm::begin(['id' => 'Menu', 'enableClientValidation' => false]);
?>

    <?php 
echo Html::hiddenInput('ru', ReturnUrl::getRequestToken());
?>

    <?php 
echo $form->errorSummary($model);
?>
    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>

    <?php 
echo Html::submitButton('<span class="fa fa-check"></span> ' . ($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Save')), ['id' => 'save-' . $model->formName(), 'class' => 'btn btn-success']);
?>

    <?php 
ActiveForm::end();
Esempio n. 3
0
<?php

use yii\helpers\Html;
use cornernote\returnurl\ReturnUrl;
/**
 * @var yii\web\View $this
 * @var cornernote\menu\models\Menu $model
 */
?>

<!-- menu buttons -->
<p class='pull-left'>
    <?php 
echo Html::a('<span class="fa fa-arrow-left"></span> ' . Yii::t('app', 'Back'), ReturnUrl::getUrl(['index']), ['class' => 'btn btn-default']);
?>
    <?php 
echo Html::a('<span class="fa fa-eye"></span> ' . Yii::t('app', 'View'), ['view', 'id' => $model->id, 'ru' => ReturnUrl::getRequestToken()], ['class' => 'btn btn-primary']);
?>
    <?php 
echo Html::a('<span class="fa fa-plus"></span> ' . Yii::t('app', 'Create') . ' ' . Yii::t('app', 'Menu'), ['top_id' => $model->id, 'create', 'ru' => ReturnUrl::getToken()], ['class' => 'btn btn-success modal-remote']);
?>
    <?php 
echo Html::a('<span class="fa fa-pencil"></span> ' . Yii::t('app', 'Update'), ['update', 'id' => $model->id, 'ru' => ReturnUrl::getRequestToken()], ['class' => 'btn btn-info']);
?>
    <?php 
echo Html::a('<span class="fa fa-trash"></span> ' . Yii::t('app', 'Delete'), ['delete', 'id' => $model->id, 'ru' => ReturnUrl::getRequestToken()], ['class' => 'btn btn-danger', 'data-confirm' => '' . Yii::t('app', 'Are you sure to delete this menu?') . '', 'data-method' => 'post']);
?>
</p>

<div class="clearfix"></div>