<?php

namespace App\Controllers\User;
use App\Views;
use App\Models\CommonModel;
use App\Libraries\MyEncrypt;

error_reporting(0);



class Genealogy extends BaseController {
/**
* 
* Start 
* Create Date: 22 sep, 2016
* This controller to manage infobox setting page.
* Created karthiga.
* @see http://zhyip.com/admin/infoboxsettings/
* Last Updated: 22 sep, 2016
* End
* 
*/

public function __construct() {
	    $this->db = db_connect();
		$myencrypt = new MyEncrypt(true);
		$this->common_model = model('CommonModel');
		$session = \Config\Services::session();
		$validation = \Config\Services::validation();
		$uri = service('uri');
		
		$status = site_info('site_status');
		if($status!='on'){
			return redirect()->to('offline');
		} 

		// user login only
		if($session->get('user_login') || $session->get('admin_login')) {

			// form validation library
			// $this->load->library('form_validation');
			// $this->load->model('userdash_model');
			// $this->load->model('finance_model');
			$this->finance_model = model('finance_model');
			$this->userdash_model = model('userdash_model');

			
		} else {
			throw new \CodeIgniter\Router\Exceptions\RedirectException('login');
		}
		
	}



public function index()
{
	$session = \Config\Services::session();
		if(!($session->get('user_login') || $session->get('admin_login')))
		{			
			return redirect()->to('login');
		}

	$this->view();



//$this->view();
}

public function view($id='')
{



//$this->uri = service('uri');
 //$this->uri = current_url(true);

// $id=$this->uri->getSegment(10);


$this->db = db_connect();
$this->common_model = model('CommonModel');

//print_r($id);
//exit();

if($id!=='') {
$this->data['userid']=$id;

}   else {
$this->data['userid'] = '2';
}



//$this->data['val'] = $this->user_ta($userid,$table);



echo view('user/genealogy',$this->data);





}
}