92 lines
2.2 KiB
PHP
92 lines
2.2 KiB
PHP
<?php
|
|
class GestionController extends Zend_Controller_Action
|
|
{
|
|
public function preDispatch()
|
|
{
|
|
|
|
}
|
|
|
|
public function init()
|
|
{
|
|
$this->view->headLink()->appendStylesheet('/themes/default/styles/dashboard.css', 'all');
|
|
}
|
|
|
|
public function indexAction()
|
|
{
|
|
|
|
|
|
}
|
|
|
|
public function profilsAction()
|
|
{
|
|
$profilsM = new Table_EnrichissementProfils();
|
|
$sql = $profilsM->select()
|
|
->from($profilsM, array('id', 'idClient', 'login', 'reference', 'tarifLigne', 'dateAjout', 'dateSuppr', 'actif'));
|
|
$profils = $profilsM->fetchAll($sql);
|
|
|
|
$this->view->assign('profils', $profils);
|
|
}
|
|
|
|
public function profilAction(){}
|
|
|
|
public function profiladdAction()
|
|
{
|
|
$request = $this->getRequest();
|
|
|
|
//Sauvegarde du formulaire
|
|
if ( $request->isPost() ){
|
|
$params = $request->getParams();
|
|
|
|
//Vérifier le formulaire
|
|
$errForm = 0;
|
|
foreach ( $params as $key => $value ) {
|
|
if (empty($value)) {
|
|
$errForm++;
|
|
}
|
|
}
|
|
if (!$errForm) {
|
|
|
|
$dataInsee = 0;
|
|
// Est ce qu'il existe une données insee
|
|
require_once 'Scores/Enrichissement.php';
|
|
$fieldsM = new Enrichissement();
|
|
$fields = $fieldsM->getFields();
|
|
foreach ( $fields as $key => $val) {
|
|
if ( array_key_exists('insee', $key) && $val['insee']===true) {
|
|
$dateInsee = 1;
|
|
break;
|
|
}
|
|
}
|
|
|
|
$data = array(
|
|
'idClient' => $params['idClient'],
|
|
'login' => $params['login'],
|
|
'reference' => $params['reference'],
|
|
'criteres' => json_encode($params['criteres']),
|
|
'tarifLigne' => $params['tarifLigne'],
|
|
'dataInsee' => $dataInsee,
|
|
'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");
|
|
}
|
|
|
|
}
|
|
|
|
//Affichage du formulaire
|
|
require_once 'Scores/Enrichissement.php';
|
|
$fieldsM = new Enrichissement();
|
|
$allFields = $fieldsM->getFields();
|
|
$this->view->assign('fields', $allFields);
|
|
}
|
|
|
|
public function profildelAction(){}
|
|
|
|
} |