<?php
class Apprentice extends Controller
{
	
	function Apprentice()
	{
		parent::Controller();
		$this->load->model("mpages");
	}

	function index()
	{
		$data['title']    = 'ARCHLine.XP Apprentice';
		$data['tartalom'] = 'apprentice/index';
		$data['csik']     = array('home','Apprentice');
		
		$data['style']     = array('workshop',"../js/tiptip/tipTip");
		$data['javascript']= array('tiptip/jquery.tipTip','tiptip/jquery.tipTip.minified','archlinetooltip');
		
		$this->load->view('site',$data);
	}
	
	function index2(){
		$this->load->model('mclusers');
		
		$temptomb = explode("/", $_SERVER[ 'REQUEST_URI'] );
		$email = str_replace("%40","@",end($temptomb));
		
		$egyezes = "fgdfgfdgdrtrgbcfgfg";
		$info = "Apprentice has been seen: (http://archlinexp.com/apprentice)";
		
		if(UJUGYFELKEZELO===true)
			$this->mclusers->levelesemeny($email, "apprentice", "index2", 168, $egyezes, $info, "eng");
		else
			$this->mclusers->levelesemeny($email, "apprentice", "index2", 152, $egyezes, $info, "eng");
		
		redirect("apprentice/");
		return;
	}
	
	function index2esp(){
		$this->load->model('mclusers');
		
		$temptomb = explode("/", $_SERVER[ 'REQUEST_URI'] );
		$email = str_replace("%40","@",end($temptomb));
		
		$egyezes = "apprentice/";
		$info = "Apprentice megtekintve: http://archlinexp.com/apprentice/";
		
		if(UJUGYFELKEZELO===true)
			$this->mclusers->levelesemeny($email, "apprentice", "index2esp", 249, $egyezes, $info, "esp");
		else
			$this->mclusers->levelesemenyEsp($email, "apprentice", "index2esp", 135, $egyezes, $info, "esp");
		
		redirect("apprentice/");
	}
	
	function buy(){
		
		$temp = "=".$_POST['darab'];
		$temp .= '&language=English';
		$voltjo = false;
		
		if( isset($_POST['G1']) ){
			if($this->input->post('valuta')=='eur')
				$head = "https://secure.shareit.com/shareit/checkout.html?PRODUCT[300300560]".$temp;
			elseif($this->input->post('valuta')=='usd')
				$head = "https://secure.shareit.com/shareit/checkout.html?PRODUCT[300500919]".$temp;
			else
				$head = "https://secure.shareit.com/shareit/checkout.html?PRODUCT[300308301]".$temp;
			
			$voltjo = true;
		}
		
		if( isset($_POST['G2']) && $this->input->post('darab12m') > 0 ){
			$head = "https://secure.shareit.com/shareit/checkout.html?PRODUCT[300522896]=".$this->input->post('darab12m');
			$voltjo = true;
		}
		
		if( isset($_POST['G3']) && $this->input->post('darab6m') > 0 ){
			$head = "https://secure.shareit.com/shareit/checkout.html?PRODUCT[300522895]=".$this->input->post('darab6m');
			$voltjo = true;
		}
		
		
		if( isset($_POST['OTS']) && $this->input->post('darabots') > 0 ){
			$head = "https://secure.shareit.com/shareit/checkout.html?PRODUCT[300523533]=".$this->input->post('darabots');
			$voltjo = true;
		}
		
		
	//	$head = "https://secure.shareit.com/shareit/checkout.html?PRODUCT[300308301]".$temp;
		if( $voltjo == true )
			header("Location: ".$head);
		else
			redirect("apprentice");
	
	//	print "post: ".print_r($_POST);
		
		exit;
		
		
		
		
		
		
		/*$temp = "=".$_POST['darab'];
		$temp .= '&language=English';
		
		if($this->input->post('valuta')=='eur')
			$head = "https://secure.shareit.com/shareit/checkout.html?PRODUCT[300300560]".$temp;
		elseif($this->input->post('valuta')=='usd')
			$head = "https://secure.shareit.com/shareit/checkout.html?PRODUCT[300500919]".$temp;
		else
			$head = "https://secure.shareit.com/shareit/checkout.html?PRODUCT[300308301]".$temp;
		
	//	$head = "https://secure.shareit.com/shareit/checkout.html?PRODUCT[300308301]".$temp;
		header("Location: ".$head);
		exit;*/
	}
	
}