/** * Get the data */ private function loadData() { $this->record = (array) BackendLocationModel::get($this->id); // no item found, throw an exceptions, because somebody is f*****g with our URL if (empty($this->record)) { $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing'); } $this->settings = BackendLocationModel::getMapSettings($this->id); // load the settings from the general settings if (empty($this->settings)) { $settings = BackendModel::getModuleSettings(); $settings = $settings['location']; $this->settings['width'] = $settings['width_widget']; $this->settings['height'] = $settings['height_widget']; $this->settings['map_type'] = $settings['map_type_widget']; $this->settings['zoom_level'] = $settings['zoom_level_widget']; $this->settings['center']['lat'] = $this->record['lat']; $this->settings['center']['lng'] = $this->record['lng']; } // no center point given yet, use the first occurance if (!isset($this->settings['center'])) { $this->settings['center']['lat'] = $this->record['lat']; $this->settings['center']['lng'] = $this->record['lng']; } $this->settings['full_url'] = isset($this->settings['full_url']) ? $this->settings['full_url'] : false; $this->settings['directions'] = isset($this->settings['directions']) ? $this->settings['directions'] : false; }
/** * Load the settings */ protected function loadData() { $this->items = BackendLocationModel::getAll(); $this->settings = BackendLocationModel::getMapSettings(0); $firstMarker = current($this->items); // if there are no markers we reset it to the birthplace of Fork if ($firstMarker === false) { $firstMarker = array('lat' => '51.052146', 'lng' => '3.720491'); } // load the settings from the general settings if (empty($this->settings)) { $settings = BackendModel::getModuleSettings(); $this->settings = $settings['location']; $this->settings['center']['lat'] = $firstMarker['lat']; $this->settings['center']['lng'] = $firstMarker['lng']; } // no center point given yet, use the first occurance if (!isset($this->settings['center'])) { $this->settings['center']['lat'] = $firstMarker['lat']; $this->settings['center']['lng'] = $firstMarker['lng']; } }