/** * Returns a list of behaviors that this component should behave as. * * Child classes may override this method to specify the behaviors they want to behave as. * * The return value of this method should be an array of behavior objects or configurations * indexed by behavior names. A behavior configuration can be either a string specifying * the behavior class or an array of the following structure: * * ```php * 'behaviorName' => [ * 'class' => 'BehaviorClass', * 'property1' => 'value1', * 'property2' => 'value2', * ] * ``` * * Note that a behavior class must extend from [[Behavior]]. Behavior names can be strings * or integers. If the former, they uniquely identify the behaviors. If the latter, the corresponding * behaviors are anonymous and their properties and methods will NOT be made available via the component * (however, the behaviors can still respond to the component's events). * * Behaviors declared in this method will be attached to the component automatically (on demand). * * @return array the behavior configurations. */ public function behaviors() { $behaviors = ['verbs' => ['class' => VerbFilter::className(), 'actions' => ['delete' => ['post']]]]; if (Module::hasUserRole()) { $behaviors['role'] = ['class' => \navatech\role\filters\RoleFilter::className(), 'name' => Translate::x_management([Translate::language()]), 'actions' => ['index' => Translate::lists(), 'delete' => Translate::delete()]]; } return $behaviors; }
<?php use navatech\language\models\Language; use navatech\language\Translate; use yii\web\View; /* @var $this View */ /* @var $model Language */ $this->params['breadcrumbs'][] = ['label' => Translate::language(), 'url' => ['list']]; $this->params['breadcrumbs'][] = Translate::update(); ?> <div class="navatech-language"> <div class="col-sm-12"> <div class="page-header"> <h1><?php echo Translate::language(); ?> <small> <i class="ace-icon fa fa-angle-double-right"></i> <?php echo Translate::update(); ?> </small> </h1> </div> <div class="space-6"></div> <?php echo $this->render('_form', ['model' => $model]); ?> </div> </div>
<div class="col-sm-12"> <div class="page-header"> <h1><?php echo Translate::language(); ?> <small> <i class="ace-icon fa fa-angle-double-right"></i> <?php echo Translate::list_x([Translate::language()]); ?> </small> </h1> </div> <div class="space-6"></div> <p> <?php echo Html::a(Translate::add_a_new_x([Translate::language()]), ['create'], ['class' => 'btn btn-success']); ?> </p> <?php echo GridView::widget(['id' => 'language', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'export' => false, 'responsive' => true, 'hover' => true, 'pjax' => true, 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], ['attribute' => 'name', 'vAlign' => 'middle'], ['attribute' => 'code', 'vAlign' => 'middle'], ['attribute' => 'country', 'vAlign' => 'middle'], ['class' => 'kartik\\grid\\BooleanColumn', 'trueLabel' => Translate::in_use(), 'falseLabel' => Translate::not_in_use(), 'attribute' => 'status', 'vAlign' => 'middle'], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update}{delete}']]]); ?> </div> </div> <script> <?php if (Yii::$app->getSession()->hasFlash('message')) { ?> alert('<?php echo Yii::$app->getSession()->getFlash('message'); ?> ');
/** * @return array attribute labels (name => label) * @see generateAttributeLabel() */ public function attributeLabels() { return ['id' => 'No.', 'phrase_id' => Translate::phrase(), 'language_id' => Translate::language(), 'value' => Translate::translate()]; }