Exemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Menu::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'pid' => $this->pid, 'sort' => $this->sort, 'status' => $this->status, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'auth_name', $this->auth_name])->andFilterWhere(['like', 'icon', $this->icon]);
     return $dataProvider;
 }
Exemplo n.º 2
0
 /**
  * Finds the Menu model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Menu the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Menu::findOne($id)) !== null) {
         if (!$model->auth_name) {
             return $model;
         }
         $auth = explode('_', $model->auth_name);
         $model->mod = $auth[0];
         $model->ctrl = $auth[0] . '_' . $auth[1];
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemplo n.º 3
0
Arquivo: ace.php Projeto: cboy868/nana
<?php

use backend\assets\AppAsset;
use backend\assets\AceAsset;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\Breadcrumbs;
use sys\models\Menu;
/* @var $this \yii\web\View */
/* @var $content string */
$menu = Menu::getList();
// $app = Yii::$app->id;
// $m = Yii::$app->controller->module->id;
// $c = Yii::$app->controller->id;
// $a = Yii::$app->controller->action->id;
// $current_menu = $app == $m ? 'backend_'.$c . $a : 'backend@' . $m .'_'. $c .'_'. $a;
$current_menu = getFullAction();
AppAsset::register($this);
AceAsset::register($this);
$this->beginPage();
?>

<!DOCTYPE html>
<html lang="<?php 
echo Yii::$app->language;
?>
">
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
        <?php 
echo Html::csrfMetaTags();