Exemple #1
0
 public function action_index()
 {
     require_once Kohana::find_file('vendor', 'php-googlemap/GoogleMap', 'php');
     $this->before('/pages/maps');
     $this->template->title = __('Map');
     $height = Core::get('height', '100%');
     $width = Core::get('width', '100%');
     $map = new GoogleMapAPI();
     $map->setWidth($width);
     $map->setHeight($height);
     $map->disableSidebar();
     $map->setMapType('map');
     $map->setZoomLevel(Core::get('zoom', core::config('advertisement.map_zoom')));
     //$map->mobile = TRUE;
     $atributes = array("target='_blank'");
     if (core::get('controls') == 0) {
         $map->disableMapControls();
         $map->disableTypeControls();
         $map->disableScaleControl();
         $map->disableZoomEncompass();
         $map->disableStreetViewControls();
         $map->disableOverviewControl();
     }
     //only 1 marker
     if (core::get('address') != '') {
         $map->addMarkerByAddress(core::get('address'), core::get('address'));
     } else {
         //last ads, you can modify this value at: general.feed_elements
         $ads = DB::select('a.seotitle')->select(array('c.seoname', 'category'), 'a.title', 'a.published', 'a.address')->from(array('ads', 'a'))->join(array('categories', 'c'), 'INNER')->on('a.id_category', '=', 'c.id_category')->where('a.status', '=', Model_Ad::STATUS_PUBLISHED)->where('a.address', 'IS NOT', NULL)->order_by('published', 'desc')->limit(Core::config('general.map_elements'))->as_object()->cached()->execute();
         foreach ($ads as $a) {
             //d($a);
             if (strlen($a->address) > 3) {
                 $url = Route::url('ad', array('category' => $a->category, 'seotitle' => $a->seotitle));
                 $map->addMarkerByAddress($a->address, $a->title, HTML::anchor($url, $a->title, $atributes));
             }
         }
         //only center if not a single ad
         $map->setCenterCoords(Core::get('lon', core::config('advertisement.center_lon')), Core::get('lat', core::config('advertisement.center_lat')));
     }
     $this->template->map = $map;
 }
    echo $MAP_OBJECT->printOnLoad();
    ?>
					<?php 
    echo $MAP_OBJECT->printMap();
    ?>
					<?php 
    echo $MAP_OBJECT->printSidebar();
    ?>
					<?php 
} else {
    //display qatar's map by default
    include_once "GoogleMap.php";
    include_once "JSMin.php";
    $MAP_OBJECT = new GoogleMapAPI();
    $MAP_OBJECT->_minify_js = isset($_REQUEST["min"]) ? FALSE : TRUE;
    $MAP_OBJECT->addMarkerByAddress("Bin omran Doha, Qatar", "IOU head office", "IOU head Office,bin Omran Doha");
    ?>
				<?php 
    echo $MAP_OBJECT->getHeaderJS();
    ?>
				<?php 
    echo $MAP_OBJECT->getMapJS();
    ?>
				
				<?php 
    echo $MAP_OBJECT->printOnLoad();
    ?>
				<?php 
    echo $MAP_OBJECT->printMap();
    ?>
				<?php 
Exemple #3
0
<?php

require_once 'header_php.php';
?>

<?php 
$map = new GoogleMapAPI('map');
$map->setAPIKey($googlemaps_key);
$map->disableSidebar();
$map->setMapType('map');
$map->setWidth(450);
$map->setHeight(350);
$map->addMarkerByAddress('5186-F Longs Peak Road Berthoud Colorado 80513', '', 'Colorado Water Jet<br>5186-F Longs Peak Road<br>Berthoud, Colorado 80513');
?>


<?php 
include 'header.php';
?>


<table>
<tr valign='middle'><td>
<table>
<tr valign='top'><td>Address:</td><td>Colorado Water Jet<br>5186-F Longs Peak Road<br>Berthoud, Colorado 80513<br>&nbsp;</td></tr>
<tr><td>Phone:</td><td>970.532.5404</td></tr>
<tr><td>Toll Free:</td><td>866.532.5404</td></tr>
<tr><td>Fax:</td><td>970.532.5405</td></tr>
</table>
</td><td><?php 
$map->printMap();
 public function viewpresentsAction()
 {
     $smarty = Zend_Registry::get('view');
     $request = $this->getRequest();
     $id = (int) $request->getParam('id', 0);
     if ($id > 0) {
         $model = $this->_getModel();
         $modelConfig = $this->_getModelConfig();
         $modelLanJoueur = $this->_getModelLanJoueur();
         $modelLanJeuxJoueurTeam = $this->_getModelLanJeuxJoueurTeam();
         $lan = $model->fetchEntryField($id, array('idLan', 'nom', 'adresse', 'ville', 'cp'));
         // API Google Map v3
         require '../library/My/GoogleMapAPI.class.php';
         $map = new GoogleMapAPI();
         $map->setMapType('ROADMAP');
         $map->setDivId('googlemap');
         // fixe les dimensions de la carte
         $map->setSize('830px', '500px');
         // definition du zoom automatique
         $map->setEnableAutomaticCenterZoom(true);
         if (true) {
             $villes = $modelLanJoueur->fetchEntriesVillePresents($id);
             foreach ($villes as $v) {
                 $joueurs = $modelLanJoueur->fetchEntriesByLanVillePresentsField($id, $v['ville'], array('idCompte', 'login', 'cp', 'ville', 'img'));
                 if (sizeof($joueurs) > 1) {
                     $logins = "";
                     foreach ($joueurs as $j) {
                         $logins .= $j['login'] . "<br/>";
                     }
                     // ajout d'un marqueur joueur sur la carte
                     $map->addMarkerByAddress($j['ville'] . ' ' . $j['cp'], "Joueurs", "<span class='rouge'><strong>{$j['ville']} ({$j['cp']})</strong></span><br/>{$logins}", "Joueurs de {$j['ville']}", $request->getBaseUrl() . '/images/comptes/thumb/no_logo.png');
                 } else {
                     // ajout d'un marqueur joueur sur la carte
                     $map->addMarkerByAddress($joueurs[0]['ville'] . ' ' . $joueurs[0]['cp'], $joueurs[0]['login'], "<span class='rouge'><strong>" . $joueurs[0]['login'] . "</strong></span><br/>" . $joueurs[0]['ville'] . " (" . $joueurs[0]['cp'] . ")", $joueurs[0]['login'], $request->getBaseUrl() . '/images/comptes/thumb/' . $joueurs[0]['img']);
                 }
             }
             // ajout du marqueur lan sur la carte
             $map->addMarkerByAddress($lan['adresse'] . ' ' . $lan['ville'] . ' ' . $lan['cp'], $lan['nom'], "<span class='rouge'><strong>{$lan['nom']}</strong></span><br/>{$lan['adresse']}<br/>{$lan['ville']} ({$lan['cp']})", $lan['nom'], $request->getBaseUrl() . '/images/admin/computer_gmap.png');
         }
         $joueurs = $modelLanJoueur->fetchEntriesByLanPresentField($id, array('idCompte', 'login', 'cp', 'ville', 'img', 'prenom', 'datenaissance'));
         $map->generate();
         $date = new Zend_Date();
         $smarty->assign('datedujour', $date->toString('YYYY-M-dd'));
         $smarty->assign('lan', $lan);
         $smarty->assign('base_url', $request->getBaseUrl());
         $smarty->assign('joueurs', $joueurs);
         $smarty->assign('map', $map);
         $smarty->assign('title', 'Pr&eacute;sents de la lan ' . $lan['nom']);
         $smarty->display('lan/viewinscrits.tpl');
     } else {
         return $this->_helper->redirector('index');
     }
 }