<?php
defined('BASEPATH') OR exit('No Direct Access Allowed');

class Pixelrep extends CI_Controller{

	public function __construct()
	{   
	    
        parent::__construct();
        
        $this->load->model('commonm','cmn');
        $logiinData = $this->session->userdata();
        $autharr=array(1,4);

        if(!in_array($logiinData['ROLE'],$autharr))
        { 
          redirect('login');
        }
    	}
	public function index(){
	   
	if(!empty($this->input->post('typ')))
	{
	  if($this->input->post('typ')=='del' && !empty($this->input->post('oid')) && !empty($this->input->post('aid'))){
		$this->cmn->setPixelstatus($this->input->post('oid'),$this->input->post('aid'));
		}
	  if($this->input->post('typ')=='edt' && !empty($this->input->post('oid')) && !empty($this->input->post('aid') && $this->input->post('upd'))){
                $this->cmn->setPixelstatusval($this->input->post('oid'),$this->input->post('aid'),$this->input->post('upd'));
                }
	}
		
	$result=$this->cmn->getPixrec();

        $total=count($result);
        $this->load->library('pagination');
        $config['base_url'] = 'https://affnads.affsure.com/pixelrep';
        $config['total_rows'] = $total;
        $config['per_page'] = 20;
        $config['page_query_string']=true;
        $config['query_string_segment'] = 'q';
        $config['reuse_query_string'] = true;
        if(!empty($this->input->get('q'))){
        $is_numeric=$this->input->get('q');
        $count=$is_numeric+1;
        }
        else
        {
           $is_numeric=0;
        }

        $this->pagination->initialize($config);
        $pagination_link=$this->pagination->create_links();

	$data['noti']=$result;
	$data['pagination']=$pagination_link;
	$this->load->view('header');
	$this->load->view('pixelreps',$data);
	$this->load->view('footer');
	}
}






