123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <?php
- namespace app\models;
- use Yii;
- /**
- * This is the model class for table "{{%nav}}".
- *
- * @property int $id ID
- * @property int $parent_id 父级
- * @property string $title 标题
- * @property string|null $url 链接
- * @property string $iconfont 字体图标
- * @property int $type 类型
- * @property int $blank 新窗口打开
- * @property int $is_dropdown 下拉菜单
- * @property int $dropdown_level 下拉层级
- * @property int $content_model_id 内容模型
- * @property int $is_system 系统自带
- * @property int|null $disabled 禁用
- * @property int|null $list_order 排序
- */
- class Nav extends \app\common\models\EActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return '{{%nav}}';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['parent_id', 'type', 'blank', 'is_dropdown', 'dropdown_level', 'content_model_id', 'width', 'is_system', 'disabled', 'list_order'], 'integer'],
- [['title'], 'required'],
- [['title'], 'string', 'max' => 30],
- [['url'], 'string', 'max' => 200],
- [['iconfont'], 'string', 'max' => 500],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => Yii::t('attr','nav.id'),
- 'parent_id' => Yii::t('attr','nav.parent_id'),
- 'title' => Yii::t('attr','nav.title'),
- 'url' => Yii::t('attr','nav.url'),
- 'iconfont' => Yii::t('attr','nav.iconfont'),
- 'type' => Yii::t('attr','nav.type'),
- 'blank' => Yii::t('attr','nav.blank'),
- 'is_dropdown' => Yii::t('attr','nav.is_dropdown'),
- 'dropdown_level' => Yii::t('attr','nav.dropdown_level'),
- 'content_model_id' => Yii::t('attr','nav.content_model_id'),
- 'width' => Yii::t('attr','nav.width'),
- 'is_system' => Yii::t('attr','nav.is_system'),
- 'is_new' => Yii::t('attr','nav.is_new'),
- 'is_hot' => Yii::t('attr','nav.is_hot'),
- 'disabled' => Yii::t('attr','nav.disabled'),
- 'list_order' => Yii::t('attr','nav.list_order'),
- ];
- }
- //导航类型
- public static function typeOptions($k=null)
- {
- $options = array('1'=>'PC站首页','2'=>'PC站内页','3'=>'PC站用户中心','4'=>'PC站底部链接','5'=>'PC站首页推荐链接','6'=>'手机站底部导航','7'=>'手机站首页菜单');
- if(Yii::$app->getModule('web')->bdappconfig['open'])
- {
- $options['81'] = '百度小程序首页菜单';
- }
- if(Yii::$app->getModule('web')->wxappconfig['open'])
- {
- $options['91'] = '微信小程序首页菜单';
- }
- if(is_numeric($k))return $options[$k];
- return $options;
- }
- }
|