Ejemplo n.º 1
0
function getWaypoints($cacheid)
{
    global $waypointline;
    global $waypointlines;
    global $nowaypoints;
    $wphandler = new ChildWp_Handler();
    $waypoints = $wphandler->getChildWps($cacheid);
    $ret = '';
    if (!empty($waypoints)) {
        $formatter = new Coordinate_Formatter();
        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;
}
Ejemplo n.º 2
0
function getChildWaypoints($cacheid)
{
    $wphandler = new ChildWp_Handler();
    $waypoints = $wphandler->getChildWps($cacheid);
    $count = count($waypoints);
    if ($count > 0) {
        $formatter = new Coordinate_Formatter();
        for ($i = 0; $i < $count; $i++) {
            $waypoints[$i]['coordinateHtml'] = $formatter->formatHtml($waypoints[$i]['coordinate'], '<br />');
        }
    }
    return $waypoints;
}
Ejemplo n.º 3
0
function getChildWaypoints($cacheid)
{
    $wphandler = new ChildWp_Handler();
    $waypoints = $wphandler->getChildWps($cacheid);
    $count = count($waypoints);
    if ($count > 0) {
        $formatter = new Coordinate_Formatter();
        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;
}
Ejemplo n.º 4
0
 public function prepare($template)
 {
     $formatter = new Coordinate_Formatter();
     $coordinate = $this->getCoordinate();
     $template->assign(self::lat_hem, $formatter->formatLatHem($coordinate));
     $template->assign(self::lat_deg, $formatter->formatLatDeg($coordinate));
     $template->assign(self::lat_min, $formatter->formatLatMin($coordinate));
     $template->assign(self::lon_hem, $formatter->formatLonHem($coordinate));
     $template->assign(self::lon_deg, $formatter->formatLonDeg($coordinate));
     $template->assign(self::lon_min, $formatter->formatLonMin($coordinate));
     if (!$this->valid) {
         $template->assign(self::coord_error, $this->translator->translate('Invalid coordinate'));
     }
 }
 function testFormatHtmlSeparator()
 {
     $formatter = new Coordinate_Formatter();
     $this->assertIdentical('N 10&deg; 20.000\'&nbsp;E 030&deg; 40.000\'', $formatter->formatHtml(Coordinate_Coordinate::fromHemDegMin(true, 10, 20, true, 30, 40), '&nbsp;'));
     $this->assertIdentical('S 15&deg; 25.000\'<br/>W 035&deg; 45.000\'', $formatter->formatHtml(Coordinate_Coordinate::fromHemDegMin(false, 15, 25, false, 35, 45), '<br/>'));
 }