/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = BLanguecenter::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['ID' => $this->ID, 'rate' => $this->rate, 'is_show' => $this->is_show]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'decription', $this->decription])->andFilterWhere(['like', 'image', $this->image])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'url', $this->url]);
     return $dataProvider;
 }
Exemplo n.º 2
0
            <?php 
echo $form->field($model, 'end_at')->widget(DateTimePicker::classname(), ['options' => ['placeholder' => 'Enter event time ...'], 'layout' => '{picker}{input}', 'pluginOptions' => ['autoclose' => true, 'todayHighlight' => true, 'todayBtn' => true, 'format' => 'mm/dd/yyyy hh:ii:ss']]);
?>

            <?php 
echo $form->field($model, 'is_show')->widget(CheckboxX::classname(), ['autoLabel' => false, 'pluginOptions' => ['threeState' => false, 'size' => 'md']])->label("Is Show");
?>

            <?php 
echo $form->field($model, 'link')->textInput(['maxlength' => true]);
?>
            <?php 
echo $form->field($model, 'body')->widget(CKEditor::className(), ['options' => ['rows' => 6], 'preset' => 'advanced']);
?>
            <?php 
$langues = BLanguecenter::find()->where(['is_show' => 1])->orderBy('ordinal_view ASC')->all();
$id = '';
$name = '';
if ($langues) {
    foreach ($langues as $category) {
        $id[] = $category->ID;
        $name[] = $category->name;
    }
    $result = array_combine($id, $name);
} else {
    $result = array("0" => "No langue's center found");
}
?>
            <?php 
echo $form->field($model, 'show_in')->dropDownList($result, ['prompt' => yii::t('backend', 'Home')]);
?>
 /**
  * Finds the BLanguecenter model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return BLanguecenter the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = BLanguecenter::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }