extranet/library/Scores/WsScores.php

34 lines
972 B
PHP
Raw Normal View History

2011-01-06 08:37:20 +00:00
<?php
class WsScores
{
protected $webservices = array();
public function __construct(){
$config = new Zend_Config_Ini(APPLICATION_PATH .
'/configs/webservices.ini', APPLICATION_ENV);
$this->webservices = $config->webservices->toArray();
}
public function getInfosLogin($login, $ipUtilisateur = ''){
$params = new stdClass();
$params->login = $login;
$params->ipUtilisateur = $ipUtilisateur;
$client = $this->loadClient('interne');
$reponse = $client->getInfosLogin($params);
return $reponse->getInfosLoginResult;
}
protected function loadClient($webservice){
$wsdl = $this->webservices[$webservice]['wsdl'];
$options = $this->webservices[$webservice]['options'];
$auth = Zend_Auth::getInstance();
$login = $auth->getIdentity()->username;
$hash = md5($login.'|'.$auth->getIdentity()->password);
$options['login'] = $login;
$options['password'] = $hash;
$client = new SoapClient($wsdl, $options);
return $client;
}
}