Chargement des critères depuis la base de données

This commit is contained in:
Michael RICOIS 2012-01-11 16:13:08 +00:00
parent e0c2095539
commit 0c95160798

View File

@ -11,17 +11,39 @@ class IndexController extends Zend_Controller_Action
public function init()
{
require_once('Scores/Field.php');
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$field = new Fields($user->username);
$this->fields = $field;
}
public function criteresAction()
{
$this->view->headScript()->appendFile('/themes/default/scripts/fields.js', 'text/javascript');
$this->view->fields = $this->fields;
$request = $this->getRequest();
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$this->view->fields = $fields;
//Chargement de la structure des champs et des préférences utilisateurs
require_once 'Scores/Field.php';
$field = new Fields($user->username);
// Chargement des critères de ciblage à partir de l'enregistrement en bdd
$id = $request->getParam('id', 0);
if (!empty($id)) {
$db = Zend_Registry::get('db');
$criteresM = new Application_Model_Criteres();
$sql = $criteresM->select()
->columns($criteresM, array('criteres'))
->where('login = ?', $user->username)
->where('id = ?', $id);
$row = $criteresM->fetchRow($sql);
if ($row != null) {
require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage();
$session->setCriteres(json_decode($row->criteres, 'true'));
}
}
}
public function resetAction()