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', 'config_group', $this->config_group])->andFilterWhere(['like', 'config_name', $this->config_name])->andFilterWhere(['like', 'config_value', $this->config_value])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'create_date', $this->create_date])->andFilterWhere(['like', 'update_date', $this->update_date]);
     return $dataProvider;
 }
 /**
  * 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 $config_group
  * @param string $config_name
  * @return GlobalConfig the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($config_group, $config_name)
 {
     if (($model = GlobalConfig::findOne(['config_group' => $config_group, 'config_name' => $config_name])) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #3
0
 public static function getConfigValue($group, $name, $default = null)
 {
     $model = GlobalConfig::findOne(['config_group' => $group, 'config_name' => $name]);
     return $model ? $model->config_value : $default;
 }
Example #4
0
use biz\models\GlobalConfig;
/**
 * @var yii\web\View $this
 * @var biz\models\GlobalConfig $model
 * @var yii\widgets\ActiveForm $form
 */
?>

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

	<?php 
$form = ActiveForm::begin();
?>

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

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

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

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