webservice/application/controllers/IndexController.php
2011-02-04 11:32:55 +00:00

61 lines
1.6 KiB
PHP

<?php
class IndexController extends Zend_Controller_Action
{
protected $serviceVersions = array();
public function init()
{
$configServiceVersions = new Zend_Config_Ini('WsScore/Entreprise/Versions.ini', null);
foreach( $configServiceVersions->toArray() as $section => $params ){
$this->serviceVersions[$section] = $params;
}
}
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 indexAction()
{
$listeWs = array(
'Entreprise' => array(
'titre' => 'WebService Entreprise',
'protect'=> array(),
'version' => $this->serviceVersions,
),
'Interne' => array(
'titre' => 'WebService Interne',
'protect'=> array('mricois', 'ylenaour', 'sbeaugrand')
),
);
$username = Zend_Auth::getInstance()->getIdentity()->username;
$displayWs = array();
foreach($listeWs as $key => $ws)
{
if ( count($ws['protect'])==0 || in_array($username, $ws['protect']) )
{
$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
}
}