Exemplo n.º 1
0
 public function showRank()
 {
     $educationRank = RankController::sortZvalues(RankController::educationKeyField());
     $governmentExpenRank = RankController::sortZvalues(RankController::governmentExpendituresKeyField());
     $healthRank = RankController::sortZvalues(RankController::healthKeyField());
     $economyRank = RankController::sortZvalues(RankController::economyKeyField());
     $employmentRank = RankController::sortZvalues(RankController::employmentKeyField());
     $environmentRank = RankController::sortZvalues(RankController::environmentKeyField());
     //Store the overal rating of each city
     $overallRating = RankController::overallRating(array('education' => $educationRank, 'governmentExpen' => $governmentExpenRank, 'health' => $healthRank, 'economy' => $economyRank, 'employment' => $employmentRank, 'environment' => $environmentRank));
     return array('education' => $educationRank, 'governmentExpen' => $governmentExpenRank, 'health' => $healthRank, 'economy' => $economyRank, 'employment' => $employmentRank, 'environment' => $environmentRank, 'overall' => $overallRating);
 }
 /**
  * Return the key fields z-values for the selected city and the key fields z-values average
  * @param string $cityName name of the selected city
  * @return array $cityValues it contains the z-values and a z-values average
  */
 public function profile($cityName)
 {
     if (isset($cityName)) {
         if (strcmp($cityName, '') != 0) {
             $keyFieldsZValues = new RankController();
             $average = new ZtransformController();
             //Retrive the z-values for each key field
             $educationKeyField = $keyFieldsZValues->educationKeyField();
             $governmentExpenKeyField = $keyFieldsZValues->governmentExpendituresKeyField();
             $healthKeyField = $keyFieldsZValues->healthKeyField();
             $economyKeyField = $keyFieldsZValues->economyKeyField();
             $employmentKeyField = $keyFieldsZValues->employmentKeyField();
             $environmentKeyField = $keyFieldsZValues->environmentKeyField();
             //create an array with each z-value of the selected city
             $cityInfo = array('Educação' => $educationKeyField[$cityName], 'Finanças Públicas' => $governmentExpenKeyField[$cityName], 'Saúde' => $healthKeyField[$cityName], 'Economia' => $economyKeyField[$cityName], 'Emprego' => $employmentKeyField[$cityName], 'Meio Ambiente' => $environmentKeyField[$cityName]);
             $cityValues = CityProfileController::mergeAverage($cityInfo);
             return $cityValues;
         }
     }
     return 0;
 }