update
This commit is contained in:
86
application/controllers/Produits.php
Normal file
86
application/controllers/Produits.php
Normal file
@ -0,0 +1,86 @@
|
||||
<?php
|
||||
class Produits extends CI_Controller {
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct('produits');
|
||||
$this->load->helper('url');
|
||||
$this->load->library('pagination');
|
||||
$this->load->model('Produits_model');
|
||||
|
||||
$this->load->library('table');
|
||||
$this->load->helper('form');
|
||||
$this->load->library('session');
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
$this->load->view('produits/header' );
|
||||
|
||||
$this->load->view('produits/list' );
|
||||
$this->load->view('produits/footer' );
|
||||
|
||||
}
|
||||
public function form($mem_id,$error='')
|
||||
{
|
||||
$error = []; // initialise comme tableau
|
||||
// $error['error']=array('type'=>'error','message'=>'test');
|
||||
$error['error']=$error;
|
||||
|
||||
|
||||
|
||||
// prépare tout les info pour la forme
|
||||
$data=$this->Produits_model->mod_getForminfo($mem_id);
|
||||
|
||||
$data_view= $this->load->view('produits/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->Produits_model->mod_loadData_list($record,$filtre1,$filtre2,$filtre3,$listactif,$model_de_produits);
|
||||
|
||||
echo json_encode($data) ;
|
||||
}
|
||||
|
||||
public function desactivate($id,$statut)
|
||||
{
|
||||
$this->Produits_model->mod_desactivateRecordbd($id,$statut);
|
||||
$error['error']=array('type'=>'success','message'=>'Produit effacé');
|
||||
|
||||
$this->load->view('produits/header' );
|
||||
|
||||
$this->load->view('produits/list' );
|
||||
$this->load->view('produits/footer', $error );
|
||||
}
|
||||
|
||||
public function saveRecord($id=0)
|
||||
{
|
||||
|
||||
$id=$this->Produits_model->mod_createRecordbd($_POST,'des_',$id);
|
||||
|
||||
$error['error']=array('type'=>'success','message'=>'Produit créée');
|
||||
|
||||
$this->load->view('produits/header' );
|
||||
|
||||
$this->load->view('produits/list' );
|
||||
$this->load->view('produits/footer',$error);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user