Example #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Companies::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(['company_id' => $this->company_id, 'company_country_id' => $this->company_country_id, 'company_province_id' => $this->company_province_id, 'company_city_id' => $this->company_city_id, 'company_zipcode' => $this->company_zipcode]);
     $query->andFilterWhere(['like', 'company_name', $this->company_name])->andFilterWhere(['like', 'company_address', $this->company_address])->andFilterWhere(['like', 'company_email', $this->company_email])->andFilterWhere(['like', 'company_phone', $this->company_phone])->andFilterWhere(['like', 'company_phone_ii', $this->company_phone_ii])->andFilterWhere(['like', 'company_contact_person', $this->company_contact_person])->andFilterWhere(['like', 'company_website', $this->company_website])->andFilterWhere(['like', 'company_status', $this->company_status])->andFilterWhere(['like', 'company_key', $this->company_key])->andFilterWhere(['like', 'company_logo', $this->company_logo]);
     return $dataProvider;
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Companies::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(['company_id' => $this->company_id]);
     $query->andFilterWhere(['like', 'company_name', $this->company_name]);
     return $dataProvider;
 }
Example #3
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Companies::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => array('pageSize' => 2)]);
     $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;
     }
     if (isset($params['CompaniesSearch']['search']) && $params['CompaniesSearch']['search'] != '') {
         if ($params['CompaniesSearch']['field'] == '') {
             $query->orFilterWhere(['=', 'id', $params['CompaniesSearch']['search']])->orFilterWhere(['=', 'status', $params['CompaniesSearch']['search']])->orFilterWhere(['like', 'company_name', $params['CompaniesSearch']['search']])->orFilterWhere(['like', 'company_address', $params['CompaniesSearch']['search']])->orFilterWhere(['like', 'created_dt', $params['CompaniesSearch']['search']])->orFilterWhere(['like', 'company_email', $params['CompaniesSearch']['search']]);
         } else {
             $query->andFilterWhere(['like', $params['CompaniesSearch']['field'], $params['CompaniesSearch']['search']]);
         }
     } else {
         $query->andFilterWhere(['id' => $this->id, 'created_dt' => $this->created_dt, 'company_name' => $this->status]);
         $query->andFilterWhere(['like', 'company_name', $this->company_name])->andFilterWhere(['like', 'company_address', $this->company_address])->andFilterWhere(['like', 'company_email', $this->company_email]);
     }
     return $dataProvider;
 }
Example #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCompany()
 {
     return $this->hasOne(Companies::className(), ['id' => 'company_id']);
 }
Example #5
0
 /**
  * Logs in a user using the provided username and password.
  *
  * @return boolean whether the user is logged in successfully
  */
 public function getuserCompany()
 {
     //$company = User::findAllByAttributes(['company_id'])
     return $this->hasMany(Companies::className(), ['company_id' => 'company_id']);
 }
Example #6
0
 /**
  * Finds the Companies model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Companies the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Companies::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #7
0
    <p>Please fill out the following fields to signup:</p>

    <div class="row">
        <div class="col-lg-5">
            <?php 
$form = ActiveForm::begin(['id' => 'form-signup']);
?>

                <?php 
echo $form->field($model, 'username');
?>
                <?php 
echo $form->field($model, 'first_name');
?>
                <?php 
echo $form->field($model, 'company_id')->dropDownList(ArrayHelper::map(Companies::find()->all(), 'company_id', 'company_name'), ['prompt' => 'Select Company'])->label('Company');
?>
                <?php 
echo $form->field($model, 'last_name');
?>

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

                <?php 
echo $form->field($model, 'password')->passwordInput();
?>
								<?php 
$authItems = ArrayHelper::map($authItems, 'name', 'name');
?>