/**
  * 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);
     }
 }
 /**
  * Sends delete POI category requests to service
  */
 private function deletePoiCategories()
 {
     $poiCategoriesToDelete = $this->getData('poiCategoriesToDelete');
     $poiCategoriesDeleted = [];
     foreach ($poiCategoriesToDelete as $poiCategoryId) {
         $response = $this->getModel()->deletePoiCategory($poiCategoryId);
         if (true === $response['success']) {
             $poiCategoriesDeleted[] = (int) $poiCategoryId;
             $this->addLogEntry(WikiaMapsLogger::newLogEntry(WikiaMapsLogger::ACTION_DELETE_PIN_TYPE, $this->wg->User, $this->getData('mapId'), $poiCategoryId, ['4::poi_category_id' => $poiCategoryId]));
         } else {
             WikiaLogger::instance()->error('WikiaMaps tried to delete POI category and failed', ['poiCategoryId' => $poiCategoryId, 'response' => $response]);
         }
     }
     $this->setData('poiCategoriesDeleted', $poiCategoriesDeleted);
 }