<?php
class Whitepaper extends Controller
{
	
	function Whitepaper(){
		parent::Controller();
	}
	
	function index(){
		$nyelv = hun() ? "hun" : "eng";
		$data['kategoriak'] = $this->db->query("SELECT * FROM wp_categories WHERE lang='{$nyelv}' ORDER BY number ASC")->result();
		$data['meta']['desc']  = $metadesc;
		$data['title']    = hun() ? 'ARCHLine.XP - Dokumentáció' : 'ARCHLine.XP - White Paper';
		$data['tartalom'] = 'whitepaper/index';
		$data['csik']     = array('home','whitepaper');
		
		$this->load->view('site',$data);
	}
	
	function routing(){
		$kategoria = $this->uri->segment(2);
		$cikk      = $this->uri->segment(3);
		if(!$cikk || $cikk=="")
			$this->showcategory($kategoria);
		else
			$this->showarticle($kategoria,$cikk);
		return;
	}
	
	function showcategory($kategoriaurl){
		$nyelv = hun() ? "hun" : "eng";
		$kategoria = $this->db->query("SELECT * FROM wp_categories WHERE url='{$kategoriaurl}' AND lang='{$nyelv}'")->row();
		$cikkek = $this->db->query("SELECT * FROM wp_articles WHERE dc_id={$kategoria->dc_id} ORDER BY number ASC")->result();
		
		$data['kategoria'] = $kategoria;
		$data['cikkek']    = $cikkek;
		$data['meta']['desc']  = $metadesc;
		$data['title']     = hun() ? 'ARCHLine.XP - Dokumentáció' : 'ARCHLine.XP - White Paper';
		$data['tartalom']  = 'whitepaper/category';
		$data['csik']      = array('home','whitepaper');
		
		$this->load->view('site',$data);
	}
	
	function showarticle($kategoriaurl,$cikkurl){
		$nyelv = hun() ? "hun" : "eng";
		$kategoria = $this->db->query("SELECT * FROM wp_categories WHERE url='{$kategoriaurl}' AND lang='{$nyelv}'")->row();
		$cikk = $this->db->query("SELECT * FROM wp_articles WHERE dc_id={$kategoria->dc_id} AND url='{$cikkurl}'")->row();
		
		$data['cikk']      = $cikk;
		$data['meta']['desc']  = $metadesc;
		$data['title']     = hun() ? 'ARCHLine.XP - Dokumentáció' : 'ARCHLine.XP - White Paper';
		$data['tartalom']  = 'whitepaper/article';
		$data['csik']      = array('home','whitepaper');
		
		$this->load->view('site',$data);
	}
	
	
}
?>