<?php

define('RENDER_MODE', 'catalyz');

$node = $page->getNode();

use_helper('Form');

$properties = array();
$properties['page'] = $page;
$properties['node'] = $node;
$properties['ContentTree'] = $ContentTree;

ob_start();
use_helper('I18N');

$allLanguages = sfConfig::get('app_translations_available_languages');
$default = sfConfig::get('app_translations_default_language');
// $existing_languages = $node->getAvailableTranslations();
$allLanguages = Catalyz::getAllTranslations();
unset($allLanguages[$default]);
// $perms = array();
// $available_languages = array();
// foreach($allLanguages as $iso => $name) {
// if (!isset($existing_languages[$iso])) {
// $available_languages[$iso] = ucfirst($name);
// }
// $perms[$iso]['edit'] = true;
// $perms[$iso]['delete'] = ($iso != $default);
// }
// include_partial('catalyz/header');

?>

<div class="content-add01">
	<div class="heading01"><h1>Mon compte</h1></div>

<?php echo form_tag('@katao_profile_gmap') ?>

<?php echo input_hidden_tag('gmap_lng', $katao_member_or_supplier->getGmapLng()) ?>
<?php echo input_hidden_tag('gmap_lat', $katao_member_or_supplier->getGmapLat()) ?>

<p><i>Modifier ci-dessous votre positionnement sur la carte en déplaçant le pion.</i></p>

<?php echo submit_tag('Sauver') ?> ou <a href="<?php echo $sf_request->getReferer() ?>">annuler</a><br /><br />

<script type="text/javascript" src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=<?php echo sfConfig::get('app_gmap') ?>&sensor=true"></script>

<script type="text/javascript" language="JavaScript">
/* <![CDATA[ */

window.onload = function(){
	if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map_canvas"));
		map.setCenter(new GLatLng(45, 3), 6);
        map.setUIToDefault();

        // "tiny" marker icon
		var icon = new GIcon();
		icon.image = "http://maps.google.com/mapfiles/ms/micons/red-dot.png";
		icon.iconSize = new GSize(32, 32);
		icon.iconAnchor = new GPoint(16, 32);

		var point = new GLatLng(<?php echo $katao_member_or_supplier->getGmapLat() ?>,<?php echo $katao_member_or_supplier->getGmapLng() ?>);

		var markerD = new GMarker(point, {icon:icon, draggable: true});
		map.addOverlay(markerD);
		markerD.enableDragging();
		GEvent.addListener(markerD, "drag", function(){
			document.getElementById("gmap_lng").value = markerD.getPoint().lng();
			document.getElementById("gmap_lat").value = markerD.getPoint().lat();
		});

	}
}

/* ]]> */
</script>

<div id="map_canvas" style="width: 385px; height: 350px"></div>

</form>

</div>

<?php

    $content = ob_get_contents();

ob_end_clean();
// $layout = LayoutManager::instance()->getCatalyzTemplate($ContentTreeNode->getCurrentLayoutNameForAction());
$properties['layout_family'] = 'katao';
$properties['layout_name'] = 'layoutv2';
$properties['content'] = $content;

include_component($properties['layout_family'], $properties['layout_name'], $properties);

?>