extranet/application/controllers/DashboardController.php
2011-06-08 12:13:31 +00:00

105 lines
2.2 KiB
PHP

<?php
class DashboardController extends Zend_Controller_Action
{
public function init()
{
require_once 'Scores/WsScores.php';
require_once 'Scores/Utilisateur.php';
}
public function preDispatch()
{
$user = new Utilisateur();
if (!$user->checkModeEdition() && $user->getIdClient()!=1 ){
$this->_forward('perms', 'error');
}
}
/**
* Affichage des différents liens d'administration
*/
public function indexAction()
{
$liens = array(
0 => array(
'libelle' => 'Gestion des clients',
'url' => $this->view->url(array('action'=>'clients')),
),
);
$this->view->assign('Liens', $liens);
}
/**
* Gestion des commandes de l'extranet
* Type : greffes | kbis | graydon | giant
*/
public function commandesAction()
{
}
/**
* Génération automatique du courrier PDF / ODT
*/
public function courrierAction()
{
}
/**
* Liste les clients
*/
public function clientsAction()
{
$this->view->headScript()->appendFile('/themes/default/scripts/dashboard.js', 'text/javascript');
$ws = new WsScores();
$reponse = $ws->getListeClients();
$listeClients = $reponse->result->item;
$reponse = $ws->getListeDroits();
$wsdroits = $reponse->item;
$this->view->assign('ListeClients', $listeClients);
$this->view->assign('wsdroits', $wsdroits);
}
/**
* Edition ou création d'un nouveau client
*/
public function clientAction()
{
$request = $this->getRequest();
$idClient = $request->getParam('idClient', false);
$titre = 'CREATION NOUVEAU CLIENT';
$submitValue = 'Créer le client';
if ($idClient!==false){
$ws = new WsScores();
$reponse = $ws->getListeClients($idClient);
$InfosClient = $reponse->result->item[0];
$titre = 'EDITION CLIENT';
$submitValue = 'Modifier le client';
}
$ws = new WsScores();
$reponse = $ws->getListeDroits();
$wsdroits = $reponse->item;
$this->view->assign('idClient', $idClient);
$this->view->assign('InfosClient', $InfosClient);
$this->view->assign('titre', $titre);
$this->view->assign('submitValue', $submitValue);
$this->view->assign('wsdroits', $wsdroits);
}
/**
* Enregistre les informations sur le client
*/
public function clientsaveAction()
{
}
}