本文整理匯總了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());
}