コード例 #1
0
 /**
  * can handle queries of:
  *  - x and y
  */
 public function getListAction()
 {
     $neighborhood_id = $this->params()->fromRoute('neighborhood_id');
     $neighborhood = $this->m()->neighborhood()->byId($neighborhood_id);
     $heatmap_points = $this->m()->heatMapPoint()->byNeighborhood($neighborhood);
     return new JsonModel(HeatMapPoint::pointsToArray($heatmap_points));
 }
コード例 #2
0
 public function heatMapPointsByNeighborhood(Neighborhood $neighborhood)
 {
     $heatmap_point_elections = array();
     $peakNumForPoints = $this->getPeakNumUserNeighborhoods($neighborhood);
     foreach ($this->getPointElections() as $ep) {
         $cn = $ep->candidateNeighborhood($neighborhood);
         $percentage = $cn->getNumVotes() / $peakNumForPoints;
         array_push($heatmap_point_elections, HeatMapPoint::build(array('neighborhood' => $neighborhood, 'electionPoint' => $ep, 'point' => $ep->getPoint(), 'percentage' => $percentage)));
     }
     return $heatmap_point_elections;
 }
コード例 #3
0
ファイル: HeatMapPoint.php プロジェクト: godentarek/whathood
 public static function build(array $array)
 {
     $hmp = new HeatMapPoint($array);
     $hmp->setCreatedAt(new \DateTime());
     return $hmp;
 }