Ejemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Surveyor::find();
     $query->joinWith(['user']);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $dataProvider->sort->attributes['user'] = ['asc' => ['user.username' => SORT_ASC], 'desc' => ['user.username' => SORT_DESC]];
     $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, 'user_id' => $this->user_id, 'created_date' => $this->created_date, 'updated_date' => $this->updated_date]);
     $query->andFilterWhere(['like', 'surveyor_no', $this->surveyor_no])->andFilterWhere(['like', 'nama_lengkap', $this->nama_lengkap])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'company', $this->company])->andFilterWhere(['like', 'jenis_kelamin', $this->jenis_kelamin])->andFilterWhere(['like', 'identitas', $this->identitas])->andFilterWhere(['like', 'identitas_no', $this->identitas_no])->andFilterWhere(['like', 'no_hp', $this->no_hp])->andFilterWhere(['like', 'no_telp', $this->no_telp])->andFilterWhere(['like', 'fax', $this->fax])->andFilterWhere(['like', 'created_by', $this->created_by])->andFilterWhere(['like', 'updated_by', $this->updated_by])->andFilterWhere(['like', 'user.username', $this->user]);
     return $dataProvider;
 }
Ejemplo n.º 2
0
?>
	
    <?php 
echo $form->field($model, 'industry_kode_pos')->textInput(['maxlength' => true]);
?>
	
    <?php 
echo $form->field($model, 'industry_telp')->textInput(['maxlength' => true]);
?>
	
    <?php 
echo $form->field($model, 'industry_fax')->textInput(['maxlength' => true]);
?>
	
	<?php 
echo $form->field($model, 'surveyor_id')->dropDownList(ArrayHelper::map(Surveyor::find()->all(), 'id', 'nama_lengkap'), ['prompt' => '']);
?>
	
	
    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
	</div>
	
    <?php 
ActiveForm::end();
?>
	
</div>
<?php 
Ejemplo n.º 3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSurveyor()
 {
     return $this->hasOne(Surveyor::className(), ['id' => 'surveyor_id']);
 }
Ejemplo n.º 4
0
 /**
  * Finds the Surveyor model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Surveyor the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Surveyor::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }