Skip to content
Permalink
Browse files

more reasonable waylength digits display

  • Loading branch information...
following5 committed May 8, 2013
1 parent 71698ef commit 5c9c64f984c2dc1765a8a98c0a5497111c870ec2
Showing with 17 additions and 2 deletions.
  1. +1 −1 htdocs/templates2/ocstyle/viewcache.tpl
  2. +1 −1 htdocs/templates2/ocstyle/viewcache_print.tpl
  3. +15 −0 htdocs/viewcache.php
@@ -185,7 +185,7 @@
<img src="resource2/{$opt.template.style}/images/viewcache/time.png" class="icon16" alt="" title="" align="middle" />&nbsp;{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" />&nbsp;{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" />&nbsp;{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" />&nbsp;{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)
{

0 comments on commit 5c9c64f

Please sign in to comment.
You can’t perform that action at this time.