Exemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Advertiser::find();
     $dataProvider = new ActiveDataProvider(['query' => $query->where(['status' => [Status::STATUS_ACTIVE, Status::STATUS_INACTIVE]])]);
     $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, 'status' => $this->status, 'created_date' => $this->created_date, 'modified_date' => $this->modified_date]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'mobile', $this->mobile])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'company', $this->company])->andFilterWhere(['like', 'created_by', $this->created_by])->andFilterWhere(['like', 'modified_by', $this->modified_by]);
     return $dataProvider;
 }
Exemplo n.º 2
0
/* @var $this yii\web\View */
/* @var $model common\models\Advertisement */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="advertisement-form">
    <div class="row">
        <div class="box box-primary">
            <div class="box-body">

                <?php 
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]);
?>

                <?php 
echo $form->field($model, 'advertiser_id')->dropDownList(ArrayHelper::map(Advertiser::find()->where(['status' => [Status::STATUS_ACTIVE, Status::STATUS_INACTIVE]])->all(), 'id', 'name'), ['prompt' => 'Select Advertiser']);
?>

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

                <?php 
echo $form->field($model, 'start_date')->widget(DatePicker::className(), ['inline' => false, 'clientOptions' => ['autoclose' => true, 'format' => 'yyyy-m-d']]);
?>
                <?php 
echo $form->field($model, 'end_date')->widget(DatePicker::className(), ['inline' => false, 'clientOptions' => ['autoclose' => true, 'format' => 'yyyy-m-d']]);
?>

                <?php 
echo $form->field($model, 'advertisement_type')->dropDownList(['Right Menu' => 'Right Menu', 'Left Menu' => 'Left Menu', '' => ''], ['prompt' => '']);