odea/application/controllers/IndexController.php
2012-05-13 13:59:15 +00:00

54 lines
1.3 KiB
PHP

<?php
Class IndexController extends Zend_Controller_Action
{
public function init()
{
$this->view->headScript()
->appendFile('/themes/default/scripts/jquery.jstree.js', 'text/javascript')
->appendFile('/themes/default/scripts/fields.js', 'text/javascript');
}
public function indexAction()
{
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
if ($user->customisation) {
$this->view->assign('preferences', $user->customisation);
}
}
public function criteresAction()
{
$ajax = $this->getRequest()->getParam('ajax');
if($ajax)
$this->_helper->layout()->disableLayout();
$session = new Scores_Fields();
$this->view->field = $session;
$this->view->criteres = $session->getCriteres();
}
public function removeAction()
{
$this->_helper->layout()->disableLayout();
$nameCritereToDelete = $this->getRequest()->getParam('critere');
$fields = new Scores_Fields();
$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);
$this->_redirect('/');
}
}