97 lines
2.9 KiB
PHP
97 lines
2.9 KiB
PHP
<?php
|
|
class IndexController extends Zend_Controller_Action
|
|
{
|
|
protected $serviceList = array();
|
|
protected $serviceClientList = array();
|
|
|
|
public function preDispatch()
|
|
{
|
|
$auth = Zend_Auth::getInstance();
|
|
if (!$auth->hasIdentity()){
|
|
$this->_redirect('/user/login');
|
|
} else {
|
|
$bootstrap = $this->getInvokeArg('bootstrap');
|
|
$this->appConfig = $bootstrap->getOptions();
|
|
}
|
|
}
|
|
|
|
public function init()
|
|
{
|
|
$auth = Zend_Auth::getInstance();
|
|
|
|
//Lecture des webservices normaux
|
|
$services = new Zend_Config_Ini('WsScore/Services.ini');
|
|
foreach( $services->toArray() as $section => $params ){
|
|
if ($params['actif']) {
|
|
$wsServices[$section] = $params;
|
|
}
|
|
}
|
|
|
|
//Parcourir les webservices
|
|
foreach($wsServices as $serviceName => $serviceInfo)
|
|
{
|
|
if ( !isset($wsServices[$serviceName]['idClient']) || $wsServices[$serviceName]['idClient'] == $auth->getIdentity()->idClient)
|
|
{
|
|
$configServiceVersions = new Zend_Config_Ini('WsScore/'.ucfirst($serviceName).'/Versions.ini', null);
|
|
$serviceVersions = array();
|
|
foreach( $configServiceVersions->toArray() as $section => $params )
|
|
{
|
|
$serviceVersions[$section] = $params;
|
|
$this->serviceList[$serviceName]['version'] = $serviceVersions;
|
|
}
|
|
}
|
|
}
|
|
|
|
//Lecture des webservices Clients
|
|
$clients = new Zend_Config_Ini('WsScore/Clients/Clients.ini');
|
|
foreach( $clients->toArray() as $section => $params ){
|
|
if ($params['actif']) {
|
|
$wsClients[$section] = $params;
|
|
}
|
|
}
|
|
|
|
//Parcourir les webservices clients
|
|
foreach($wsClients as $serviceName => $serviceInfo)
|
|
{
|
|
if ($wsClients[$serviceName]['idClient'] == $auth->getIdentity()->idClient) {
|
|
$this->serviceList = array();
|
|
}
|
|
if ($wsClients[$serviceName]['idClient'] == $auth->getIdentity()->idClient || in_array($auth->getIdentity()->username, $wsClients[$serviceName]['user']) )
|
|
{
|
|
$configServiceVersions = new Zend_Config_Ini('WsScore/Clients/'.ucfirst($serviceName).'/Versions.ini', null);
|
|
$serviceVersions = array();
|
|
foreach( $configServiceVersions->toArray() as $section => $params )
|
|
{
|
|
$serviceVersions[$section] = $params;
|
|
$this->serviceList[$serviceName]['version'] = $serviceVersions;
|
|
$this->serviceList[$serviceName]['type'] = 'client';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public function indexAction()
|
|
{
|
|
$displayWs = array();
|
|
if (count($this->serviceList)>0)
|
|
{
|
|
foreach($this->serviceList as $key => $ws)
|
|
{
|
|
$displayWs[$key] = $ws;
|
|
}
|
|
}
|
|
|
|
$this->view->assign('ws', $displayWs);
|
|
}
|
|
|
|
public function testAction()
|
|
{
|
|
//Connexion au service - Faire comme ci on charger le WSDL de l'extérieur
|
|
//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
|
|
}
|
|
}
|
|
|