public function deleteAction()
 {
     $neighborhood_id = $this->params()->fromRoute('id');
     $neighborhood_name = $this->paramFromRoute('neighborhood');
     $region_name = $this->paramFromRoute('region');
     $this->logger()->info("deleting neighborhood with id " . $neighborhood_id);
     if ($neighborhood_id) {
         $neighborhood = $this->m()->neighborhoodMapper()->byId($neighborhood_id);
         \Whathood\Util::prompt_user(sprintf("are you sure you want to delete neighborhood?\n\tid=%s\n\tname=%s\n\tregion=%s\n", $neighborhood->getId(), $neighborhood->getName(), $neighborhood->getRegion()->getName()));
         $this->m()->neighborhoodMapper()->delete($neighborhood, $this->m()->userPolygonMapper(), $this->m()->neighborhoodPolygonMapper(), $this->m()->heatMapPoint());
         $this->logger()->info("neighborhood deleted");
     } else {
         throw new \Exception('not yet implemented');
     }
 }
Esempio n. 2
0
 public function send($subject, $messageBody)
 {
     if (empty($subject)) {
         throw new \InvalidArgumentException("subject may not be empty");
     }
     $subject = sprintf("[%s] %s", substr(strtoupper(\Whathood\Util::environment()), 0, 4), $subject);
     $html = new \Zend\Mime\Part(nl2br($messageBody));
     $html->type = 'text/html';
     $body = new \Zend\Mime\Message();
     $body->setParts(array($html));
     $message = new Message();
     $message->addFrom($this->fromAddress, $this->fromName)->addTo($this->toAddress)->setSubject($subject);
     $message->setBody($body);
     $transport = $this->getTransport();
     if (\Whathood\Util::is_production()) {
         $transport->send($message);
     }
 }
Esempio n. 3
0
 public static function prompt_user($msg)
 {
     \Whathood\Util::prompt_user("{$msg}; Enter to continue; CTRL-C to cancel");
 }
Esempio n. 4
0
 public static function build($request)
 {
     $ip_address = \Whathood\Util::getRemoteIp($request);
     $user = new WhathoodUser(array('ip_address' => $ip_address));
     return $user;
 }
Esempio n. 5
0
 public function whatsMyIpAction()
 {
     $remote_ip = \Whathood\Util::getRemoteIp($this->getRequest());
     return new ViewModel(array('remoteIp' => $remote_ip));
 }