webservice/application/controllers/IndexController.php

87 lines
2.5 KiB
PHP
Raw Normal View History

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();
protected $serviceClientList = array();
public function init()
{
$auth = Zend_Auth::getInstance();
//Lecture des webservices normaux
2012-07-17 10:07:18 +00:00
$services = include APPLICATION_PATH . '/../library/WsScore/ServicesConfig.php';
2012-07-17 08:54:02 +00:00
foreach( $services as $section => $params )
{
if ($params['actif']) {
$wsServices[$section] = $params;
}
}
2012-07-17 08:54:02 +00:00
//Parcourir les webservices
foreach($wsServices as $serviceName => $serviceInfo)
{
if ( !isset($wsServices[$serviceName]['idClient']) || $wsServices[$serviceName]['idClient'] == $auth->getIdentity()->idClient)
{
$serviceVersions = array();
$configServiceVersions = $wsServices[$serviceName]['versions'];
foreach( $configServiceVersions as $section => $params )
{
$serviceVersions[$section] = $params;
$this->serviceList[$serviceName]['version'] = $serviceVersions;
}
}
}
//Lecture des webservices Clients
2012-07-17 10:07:18 +00:00
$clients = include APPLICATION_PATH . '/../library/WsScore/Clients/ClientsConfig.php';
foreach( $clients 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) {
2012-07-17 08:54:02 +00:00
$this->serviceList = array();
}
if ($wsClients[$serviceName]['idClient'] == $auth->getIdentity()->idClient || in_array($auth->getIdentity()->username, $wsClients[$serviceName]['user']) )
{
$serviceVersions = array();
$configServiceVersions = $wsClients[$serviceName]['versions'];
foreach( $configServiceVersions as $section => $params )
2012-07-17 08:54:02 +00:00
{
$serviceVersions[$section] = $params;
$this->serviceList[$serviceName]['version'] = $serviceVersions;
$this->serviceList[$serviceName]['type'] = 'client';
2012-07-17 08:54:02 +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();
if (count($this->serviceList)>0)
{
foreach($this->serviceList as $key => $ws)
{
$displayWs[$key] = $ws;
}
}
$this->view->assign('ws', $displayWs);
}
2010-09-13 09:53:55 +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-08-30 07:49:44 +00:00
}