dosamigos\google\maps\Map::addOverlay PHP Méthode

addOverlay() public méthode

public addOverlay ( $overlay )
$overlay
    public function addOverlay($overlay)
    {
        $this->_overlays[] = $overlay;
        return $this;
    }

Usage Example

Exemple #1
3
 public function actionViewAdvert($id)
 {
     $model = Advert::findOne($id);
     $data = ['name', 'email', 'text'];
     $model_feedback = new DynamicModel($data);
     $model_feedback->addRule('name', 'required');
     $model_feedback->addRule('email', 'required');
     $model_feedback->addRule('text', 'required');
     $model_feedback->addRule('email', 'email');
     if (Yii::$app->request->isPost) {
         if ($model_feedback->load(Yii::$app->request->post()) && $model_feedback->validate()) {
             Yii::$app->common->sendMail('Subject Advert', $model_feedback->text);
         }
     }
     $user = $model->user;
     $images = Common::getImageAdvert($model, false);
     $current_user = ['email' => '', 'username' => ''];
     if (!Yii::$app->user->isGuest) {
         $current_user['email'] = Yii::$app->user->identity->email;
         $current_user['username'] = Yii::$app->user->identity->username;
     }
     $coords = str_replace(['(', ')'], '', $model->location);
     $coords = explode(',', $coords);
     $coord = new LatLng(['lat' => $coords[0], 'lng' => $coords[1]]);
     $map = new Map(['center' => $coord, 'zoom' => 15]);
     $marker = new Marker(['position' => $coord, 'title' => Common::getTitleAdvert($model)]);
     $map->addOverlay($marker);
     return $this->render('view_advert', ['model' => $model, 'model_feedback' => $model_feedback, 'user' => $user, 'images' => $images, 'current_user' => $current_user, 'map' => $map]);
 }
All Usage Examples Of dosamigos\google\maps\Map::addOverlay