Back to PhocaGalleryRenderMap class

Method setMarker

public
setMarker
(mixed $id, mixed $title, mixed $description, mixed $latitude, mixed $longitude, mixed $icon = 0, mixed $text = '')

Method setMarker - Source code

public function setMarker($id, $title, $description, $latitude, $longitude, $icon = 0, $text = '')
{
    jimport('joomla.filter.output');
    phocagalleryimport('phocagallery.text.text');
    $output = '';
    if ($text == '') {
        if ($title != '') {
            $text .= '<h1>' . PhocaGalleryText::filterValue($title, 'text') . '</h1>';
        }
        if ($description != '') {
            $text .= '<div>' . PhocaGalleryText::strTrimAll(PhocaGalleryText::filterValue($description, 'text')) . '</div>';
        }
    }
    $output .= 'var phocaPoint' . $id . ' = new google.maps.LatLng(' . PhocaGalleryText::filterValue($latitude, 'number2') . ', ' . PhocaGalleryText::filterValue($longitude, 'number2') . ');' . "\n";
    $output .= 'var markerPhocaMarker' . $id . ' = new google.maps.Marker({title:"' . PhocaGalleryText::filterValue($title, 'text') . '"';
    if ($icon == 1) {
        $output .= ', icon:phocaImage';
        $output .= ', shadow:phocaImageShadow';
        $output .= ', shape:phocaImageShape';
    }
    $output .= ', position: phocaPoint' . $id;
    $output .= ', map: ' . $this->_map;
    $output .= '});' . "\n";
    $output .= 'var infoPhocaWindow' . $id . ' = new google.maps.InfoWindow({' . "\n" . ' content: \'' . $text . '\'' . "\n" . '});' . "\n";
    $output .= 'google.maps.event.addListener(markerPhocaMarker' . $id . ', \'click\', function() {' . "\n" . ' infoPhocaWindow' . $id . '.open(' . $this->_map . ', markerPhocaMarker' . $id . ' );' . "\n" . ' });' . "\n";
    return $output;
}