more reasonable waylength digits display
This commit is contained in:
@@ -185,7 +185,7 @@
|
||||
<img src="resource2/{$opt.template.style}/images/viewcache/time.png" class="icon16" alt="" title="" align="middle" /> {t}Time required{/t}: {$cache.searchtime|format_hour} h
|
||||
{/if}
|
||||
{if $cache.waylength>0}
|
||||
<img src="resource2/{$opt.template.style}/images/viewcache/arrow_roundtrip.png" class="icon16" alt="" title="" align="middle" /> {t}Waylength{/t}: {$cache.waylength|sprintf:'%01.2f'} km
|
||||
<img src="resource2/{$opt.template.style}/images/viewcache/arrow_roundtrip.png" class="icon16" alt="" title="" align="middle" /> {t}Waylength{/t}: {$cache.waylength} km
|
||||
{/if}
|
||||
{if $cache.searchtime>0 || $cache.waylength>0}<br />{/if}
|
||||
<img src="resource2/{$opt.template.style}/images/viewcache/date.png" class="icon16" alt="" title="" align="middle" /> {if $cache.type==6}{t}Event date{/t}{else}{t}Hidden at{/t}{/if}: {$cache.datehidden|date_format:$opt.format.datelong}<br />
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
<nobr>{t}Time required{/t}: {$cache.searchtime|format_hour} h</nobr>
|
||||
{/if}
|
||||
{if $cache.waylength>0}
|
||||
<nobr>{t}Distance{/t}: {$cache.waylength|sprintf:'%01.2f'} km</nobr>
|
||||
<nobr>{t}Distance{/t}: {$cache.waylength} km</nobr>
|
||||
{/if}
|
||||
{if $cache.searchtime>0 || $cache.waylength>0}<br />{/if}
|
||||
{if $cache.status!=1}
|
||||
|
||||
@@ -146,6 +146,21 @@ function getChildWaypoints($cacheid)
|
||||
if ($rCache === false)
|
||||
$tpl->error(ERROR_CACHE_NOT_EXISTS);
|
||||
|
||||
// format waylength
|
||||
if ($rCache['waylength'] < 5)
|
||||
if (round($rCache['waylength'],2) != round($rCache['waylength'],1))
|
||||
$digits = 2;
|
||||
else
|
||||
$digits = 1;
|
||||
else if ($rCache['waylength'] < 50)
|
||||
if (round($rCache['waylength'],1) != round($rCache['waylength'],0))
|
||||
$digits = 1;
|
||||
else
|
||||
$digits = 0;
|
||||
else
|
||||
$digits = 0;
|
||||
$rCache['waylength'] = sprintf('%.'.$digits.'f', $rCache['waylength']);
|
||||
|
||||
// not published?
|
||||
if ($rCache['status'] == 5)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user