<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Welcome extends CI_Controller {

	public function index()
	{
		$this->session->set_userdata('site_lang', 'portuguese');
		$this->fiverscans->pegarSaldo($this->session->id);
		$data = [
			'partner' => $this->input->get('ref'),
			'nomepagina' => 'Bem vindo!',
			'config' => $this->app->config(),
			'populares' => $this->db->get('populares')->result(),
			'aovivo' => $this->db->query("SELECT * FROM games WHERE game_name like '%Roulette%' LIMIT 24;")->result(),
			'jogos' => $this->db->query("SELECT * FROM games LIMIT 60;")->result(),
			'banners' => $this->db->get('banner')->result(),
			'signup' => $this->app->configFin('signup-bonus-text'),
			'bonus' => $this->app->configFin('deposit-bonus-text'),
			'minSaque' => $this->app->configFin('min-saque'),
			'EnableCashback' => $this->app->configFin('cashback-enable-text'),
		];
	
		$this->app->AccessLogger();
	
		$views = ['layout/header', 'layout/register', 'layout/modals', 'welcome/home', 'layout/footer'];
	
		foreach ($views as $view) {
			$this->load->view("pages/$view", $data);
		}
	}
	public function switchLang($language = "") {
		$this->session->set_userdata('site_lang', $language);
		header('Location: '.base_url());
	}
	public function terms(){

		$this->session->set_userdata('site_lang', 'portuguese');
	
		$data = [
			'partner' => $this->input->get('ref'),
			'nomepagina' => 'Termos!',
			'config' => $this->app->config(),
			'populares' => $this->db->get('populares')->result(),
			'aovivo' => $this->db->query("SELECT * FROM games WHERE game_name like '%Roulette%' LIMIT 24;")->result(),
			'jogos' => $this->db->query("SELECT * FROM games LIMIT 60;")->result(),
			'banners' => $this->db->get('banner')->result(),
			'signup' => $this->app->configFin('signup-bonus-text'),
			'bonus' => $this->app->configFin('deposit-bonus-text'),
			'minSaque' => $this->app->configFin('min-saque'),
			'EnableCashback' => $this->app->configFin('cashback-enable-text'),
		];
	
		$this->app->AccessLogger();
	
		$views = ['layout/header', 'layout/register', 'layout/modals', 'welcome/terms', 'layout/footer'];
	
		foreach ($views as $view) {
			$this->load->view("pages/$view", $data);
		}

	}
	public function faq(){

		$this->session->set_userdata('site_lang', 'portuguese');
	
		$data = [
			'partner' => $this->input->get('ref'),
			'nomepagina' => 'FAQ!',
			'config' => $this->app->config(),
			'populares' => $this->db->get('populares')->result(),
			'aovivo' => $this->db->query("SELECT * FROM games WHERE game_name like '%Roulette%' LIMIT 24;")->result(),
			'jogos' => $this->db->query("SELECT * FROM games LIMIT 60;")->result(),
			'banners' => $this->db->get('banner')->result(),
			'signup' => $this->app->configFin('signup-bonus-text'),
			'bonus' => $this->app->configFin('deposit-bonus-text'),
			'minSaque' => $this->app->configFin('min-saque'),
			'EnableCashback' => $this->app->configFin('cashback-enable-text'),
		];
	
		$this->app->AccessLogger();
	
		$views = ['layout/header', 'layout/register', 'layout/modals', 'welcome/faq', 'layout/footer'];
	
		foreach ($views as $view) {
			$this->load->view("pages/$view", $data);
		}

	}
	public function gambling(){

		$this->session->set_userdata('site_lang', 'portuguese');
	
		$data = [
			'partner' => $this->input->get('ref'),
			'nomepagina' => 'Jogo Responsavel!',
			'config' => $this->app->config(),
			'populares' => $this->db->get('populares')->result(),
			'aovivo' => $this->db->query("SELECT * FROM games WHERE game_name like '%Roulette%' LIMIT 24;")->result(),
			'jogos' => $this->db->query("SELECT * FROM games LIMIT 60;")->result(),
			'banners' => $this->db->get('banner')->result(),
			'signup' => $this->app->configFin('signup-bonus-text'),
			'bonus' => $this->app->configFin('deposit-bonus-text'),
			'minSaque' => $this->app->configFin('min-saque'),
			'EnableCashback' => $this->app->configFin('cashback-enable-text'),
		];
	
		$this->app->AccessLogger();
	
		$views = ['layout/header', 'layout/register', 'layout/modals', 'welcome/gambling', 'layout/footer'];
	
		foreach ($views as $view) {
			$this->load->view("pages/$view", $data);
		}

	}
	public function teste() {
		$niveis = $this->cpa->obterNivel(1);
	
		foreach ($niveis as $nvs) {

			if($nvs->nivel == 'lv1'){
				
				 echo $nvs->id_usuario . ' LV1   </br>';

			}elseif($nvs->nivel == 'lv2'){

				 echo $nvs->id_usuario . ' LV2 </br>';
			}elseif($nvs->nivel == 'lv3'){
				 echo $nvs->id_usuario . ' LV3 </br>';
			};

			
		}
	}	
}