extranet/application/controllers/GiantController.php

132 lines
6.2 KiB
PHP
Raw Normal View History

2011-04-15 12:40:29 +00:00
<?php
require_once ('Giant/ChromePhp.php');
2011-04-19 15:59:50 +00:00
require_once ('Giant/WSgiant.php');
require_once ('Giant/Search.lib.php');
2011-06-29 14:39:16 +00:00
require_once ('Scores/RechercheHistorique.php');
require_once ('Giant/CreditData.lib.php');
require_once ('Giant/Controller/RechercheController.php');
require_once ('Scores/Utilisateur.php');
require_once ('Giant/Functions.php');
require_once ('Giant/Controller/GiantController.php');
require_once ('Giant/Controller/IdentiteController.php');
2011-08-23 15:19:30 +00:00
require_once ('common/dates.php');
require_once ('Giant/Commandes.php');
require_once ('Giant/Rapports.php');
2011-08-29 15:49:41 +00:00
require_once ('Graphique/Graphique.lib.php');
2011-04-19 15:59:50 +00:00
2011-04-15 12:40:29 +00:00
class GiantController extends Zend_Controller_Action
{
protected $TestIndication = true;
2011-04-19 15:59:50 +00:00
public function init()
{
$this->view->headLink()->appendStylesheet('/themes/default/styles/giant.css', 'all');
$this->view->headScript()->appendFile('/themes/default/scripts/giant.js', 'text/javascript');
$this->view->debug = false;
2011-04-15 12:40:29 +00:00
}
2011-04-19 15:59:50 +00:00
public function searchAction()
2011-08-26 14:02:45 +00:00
{
$user = new Utilisateur();
$params = $this->getRequest()->getParams();
$search = new GiantRechercheController($params['pays'], $this->TestIndication);
$result = $search->Liste($params, $this->getRequest()->getParam('page'));
$this->view->label = $search->getObjet()->getLabelDesc();
$this->view->labelResults = $search->getObjet()->getLabelResults;
$this->view->pays = $params['pays'];
$this->view->currentPage = $search->getObjet()->getCurrentPage();
$this->view->userMaxResult = $user->getNbRep();
$this->view->resultats = $result;
$this->view->page = $this->getRequest()->getParam('page');
$this->view->referer = $search->getObjet()->getQuery();
$this->view->lienReferer = $search->getQueryLink($params);
if($this->view->debug)
$this->view->soap = $search->soapG;
2011-04-19 15:59:50 +00:00
}
2011-06-27 16:34:26 +00:00
public function identiteAction()
2011-04-19 15:59:50 +00:00
{
$rechercheParams = new RechercheHistorique();
if (count($rechercheParams->liste()) > 0)
{
$recherche = $rechercheParams->item(0);
$type = $recherche['type'];
$params = $recherche['params'];
}
$Commande = new Commandes();
$Utilisateur = new Utilisateur();
$listeCommandes = $Commande->getCommandesByLogin($Utilisateur->getLogin());
$total = 0;
$liste = GiantFunction::divCommande($listeCommandes, $total);
$ListeRapport = new GiantRechercheController($params['pays'], $this->TestIndication);
$result = $ListeRapport->ListeRapport($this->getRequest()->getParam('CompanyId'));
$this->view->total = $total;
$this->view->listeCommandes = $liste;
$this->view->modification = (isset($result->MonitoringOptions))?($ListeRapport->getModification($result->MonitoringOptions->MonitoringOption[0])):null;
$this->view->description = $ListeRapport->getDescription();
$this->view->raisonSociale = $this->getRequest()->getParam('raisonSociale');
$this->view->listeRapport = $result;
$this->view->CompanyId = $this->getRequest()->getParam('CompanyId');
$this->view->raisonSociale = $this->getRequest()->getParam('raisonSociale');
$this->view->CompanyRegisterNumber = $this->getRequest()->getParam('CompanyRegisterNumber');
$this->view->Pays = $this->getRequest()->getParam('Pays');
$this->view->Adresse = explode(':', $this->getRequest()->getParam('Adresse'));
if($this->view->debug)
$this->view->soap = $ListeRapport->soapG;
2011-06-30 15:30:43 +00:00
}
public function commandesAction()
{
$Utilisateur = new Utilisateur();
$Commande = new Commandes();
$Rapport = new Rapports($this->getRequest()->getParam('Pays'), $this->TestIndication);
$CommandeP = new stdClass();
$id = $Rapport->getRapportExist($this->getRequest()->getParam('CompanyId'), $this->getRequest()->getParam('Type'));
if(empty($id)) {
$rapport = new GiantRechercheController($this->getRequest()->getParam('Pays'), $this->TestIndication);
$result = $rapport->GetRapport($this->getRequest()->getParam('CompanyId'), $this->getRequest()->getParam('Type'));
$result = base64_encode(serialize($result));
$id = $Rapport->setReport($this->getRequest()->getParam('CompanyId'),
$this->getRequest()->getParam('Type'),
$this->getRequest()->getParam('Pays'),
$result);
}
$CommandeP->login = $Utilisateur->getLogin();
$CommandeP->date = date("Y-m-d");
$CommandeP->typeReport = GiantFunction::getTypeReport($this->getRequest()->getParam('Type'));
$CommandeP->price = 150;
$CommandeP->rapportId = 1;
$CommandeP->pays = strtolower($this->getRequest()->getParam('Pays'));
if(!$Commande->getCommandeExistToday($CommandeP->login, $CommandeP->date, $CommandeP->rapportId, $CommandeP->typeReport, $CommandeP->pays)) {
$Commande->setCommandes($CommandeP);
}
$this->_forward(lcfirst($this->getRequest()->getParam('Type')), 'giant', null, array('idRapport' => $id, 'Pays' => $this->getRequest()->getParam('Pays')));
}
public function fullAction()
2011-06-30 15:30:43 +00:00
{
$fullAction = array('getAvisDeCredit' => 'CreditRecommendation', 'getComptesAnnuels' => 'AnnualAccounts', 'getPositionFinanciere' => 'FinancialSummary',
'getComportementPaiement' => 'PaymentBehaviour', 'getStructureEntreprise' => 'Associated', 'getDirigeant' => 'Position',
'getComparaisonValeurs'=> 'PeerGroup'
);
$full = unserialize(base64_decode($this->getRequest()->getParam('idRapport')));
$identiteController = new GiantIdentiteController($full);
$giantConstroller = new GiantControllerLib($this->getRequest()->getParam('CompanyId'));
$identiteController->ficheAction();
$fiche = $identiteController->getObjet('fiche');
foreach($fullAction as $action => $val) {
if(isset($full->DataSet->Company->$val))
$full = $giantConstroller->$action($full);
}
$fiche = $giantConstroller->getInformationGenerale($full);
2011-08-26 14:02:45 +00:00
$this->view->carte = $this->getRequest()->getParam('Pays');
$this->view->reportType = $this->getRequest()->getParam('Type');
$this->view->report = $fiche;
2011-04-19 15:59:50 +00:00
}
2011-04-15 12:40:29 +00:00
}