本文整理汇总了PHP中Results::formatTime方法的典型用法代码示例。如果您正苦于以下问题:PHP Results::formatTime方法的具体用法?PHP Results::formatTime怎么用?PHP Results::formatTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Results
的用法示例。
在下文中一共展示了Results::formatTime方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEventsString
public function getEventsString($event)
{
$str = '';
if (in_array($event, $this->events)) {
$str = '<span class="fa fa-check"></span>';
if ($this->best > 0 && self::$sortAttribute === $event && self::$sortDesc !== true) {
$str = self::$sortDesc === true ? '' : '[' . $this->pos . ']' . $str;
$str .= Results::formatTime($this->best, $event);
}
}
return $str;
}
示例2: formatSum
private static function formatSum($row)
{
switch ($row['eventId']) {
case '333mbf':
return array_sum(array_map(function ($row) {
$result = $row[0]['average'];
$difference = 99 - substr($result, 0, 2);
return $difference;
}, array($row['first'], $row['second'], $row['third'])));
case '333fm':
return $row['sum'] / 100;
default:
return Results::formatTime($row['sum'], $row['eventId']);
}
}
示例3: makePerson
private function makePerson($result, $appendUnit = true, $type = 'both')
{
switch ($type) {
case 'average':
$score = $result->average;
break;
case 'single':
$score = $result->best;
break;
default:
$score = $result->average ?: $result->best;
break;
}
$temp = new stdClass();
$temp->name = $result->personName;
$temp->name_zh = preg_match('{\\((.*?)\\)}i', $result->personName, $matches) ? $matches[1] : $result->personName;
$temp->link = CHtml::link($temp->name, array('/results/p', 'id' => $result->personId), array('target' => '_blank'));
$temp->link_zh = CHtml::link($temp->name_zh, array('/results/p', 'id' => $result->personId), array('target' => '_blank'));
$temp->score = Results::formatTime($score, $result->eventId);
$temp->score_zh = $temp->score;
if ($appendUnit && is_numeric($temp->score)) {
switch ($result->eventId) {
case '333fm':
$unit = array('en' => ' turns', 'zh' => '步');
break;
default:
$unit = array('en' => ' seconds', 'zh' => '秒');
break;
}
$temp->score .= $unit['en'];
$temp->score_zh .= $unit['zh'];
}
return $temp;
}
示例4: getPersonRankValue
protected function getPersonRankValue($results, $eventId, $attribute)
{
if (!isset($results['personRanks'][$eventId])) {
return '-';
}
$model = $results['personRanks'][$eventId];
$attribute = explode('.', $attribute);
if (isset($attribute[1])) {
$model = $model->{$attribute[0]};
$attribute = $attribute[1];
} else {
$attribute = $attribute[0];
}
if ($model === null) {
return '-';
}
$value = isset($model[$attribute]) ? $model[$attribute] : '-';
if ($attribute === 'best') {
$value = Results::formatTime($value, "{$eventId}");
}
if ($attribute === 'solve') {
$value .= '/' . $model['attempt'];
}
return $value;
}