87 lines
2.5 KiB
PHP
87 lines
2.5 KiB
PHP
<?php
|
|
class User extends CI_Controller {
|
|
|
|
function __construct()
|
|
{
|
|
parent::__construct('user');
|
|
$this->load->helper('url');
|
|
$this->load->library('pagination');
|
|
$this->load->model('User_model');
|
|
|
|
$this->load->library('table');
|
|
$this->load->helper('form');
|
|
$this->load->library('session');
|
|
}
|
|
public function index()
|
|
{
|
|
$this->load->view('user/header' );
|
|
|
|
$this->load->view('user/list' );
|
|
$this->load->view('user/footer' );
|
|
|
|
}
|
|
public function form($mem_id,$error='')
|
|
{
|
|
|
|
$message = $error; // garde le contenu original (chaîne ou message)
|
|
$error = []; // initialise un tableau
|
|
$error['error'] = $message; // stocke le message dans la clé 'error'
|
|
|
|
|
|
|
|
// prépare tout les info pour la forme
|
|
$data=$this->User_model->mod_getForminfo($mem_id);
|
|
|
|
$data_view= $this->load->view('user/form',$data,true );
|
|
|
|
echo json_encode($data_view);
|
|
|
|
}
|
|
public function loadData_list($record=0,$filtre1='',$filtre2='',$filtre3='',$listactif=1,$model_de_produits="liste") {
|
|
|
|
$this->Config_model->conf_getFiltreData($this->session->id,'list_produit','mem_select_1',$filtre1,1,0);
|
|
$this->Config_model->conf_getFiltreData($this->session->id,'list_produit','mem_select_2',$filtre2,1,0);
|
|
$this->Config_model->conf_getFiltreData($this->session->id,'list_produit','mem_select_3',$filtre3,1,0);
|
|
|
|
$this->Config_model->conf_getFiltreData($this->session->id,'list_produit','mem_listactive',$listactif,1,0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$filtre1=urldecode($filtre1);
|
|
$filtre2=urldecode($filtre2);
|
|
$filtre3=urldecode($filtre3);
|
|
|
|
$data=$this->User_model->mod_loadData_list($record,$filtre1,$filtre2,$filtre3,$listactif,$model_de_produits);
|
|
|
|
echo json_encode($data) ;
|
|
}
|
|
|
|
public function desactivate($id,$statut)
|
|
{
|
|
$this->User_model->mod_desactivateRecordbd($id,$statut);
|
|
$error['error']=array('type'=>'success','message'=>'Utilisateur effacé');
|
|
|
|
$this->load->view('user/header' );
|
|
|
|
$this->load->view('user/list' );
|
|
$this->load->view('user/footer', $error );
|
|
}
|
|
|
|
public function saveRecord($id=0)
|
|
{
|
|
|
|
$id=$this->User_model->mod_createRecordbd($_POST,'usa_',$id);
|
|
|
|
$error['error']=array('type'=>'success','message'=>'Utilisateurs créée');
|
|
|
|
$this->load->view('user/header' );
|
|
|
|
$this->load->view('user/list' );
|
|
$this->load->view('user/footer',$error);
|
|
|
|
|
|
}
|
|
} |