All pastes #2076607 Raw Edit

Unnamed

public text v1 · immutable
#2076607 ·published 2011-06-08 07:43 UTC
rendered paste body
class Ads extends Controller {

	function __construct()
	{
		parent::Controller();
	}

	function index()
	{
		if($this->session->userdata('appID')){
			$this->load->model('fte_db');
			$msg['test']=true;
			$msg['appID'] = $this->session->userdata('appID');
			$msg['ads'] = $this->fte_db->ads($msg); // string of all the perms
			//var_dump($msg['ads']);
			$this->load->view('ads', $msg);
		}else{
			$msg['error'] = "Please go back and fill in the Application details.";
			$this->load->view('ads', $msg);
		}
	}

	function update()
	{
		if($this->session->userdata('appID')){
			$this->load->library('form_validation');
			$this->form_validation->set_rules('topAdID', 'Top Ad ID', 'trim|required');
			$this->form_validation->set_rules('bottomAdID', 'Bottom Ad ID', 'trim|required');

			if($this->form_validation->run() == FALSE){
				$this->load->view('ads');
			}else{
				// validation has passed
				$ads['appID'] = $this->session->userdata('appID');
				$ads['top'] = $this->input->post('topAdID');
				$ads['bottom'] = $this->input->post('bottomAdID');
				$ads['test'] = false;

				$this->load->model('fte_db');
				$msg['ads'] = $this->fte_db->ads($ads); // string of all the perms

				$this->load->view('ads', $msg);

			}
		}else{
			$msg['error'] = "Please go back and fill in the Application details.";
			$this->load->view('ads', $msg);
		}
	}
	
}