Reintegrate trunk
This commit is contained in:
commit
7b0cef6538
@ -133,7 +133,8 @@ class PiecesController extends Zend_Controller_Action
|
||||
foreach($items as $item) {
|
||||
|
||||
if ($item->ActeDate == '0000-00-00') {
|
||||
$infosActe['date'] = '-';
|
||||
$date = new Zend_Date($item->DepotDate, 'yyyy-MM-dd');
|
||||
$infosActe['date'] = $date->toString('dd/MM/yyyy');
|
||||
} else {
|
||||
$date = new Zend_Date($item->ActeDate, 'yyyy-MM-dd');
|
||||
$infosActe['date'] = $date->toString('dd/MM/yyyy');
|
||||
|
@ -590,7 +590,7 @@ class Infogreffe
|
||||
* @return unknown_type
|
||||
*/
|
||||
function formatActes($actes)
|
||||
{
|
||||
{set_time_limit(90);
|
||||
$tabActes = array();
|
||||
//Pour chaque depot
|
||||
foreach($actes as $key => $depot)
|
||||
|
@ -22,7 +22,7 @@ class Scores_Google_Streetview
|
||||
|
||||
/**
|
||||
* GPS ou Adresse
|
||||
* @var string
|
||||
* @var strign
|
||||
*/
|
||||
protected $location = null;
|
||||
|
||||
@ -53,7 +53,7 @@ class Scores_Google_Streetview
|
||||
/**
|
||||
* Indicates the compass heading of the camera (0 to 360)
|
||||
*/
|
||||
protected $heading = null;
|
||||
protected $heading = 0;
|
||||
|
||||
/**
|
||||
* Number of image by the circle (360°)
|
||||
@ -74,51 +74,14 @@ class Scores_Google_Streetview
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $siret;
|
||||
|
||||
/**
|
||||
* Maximum request per day
|
||||
* @var int
|
||||
*/
|
||||
protected $maxRequestPerDay = 25000;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var unknown
|
||||
*/
|
||||
protected $mode;
|
||||
|
||||
/**
|
||||
* Mode GPS
|
||||
* @var unknown
|
||||
*/
|
||||
const MODE_GPS = 1;
|
||||
|
||||
/**
|
||||
* Mode Adresse
|
||||
* @var unknown
|
||||
*/
|
||||
const MODE_ADDRESS = 2;
|
||||
|
||||
/**
|
||||
* Google Streetview
|
||||
* Get image by GPS coord or by adresse
|
||||
* Save image reference in a database
|
||||
* GpsLat, GpsLong, Adresse, Image, Date
|
||||
* Save request that give no imagery
|
||||
* Siren, Nic, Date
|
||||
* Save in database, with a counter the number of request by day
|
||||
*/
|
||||
public function __construct($siret)
|
||||
public function __construct()
|
||||
{
|
||||
$this->size = '320x320';
|
||||
|
||||
$this->siret = $siret;
|
||||
|
||||
$c = Zend_Registry::get('config');
|
||||
$this->path = realpath($c->profil->path->data).'/google/streetview';
|
||||
$ths->path = realpath($c->profil->path->data).'/google/streetview';
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -128,23 +91,18 @@ class Scores_Google_Streetview
|
||||
*/
|
||||
public function setLocationGeo($lattitude, $longitude)
|
||||
{
|
||||
$this->mode = self::MODE_GPS;
|
||||
$this->location = $lattitude.','.$longitude;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $adresse
|
||||
* @param unknown $adresse
|
||||
*/
|
||||
public function setLocationTxt($adresse)
|
||||
{
|
||||
$this->mode = self::MODE_ADDRESS;
|
||||
$this->location = $adresse;
|
||||
}
|
||||
public function setLocationTxt($adresse){}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param int $num
|
||||
* @param unknown $num
|
||||
*/
|
||||
public function setHeading($num)
|
||||
{
|
||||
@ -169,7 +127,7 @@ class Scores_Google_Streetview
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct the image URL
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function urlImg()
|
||||
@ -179,7 +137,7 @@ class Scores_Google_Streetview
|
||||
$params = array( 'size', 'location', 'fov', 'pitch', 'sensor', 'heading' );
|
||||
foreach ($params as $param) {
|
||||
if ( $this->{$param} !== null ) {
|
||||
$url.= '&'.$param.'='. urlencode($this->{$param});
|
||||
$url.= '&'.$param.'='. $this->{$param};
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,19 +149,12 @@ class Scores_Google_Streetview
|
||||
*/
|
||||
public function getImg()
|
||||
{
|
||||
try {
|
||||
$client = new Zend_Http_Client($this->url);
|
||||
$client->setStream();
|
||||
$response = $client->request('GET');
|
||||
if ( $response->isSuccessful() ) {
|
||||
if (!copy($response->getStreamName(), $this->pathImg())) {
|
||||
Zend_Registry::get('firebug')->info('Erreur copie image !');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} catch (Zend_Http_Client_Exception $e) {
|
||||
Zend_Registry::get('firebug')->info('HTTP Exception : '.$e->getMessage());
|
||||
return false;
|
||||
require_once 'common/curl.php';
|
||||
$page = getUrl($this->url, '', '', '', false);
|
||||
|
||||
if ( !in_array($page['code'], array(400, 408, 403)) ) {
|
||||
$body = $page['body'];
|
||||
file_put_contents($this->pathImg(), $body);
|
||||
}
|
||||
}
|
||||
|
||||
@ -213,11 +164,7 @@ class Scores_Google_Streetview
|
||||
*/
|
||||
public function pathImg()
|
||||
{
|
||||
if ($this->mode == self::MODE_GPS) {
|
||||
$filename = $this->siret.'-'.$this->heading . '.' . $this->extension;
|
||||
} else if ($this->mode == self::MODE_ADDRESS) {
|
||||
$filename = $this->siret.'-ADDRESS' . $this->extension;
|
||||
}
|
||||
$filename = $this->siret.'-'.$this->heading . '.' . $this->extension;
|
||||
return $this->path . DIRECTORY_SEPARATOR . $filename;
|
||||
}
|
||||
|
||||
@ -225,33 +172,14 @@ class Scores_Google_Streetview
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function serveUrl()
|
||||
public function display()
|
||||
{
|
||||
return $this->urlImg();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function serveImg()
|
||||
{
|
||||
$this->url = $this->urlImg();
|
||||
Zend_Registry::get('firebug')->info('URL = '.$file);
|
||||
$file = $this->pathImg();
|
||||
Zend_Registry::get('firebug')->info('Filename = '.$file);
|
||||
$imgExist = false;
|
||||
if ( !file_exists($file) && APPLICATION_ENV == 'production' ) {
|
||||
$imgExist = $this->getImg();
|
||||
} elseif (file_exists($file)) {
|
||||
$imgExist = true;
|
||||
if ( !file_exists($file) ) {
|
||||
$this->getImg();
|
||||
}
|
||||
|
||||
if ($imgExist) {
|
||||
return basename($file);
|
||||
}
|
||||
|
||||
return false;
|
||||
return basename($file);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user