当前位置: 首页>>代码示例>>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;未经允许,请勿转载。