2011-01-06 08:37:20 +00:00
|
|
|
<?php
|
|
|
|
class WsScores
|
|
|
|
{
|
|
|
|
protected $webservices = array();
|
2011-01-07 17:16:07 +00:00
|
|
|
protected $login = '';
|
|
|
|
protected $password = '';
|
|
|
|
|
2011-02-16 14:41:54 +00:00
|
|
|
public function __construct($login = '', $password = '') {
|
2011-01-06 08:37:20 +00:00
|
|
|
$config = new Zend_Config_Ini(APPLICATION_PATH .
|
|
|
|
'/configs/webservices.ini', APPLICATION_ENV);
|
|
|
|
$this->webservices = $config->webservices->toArray();
|
2011-01-07 17:16:07 +00:00
|
|
|
|
|
|
|
if ( !empty($login) && !empty($password) ){
|
|
|
|
$this->login = $login;
|
|
|
|
$this->password = $password;
|
|
|
|
} else {
|
|
|
|
$auth = Zend_Auth::getInstance();
|
|
|
|
$this->login = $auth->getIdentity()->username;
|
|
|
|
$this->password = md5($this->login.'|'.$auth->getIdentity()->password);
|
|
|
|
}
|
2011-01-06 08:37:20 +00:00
|
|
|
}
|
|
|
|
|
2011-02-16 14:41:54 +00:00
|
|
|
public function getInfosLogin($login, $ipUtilisateur = '') {
|
2011-01-06 08:37:20 +00:00
|
|
|
$params = new stdClass();
|
|
|
|
$params->login = $login;
|
|
|
|
$params->ipUtilisateur = $ipUtilisateur;
|
2011-01-07 17:16:07 +00:00
|
|
|
try {
|
|
|
|
$client = $this->loadClient('interne');
|
|
|
|
$reponse = $client->getInfosLogin($params);
|
|
|
|
return $reponse->getInfosLoginResult;
|
|
|
|
} catch (SoapFault $fault) {
|
|
|
|
//Placer exception pour affichage message
|
|
|
|
return false;
|
|
|
|
}
|
2011-01-06 08:37:20 +00:00
|
|
|
}
|
|
|
|
|
2011-02-16 14:41:54 +00:00
|
|
|
protected function loadClient($webservice) {
|
2011-01-06 08:37:20 +00:00
|
|
|
$wsdl = $this->webservices[$webservice]['wsdl'];
|
|
|
|
$options = $this->webservices[$webservice]['options'];
|
2011-01-07 17:16:07 +00:00
|
|
|
$options['login'] = $this->login;
|
|
|
|
$options['password'] = $this->password;
|
2011-02-16 14:41:54 +00:00
|
|
|
if (APPLICATION_ENV != 'production'){
|
|
|
|
$options['cache_wsdl'] = WSDL_CACHE_NONE;
|
|
|
|
}
|
|
|
|
$options['encoding'] = 'utf-8';
|
2011-01-06 08:37:20 +00:00
|
|
|
$client = new SoapClient($wsdl, $options);
|
|
|
|
return $client;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|