<?php
class Lots extends CI_Controller {

    function __construct()
    {
        parent::__construct('lots');
        $this->load->helper('url');
        $this->load->library('pagination');
        $this->load->model('Lots_model');

        $this->load->model('Config_model');
        $this->load->library('table');
        $this->load->helper('form');
        $this->load->library('session');

    }
    public function index()
    {


        $this->load->view('lots/header' );
        $this->load->view('lots/list' );
        $this->load->view('lots/footer' );
    }
    public function test()
    {
        $data['body']=$this->load->view('lots/email_fr', '', true);

        $data['subject']='test';

        $data['to_mail']='stephan@progiweb.ca';
        $data['to_name']='stephan';
        $data['from_mail']=$this->config->item('emailreservation');
        $data['from_name']='Expresstours';
        $data['attach'] = '';
        $data['blnGoDaddy'] = true;




      //  $data['mem_fou_email']='stephan@va-voir.com';
       // $data['mem_sujet']= 'Reservations ExpressTours ' ;
       // $this->Config_model->conf_email($data);
        $this->Config_model->fxSendMail($data)  ;


            //  $this->load->view('lots/email_fr' );



    }
    public function loadData_list($record=0,$filtre1='',$filtre2='',$filtre3='',$listactif=1 ) {

        $filtre1=urldecode($filtre1);
        $filtre2=urldecode($filtre2);
        $filtre3=urldecode($filtre3);


        $data=$this->Lots_model->mod_loadData_list($record,$filtre1,$filtre2,$filtre3,$listactif );

        echo json_encode($data);
    }

    public function removelot($id,$mem_listactivechange){
        $change=($mem_listactivechange==1?0:1);
        $data=$this->Lots_model->mod_modiflot($id,$change);

        echo json_encode('ok');

    }

    public function reload($mem_listactivechange){
        $data['listactivechange']=$mem_listactivechange;
        $this->load->view('lots/header' );
        $this->load->view('lots/list',$data );
        $this->load->view('lots/footer' );

    }
    public function prepare_lot(){

        $data=$this->Lots_model->mod_prepare_lot($_POST);
        $this->load->view('lots/header' );
        $this->load->view('lots/list',$data );
        $this->load->view('lots/footer' );
    }



}