/**
  * Delete Author
  * 
  * @url POST /location/delete/
  */
 public function deleteLocation()
 {
     $userId = parent::CheckAuthentication();
     $locationId = $_POST['LocationId'];
     if (parent::CheckIfOwned($userId, "Location", $locationId) == true) {
         $locationInEventsCount = parent::GetRecordsCount('Event', $userId, 'LocationId = ' . $locationId);
         if ($locationInEventsCount > 0) {
             parent::DeActivateRecord('Location', $locationId);
         } else {
             parent::DeleteRecord('Location', $userId, $locationId);
         }
         return "OK";
     }
 }
 function EventById($EventId)
 {
     $userEventsFolder = Settings::getInstance()->p['userEventsFolder'];
     $EventFieldsSql = " Event.UserId, Event.EventId, Event.Title, Event.Image, Event.Description AS Description, Event.CreationDateTime, Event.DateTime, Event.FacebookLink, Event.YouTubeLink, Event.FlickrLink, Event.Language, Event.Published, Event.Statistics ";
     $sql = "SELECT {$EventFieldsSql}, AuthorId, LocationId FROM Event WHERE Event.EventId = {$EventId}";
     $result = $this->mysqli->query($sql);
     $recordsCount = mysqli_num_rows($result);
     $data = 0;
     if ($recordsCount >= 1 && $result != null) {
         $row = mysqli_fetch_array($result);
         $imageUrl = parent::GetImageUrl($row['UserId'], $row['Image'], $userEventsFolder);
         $imageThumbnailUrl = parent::GetImageUrl($row['UserId'], $row['Image'], $userEventsFolder, true);
         $ShortDescription = parent::substrwords(strip_tags($row['Description']), 120);
         $Description = $row['Description'];
         $AuthorsDbHandler = new AuthorsDatabaseHandler();
         $LocationsDbHandler = new LocationsDatabaseHandler();
         $data = array('EventId' => $row['EventId'], 'Title' => $row['Title'], 'Image' => $row['Image'], 'ImageUrl' => $imageUrl, 'ThumbnailUrl' => $imageThumbnailUrl, 'Description' => $Description, 'CreationDateTime' => $row['CreationDateTime'], 'DateTime' => $row['DateTime'], 'FacebookLink' => $row['FacebookLink'], 'YouTubeLink' => $row['YouTubeLink'], 'FlickrLink' => $row['FlickrLink'], 'Language' => $row['Language'], 'Published' => $row['Published'], 'ShortDescription' => $ShortDescription, 'LocationId' => $row['LocationId'], 'Location' => $LocationsDbHandler->LocationById($row['LocationId']), 'AuthorId' => $row['AuthorId'], 'Author' => $AuthorsDbHandler->AuthorById($row['AuthorId']), 'UserId' => $row['UserId'], 'Statistics' => $row['Statistics']);
     }
     return $data;
 }