extranet/application/controllers/DevController.php

131 lines
6.3 KiB
PHP
Raw Normal View History

<?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);
}
2011-05-05 14:40:51 +00:00
protected function formatParam($function, $param)
{
$array = array();
switch($function) {
case 'rechercheEntreprise':
$array[0] = $param[0];
$array[1]['raisonSociale'] = $param[1];
$array[1]['identifiant'] = '';
$array[1]['adresse'] = '';
$array[1]['codePostal'] = '';
$array[1]['ville'] = '';
$array[1]['telFax'] = '';
$array[1]['naf'] = '';
return ($array);
default:
return (false);
}
}
protected function formatFunction($parametre, $function)
{
2011-05-05 14:40:51 +00:00
$wsScores = new WsScores();
if (!empty($parametre))
{
foreach($parametre as $name => $param) {
2011-05-05 14:40:51 +00:00
if($name != 'function') {
if(!empty($param)) {
$format[] = $param;
}
}
}
if(!empty($parametre[1]))
{
echo '<center><b>Fonction::'.$function.'</b></center><br />';
2011-05-05 14:40:51 +00:00
if($array = self::formatParam($function, $format))
$param = $array;
else
$param = $format;
print_r($param);
$result = call_user_func_array(array($wsScores, $function), $param);
$this->view->assign('result', $result);
unset($_POST['function']);
}
//$this->view->render('dev/listefunction.phtml');
}
}
2011-05-18 15:43:46 +00:00
public function htmltowordAction()
{
require_once('generateDocX/library/odf.php');
//$odf = new Odf('template.odt');
//$odf->setVars('entreprise_siret', '5031254877');
//$odf->exportAsAttachedFile();
}
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]);
}
}
?>