/** * Entry point to delete a poi * * @requestParam Integer id an unique POI id * * @throws PermissionsException * @throws BadRequestApiException */ public function deletePoi() { $this->setAction(self::ACTION_DELETE); $poiId = $this->request->getInt('id'); $mapId = $this->request->getInt('mapId'); $this->setData('poiId', $poiId); $this->validatePoiData(); $results = $this->getModel()->deletePoi($this->getData('poiId')); if (true === $results['success']) { WikiaMapsLogger::addLogEntry(WikiaMapsLogger::ACTION_DELETE_PIN, $this->wg->User, $mapId, $poiId); } $this->setVal('results', $results); }
/** * Ajax method for un/deleting a map from IntMaps API */ public function updateMapDeletionStatus() { $mapId = $this->request->getInt('mapId'); $deleted = $this->request->getInt('deleted'); if (!in_array($deleted, [WikiaMaps::MAP_DELETED, WikiaMaps::MAP_NOT_DELETED])) { $deleted = WikiaMaps::MAP_DELETED; } $result = false; if (!$this->isUserAllowed() || !$this->canUserDelete() && !$this->isUserMapCreator($mapId)) { throw new WikiaMapsPermissionException(); } if ($mapId) { $result = $this->getModel()->updateMapDeletionStatus($mapId, $deleted)['success']; } if ($result) { $action = $deleted === WikiaMaps::MAP_DELETED ? WikiaMapsLogger::ACTION_DELETE_MAP : WikiaMapsLogger::ACTION_UNDELETE_MAP; WikiaMapsLogger::addLogEntry($action, $this->wg->User, $mapId, $mapId); BannerNotificationsController::addConfirmation($deleted ? wfMessage('wikia-interactive-maps-delete-map-success')->text() : wfMessage('wikia-interactive-maps-undelete-map-success')->text()); $redirectUrl = WikiaMapsSpecialController::getSpecialUrl(); if ($deleted === WikiaMaps::MAP_NOT_DELETED) { $redirectUrl .= '/' . $mapId; } $this->response->setVal('redirectUrl', $redirectUrl); } }