本文整理汇总了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());
}
示例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, ',', ' ')));
}
}
示例3: getPercentSensitivity
public function getPercentSensitivity()
{
return Tool::percent($this->getTotalSensitivity(), $this->getTotal());
}
示例4: getPercentResultsFemale
public function getPercentResultsFemale()
{
return Tool::percent($this->getTotalResultsMale(), $this->getTotalResults());
}
示例5: getPercentFriendGuessesBad
public function getPercentFriendGuessesBad()
{
return Tool::percent($this->getTotalFriendGuessesBad(), $this->getTotalFriendGuesses());
}