Ejemplo n.º 1
0
 /**
  * Convert the overlay object into a Javascript string.
  * @return string
  */
 public function toJS()
 {
     // set elements into the storage object
     if ($this->options || $this->events || $this->onces || $this->callback) {
         // transform class name into gmap3 storage name
         $name = strtolower(str_replace('EGmap3', null, get_class($this)));
         $this->{$name} = new EGmap3ObjectBase();
         if ($this->options) {
             $this->{$name}->options = $this->options;
             $this->options = null;
         }
         if ($this->events) {
             $this->{$name}->events = $this->eventsToJS($this->events);
             $this->events = null;
         }
         if ($this->onces) {
             $this->{$name}->onces = $this->eventsToJS($this->onces);
             $this->onces = null;
         }
         if ($this->callback) {
             $this->{$name}->callback = $this->callback;
             $this->callback = null;
         }
         if ($this->data) {
             $this->{$name}->data = $this->data;
             $this->data = null;
         }
     }
     return parent::toJS();
 }