/** * 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 action */ public function execute() { $this->id = $this->getParameter('id', 'int'); // does the item exists if ($this->id !== null && BackendLocationModel::exists($this->id)) { parent::execute(); // add js $this->header->addJS('http://maps.google.com/maps/api/js?sensor=false', 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 action */ public function execute() { // get parameters $this->id = $this->getParameter('id', 'int'); // does the item exist if ($this->id !== null && BackendLocationModel::exists($this->id)) { parent::execute(); // get all data for the item we want to edit $this->record = (array) BackendLocationModel::get($this->id); // delete item BackendLocationModel::delete($this->id); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id)); // user was deleted, so redirect $this->redirect(BackendModel::createURLForAction('Index') . '&report=deleted&var=' . urlencode($this->record['title'])); } else { $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing'); } }