/** * Execute the action */ public function execute() { $this->id = $this->getParameter('id', 'int'); // does the item exists if ($this->id !== null && BackendLocationModel::exists($this->id)) { $this->header->addJS(FrontendLocationModel::getPathToMapStyles()); parent::execute(); // define Google Maps API key $apikey = $this->get('fork.settings')->get('Core', 'google_maps_key'); // check Google Maps API key, otherwise redirect to settings if ($apikey === null) { $this->redirect(BackendModel::createURLForAction('Index', 'Settings')); } // add js $this->header->addJS('https://maps.googleapis.com/maps/api/js?key=' . $apikey, null, false, true, false); $this->loadData(); $this->loadForm(); $this->validateForm(); $this->loadSettingsForm(); $this->parse(); $this->display(); } else { $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing'); } }
/** * Execute the extra */ public function execute() { // define Google Maps API key $apikey = $this->get('fork.settings')->get('Core', 'google_maps_key'); // check Google Maps API key, otherwise show error if ($apikey == null) { trigger_error('Please provide a Google Maps API key.'); } $this->addJS('https://maps.googleapis.com/maps/api/js?key=' . $apikey, true, false); $this->addJS(FrontendLocationModel::getPathToMapStyles(false), true); parent::execute(); $this->loadTemplate(); $this->loadData(); $this->parse(); }
/** * Execute the action */ public function execute() { $this->header->addJS(FrontendLocationModel::getPathToMapStyles()); parent::execute(); // define Google Maps API key $apikey = $this->get('fork.settings')->get('Core', 'google_maps_key'); // check Google Maps API key, otherwise redirect to settings if ($apikey === null) { $this->redirect(BackendModel::createURLForAction('Index', 'Settings')); } // add js $this->header->addJS('https://maps.googleapis.com/maps/api/js?key=' . $apikey, null, false, true, false); $this->loadData(); $this->loadDataGrid(); $this->loadSettingsForm(); $this->parse(); $this->display(); }