Display status of ciblage motor
This commit is contained in:
parent
78c7fb02e2
commit
37151eb6c5
@ -30,6 +30,7 @@ class ComptageController extends Zend_Controller_Action
|
||||
require_once 'Scores/Ciblage.php';
|
||||
$ciblage = new Ciblage($fields->getValues());
|
||||
|
||||
//@todo : if $total = false then an error occured ?
|
||||
$total = $ciblage->execute();
|
||||
$insee = $ciblage->calculRedevanceInsee();
|
||||
|
||||
|
@ -13,6 +13,7 @@ class IndexController extends Zend_Controller_Action
|
||||
{
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
if ($user->customisation) {
|
||||
$this->view->assign('preferences', $user->customisation);
|
||||
}
|
||||
|
@ -16,8 +16,8 @@
|
||||
<div id="message">
|
||||
<?php if ($this->msgComptage){?>
|
||||
<div id="comptage" >
|
||||
<?php if (!empty($this->total)) {?>
|
||||
Nombre sélectionnées :
|
||||
<?php if ( $this->total!==null ) {?>
|
||||
Nombre sélectionnées :
|
||||
<span class="valeur"><?=$this->total?></span>
|
||||
(dont <span class="valeur"><?=$this->insee?></span> unité(s) insee)
|
||||
<?php } else {?>
|
||||
@ -28,8 +28,8 @@
|
||||
<img src="/themes/default/images/ajax.gif" />
|
||||
</div>
|
||||
<div id="control">
|
||||
[<a href="<?=$this->url(array('controller'=>'comptage', 'action'=> 'reset'))?>">Initialiser les critères</a>],
|
||||
[<a href="<?=$this->url(array('controller'=>'comptage', 'action'=> 'reset'))?>">Initialiser les critères</a>],
|
||||
[<a class="saveciblage" href="<?=$this->url(array('controller'=>'comptage', 'action'=>'savedialog'))?>">Sauvegarder le profil du ciblage</a>]
|
||||
</div>
|
||||
<?php }?>
|
||||
<?php }?>
|
||||
</div>
|
@ -1,3 +1,10 @@
|
||||
<?php if ($this->CiblageError) { ?>
|
||||
|
||||
<div id="CiblageError">
|
||||
Erreur ! Le moteur de ciblage n'est pas disponible !
|
||||
</div>
|
||||
|
||||
<?php } else {?>
|
||||
<div id="panel"><?=$this->action('criteres', 'index')?></div>
|
||||
<div id="tabs">
|
||||
<ul>
|
||||
@ -13,3 +20,4 @@
|
||||
<div id="tabs-4"><?=$this->action('index', 'juridique')?></div>
|
||||
<div id="tabs-5"><?=$this->action('index', 'financier')?></div>
|
||||
</div>
|
||||
<?php }?>
|
||||
|
@ -4,42 +4,58 @@ class Application_Controller_Plugin_Comptage extends Zend_Controller_Plugin_Abst
|
||||
public function preDispatch($request)
|
||||
{
|
||||
$layout = Zend_Layout::getMVCInstance();
|
||||
if ($layout->isEnabled()) {
|
||||
if ($layout->isEnabled())
|
||||
{
|
||||
$controller = $request->getControllerName();
|
||||
$action = $request->getActionName();
|
||||
|
||||
if ($controller == 'index' && $action == 'index') {
|
||||
$session = new Scores_Fields();
|
||||
if ($controller == 'index' && $action == 'index')
|
||||
{
|
||||
$view = $layout->getView();
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
// Chargement des critères de ciblage à partir de l'enregistrement en bdd
|
||||
$id = $request->getParam('id', 0);
|
||||
if (!empty($id)) {
|
||||
$criteresM = new Application_Model_Criteres();
|
||||
$sql = $criteresM->select()
|
||||
->from($criteresM, array('criteres'))
|
||||
->where('login = ?', $user->username)
|
||||
->where('id = ?', $id);
|
||||
$row = $criteresM->fetchRow($sql);
|
||||
if ($row != null) {
|
||||
//On charge les critères
|
||||
$session->setCriteres(json_decode($row->criteres, 'true'));
|
||||
//Réalise le comptage
|
||||
require_once 'Scores/Ciblage.php';
|
||||
$fields = new Scores_Fields();
|
||||
$ciblage = new Ciblage($fields->getValues());
|
||||
$total = $ciblage->execute();
|
||||
$insee = $ciblage->calculRedevanceInsee();
|
||||
$session->setNb('total', $total);
|
||||
$session->setNb('insee', $insee);
|
||||
//Load ciblage to get status of sphinxsearch
|
||||
require_once 'Scores/Ciblage.php';
|
||||
$ciblage = new Ciblage();
|
||||
$status = $ciblage->Status();
|
||||
|
||||
if ($status===false) {
|
||||
|
||||
$view->CiblageError = true;
|
||||
|
||||
} else {
|
||||
|
||||
//Load def and session values
|
||||
$session = new Scores_Fields();
|
||||
|
||||
// Chargement des critères de ciblage à partir de l'enregistrement en bdd
|
||||
$id = $request->getParam('id', 0);
|
||||
if (!empty($id)) {
|
||||
$criteresM = new Application_Model_Criteres();
|
||||
$sql = $criteresM->select()
|
||||
->from($criteresM, array('criteres'))
|
||||
->where('login = ?', $user->username)
|
||||
->where('id = ?', $id);
|
||||
$row = $criteresM->fetchRow($sql);
|
||||
if ($row != null) {
|
||||
//On charge les critères
|
||||
$session->setCriteres(json_decode($row->criteres, 'true'));
|
||||
//Réalise le comptage
|
||||
$fields = new Scores_Fields();
|
||||
$ciblage = new Ciblage($fields->getValues());
|
||||
$total = $ciblage->execute();
|
||||
$insee = $ciblage->calculRedevanceInsee();
|
||||
$session->setNb('total', $total);
|
||||
$session->setNb('insee', $insee);
|
||||
}
|
||||
}
|
||||
|
||||
$view->total = number_format($session->getNb('total'), 0, '', ' ');
|
||||
$view->insee = number_format($session->getNb('insee'), 0, '', ' ');
|
||||
$view->msgComptage = true;
|
||||
}
|
||||
$view->total = number_format($session->getNb('total'), 0, '', ' ');
|
||||
$view->insee = number_format($session->getNb('insee'), 0, '', ' ');
|
||||
$view->msgComptage = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,10 +24,10 @@ class Ciblage
|
||||
|
||||
/**
|
||||
*
|
||||
* @param array $structure
|
||||
* @param null|array $structure
|
||||
* @param boolean $need
|
||||
*/
|
||||
public function __construct($structure)
|
||||
public function __construct($structure = null)
|
||||
{
|
||||
Zend_Registry::get('firebug')->info($structure);
|
||||
|
||||
@ -50,7 +50,7 @@ class Ciblage
|
||||
$this->sphinx->ResetFilters();
|
||||
|
||||
//
|
||||
if ( count($structure)>0 ) {
|
||||
if ( $structure!==null && count($structure)>0 ) {
|
||||
foreach($structure as $key => $valeur) {
|
||||
if ($key!= 'NB' && method_exists($this, $key)) {
|
||||
$this->{$key}($valeur);
|
||||
@ -61,6 +61,14 @@ class Ciblage
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return array of status variable
|
||||
*/
|
||||
public function Status()
|
||||
{
|
||||
return $this->sphinx->Status();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param unknown_type $name
|
||||
|
@ -204,6 +204,11 @@ h3 {
|
||||
zoom:1;
|
||||
}
|
||||
|
||||
div#CiblageError {
|
||||
background-color: white;
|
||||
padding:20px;
|
||||
}
|
||||
|
||||
#naf li { width:650px; }
|
||||
#naf a { }
|
||||
#naf a ins { }
|
||||
|
Loading…
Reference in New Issue
Block a user