Modification bug sur le controller Finance

Création de la géolocalisation de google sur les fiche identité
This commit is contained in:
Damien LASSERRE 2011-05-06 14:34:12 +00:00
parent c8392bd7e3
commit 6302def1c6
11 changed files with 279 additions and 24 deletions

View File

@ -317,6 +317,8 @@ class FinanceController extends Zend_Controller_Action
self::constructElementForBilan($bilan, $referencePassif, $passif, $date, $duree, $typeBilan);
self::constructElementForBilan($bilan, $referenceSIG, $SIG, $date, $duree, $typeBilan);
$this->view->assign('siren', $this->entreprise->siren);
$this->view->assign('raisonSociale', $this->entreprise->nom);
$this->view->assign('listeBilan', $listeBilan);
$this->view->assign('date', $date);
$this->view->assign('duree', $duree);
@ -714,7 +716,7 @@ class FinanceController extends Zend_Controller_Action
public function bourseAction()
{
$this->view->assign('bourse', $bourse);
}
/* --------------------------------------------------------------------------------------------------- */

View File

@ -3,9 +3,12 @@ require_once ('geoLocalisation/geoLocalisation.lib.php');
Class geolocalisationController extends Zend_Controller_Action
{
public function _init()
public function init()
{
$this->view->headScript()
->appendFile('/themes/default/scripts/geolocalisation.js', 'text/javascript');
$this->view->headLink()
->appendStylesheet('/themes/default/styles/geolocalisation.css', 'all');
}
public function iframeAction()
@ -22,4 +25,22 @@ Class geolocalisationController extends Zend_Controller_Action
$geoLocalisation = new geoLocalisationLib($listeEtablissement, $valeur);
$this->view->assign('geoInformations', $valeur);
}
public function geophotoAction()
{
$googleKey = geoLocalisationLib::getGoogleKey('extranet.sd.dev');
$adress = array();
$request = $this->getRequest();
$info = $request->getParam('infos');
$google_map = 'http://maps.google.fr/maps?f=q&hl=fr&geocode=&q='.
$info->AdresseNum.',+'.
urlencode($info->AdresseVoie).'+'.
urlencode(htmlspecialchars_decode($info->AdresseRue, ENT_QUOTES)).
',+'.$info->CP.'+'.
urlencode($info->Ville);
$this->view->assign('infos', $info);
$this->view->assign('google_map_link', $google_map);
$this->view->assign('googleKey', $googleKey);
}
}

View File

@ -138,6 +138,7 @@ class IdentiteController extends Zend_Controller_Action
$this->view->assign('dateDerMaj', $dateDerMaj);
$this->view->assign('datemajTexte', $datemajTexte);
$this->view->assign('raisonSociale', $session->getRaisonSociale());
$this->view->assign('infos', $infos);
}
public function fichepcAction()
@ -152,6 +153,7 @@ class IdentiteController extends Zend_Controller_Action
$this->view->headTitle()->append('Liste des établissements - Siren '.$siren);
$session = new SessionEntreprise($this->siret, $this->id);
$user = new Utilisateur();
$ws = new WsScores();
$infos = $ws->getListeEtablissements($siren, $actif);
@ -162,7 +164,12 @@ class IdentiteController extends Zend_Controller_Action
$this->view->assign('siret', $this->siret);
$this->view->assign('raisonSociale', $session->getRaisonSociale());
$this->view->assign('etabs', $etabs);
$this->view->assign('listeEtablissement', $infos);
// Permet de verifier si la personne a la preference d'affichage des cartes.
if($user->checkPref('carte')) {
$this->view->assign('hasPrefCarte', true);
$this->view->assign('listeEtablissement', $infos);
}
}
public function liensAction()

View File

@ -1,7 +1,30 @@
<div id="center">
<h1>Les bilans</h1>
<h1>ÉLÉMENTS FINANCIERS - BILANS</h1>
<div class="paragraph">
<table class="identite">
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">
Num&eacute;ro identifiant Siren
</td>
<td width="350" class="StyleInfoData">
<?php echo $this->SirenTexte($this->siren);?>
</td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Raison Sociale</td>
<td width="350" class="StyleInfoData"><?php echo $this->raisonSociale;?></td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td class="StyleInfoLib" width="200">Bilan de banque/assurance non gérés</td>
<td class="StyleInfoData" width="350"></td>
</tr>
</table>
<?php foreach ($this->listeBilan as $bilan):?>
<?php if(!empty($this->$bilan)):?>
<?php echo $this->partial('finance/bilansPartials/'.$bilan.'.partial.phtml',
array(
'date' => $this->date,
@ -10,6 +33,10 @@
$bilan => $this->$bilan
));
?><br />
<?php else :?>
<?php $banqueAssurance = true;?>
<?php endif;?>
<?php endforeach;?>
</div>
<?php echo $this->render('cgu.phtml', $this->cgu);?>
</div>

View File

@ -9,14 +9,15 @@
Num&eacute;ro identifiant Siren
</td>
<td width="350" class="StyleInfoData">
<?=$this->SirenTexte($this->siren)?>
<?php echo $this->SirenTexte($this->siren);?>
</td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Raison Sociale</td>
<td width="350" class="StyleInfoData"><?=$this->raisonSociale?></td>
<td width="350" class="StyleInfoData"><?php echo $this->raisonSociale;?></td>
</tr>
<?php if(!empty($this->synthese)):?>
<tr>
<td width="30"></td>
@ -31,9 +32,6 @@
</td>
</tr>
</table>
</div>
<div class="paragraph">
<table id="synthese">
<thead>
<tr>
@ -74,6 +72,14 @@
<?php endforeach;?>
</table>
<img src='/fichier/imgcache/test.png' />
<?php else:?>
<tr>
<td width="30">&nbsp;</td>
<td class="StyleInfoLib" width="200">Bilan de banque/assurance non gérés</td>
<td class="StyleInfoData" width="350"></td>
</tr>
</table>
</div>
<?php endif;?>
</div>
</div>

View File

@ -0,0 +1,74 @@
<div id="infogeo" class="clearfix">
<div id="infogeo_txt">
<span id=geolocalisation>
<b>Information géographique :</b><br/>
Latitude : <?php echo geoLocalisationLib::dec2dms($this->infos->GeoLat)?> (<?php echo $this->infos->GeoLat;?>)<br />
Longitude : <?php echo geoLocalisationLib::dec2dms($this->infos->GeoLon)?> (<?php echo $this->infos->GeoLon;?>)<br />
</span>
<a id="lien-google" href="<?php echo $this->google_map_link;?>" target="_blank">
Afficher l&#039;adresse sur Google Map &copy;</a><br/>
<br/>
<b>Code commune / Rivoli :</b><br/>
<?php print $this->infos->Dept.' '.$this->infos->codeCommune.' / '.$this->infos->Rivoli; ?>
</div>
<div id="infogeo_photo">
<div id="legende-photo" style="display: block;">
Cliché à l'approche de l'adresse postale.
</div>
<div>
<img id="pp-cb-thumb" src="http://cbk0.google.com/cbk?output=thumbnail&w=150&h=69&ll=<?php echo $this->infos->GeoLat.','.$this->infos->GeoLon?>" width="300px" height="128px" />
</div>
</div>
<script type="text/javascript"
src="http://maps.google.com/maps?file=api&v=2&key=<?php echo $this->googleKey;?>">
</script>
<script type="text/javascript">
function affichePhoto() {
<?php
if ($this->infos->GeoPrecis < 7) {
print 'var geoCoder = new GClientGeocoder;';
print 'geoCoder.getLocations("'.
$this->infos->AdresseNum.' '.
$this->infos->AdresseRue.' '.
$this->infos->CP.' '.
$this->infos->Ville.'", geoCodeCB);';
} else {
print 'var ll = new GLatLng('.$this->infos->GeoLat.', '.$this->infos->GeoLon.');';
print 'doShowPanoData(ll);';
}
?>
}
function geoCodeCB(reponse) {
if (reponse &&
reponse.Status.code == 200 &&
reponse.Placemark.length == 1 &&
reponse.Placemark[0].AddressDetails.Accuracy > 5) {
var lat = reponse.Placemark[0].Point.coordinates[1];
var lon = reponse.Placemark[0].Point.coordinates[0];
var ll = new GLatLng(lat, lon);
$("#geolocalisation").
replaceWith("<b>Information géographique :</b><br/>" +
"Latitude : " + lat + "<br/>" +
"Longitude : " + lon + "<br/>"
);
$("#lien-google").
replaceWith(
"<a href=http://maps.google.fr/maps?q=" +
"<?php echo $this->info->AdresseNum.'+'.$this->infos->AdresseRue.'+'.
$this->infos->CP.'+'.$this->infos->Ville;?>" +
" target=_blank>" +
"Afficher l'adresse sur Google Map &copy;</a>"
);
doShowPanoData(ll);
}
}
$(document).ready(function() {
if ($('#pp-cb-thumb').length) {
affichePhoto();
}
}
);
</script>
</div>

View File

@ -108,11 +108,13 @@
</table>
</td>
</tr>
<?php if ($this->hasPrefCarte):?>
<tr>
<td align="center" colspan="3">
<?php echo $this->action('iframe', 'geolocalisation', null, array('listeEtablissement' => $this->listeEtablissement)) ?>
</td>
</tr>
<?php endif;?>
</table>
</div>

View File

@ -70,7 +70,7 @@ echo $this->partial('identite/fiche-item.phtml', $this->dBlock['EffectifEtab']);
<h2>Localisation géographique &amp; Recherche presse</h2>
<div class="paragraph">
<?php echo $this->action('geophoto', 'geolocalisation', null, array('infos' => $this->infos));?>
</div>
<?=$this->render('cgu.phtml', $this->cgu)?>

View File

@ -3,14 +3,28 @@ require_once ('common/curl.php');
Class geoLocalisationLib
{
private $googleKey = 'ABQIAAAAuKBtUyFonYJBl1fqfc78tRQvADPcxwXf3Q2QIE-M32vuSkrxiBRLUHDB_YSLeTscTDeWRKM_wILaaw';
private $googleUrl = 'http://maps.google.com/maps/geo?q=';
public $googleKey;
public $googleUrl = 'http://maps.google.com/maps/geo?q=';
public function __construct($listeEtablissement, &$valeur)
{
$valeur = self::createListeOfAdress($listeEtablissement);
}
public function getGoogleKey($domaineName)
{
switch ($domaineName) {
case 'extranet.sd.dev':
return ($this->googleKey = 'ABQIAAAAuKBtUyFonYJBl1fqfc78tRTTQao-JYbZvohjws19Eq-s8HocrxTKnnmfOnWxcHe01UHRIkRkZ1f17Q');
case 'extranet.sd.lan':
return ($this->googleKey = 'ABQIAAAAuKBtUyFonYJBl1fqfc78tRSKTEtsiH12Xc5SNL4Zmo_wRXVkrxR4jPIy3GOKGzZxBEOkvOsLG2CJ3w');
default:
return (false);
}
return ($this->googleKey);
}
/**
* Execute une requete cURL pour recuperer les infos XML
* Traitement XML avec SimpleXml.
@ -19,15 +33,19 @@ Class geoLocalisationLib
*/
public function getCoordinates($marqueur)
{
// Pour les appelles statics. version dev pour la clef.
(isset($this->googleKey))?$googleKey = $this->googleKey:$googleKey = 'ABQIAAAAuKBtUyFonYJBl1fqfc78tRTTQao-JYbZvohjws19Eq-s8HocrxTKnnmfOnWxcHe01UHRIkRkZ1f17Q';
(isset($this->googleUrl))?$googleUrl = $this->googleUrl:$googleUrl = 'http://maps.google.com/maps/geo?q=';
$sep = ',';
$cURL = curl_init();
$user_agent = 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)';
$googleUrl = $this->googleUrl . urlencode(
$Url = $googleUrl . urlencode(
$marqueur['adresse'].$sep.$marqueur['cp'].
$sep.$marqueur['ville'].$sep.$marqueur['pays']).'&output=xml&key='.$this->googleKey;
$sep.$marqueur['ville'].$sep.$marqueur['pays']).'&output=xml&key='.$googleKey;
curl_setopt($cURL, CURLOPT_URL, $googleUrl);
curl_setopt($cURL, CURLOPT_URL, $Url);
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($cURL, CURLOPT_SSL_VERIFYPEER, FALSE);
//curl_setopt($cURL, CURLOPT_USERAGENT, $user_agent);
@ -36,7 +54,7 @@ Class geoLocalisationLib
curl_close($cURL);
if (isset($data)) {
if (isset($data) and !empty($data)) {
$xml = new SimpleXMLElement($data);
$result = simplexml_load_string($data);
$explode = explode(',' ,$result->Response->Placemark->Point->coordinates);
@ -49,13 +67,37 @@ Class geoLocalisationLib
return ($coordinates);
}
public function getImage($coordonnees)
{
$image = 'http://cbk0.google.com/cbk?output=thumbnail&w=300&h=234&ll=';
return ($image.$coordonnees[1].','.$coordonnees[0]);
}
public function supprDecimales($dec)
{
if ($dec>0 )
return floor($dec);
else
return ceil($dec);
}
public function dec2dms($dec)
{
$d = self::supprDecimales($dec);
$m = self::supprDecimales(($dec - $d) * 60);
$s = abs(round(((($dec - $d) * 60) - $m) * 60));
$m = abs($m);
return $d.'°'.$m."'".$s.'"';
}
/**en cours **/
protected function createListeOfAdress($listeEtablissement)
{
$coordonnes = array();
$i = 0;
$image = 'http://cbk0.google.com/cbk?output=thumbnail&w=150&h=69&ll=';
print_r($etablissement);
foreach ($listeEtablissement->result->item as $etablissement)
{
$search = array();
@ -79,9 +121,4 @@ Class geoLocalisationLib
return ($coordonnes);
}
protected function google_getLatLong($adresse)
{
}
}

View File

@ -0,0 +1,27 @@
/**
*
*/
function showPanoData(panoData) {
if (panoData.code != 200) {
return;
}
$('#pp-cb-thumb').replaceWith(
'<div id="pp-cb-thumb"><div class="left">' +
'<img src="http://maps.google.fr/cbk?output=tile&panoid=' +
panoData.location.panoId +
'&zoom=1&x=0&y=0&cb_client=maps_sv" />' +
'</div>' +
'<div class="right">' +
'<img src="http://maps.google.fr/cbk?output=tile&panoid=' +
panoData.location.panoId +
'&zoom=1&x=1&y=0&cb_client=maps_sv" />' +
'</div></div>');
$('#legende-photo' ).css('display','block');
$('#pp-cb-thumb' ).css('display','block');
}
function doShowPanoData(ll) {
var panoClient = new GStreetviewClient();
panoClient.getNearestPanorama(ll, showPanoData);
}

View File

@ -0,0 +1,52 @@
#infogeo_txt {
float:left;
width:200px;
padding:20px 0 0 20px;
}
#infogeo_photo {
float:left;
margin:0;
padding:0;
width:340px;
}
#legende-photo {
display:none;
width:278px;
margin:5px 0 10px 0;
padding:10px;
border:1px solid #0000ff;
color:#0000ff;
}
#pp-cb-thumb {
display:none;
}
#pp-cb-thumb div.left {
float:left;
position:relative;
width:256px;
height:128px;
overflow:hidden;
}
#pp-cb-thumb div.right {
float:left;
position:relative;
width:44px;
height:128px;
overflow:hidden;
}
#pp-cb-thumb div.left img{
position:relative;
left:-256px;
top:-140px;
}
#pp-cb-thumb div.right img{
position:relative;
top:-140px;
}