public static function getTabs($active = []) { $tabs = parent::getTabs($active); array_splice($tabs, 1, 0, [['label' => Yii::t('beacon_layout', ':beacon_create'), 'url' => Url::to(['beacon/create']), 'active' => self::getActive($active, TabbedLayout::create())]]); array_splice($tabs, 2, 0, [['label' => Yii::t('beacon_layout', ':beacon_map'), 'url' => Url::to(['beacon/map']), 'active' => self::getActive($active, AdminBeaconLayout::map())]]); return $tabs; }
public function behaviors() { $behaviors = ['access' => ['class' => AccessControl::className(), 'rules' => [['actions' => ['list', 'update', 'view', 'get-selection-by-id', 'get-selection-list', 'save-redactor-image'], 'allow' => true, 'roles' => ['@']], ['actions' => ['create', 'delete', 'map'], 'allow' => true, 'roles' => [RbacController::admin]]]], 'verbs' => ['class' => VerbFilter::className(), 'actions' => ['delete' => ['post']]]]; $behaviors['layout'] = ['class' => Yii::$app->user->can(RbacController::admin) ? AdminBeaconLayout::className() : UserBeaconLayout::className()]; return $behaviors; }