30], [['table_name'], 'string', 'max' => 20], [['description'], 'string', 'max' => 100], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'model_id' => Yii::t('attr','content_model.model_id'), 'name' => Yii::t('attr','content_model.name'), 'table_name' => Yii::t('attr','content_model.table_name'), 'description' => Yii::t('attr','content_model.description'), 'settings' => Yii::t('attr','content_model.settings'), 'enable_search' => Yii::t('attr','content_model.enable_search'), 'default_theme' => Yii::t('attr','content_model.default_theme'), 'category_template' => Yii::t('attr','content_model.category_template'), 'list_template' => Yii::t('attr','content_model.list_template'), 'show_template' =>Yii::t('attr','content_model.show_template'), 'wap_default_theme' => Yii::t('attr','content_model.wap_default_theme'), 'wap_category_template' => Yii::t('attr','content_model.wap_category_template'), 'wap_list_template' => Yii::t('attr','content_model.wap_list_template'), 'wap_show_template' => Yii::t('attr','content_model.wap_show_template'), 'items' => Yii::t('attr','content_model.items'), 'type' => Yii::t('attr','content_model.type'), 'for_cms' => Yii::t('attr','content_model.for_cms'), 'is_system' => Yii::t('attr','content_model.is_system'), 'disabled' => Yii::t('attr','content_model.disabled'), 'create_time' => Yii::t('attr','content_model.create_time'), 'list_order' =>Yii::t('attr','content_model.list_order'), ]; } //类型 public static function typeOptions($k=null) { $options = array('1'=>'内容模型','2'=>'用户模型'); if(is_numeric($k))return $options[$k]; return $options; } //模型选项 public static function userModelOptions($k=null) { $options = []; $resultList = ContentModel::find()->where("disabled=0 and type=2")->all(); if(is_array($resultList))foreach($resultList as $result) { $options[$result->model_id] = $result->name; } if($k>0)return $options[$k]; return $options; } //内容模型选项 public static function modelOptions($k=null) { $options = []; $resultList = ContentModel::find()->where("disabled=0 and type=1")->all(); if(is_array($resultList))foreach($resultList as $result) { $options[$result->model_id] = $result->name; } if($k>0)return $options[$k]; return $options; } }