texte * @var array */ protected $sourceTxt = array( 'annonces' => 'Annonces', 'insee' => 'Insee', 'bilans' => 'Bilans', 'score' => 'IndiScore', 'actes' => 'Actes', 'dirigeants' => 'Dirigeants', 'privileges' => 'Privilèges', ); /** * Association source => droits * @var array */ protected $sourceDroit = array( 'annonces' => 'survannonce', 'insee' => 'survinsee', 'bilans' => 'survbilan', 'score' => 'survscore', 'actes' => 'survactes', 'dirigeants' => 'survdirigeants', 'privileges' => 'survpriv', ); public function init() { require_once 'Scores/Utilisateur.php'; require_once 'Scores/WsScores.php'; require_once 'common/dates.php'; } public function indexAction() { //What we want to do here } /** * Ajouter une surveillance */ public function ajouterAction() { //Affichage formulaire demande ref et email $this->_helper->layout->disableLayout(); $request = $this->getRequest(); $siret = $request->getParam('siret', ''); $email = $request->getParam('email', ''); $ref = $request->getParam('ref', ''); $source = $request->getParam('source', 'annonces'); $encours = $request->getParam('encours', 0); $user = new Utilisateur(); $email = $user->getEmail(); if( empty($source) ) { $source = array(); foreach($this->sourceTxt as $Source => $Txt) { if( $user->checkPerm($this->sourceDroit[$Source]) ) { $checked = 'checked'; if ($Source=='privileges') { $checked = ''; } $source[] = array( 'id' => $Source, 'txt' => $Txt, 'checked' => $checked, ); } } } $this->view->assign('source', $source); $this->view->assign('siret', $siret); $this->view->assign('email', $email); $this->view->assign('ref', $ref); $this->view->assign('encours', $encours); } /** * Supprimer une surveillances */ public function supprimerAction() { $request = $this->getRequest(); $siret = $request->getParam('siret', ''); $email = $request->getParam('email', ''); $ref = $request->getParam('ref', ''); $source = $request->getParam('source', 'annonces'); $ws = new WsScores(); $set = $ws->setSurveillance($siret, $email, $ref, $source, true); $this->_redirect('surveillance/liste'); } /** * Ajoute, Supprime, Edite la surveillance (Ajax) */ public function setAction() { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); $request = $this->getRequest(); $siret = $request->getParam('siret', ''); $email = $request->getParam('email', ''); $ref = $request->getParam('ref', ''); $source = $request->getParam('source', 'annonces'); $delete = $request->getParam('delete', false); $encours = $request->getParam('encours', 0); //Vérification siret / email / ref if (empty($siret) || empty($email) | empty($ref)){ echo 'Erreur email ou reférence non définie !'; exit; } //Vérification de l'encours (chiffres) if (!preg_match('/([0-9]+)/', $encours)){ echo 'Encours incorrect'; exit; } if (!empty($delete)){ $delete = true; } $ws = new WsScores(); if (is_array($source)) { foreach($source as $s) { $set = $ws->setSurveillance($siret, $email, $ref, $s, $delete, $encours); } } else { $set = $ws->setSurveillance($siret, $email, $ref, $source, $delete, $encours); } Zend_Registry::get('firebug')->info($result); echo $set->result; } /** * Ajoute un encours client */ public function encoursAction() { $this->_helper->layout->disableLayout(); $this->_forward('ajouter'); } /** * Affiche les infos d'une surveillance */ public function infosAction() { $this->view->headScript()->appendFile('/themes/default/scripts/surveillance.js', 'text/javascript'); $request = $this->getRequest(); $source = $request->getParam('source', ''); $siret = $request->getParam('siret', 0); $user = new Utilisateur(); //if ($user->checkPerm()) $listSurv = array(); if (intval($siret)!=0) { $ws = new WsScores(); $infos = $ws->getSurveillances('siren', $source, $siret); $surveillances = $infos->result->item; if (count($surveillances)>0) { $titre = 'Ajouter une surveillance'; $texte = "L'entité est sous surveillance"; foreach($surveillances as $surv){ $tooltipTexte = ''; $ref = $surv->ref; $tooltipTexte.= "Ref : ".$ref; $tooltipTexte.= "
Date d'ajout :".WDate::dateT('Y-m-d', 'd/m/Y', $surv->dateAjout); if ($surv->dateDerEnvoi!='0000-00-00 00:00:00') { $tooltipTexte.= "
Date de dernier envoi : ". WDate::dateT('Y-m-d', 'd/m/Y', substr($surv->dateDerEnvoi,0,10)); } $listSurv[] = array( 'tooltipTexte' => $tooltipTexte, 'sourceTexte' => $this->sourceTxt[$surv->source] ); } } else { $titre = 'Ajouter une surveillance'; $texte = 'Mettre sous surveillance'; if (!empty($source)){ $texte.= ' '.$this->sourceTxt[$source]; } } } if (!empty($ref)) { $this->view->assign('ref', $ref); } else { $this->view->assign('ref', $ref); } $this->view->assign('surveillances', $listSurv); $this->view->assign('dialogTitre', $titre); $this->view->assign('dialogTexte', $texte); $this->view->assign('dialogSource', $source); } /** * Liste les surveillances */ public function listeAction() { $user = new Utilisateur(); if (!$user->checkPerm('survliste')){ $this->_forward('perm', 'error'); } $this->view->headLink() ->appendStylesheet('/themes/default/styles/surveillance.css', 'all'); $this->view->headScript() ->appendFile('/themes/default/scripts/jquery.qtip.js', 'text/javascript') ->appendFile('/themes/default/scripts/jquery.tablesorter.js', 'text/javascript') ->appendFile('/themes/default/scripts/surveillance.js', 'text/javascript'); $request = $this->getRequest(); $page = $request->getParam('page', 0); $source = $request->getParam('source', ''); $tri = $request->getParam('tri', 'siren'); $detail = true; $nbAffichage = 100; $position = $page*$nbAffichage; switch($tri){ default: case 'siren': $triws = 'siren'; break; case 'rs': $triws = 'rs'; break; case 'reference': $triws = 'ref'; break; case 'dateajout': $triws = 'dateAjout'; break; case 'datederenvoi': $triws = 'dateDerEnvoi'; break; } // Source => Permission $tabSource = array( 'annonces' => 'annonce', 'insee' => 'insee', 'bilans' => 'bilan', 'score' => 'score', 'actes' => 'actes', 'dirigeants' => 'dirigeants', 'privileges' => 'priv', ); $user = new Utilisateur(); //Select Tri + Liste des sources autorisée $selectTri = ''; $permSource = array(); foreach ($tabSource as $s => $perm) { if ($user->checkPerm('surv'.$perm)) { $permSource[] = $s; $selectTri.= '