Outils pour les devellopeurs permettant d'afficher le retour d'une fonction sur WS

.
rooute : /dev/listefunctions
This commit is contained in:
Damien LASSERRE 2011-05-05 12:37:39 +00:00
parent 871422edd2
commit b7d0a46b1b
4 changed files with 185 additions and 0 deletions

View File

@ -0,0 +1,119 @@
<?php
require_once ('Scores/WsScores.php');
Class devController extends Zend_Controller_Action
{
private $webService;
private $functions = array('getAnnonces' => array('string siren', '[integer filtre = 0]',
'[string idAnn = ]', '[integer position = 0]', '[integer nbRep = 100]'),
'getBanques' => array('string siren'),
'getBilan' => array('string siren', 'string millesime',
'[string typeBilan = N]', '[string ref = ]'),
'getDirigeants' => array('string siren', '[boolean histo = false]'),
'getIdentite' => array('string siret', '[integer id = 0]'),
'getIndiScore' => array('string siren', '[mixed nic = 0]',
'[mixed niveau = 2]', '[mixed plus = false]'),
'getInfosBourse' => array('string siren'),
'getInfosReg' => array('string siren', '[mixed id = false]'),
'getLiens' => array('integer siren', '[boolean actifsUniquement = true]'),
'getListeBilans' => array('string siren'),
'getListeCompetences' => array('string siret', 'string type', 'string codeInsee'),
'getListeEtablissements' => array('string siren', '[integer dep = 0]',
'[integer actif = -1]', '[integer position = 0]',
'[integer nbRep = 20]'),
'getListeEvenements' => array('string siren', '[string nic = 0]',
'[integer position = 0]', '[integer nbRep = 1000]'),
'getPrivilegesCumul' => array('string siren', '[array tabTypes = Array]'),
'getPrivilegesDetail' => array('string siren', '[array tabTypes = Array]'),
'getRapport' => array('string siren', '[integer niveau = 3]', '[integer id = 0]'),
'getRatios' => array('string siren', '[string page = ratios]'),
'getSurveillances' => array('SurveillancesFiltre filtre', '[integer position = 0]',
'[integer nbRep = 100]'),
'getTVA' => array('string siren'),
'getTribunaux' => array('array tabTypes'),
'isSirenExistant' => array('string siren'),
'rechercheAnnonce' => array('string source', 'string dateAnnee', 'integer numParution', 'integer numAnnonce'),
'rechercheEntreprise' => array('string type', 'RechercheEntreprise criteres',
'[integer position = 0]', '[integer nbRep = 20]',
'[integer maxRep = 200]', '[boolean pertinence = false]',
'[boolean avecSiren = false]'),
'searchMandataires' => array('mixed nom', '[array type = Array]', '[integer cpDep = 0]'),
'setSurveillance' => array('string siret', 'string email', '[string ref = ]',
'[string source = annonces]', '[boolean delete = false]',
'[integer encoursClient = 0]'),
'status' => array()
);
public function init()
{
$this->webService = new WsScores();
}
public function listefunctionAction()
{
$this->view->assign('listeFunctions', $this->functions);
}
protected function formatFunction($parametre, $function)
{
$i = 0;
if (!empty($parametre))
{
foreach($parametre as $name => $param) {
if($name != 'function')
{
if(!empty($param))
{
$format .= $param;
if($i > 0 and $i < count($parametre))
$format .= ',';
$i++;
}
}
}
if(!empty($parametre[1]))
{
echo '<center><b>Fonction::'.$function.'</b></center><br />';
if(!$result = $this->webService->$function($format))
echo 'erreur sur la fonction';
$this->view->assign('result', $result);
unset($_POST['function']);
}
//$this->view->render('dev/listefunction.phtml');
}
}
public function parametreAction()
{
$webService= new WsScores();
$request = $this->getRequest();
$function = $request->getParam('function');
//$this->_helper->layout()->disableLayout();
if (isset($function)) {
if(!empty($function)) {
self::formatFunction($this->getRequest()->getParams(), $function);
}
}
$this->view->assign('function', $function);
$this->view->assign('parametre', $this->functions[$function]);
}
public function printobjetAction()
{
$webService= new WsScores();
$request = $this->getRequest();
$siren = $request->getParam('siren');
$function = $request->getParam('fonction');
if (isset($siren) and isset($function)) {
if(!empty($siren) and !empty($function)) {
echo $function.'('.$siren.')';
//$result = $webService->$function($siren);
}
}
//$this->view->assign('result', $result);
}
}
?>

View File

@ -0,0 +1,32 @@
<div id="center">
<h1>Outils pour le développement</h1>
<div class="paragraph">
<table width="100%">
<?php if(!isset($_POST['function'])):?>
<tr>
<td>Fonction : </td>
<td align="right">
<form method="POST" action="">
<select name="function" onchange="submit()">
<option></option>
<?php foreach ($this->listeFunctions as $function => $parametres):?>
<option value="<?php echo $function;?>"><?php echo $function; ?></option>
<?php endforeach;?>
</select>
</form>
</td>
</tr>
<?php else:?>
<tr>
<td align="center" colspan="2"> <a href="">effectuer une nouvelle requete</a></td>
</tr>
<?php endif;?>
<form method="POST" action="/dev/listefunction">
<input type="hidden" name="function" value="<?php echo $_POST['function'];?>" />
<?php if(isset($_POST['function'])):?>
<?php echo $this->action('parametre', 'dev', array('function' => $_POST['function']))?>
<?php endif;?>
</form>
</table>
</div>
</div>

View File

@ -0,0 +1,32 @@
<input type="hidden" name="function" value="<?php echo $this->function;?>" />
<?php $i = 1;?>
<tr>
<td align="center" colspan="2"><h2>Liste des paramêtres</h2></td>
</tr>
<?php foreach($this->parametre as $parametre):?>
<tr>
<td colspan="2"><br /></td>
</tr>
<tr>
<td><b>[<?php echo $i;?>]</b> <?php echo $parametre;?></td>
<td align="right">
<input value="<?php echo (isset($_POST[$i]))?$_POST[$i] : false;?>" style="width:142px" type="text" name="<?php echo $i;?>">
</td>
</tr>
<?php $i++;?>
<?php endforeach;?>
<tr>
<td colspan="2"><h2>Resultat de votre requete</h2></td>
</tr>
<tr>
<td colspan="2">
<div style="padding:3px;border:1px solid black;overflow:scroll;width:652px;height:400px;background-color:silver;">
<pre>
<?php print_r($this->result);?>
</pre>
</div>
</td>
</tr>
<tr>
<td colspan="2" align="right" style="padding-top:10px"><input type="submit" value="Envoyer" /></td>
</tr>

View File

@ -0,0 +1,2 @@