當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Tool::percent方法代碼示例

本文整理匯總了PHP中Tool::percent方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tool::percent方法的具體用法?PHP Tool::percent怎麽用?PHP Tool::percent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Tool的用法示例。


在下文中一共展示了Tool::percent方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: configure

 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());
 }
開發者ID:Hiswe,項目名稱:Opipop,代碼行數:25,代碼來源:Gender.php

示例2: configure

 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, ',', ' ')));
     }
 }
開發者ID:xpac27,項目名稱:Opipop,代碼行數:17,代碼來源:Map.php

示例3: getPercentSensitivity

 public function getPercentSensitivity()
 {
     return Tool::percent($this->getTotalSensitivity(), $this->getTotal());
 }
開發者ID:xpac27,項目名稱:Opipop,代碼行數:4,代碼來源:Feelings.php

示例4: getPercentResultsFemale

 public function getPercentResultsFemale()
 {
     return Tool::percent($this->getTotalResultsMale(), $this->getTotalResults());
 }
開發者ID:xpac27,項目名稱:Opipop,代碼行數:4,代碼來源:Question.php

示例5: getPercentFriendGuessesBad

 public function getPercentFriendGuessesBad()
 {
     return Tool::percent($this->getTotalFriendGuessesBad(), $this->getTotalFriendGuesses());
 }
開發者ID:xpac27,項目名稱:Opipop,代碼行數:4,代碼來源:Friend.php


注:本文中的Tool::percent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。