public function search($params)
 {
     $query = GlobalConfigModel::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['create_by' => $this->create_by, 'update_by' => $this->update_by]);
     $query->andFilterWhere(['like', 'group', $this->group])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'value', $this->value])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'create_at', $this->create_at])->andFilterWhere(['like', 'update_at', $this->update_at]);
     return $dataProvider;
 }
Example #2
0
/**
 * @var yii\web\View $this
 * @var biz\master\models\GlobalConfig $model
 * @var yii\widgets\ActiveForm $form
 */
?>

<div class="global-config-form">

    <?php 
$form = ActiveForm::begin();
?>
    <div class="box box-primary">
        <div class="box-body">
            <?php 
$groups = GlobalConfig::find()->select('group')->distinct(true)->column();
echo $form->field($model, 'group')->widget('yii\\jui\\AutoComplete', ['options' => ['class' => 'form-control', 'maxlength' => 16], 'clientOptions' => ['source' => $groups]]);
?>

            <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => 32]);
?>

            <?php 
echo $form->field($model, 'value')->textInput();
?>

            <?php 
echo $form->field($model, 'description')->textInput(['maxlength' => 128]);
?>
 /**
  * Finds the GlobalConfig model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param  string                $group
  * @param  string                $name
  * @return GlobalConfig          the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($group, $name)
 {
     if (($model = GlobalConfig::findOne(['group' => $group, 'name' => $name])) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #4
0
 public static function getConfigValue($group, $name, $default = null)
 {
     $model = GlobalConfig::findOne(['group' => $group, 'name' => $name]);
     return $model ? $model->value : $default;
 }