Esempio n. 1
0
 /**
  * [renderContent description]
  * @return [type] [description]
  */
 public function run()
 {
     $result = \frenzelgmbh\cmaddress\models\Address::getIPLocation();
     if ($result->getLatitude() == 0) {
         return $this->render('@frenzelgmbh/cmaddress/widgets/views/_iplocation', ['latitude' => 48.8077, 'longitude' => 9.15362, 'options' => $this->options]);
     } else {
         return $this->render('@frenzelgmbh/cmaddress/widgets/views/_iplocation', ['latitude' => $result->getLatitude(), 'longitude' => $result->getLongitude(), 'options' => $this->options]);
     }
 }
Esempio n. 2
0
 /**
  * [search description]
  * @param  array $params [description]
  * @param  string $module [description]
  * @param  integer $id     [description]
  * @return [type]         [description]
  */
 public function search($params, $entity = NULL, $entity_id = NULL)
 {
     $query = Address::find()->active()->related($entity, $entity_id);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'country_id' => $this->country_id]);
     $query->andFilterWhere(['like', 'cityName', $this->cityName])->andFilterWhere(['like', 'zipCode', $this->zipCode])->andFilterWhere(['like', 'postBox', $this->postBox])->andFilterWhere(['like', 'addresslineOne', $this->addresslineOne])->andFilterWhere(['like', 'addresslineTwo', $this->addresslineTwo])->andFilterWhere(['like', 'regionName', $this->regionName]);
     return $dataProvider;
 }