示例#1
0
function getWaypoints($cacheid)
{
    global $waypointline;
    global $waypointlines;
    global $nowaypoints;
    $wphandler = new HandlerChildWp();
    $waypoints = $wphandler->getChildWps($cacheid);
    $ret = '';
    if (!empty($waypoints)) {
        $formatter = new FormatterCoordinate();
        foreach ($waypoints as $waypoint) {
            $tmpline = $waypointline;
            $tmpline = mb_ereg_replace('{wp_image}', htmlspecialchars($waypoint['image'], ENT_COMPAT, 'UTF-8'), $tmpline);
            $tmpline = mb_ereg_replace('{wp_type}', htmlspecialchars($waypoint['name'], ENT_COMPAT, 'UTF-8'), $tmpline);
            $htmlcoordinate = $formatter->formatHtml($waypoint['coordinate'], '</td></tr><tr><td style="white-space:nowrap">');
            $tmpline = mb_ereg_replace('{wp_coordinate}', $htmlcoordinate, $tmpline);
            $tmpline = mb_ereg_replace('{wp_description}', htmlspecialchars(trim($waypoint['description']), ENT_COMPAT, 'UTF-8'), $tmpline);
            $tmpline = mb_ereg_replace('{wp_show_description}', mb_ereg_replace('\\r\\n', '<br />', htmlspecialchars($waypoint['description'], ENT_COMPAT, 'UTF-8')), $tmpline);
            $tmpline = mb_ereg_replace('{cacheid}', htmlspecialchars($cacheid, ENT_COMPAT, 'UTF-8'), $tmpline);
            $tmpline = mb_ereg_replace('{childid}', htmlspecialchars($waypoint['childid'], ENT_COMPAT, 'UTF-8'), $tmpline);
            $ret .= $tmpline;
        }
        $ret = mb_ereg_replace('{lines}', $ret, $waypointlines);
        return $ret;
    }
    return $nowaypoints;
}
示例#2
0
function getChildWaypoints($cacheid)
{
    $wphandler = new HandlerChildWp();
    $waypoints = $wphandler->getChildWps($cacheid);
    $count = count($waypoints);
    if ($count > 0) {
        $formatter = new FormatterCoordinate();
        for ($i = 0; $i < $count; $i++) {
            $waypoints[$i]['coord']['lat'] = $waypoints[$i]['coordinate']->latitude();
            $waypoints[$i]['coord']['lon'] = $waypoints[$i]['coordinate']->longitude();
            $waypoints[$i]['coordinateHtml'] = $formatter->formatHtml($waypoints[$i]['coordinate'], '<br />');
            $waypoints[$i]['description'] = trim($waypoints[$i]['description']);
            $waypoints[$i]['position'] = $i + 1;
        }
    }
    return $waypoints;
}