Exemplo n.º 1
0
 public function configure()
 {
     // Get answers
     $answers = $this->question->getAnswers();
     $colors = Conf::get('GRAPH_COLORS');
     $dataWomen = array();
     $dataMen = array();
     // Percent MALE
     foreach (array_reverse($answers) as $key => $answer) {
         $dataMen[] = array('value' => Tool::percent($answer->getTotalMale(), $this->question->getTotalMale()) / 100 * 0.95 + 0.05, 'color' => $colors[$key]);
     }
     foreach ($answers as $key => $answer) {
         Globals::$tpl->assignLoopVar('question_men', array('key' => $key, 'label' => $answer->getLabel(), 'percent' => number_format(Tool::percent($answer->getTotalMale(), $this->question->getTotalMale()), 1, ',', ' ')));
     }
     // Percent FEMALE
     foreach (array_reverse($answers) as $key => $answer) {
         $dataWomen[] = array('value' => Tool::percent($answer->getTotalFemale(), $this->question->getTotalFemale()) / 100 * 0.95 + 0.05, 'color' => $colors[$key]);
     }
     foreach ($answers as $key => $answer) {
         Globals::$tpl->assignLoopVar('question_women', array('key' => $key, 'label' => $answer->getLabel(), 'percent' => number_format(Tool::percent($answer->getTotalFemale(), $this->question->getTotalFemale()), 1, ',', ' ')));
     }
     Globals::$tpl->assignVar('question_men_data', json_encode($dataMen));
     Globals::$tpl->assignVar('question_women_data', json_encode($dataWomen));
     Globals::$tpl->assignVar('question_label', $this->question->getLabel());
 }
Exemplo n.º 2
0
 public function configure()
 {
     $regions = array('Alsace', 'Aquitaine', 'Auvergne', 'Basse-Normandie', 'Bourgogne', 'Bretagne', 'Centre', 'Champagne-Ardenne', 'Corse', 'Franche-Comté', 'Haute-Normandie', 'Île-de-France', 'Languedoc-Roussillon', 'Limousin', 'Lorraine', 'Midi-Pyrénées', 'Nord-Pas-de-Calais', 'Pays de la Loire', 'Picardie', 'Poitou-Charentes', 'Provence-Alpes-Côte d\'Azur', 'Rhône-Alpes');
     $colors = array();
     $values = array();
     foreach ($regions as $region) {
         $v = rand(0, 100);
         $colors[] = $this->getRandomColor($v, rand(0, 1));
         $values[] = $v;
     }
     Globals::$tpl->assignVar(array('map_regionColors' => json_encode($colors), 'map_regionValues' => json_encode($values), 'question_label' => $this->question->getLabel()));
     // Get answers
     $answers = $this->question->getAnswers();
     foreach ($answers as $key => $answer) {
         Globals::$tpl->assignLoopVar('answer', array('key' => $key, 'label' => $answer->getLabel(), 'percent' => number_format(Tool::percent($answer->getTotalResultsMatching(), $this->question->getTotalResults()), 1, ',', ' ')));
     }
 }
Exemplo n.º 3
0
 public function getPercentSensitivity()
 {
     return Tool::percent($this->getTotalSensitivity(), $this->getTotal());
 }
Exemplo n.º 4
0
 public function getPercentResultsFemale()
 {
     return Tool::percent($this->getTotalResultsMale(), $this->getTotalResults());
 }
Exemplo n.º 5
0
 public function getPercentFriendGuessesBad()
 {
     return Tool::percent($this->getTotalFriendGuessesBad(), $this->getTotalFriendGuesses());
 }