<?php 


namespace App\Controllers\User;
use App\Views;
use App\Models\CommonModel;
use App\Helpers\site_helper;
use App\Libraries\MyEncrypt;
use App\Libraries\My_PHPMailer;
use App\Libraries\PHPMailer;  
error_reporting(0);


class Faq extends BaseController {	

	public function __construct() {

        
        helper('site_helper');
        $this->db = db_connect();
		$this->common_model = model('CommonModel');
		$this->session = \Config\Services::session();

		$status = site_info('site_status');
		if($status!='on'){
			throw new \CodeIgniter\Router\Exceptions\RedirectException('login');
		} 

	}
	
	public function index()
	{

		$this->db = db_connect();
		$this->common_model = model('CommonModel');
		$this->session = \Config\Services::session();
		if(!$this->session->get('user_login')){
			throw new \CodeIgniter\Router\Exceptions\RedirectException('login');
		}
		
		$languageid = ($this->session->get('user_langid')) ? $this->session->get('user_langid'): '1';
		$faq_condition = "faq_status = '1' AND language_id = '".$languageid."'";
		$this->data['faqs'] = $this->common_model->GetResults('faq_controls',$faq_condition);
		// $this->data['faqs'] = $this->common_model->GetLimitedRes('faq_controls',$faq_condition,'');
		echo view('user/faq',$this->data);
	}
}

