From 2e0e6cc0ad02293f5e88f6e614fa422c0a3ae4bf Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Thu, 24 Oct 2013 11:35:29 +0000 Subject: [PATCH] Correct streetview following the release --- application/controllers/IdentiteController.php | 3 ++- application/controllers/UserController.php | 6 +++--- .../views/default/scripts/identite/facade.phtml | 5 +++-- library/Scores/Google/Streetview.php | 16 +++++++++++++--- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/application/controllers/IdentiteController.php b/application/controllers/IdentiteController.php index 5d392834e..4973c91ea 100644 --- a/application/controllers/IdentiteController.php +++ b/application/controllers/IdentiteController.php @@ -1160,6 +1160,7 @@ class IdentiteController extends Zend_Controller_Action public function streetviewAction() { $request = $this->getRequest(); + $siret = $request->getParam('siret'); if ( $request->isXmlHttpRequest() ) { $this->_helper->layout()->disableLayout(); @@ -1169,7 +1170,7 @@ class IdentiteController extends Zend_Controller_Action $lon = $request->getParam('lon', ''); $num = $request->getParam('heading', 0); - $streetview = new Scores_Google_Streetview(); + $streetview = new Scores_Google_Streetview($siret); if ( $lat != '' && $lon != '' ) { $deg = $streetview->getNumDeg(); $nbImg = count($deg); diff --git a/application/controllers/UserController.php b/application/controllers/UserController.php index 964a384aa..dc4de6b58 100644 --- a/application/controllers/UserController.php +++ b/application/controllers/UserController.php @@ -348,7 +348,7 @@ class UserController extends Zend_Controller_Action $this->view->form = $form; $request = $this->getRequest(); if ( $request->isPost() ) { - $formData = $request->getPost (); + $formData = $request->getPost(); if ($form->isValid($formData)) { $login = $form->getValue('login'); $pass = $form->getValue('pass'); @@ -634,8 +634,8 @@ class UserController extends Zend_Controller_Action } catch ( Zend_Mail_Transport_Exception $e ){ $message = $e->getMessage(); - } - + } + } $this->view->assign('message', $message); } diff --git a/application/views/default/scripts/identite/facade.phtml b/application/views/default/scripts/identite/facade.phtml index 4f693b4f4..148430083 100644 --- a/application/views/default/scripts/identite/facade.phtml +++ b/application/views/default/scripts/identite/facade.phtml @@ -2,8 +2,9 @@
action('streetview', 'identite', null, array( - 'lat' => $this->infos->GeoLat, - 'lon' => $this->infos->GeoLon + 'lat' => $this->infos->GeoLat, + 'lon' => $this->infos->GeoLon, + 'siret' => $this->infos->Siret, ));?>
diff --git a/library/Scores/Google/Streetview.php b/library/Scores/Google/Streetview.php index 50160519a..1ce891dd3 100644 --- a/library/Scores/Google/Streetview.php +++ b/library/Scores/Google/Streetview.php @@ -74,14 +74,21 @@ class Scores_Google_Streetview /** * + * @var string */ - public function __construct() + protected $siret; + + /** + * + */ + public function __construct($siret) { $this->size = '320x320'; - $c = Zend_Registry::get('config'); - $ths->path = realpath($c->profil->path->data).'/google/streetview'; + $this->siret = $siret; + $c = Zend_Registry::get('config'); + $this->path = realpath($c->profil->path->data).'/google/streetview'; } /** @@ -152,6 +159,7 @@ class Scores_Google_Streetview require_once 'common/curl.php'; $page = getUrl($this->url, '', '', '', false); + Zend_Registry::get('firebug')->info('URL = '.$this->url); if ( !in_array($page['code'], array(400, 408, 403)) ) { $body = $page['body']; file_put_contents($this->pathImg(), $body); @@ -174,7 +182,9 @@ class Scores_Google_Streetview */ public function display() { + $this->url = $this->urlImg(); $file = $this->pathImg(); + Zend_Registry::get('firebug')->info('Filename = '.$file); if ( !file_exists($file) ) { $this->getImg(); }