/** * 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; }
/** * Parse the datagrid */ protected function parse() { parent::parse(); $this->tpl->assign('dataGrid', $this->dataGrid->getNumResults() != 0 ? $this->dataGrid->getContent() : false); // get settings $settings = BackendModel::getModuleSettings(); // assign to template $this->tpl->assign('items', BackendLocationModel::getAll()); $this->tpl->assign('settings', $settings['location']); }
/** * Parse the form */ protected function parse() { parent::parse(); $settings = BackendModel::getModuleSettings(); // assign to template $this->tpl->assign('item', $this->record); $this->tpl->assign('settings', $settings['location']); // assign message if address was not be geocoded if ($this->record['lat'] == null || $this->record['lng'] == null) { $this->tpl->assign('errorMessage', BL::err('AddressCouldNotBeGeocoded')); } }
/** * Execute the action */ public function execute() { parent::execute(); $generalSettings = BackendModel::getModuleSettings(); $generalSettings = $generalSettings['location']; // get parameters $itemId = SpoonFilter::getPostValue('id', null, null, 'int'); $zoomLevel = trim(SpoonFilter::getPostValue('zoom', null, 'auto')); $mapType = strtoupper(trim(SpoonFilter::getPostValue('type', array('roadmap', 'satelitte', 'hybrid', 'terrain'), 'roadmap'))); $centerLat = SpoonFilter::getPostValue('centerLat', null, 1, 'float'); $centerlng = SpoonFilter::getPostValue('centerLng', null, 1, 'float'); $height = SpoonFilter::getPostValue('height', null, $generalSettings['height'], 'int'); $width = SpoonFilter::getPostValue('width', null, $generalSettings['width'], 'int'); $showLink = SpoonFilter::getPostValue('link', array('true', 'false'), 'false', 'string'); $showDirections = SpoonFilter::getPostValue('directions', array('true', 'false'), 'false', 'string'); $showOverview = SpoonFilter::getPostValue('showOverview', array('true', 'false'), 'true', 'string'); // reformat $center = array('lat' => $centerLat, 'lng' => $centerlng); $showLink = $showLink == 'true'; $showDirections = $showDirections == 'true'; $showOverview = $showOverview == 'true'; // standard dimensions if ($width > 800) { $width = 800; } if ($width < 300) { $width = $generalSettings['width']; } if ($height < 150) { $height = $generalSettings['height']; } // no id given, this means we should update the main map BackendLocationModel::setMapSetting($itemId, 'zoom_level', (string) $zoomLevel); BackendLocationModel::setMapSetting($itemId, 'map_type', (string) $mapType); BackendLocationModel::setMapSetting($itemId, 'center', (array) $center); BackendLocationModel::setMapSetting($itemId, 'height', (int) $height); BackendLocationModel::setMapSetting($itemId, 'width', (int) $width); BackendLocationModel::setMapSetting($itemId, 'directions', $showDirections); BackendLocationModel::setMapSetting($itemId, 'full_url', $showLink); $item = array('id' => $itemId, 'language' => BL::getWorkingLanguage(), 'show_overview' => $showOverview ? 'Y' : 'N'); BackendLocationModel::update($item); // output $this->output(self::OK, null, FL::msg('Success')); }
/** * 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']; } }
/** * Get all necessary data * * @return void */ private function getData() { // fetch the mailmotor settings $settings = BackendModel::getModuleSettings(); // store mailmotor settings $this->settings = $settings['mailmotor']; // check if an account was linked already and/or client ID was set $this->accountLinked = BackendMailmotorCMHelper::checkAccount(); $this->clientID = BackendMailmotorCMHelper::getClientID(); }