/**
* 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 = $this->get('fork.settings')->getForModule('Location');
$this->settings['width'] = $settings['width_widget'];
$this->settings['height'] = $settings['height_widget'];
$this->settings['map_type'] = $settings['map_type_widget'];
$this->settings['map_style'] = isset($settings['map_style_widget']) ? $settings['map_style_widget'] : 'standard';
$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 occurrence
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;
}