Back to PhocaGalleryRenderMaposm class

Method setMarker

public
setMarker
(mixed $markerId, mixed $title, mixed $description, mixed $lat, mixed $lng, mixed $text = '', mixed $width = '', mixed $height = '', mixed $open = 0, mixed $closeOpenedWindow = 0)

Method setMarker - Source code

public function setMarker($markerId, $title, $description, $lat, $lng, $text = '', $width = '', $height = '', $open = 0, $closeOpenedWindow = 0)
{
    $o = array();
    if ($open != 2) {
        $o[] = 'var marker' . $markerId . ' = L.marker([' . PhocaGalleryText::filterValue($lat, 'number2') . ', ' . PhocaGalleryText::filterValue($lng, 'number2') . ']).addTo(map' . $this->name . $this->id . ');';
    }
    jimport('joomla.filter.output');
    $style = '';
    if ($width != '') {
        $style .= 'width: ' . (int) $width . 'px;';
    }
    if ($height != '') {
        $style .= 'height: ' . (int) $height . 'px;';
    }
    if ($text == '') {
        if ($title != '') {
            $hStyle = 'font-size:120%;margin: 5px 0px;font-weight:bold;';
            $text .= '<div style="' . $hStyle . '">' . addslashes($title) . '</div>';
        }
        if ($description != '') {
            $text .= '<div>' . PhocaGalleryText::strTrimAll(addslashes($description)) . '</div>';
        }
    }
    if ($text != '') {
        if ($style != '') {
            $text = '<div style="' . $style . '">' . $text . '</div>';
        }
        $openO = '';
        if ($open == 1) {
            $openO = '.openPopup()';
        }
        $o[] = 'marker' . $markerId . '.bindPopup(\'' . $text . '\')' . $openO . ';';
    }
    $this->output[] = implode("\n", $o);
    return true;
}