20afc52f
andryeyev
+ термины и меню ...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
<?php
namespace backend\models;
use Yii;
/**
* This is the model class for table "menu".
*
* @property integer $menu_id
* @property integer $menu_pid
* @property integer $level
* @property integer $termin_id
* @property integer $show
* @property integer $is_open
* @property integer $menu_location_id
* @property integer $sortorder
* @property string $name
* @property string $url
*
* @property Termin $termin
*/
class Menu extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'menu';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
|
6c18fb74
andryeyev
+ fix по багам по...
|
39
40
|
[['menu_id', 'menu_pid', 'level', 'termin_id', 'status', 'is_open', 'menu_location_id', 'sort'], 'required'],
[['menu_id', 'menu_pid', 'level', 'termin_id', 'status', 'is_open', 'menu_location_id', 'sort'], 'integer'],
|
20afc52f
andryeyev
+ термины и меню ...
|
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
[['name', 'url'], 'string', 'max' => 250]
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'menu_id' => Yii::t('app', 'Menu ID'),
'menu_pid' => Yii::t('app', 'Menu Pid'),
'level' => Yii::t('app', 'Level'),
'termin_id' => Yii::t('app', 'Termin ID'),
|
6c18fb74
andryeyev
+ fix по багам по...
|
55
|
'status' => Yii::t('app', 'Show'),
|
20afc52f
andryeyev
+ термины и меню ...
|
56
57
|
'is_open' => Yii::t('app', 'Is Open'),
'menu_location_id' => Yii::t('app', 'Menu Location ID'),
|
6c18fb74
andryeyev
+ fix по багам по...
|
58
|
'sort' => Yii::t('app', 'Sortorder'),
|
20afc52f
andryeyev
+ термины и меню ...
|
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
'name' => Yii::t('app', 'Name'),
'url' => Yii::t('app', 'Url'),
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getTermin()
{
return $this->hasOne(Termin::className(), ['termin_id' => 'termin_id']);
}
public function getMenuList ($location_name)
{
return yii::$app->db->createCommand('
SELECT
menu.menu_id, menu.menu_pid, menu.level,
termin_lang.termin_title, termin_lang.termin_alias
FROM menu
INNER JOIN menu_location ON menu_location.menu_location_id = menu.menu_location_id
AND menu_location.menu_location_name = \''.$location_name.'\'
INNER JOIN termin ON termin.termin_id = menu.termin_id
INNER JOIN termin_lang ON termin_lang.termin_id = menu.termin_id
|
f1ea4c01
andryeyev
lang_id => langua...
|
83
|
AND termin_lang.language_id = '.Yii::$app->params['language_id'].'
|
6c18fb74
andryeyev
+ fix по багам по...
|
84
|
ORDER BY menu.level ASC, menu.sort ASC
|
20afc52f
andryeyev
+ термины и меню ...
|
85
86
87
88
89
90
91
92
|
')->queryAll();
/*
return $this->find()
->selectOption('termin_lang.termin_title')
->from('menu')
->join(
'INNER JOIN',
'termin_lang.termin_id = menu.termin_id',
|
f1ea4c01
andryeyev
lang_id => langua...
|
93
|
['language_id' => yii::$app->params['language_id']])
|
20afc52f
andryeyev
+ термины и меню ...
|
94
95
96
|
->all();
*/
}
|
6f8e46af
andryeyev
+ fix по сливания...
|
97
98
99
100
101
|
public function getTerminLang()
{
return $this->hasOne(TerminLang::className(), ['termin_id' => 'termin_id']);
}
|
20afc52f
andryeyev
+ термины и меню ...
|
102
|
}
|