webservice/application/controllers/IndexController.php
2010-09-23 16:20:08 +00:00

74 lines
2.0 KiB
PHP

<?php
class IndexController extends Zend_Controller_Action
{
protected $appConfig;
public function init()
{
/* Initialize action controller here */
}
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()
{
require_once 'Web/WebClassDoc.php';
// Gestion des types
$typeConfig = $this->appConfig['classmap']['WsEntreprise']['Type'];
$classmap = array();
foreach ( $typeConfig as $type ){
$classmap[$type] = $type;
}
$doc = new WebClassDoc('WsEntreprise', $classmap);
$tabServiceMethods = $doc->getServiceMethods();
$tabServiceTypes = $doc->getServiceTypes();
$this->view->assign('serviceMethods', $tabServiceMethods);
$this->view->assign('serviceTypes', $tabServiceTypes);
}
public function codeAction()
{
$langage = strtolower($this->_getParam('langage',''));
$element = $this->_getParam('element','');
$fichier = APPLICATION_PATH . '/../public/code/'.$element.'-'.$langage.'.txt';
if (file_exists($fichier)){
$sourceCode = file_get_contents($fichier);
require_once 'geshi/geshi.php';
$geshi = new GeSHi($sourceCode, $langage);
$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
$sourceHighlight = $geshi->parse_code();
$this->view->assign('langage', strtoupper($langage));
$this->view->assign('code', $sourceHighlight);
} else {
$this->view->assign('langage',
'Element non traités, Vous pouvez aussi nous fournir des exemples.');
}
}
public function testAction()
{
//Connexion au service
//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
}
}