本文整理汇总了PHP中Converter::unConvert方法的典型用法代码示例。如果您正苦于以下问题:PHP Converter::unConvert方法的具体用法?PHP Converter::unConvert怎么用?PHP Converter::unConvert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Converter
的用法示例。
在下文中一共展示了Converter::unConvert方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRoutejson
public function getRoutejson($_routeid)
{
require '/var/www/db-init-climb.php';
require 'Comment.class.php';
$comment = new Comment();
$stmt = $db->prepare("SELECT RouteId, Name, Grade, Description \n FROM Route \n WHERE RouteId=:routeid");
$stmt->execute([':routeid' => $_routeid]);
$data = $stmt->fetch(PDO::FETCH_ASSOC);
$data['Grade'] = preg_replace('/-/', '', parent::unConvert($data['Grade']));
$muuttuja = $comment->getComments($_routeid, 'route');
$muuttuja = $muuttuja->fetchAll();
$data['Image'] = $this->loadRoutePic($_routeid);
$data['Comments'] = $muuttuja;
echo json_encode($data);
}
示例2: date
echo "<h3>";
$startTime = strtotime($pstat['StartTime']);
$endTime = strtotime($pstat['EndTime']);
echo date("d.m.Y", $startTime) . " klo " . date("H:i", $startTime) . " - " . date("H:i", $endTime);
echo "</h3>";
echo "<h3>Toppaukset</h3>";
//ollaan valittu ulkoharjoitus
if ($pstat['IsOutside']) {
$cursor = $estats->getExercises($id, "outdoor-top");
foreach ($cursor as $object) {
$route = new Route($object['RouteId']);
$routeRow = $route->getRoute();
echo "<div class='practice'>";
echo "Crag: <a href='showcrag.php?cid={$routeRow['CragId']}'>" . $routeRow['CragName'] . "</a><br>";
echo "Reitti: " . $routeRow['RouteName'] . "<br>";
echo "Grade: " . preg_replace('/-/', '', $converter->unConvert($estats->getRouteGrade($object['RouteId'])));
echo "</div>";
}
unset($route);
unset($routeRow);
} else {
$cursor = $estats->getExercises($id, "indoor-top");
foreach ($cursor as $object) {
$route = new Route($object['RouteId']);
$routeRow = $route->getRoute();
echo "<div class='practice'>";
echo "Grade: " . preg_replace('/-/', '', $converter->unConvert($object['Grade']));
echo "</div>";
}
}
echo "<h3>Yritykset</h3>";
示例3: getAvgGrade
/**
* Laskee kaikkien kiipeilysuoritusten keskiarvograden (Sisä ja ulko).
* @return string Keskiarvograde.
*/
public function getAvgGrade()
{
$sum = 0;
$count = 0;
$cursor = $this->collection->find(['UserId' => $_SESSION['logged_user'], 'Type' => 'indoor-top']);
foreach ($cursor as $object) {
$sum += $object['Grade'];
$count++;
}
$cursor = $this->collection->find(['UserId' => $_SESSION['logged_user'], 'Type' => 'outdoor-top']);
foreach ($cursor as $object) {
$sum += $this->getRouteGrade($object['RouteId']);
$count++;
}
return parent::unConvert(round($sum / $count));
}