2012-02-02 17:29:14 +00:00
|
|
|
<?php
|
2012-05-17 18:12:55 +00:00
|
|
|
class IndexController extends Zend_Controller_Action
|
2012-02-02 17:29:14 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
public function init()
|
|
|
|
{
|
2012-02-22 19:17:11 +00:00
|
|
|
$this->view->headScript()
|
|
|
|
->appendFile('/themes/default/scripts/jquery.jstree.js', 'text/javascript')
|
2012-05-04 18:21:51 +00:00
|
|
|
->appendFile('/themes/default/scripts/fields.js', 'text/javascript');
|
2012-02-02 17:29:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function indexAction()
|
|
|
|
{
|
|
|
|
$auth = Zend_Auth::getInstance();
|
|
|
|
$user = $auth->getIdentity();
|
2012-05-25 09:19:42 +00:00
|
|
|
|
2012-02-02 17:29:14 +00:00
|
|
|
if ($user->customisation) {
|
|
|
|
$this->view->assign('preferences', $user->customisation);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-02-15 09:25:21 +00:00
|
|
|
public function criteresAction()
|
|
|
|
{
|
2012-03-08 15:25:27 +00:00
|
|
|
$ajax = $this->getRequest()->getParam('ajax');
|
|
|
|
if($ajax)
|
|
|
|
$this->_helper->layout()->disableLayout();
|
2012-05-04 18:21:51 +00:00
|
|
|
|
2012-05-22 06:10:32 +00:00
|
|
|
$fields = new Scores_Fields();
|
|
|
|
|
|
|
|
$infosCriteres = array();
|
|
|
|
|
|
|
|
$decodeCriteres = $fields->getCriteres();
|
|
|
|
|
|
|
|
//Construction affichage des critères
|
|
|
|
foreach ( $decodeCriteres as $key => $item ) {
|
|
|
|
|
|
|
|
$inValue = $fields->getValueLabel($key, $item['in']);
|
|
|
|
$exValue = $fields->getValueLabel($key, $item['ex']);
|
|
|
|
|
|
|
|
$infosCriteres[$key] = array(
|
|
|
|
'label' => $fields->getLabel($key),
|
|
|
|
'in' => $inValue,
|
|
|
|
'ex' => $exValue,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->view->infos = $infosCriteres;
|
|
|
|
}
|
2012-05-02 18:19:07 +00:00
|
|
|
|
2012-05-22 06:10:32 +00:00
|
|
|
public function criterelistAction()
|
|
|
|
{
|
|
|
|
$this->_helper->layout()->disableLayout();
|
|
|
|
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$critere = $request->getParam('key');
|
|
|
|
|
|
|
|
$fields = new Scores_Fields();
|
|
|
|
$values = $fields->getCritere($critere);
|
|
|
|
|
|
|
|
//Inclusion
|
|
|
|
if (count($values['in'])>0) {
|
|
|
|
$inLabels = $fields->getValueLabel($critere, $values['in']);
|
|
|
|
$inValues = array_values($values['in']);
|
|
|
|
$this->view->assign('inLabels', $inLabels);
|
|
|
|
$this->view->assign('inValues', $inValues);
|
|
|
|
}
|
|
|
|
|
|
|
|
//Exclusion
|
|
|
|
if (count($values['ex'])>0) {
|
|
|
|
$exLabels = $fields->getValueLabel($critere, $values['ex']);
|
|
|
|
$exValues = array_values($values['ex']);
|
|
|
|
$this->view->assign('exLabels', $exLabels);
|
|
|
|
$this->view->assign('exValues', $exValues);
|
|
|
|
}
|
2012-02-15 09:25:21 +00:00
|
|
|
}
|
2012-05-02 18:19:07 +00:00
|
|
|
|
2012-05-22 06:10:32 +00:00
|
|
|
|
2012-03-08 15:04:08 +00:00
|
|
|
public function removeAction()
|
|
|
|
{
|
|
|
|
$this->_helper->layout()->disableLayout();
|
2012-05-11 20:25:55 +00:00
|
|
|
|
2012-05-13 13:59:15 +00:00
|
|
|
$nameCritereToDelete = $this->getRequest()->getParam('critere');
|
2012-05-11 20:25:55 +00:00
|
|
|
|
|
|
|
$fields = new Scores_Fields();
|
2012-05-13 13:59:15 +00:00
|
|
|
$fields->unsetCritere($nameCritereToDelete);
|
|
|
|
|
|
|
|
//Comptage
|
|
|
|
require_once 'Scores/Ciblage.php';
|
|
|
|
$ciblage = new Ciblage($fields->getValues());
|
|
|
|
|
|
|
|
$total = $ciblage->execute();
|
|
|
|
$insee = $ciblage->calculRedevanceInsee();
|
|
|
|
|
|
|
|
$fields->setNb('total', $total);
|
|
|
|
$fields->setNb('insee', $insee);
|
2012-05-11 20:25:55 +00:00
|
|
|
|
2012-03-08 15:04:08 +00:00
|
|
|
$this->_redirect('/');
|
|
|
|
}
|
2012-05-13 13:59:15 +00:00
|
|
|
}
|