odea/application/modules/frontend/controllers/GestionController.php

79 lines
1.8 KiB
PHP
Raw Normal View History

2012-02-22 17:08:39 +00:00
<?php
class GestionController extends Zend_Controller_Action
{
public function preDispatch()
{
}
2012-02-24 09:54:21 +00:00
public function init()
{
$this->view->headLink()->appendStylesheet('/themes/default/styles/dashboard.css', 'all');
}
2012-02-22 17:08:39 +00:00
public function indexAction()
{
}
public function profilsAction()
{
2012-02-24 09:54:21 +00:00
$profilsM = new Table_EnrichissementProfils();
$sql = $profilsM->select()
->from($profilsM, array('id', 'idClient', 'login', 'reference', 'tarifLigne', 'dateAjout', 'dateSuppr', 'actif'));
$profils = $profilsM->fetchAll($sql);
2012-02-22 17:08:39 +00:00
2012-02-24 09:54:21 +00:00
$this->view->assign('profils', $profils);
2012-02-22 17:08:39 +00:00
}
public function profilAction(){}
2012-02-24 09:54:21 +00:00
public function profiladdAction()
{
$request = $this->getRequest();
//Sauvegarde du formulaire
if ( $request->isPost() ){
2012-03-06 15:02:50 +00:00
$params = $request->getParams();
//Vérifier le formulaire
$errForm = 0;
foreach ( $params as $key => $value ) {
if (empty($value)) {
$errForm++;
}
}
if (!$errForm) {
$data = array(
'idClient' => $params['idClient'],
'login' => $params['login'],
'reference' => $params['reference'],
'criteres' => json_encode($params['criteres']),
'tarifLigne' => $params['tarifLigne'],
'dateAjout' => date('Y-m-d H:i:s'),
'actif' => 1,
);
$profilM = new Table_EnrichissementProfils();
if ( $profilM->insert($data) ){
$this->view->message('message', "Profil enregistré");
} else {
$this->view->message('message', "Erreur lors de la sauvegarde");
}
} else {
$this->view->message('message', "Erreur lors de la saisie");
}
2012-02-24 09:54:21 +00:00
}
//Affichage du formulaire
require_once 'Scores/Enrichissement.php';
$fieldsM = new Enrichissement();
$allFields = $fieldsM->getFields();
$this->view->assign('fields', $allFields);
2012-02-24 09:54:21 +00:00
}
2012-02-22 17:08:39 +00:00
public function profildelAction(){}
}