2010-08-30 07:49:44 +00:00
|
|
|
<?php
|
|
|
|
class IndexController extends Zend_Controller_Action
|
|
|
|
{
|
2012-07-17 08:54:02 +00:00
|
|
|
protected $serviceList = array();
|
2011-10-10 13:15:48 +00:00
|
|
|
protected $serviceClientList = array();
|
|
|
|
|
2011-02-03 17:11:26 +00:00
|
|
|
public function init()
|
|
|
|
{
|
2011-08-29 14:48:29 +00:00
|
|
|
$auth = Zend_Auth::getInstance();
|
2011-10-10 13:15:48 +00:00
|
|
|
|
|
|
|
//Lecture des webservices normaux
|
2012-07-17 08:54:02 +00:00
|
|
|
$services = require_once APPLICATION_PATH . '/../library/WsScore/ServicesConfig.php';
|
|
|
|
foreach( $services as $section => $params )
|
|
|
|
{
|
2011-08-29 14:48:29 +00:00
|
|
|
if ($params['actif']) {
|
2011-10-10 13:15:48 +00:00
|
|
|
$wsServices[$section] = $params;
|
2011-08-29 14:48:29 +00:00
|
|
|
}
|
2011-06-10 10:09:09 +00:00
|
|
|
}
|
|
|
|
|
2012-07-17 08:54:02 +00:00
|
|
|
//Parcourir les webservices
|
2011-10-10 13:15:48 +00:00
|
|
|
foreach($wsServices as $serviceName => $serviceInfo)
|
|
|
|
{
|
|
|
|
if ( !isset($wsServices[$serviceName]['idClient']) || $wsServices[$serviceName]['idClient'] == $auth->getIdentity()->idClient)
|
2011-08-29 14:48:29 +00:00
|
|
|
{
|
2011-10-12 09:47:54 +00:00
|
|
|
$configServiceVersions = new Zend_Config_Ini('WsScore/'.ucfirst($serviceName).'/Versions.ini', null);
|
2011-08-29 14:48:29 +00:00
|
|
|
$serviceVersions = array();
|
|
|
|
foreach( $configServiceVersions->toArray() as $section => $params )
|
|
|
|
{
|
|
|
|
$serviceVersions[$section] = $params;
|
|
|
|
$this->serviceList[$serviceName]['version'] = $serviceVersions;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-10-10 13:15:48 +00:00
|
|
|
|
|
|
|
//Lecture des webservices Clients
|
|
|
|
$clients = new Zend_Config_Ini('WsScore/Clients/Clients.ini');
|
2012-07-17 08:54:02 +00:00
|
|
|
|
|
|
|
|
2011-10-10 13:15:48 +00:00
|
|
|
foreach( $clients->toArray() as $section => $params ){
|
|
|
|
if ($params['actif']) {
|
|
|
|
$wsClients[$section] = $params;
|
2011-08-29 14:48:29 +00:00
|
|
|
}
|
2011-06-10 10:09:09 +00:00
|
|
|
}
|
2011-10-10 13:15:48 +00:00
|
|
|
|
|
|
|
//Parcourir les webservices clients
|
|
|
|
foreach($wsClients as $serviceName => $serviceInfo)
|
|
|
|
{
|
|
|
|
if ($wsClients[$serviceName]['idClient'] == $auth->getIdentity()->idClient) {
|
2012-07-17 08:54:02 +00:00
|
|
|
$this->serviceList = array();
|
|
|
|
}
|
2011-10-10 13:15:48 +00:00
|
|
|
if ($wsClients[$serviceName]['idClient'] == $auth->getIdentity()->idClient || in_array($auth->getIdentity()->username, $wsClients[$serviceName]['user']) )
|
|
|
|
{
|
2011-10-12 09:47:54 +00:00
|
|
|
$configServiceVersions = new Zend_Config_Ini('WsScore/Clients/'.ucfirst($serviceName).'/Versions.ini', null);
|
2011-10-10 13:15:48 +00:00
|
|
|
$serviceVersions = array();
|
|
|
|
foreach( $configServiceVersions->toArray() as $section => $params )
|
2012-07-17 08:54:02 +00:00
|
|
|
{
|
2011-10-10 13:15:48 +00:00
|
|
|
$serviceVersions[$section] = $params;
|
|
|
|
$this->serviceList[$serviceName]['version'] = $serviceVersions;
|
2011-10-10 13:50:44 +00:00
|
|
|
$this->serviceList[$serviceName]['type'] = 'client';
|
2012-07-17 08:54:02 +00:00
|
|
|
}
|
2011-10-10 13:15:48 +00:00
|
|
|
}
|
2010-09-13 09:53:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-30 07:49:44 +00:00
|
|
|
public function indexAction()
|
|
|
|
{
|
2012-07-17 08:54:02 +00:00
|
|
|
$displayWs = array();
|
2011-10-10 13:15:48 +00:00
|
|
|
if (count($this->serviceList)>0)
|
|
|
|
{
|
2011-08-29 14:48:29 +00:00
|
|
|
foreach($this->serviceList as $key => $ws)
|
|
|
|
{
|
|
|
|
$displayWs[$key] = $ws;
|
|
|
|
}
|
2010-09-20 09:38:18 +00:00
|
|
|
}
|
2011-10-10 13:15:48 +00:00
|
|
|
|
2010-10-20 14:30:23 +00:00
|
|
|
$this->view->assign('ws', $displayWs);
|
2010-09-17 14:49:18 +00:00
|
|
|
}
|
2010-09-13 09:53:55 +00:00
|
|
|
|
2010-09-21 15:22:15 +00:00
|
|
|
public function testAction()
|
|
|
|
{
|
2010-10-08 07:37:43 +00:00
|
|
|
//Connexion au service - Faire comme ci on charger le WSDL de l'extérieur
|
2010-09-23 16:20:08 +00:00
|
|
|
//getFunctions / getTypes
|
|
|
|
//Pour chaque Function, identifier les Types puis proposer les champs associés
|
|
|
|
//Valider les formulaires pour executer la requête du service
|
|
|
|
//Utiliser le jeux de tests disponible
|
2010-09-21 15:22:15 +00:00
|
|
|
}
|
2010-08-30 07:49:44 +00:00
|
|
|
}
|
|
|
|
|