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

	class Admin extends CI_Controller {
		public function __construct() {
	        parent::__construct();
	        $this->load->library('layouts');
	        if($this->session->userdata('admin_master_code') !== md5("yes")){
	            redirect(base_url().'logout');
	        }
	    }

	    public function index() {
	    	// echo '<h3>admin dashboard</h3>';
	    	var_dump($this->session->userdata('admin_master_code'));
	    	if($this->session->userdata('logged_in')) {

	    	}
	    	$this->layouts->view('home', array(), array(), true);
	    }

	    public function chat_helpdesk() {
	        $this->lang->load("admin", $this->session->userdata('language'));
	        $this->layouts->view('admin/online_help_desk', array('Menu' => 'layouts/menu'), false, true);
	    }

	    public function get_chat_users() {
	        $this->load->model('admin/admin_model');
	        $session_users = $this->admin_model->get_unread_chat_fromusers();
	        //$this->admin_model->set_chat_users_to_read();
	        print json_encode(array("status"=>"success", "records"=>$session_users));
	    }

	    public function get_msg_receive_for_admin() {
	        $this->load->model('admin/admin_model');

	        $session_msg = $this->admin_model->admin_msg_receive(0);

	        print json_encode(array("status"=>"success", "records"=>$session_msg));
	    }

	    public function update_sesion_admin() {
	        $this->load->model('admin/admin_model');
	        $sessionID = $this->input->post('session');

	        $data = array(
	            "adminID" => element('role', $this->session->userdata('logged_in')),
	            "status" => 1
	        );

	        $status = $this->admin_model->update_row("chat_session",$sessionID, $data);
	        if($status){
	            print json_encode(array("status"=>"success"));
	        } else {
	            print json_encode(array("status"=>"fail"));
	        }


	    }

	    public function end_chatting_session() {
	        $this->load->model('admin/admin_model');
	        $sessionID = $this->input->post('session');

	        $data = array(
	            "status" => 2
	        );

	        $status = $this->admin_model->update_row("chat_session",$sessionID, $data);
	        if($status){
	            print json_encode(array("status"=>"success"));
	        } else {
	            print json_encode(array("status"=>"fail"));
	        }
	    }

	    public function admin_send_msg() {
	        $this->load->model('admin/admin_model');
	        $data = array(
	            "sessionID" => $this->input->post('sesionID'),
	            "msgFrom" => 0,
	            "message" => $this->input->post('message')
	        );

	        $status = $this->admin_model->insert("chat_message", $data);
	        if($status){
	            print json_encode(array("status"=>"success"));
	        } else {
	            print json_encode(array("status"=>"fail"));
	        }
	    }

	    public function set_msg_to_read() {
	        $this->load->model('admin/admin_model');
	        $msgID = $this->input->post('msgID');

	        $data = array(
	            "status" => 1
	        );

	        $status = $this->admin_model->update_row("chat_message",$msgID, $data);

	        if($status){
	            print json_encode(array("status"=>"success"));
	        } else {
	            print json_encode(array("status"=>"fail"));
	        }
	    }

	    public function company() {

	        $this->lang->load("companyInfo", $this->session->userdata('language'));
	        $this->load->model('company/company_info_model');
	        //$this->load->model('State');
	        //$data['state'] = $this->state->state_id($id);
	        $data['list_company'] = $this->company_info_model->company_all();
	        $this->layouts->view('admin/companyList', array('Menu' => 'layouts/menuAdmin'), $data, true);
	    }

	    public function delete_company() {
	        $this->load->model('company/company_info_model');
	        $to_delete_list = $this->input->post('companyID');
	        if ($to_delete_list) {
	            foreach ($to_delete_list as $row_id) {
	                $this->company_info_model->delete_row("company", $row_id);
	            }
	        }
	        redirect(base_url() . "admin/company");
	    }

	    public function addNewCompany() {
	        //need to insert default data upon creating a new company
	        //chart of account, bank list
	        echo '<h3>admin add new company</h3>';
	    }

	    public function addNewUser() {
	        $this->load->model('UseraccessDetails');
	        $query = $this->UseraccessDetails->UseraccessDetails_id_code('UM');
	        if (!$query) {
	            echo '<script>alert("Not authorised..");
					window.location.replace("' . base_url() . 'Error");
					</script>';
	        }
	        $this->load->model('Usermaster');
	        if ($this->input->post('mysubmit')) {
	            $this->load->model('Gallery_user');
	            if ($this->input->post('fldid') == NULL) {
	                $newusermaster = array(
	                    //'fldid' => $this->input->post('fldid'),
	                    'userid' => $this->input->post('userid'),
	                    'password' => md5($this->input->post('password')),
	                    'username' => $this->input->post('username'),
	                    'position' => $this->input->post('position'),
	                    'email' => $this->input->post('email'),
	                    'phone_off' => $this->input->post('phone_off'),
	                    'Phone_mobile' => $this->input->post('phone_mobile'),
	                    'department' => $this->input->post('department'),
	                    'section' => $this->input->post('section'),
	                    'language' => $this->input->post('language'),
	                    //'companyID' => $this->input->post('companyID'),
	                    'create_dt' => $this->input->post('order_time'),
	                    'create_user' => element('userid', $this->session->userdata('logged_in')),
	                );
	                $insert_user = $this->Usermaster->usermaster_insert($newusermaster);
	                if ($insert_user) {

						$getUserID = $this->Usermaster->usermaster_allDESC();

						$newUserExpiry = array(
							'userID' => $getUserID[0]->fldid,
							'username' => $this->input->post('userid'),
							'typeOfPackage' => $this->input->post('typeOfPack'),
							'numberOfPeriod' => $this->input->post('numberOfPeriod'),
							'startDate' => date("Y-m-d", strtotime($this->input->post('startDate'))),
							'endDate' => date("Y-m-d", strtotime($this->input->post('endDate'))),
						);

						$insert_userExpiry = $this->Usermaster->userExpiry_insert($newUserExpiry);

	                    $this->db->query('INSERT INTO user_module_access(userid, companyID, transaction, reports, setup, accessright) values ('.$insert_user.', '.$this->input->post('companyID').', 1, 1, 1, 1)');
	                    $this->Gallery_user->do_upload($insert_user);
	                    echo '<script>alert("Insert Data Success..");
	                window.location.replace("userList");
	                </script>';
	                } else {
	                    echo '<script>alert("Insert Data Failed.");
	                history.go(-1);</script>';
	                }
	            } else {
	                $fldid = $this->input->post('fldid');
	                $newusermaster = array(
	                    //'fldid' => $this->input->post('fldid'),
	                    'userid' => $this->input->post('userid'),
	                    'password' => md5($this->input->post('password')),
	                    'username' => $this->input->post('username'),
	                    'position' => $this->input->post('position'),
	                    'email' => $this->input->post('email'),
	                    'phone_off' => $this->input->post('phone_off'),
	                    'Phone_mobile' => $this->input->post('phone_mobile'),
	                    'department' => $this->input->post('department'),
	                    'section' => $this->input->post('section'),
	                    'language' => $this->input->post('language'),
	                    //'companyID' => $this->input->post('companyID'),
	                    'modified_dt' => $this->input->post('order_time'),
	                    'modified_user' => element('userid', $this->session->userdata('logged_in')),
	                );
	                $insert_user = $this->Usermaster->usermaster_edit($newusermaster, $fldid);

	                if ($insert_user) {
	                    $rs = $this->db->query('SELECT * FROM user_module_access WHERE userid = '.$fldid);
	                    if ($rs->num_rows()>0) {
	                        $this->db->query('update user_module_access set companyID = '.$this->input->post('companyID').' WHERE userid = '.$this->input->post('fldid'));
	                    }else{
	                        $this->db->query('INSERT INTO user_module_access(userid, companyID, transaction, reports, setup, accessright) values ('.$insert_user.', '.$this->input->post('companyID').', 1, 1, 1, 1)');
	                    }
	                    $this->Gallery_user->do_upload($fldid);
	                    echo '<script>alert("Update Success..");
	                    window.location = "' . base_url() . 'admin/userList";
	                    </script>';
	                } else {
	                    echo '<script>alert("Update Failed.");
	                history.go(-1);</script>';
	                }
	            }
	        } else {
	            $id = isset($_REQUEST['id']) ? $_REQUEST['id'] : "";
	            $this->load->library('layouts');
	            $this->lang->load("usermaster", $this->session->userdata('language'));
	            $this->load->model('Department');
	            $data['deptrec'] = $this->Department->department_all();
	            $this->load->model('Section');
	            $data['secrec'] = $this->Section->section_all();
	            $dataum = $this->Usermaster->usermaster_id($id);
	            $dataum1 = $this->Usermaster->getUserComp($id);
	            //print_r($dataum[0]);
	            $data['umaster'] = $dataum[0];
	            $data['umastercomp'] = $dataum1[0];
	//			$data['companyID'] = $dataum[0]->companyID;
				$this->load->model('Company/Company_info_model');
				$data['companyList'] = $this->Company_info_model->company_all();
				$this->load->model('Language');
	            $data['language'] = $this->Language->language_all();

				$data['startDate'] = date("d-m-Y");
				$data['endDate'] = date("d-m-Y");
				$data['typeOfPack'] = 1;

	            $this->layouts->add_includes('js/validationengine/languages/jquery.validationEngine-' . $this->session->userdata('language') . '.js')
	                    ->add_includes('js/validationengine/jquery.validationEngine.js');
	            if ($id >= '0') {
	                $this->layouts->view('admin/userProfileEdit', array('latest' => 'sidebar/latest'), $data);
	            } else {
	                //control number of use
	                $this->load->model('license_model');
	                $res = $this->license_model->decrytNumberOfUser($this->input->post('activationKey'));
	                if ($res) {
	                    $this->layouts->view('admin/usermaster', array('latest' => 'sidebar/latest'), $data);
	                } else {
	                    echo "<script>alert('Number of user limited according to the license agreement...');"
	                    . "window.location = '" . base_url() . "admin/usermasterlist'</script>";
	                }
	            }
	        }
	    }

	    public function userList() {
	        $this->lang->load("usermaster", $this->session->userdata('language'));
	        $this->load->model('usermaster');

	        //$data['list_user'] = $this->usermaster->usermaster_all();
	        // var_dump($id);
	        $data['user_company'] = $this->usermaster->getAllUserComp();
	        // var_dump($data['user_company']);
	        // exit();
	        // $user_company = $this->usermaster->getUserComp('fldid');
	        $this->layouts->view('admin/userList', array('Menu' => 'layouts/menu'), $data, true);
	        //echo '<h3>admin user list</h3>';
	    }

	    public function delete_user() {
	        $this->load->model('usermaster');
	        $to_delete_list = $this->input->post('fldid');
	        if ($to_delete_list) {
	            foreach ($to_delete_list as $row_id) {
	                $this->usermaster->delete_row("tbl_usermaster", $row_id);
	            }
	        }
	        redirect(base_url() . "admin/userList");
	    }

	    public function userEdit() {

	        $this->load->model('Usermaster');

	        if ($this->input->post('submit')) {

	            $this->load->model('Gallery_user');
	            if ($this->input->post('fldid') == NULL) {

	                $newusermaster = array(
	                    'fldid' => $this->input->post('fldid'),
	                    'userid' => $this->input->post('userid'),
	                    //'password'      => $this->input->post('password'),
	                    'username' => $this->input->post('username'),
	                    'position' => $this->input->post('position'),
	                    'email' => $this->input->post('email'),
	                    'phone_off' => $this->input->post('phone_off'),
	                    'Phone_mobile' => $this->input->post('phone_mobile'),
	                    'department' => $this->input->post('department'),
	                    'section' => $this->input->post('section'),
	                    'language' => $this->input->post('language'),
	                    //'companyID' => $this->input->post('companyID'),
	                    'imageFile' => $this->input->post('userfile'),
	                    'create_dt' => $this->input->post('order_time'),
	                    'create_user' => element('userid', $this->session->userdata('logged_in')),
	                );


	                $insert_user = $this->Usermaster->usermaster_insert($newusermaster);
	                if ($insert_user) {
	                    $this->db->query('INSERT INTO user_module_access(userid, companyID, transaction, report, setup, accessright) values ('.$insert_user.', '.$this->input->post('companyID').', 1, 1, 1, 1)');
	                    $this->Gallery_user->do_upload($insert_user);
	                    echo '<script>alert("Insert Data Success..");
	                window.location.replace("usermasterlist");
	                </script>';
	                } else {
	                    echo '<script>alert("Insert Data Failed.");
	                history.go(-1);</script>';
	                }
	            } else {
	                $fldid = $this->input->post('fldid');

	                $editusermaster = array(
	                    'fldid' => $this->input->post('fldid'),
	                    'userid' => $this->input->post('userid'),
	                    //'password'      => $this->input->post('password'),
	                    'username' => $this->input->post('username'),
	                    'position' => $this->input->post('position'),
	                    'email' => $this->input->post('email'),
	                    'phone_off' => $this->input->post('phone_off'),
	                    'Phone_mobile' => $this->input->post('phone_mobile'),
	                    'department' => $this->input->post('department'),
	                    'section' => $this->input->post('section'),
	                    'language' => $this->input->post('language'),
	                    //'companyID' => $this->input->post('companyID'),
	                    'imageFile' => $this->input->post('userfile'),
	                    'modified_dt' => $this->input->post('order_time'),
	                    'modified_user' => element('userid', $this->session->userdata('logged_in')),
	                );


	                $insert_user = $this->Usermaster->usermaster_edit($editusermaster, $fldid);
	                if ($insert_user) {

	                    $rs = $this->db->query('SELECT * FROM user_module_access WHERE userid = '.$fldid);
	                    if ($rs->num_rows()>0) {
	                        $this->db->query('update user_module_access set companyID = '.$this->input->post('companyID').' WHERE userid = '.$this->input->post('fldid'));
	                    }else{
	                        $this->db->query('INSERT INTO user_module_access(userid, companyID, transaction, report, setup, accessright) values ('.$insert_user.', '.$this->input->post('companyID').', 1, 1, 1, 1)');
	                    }
	                    $this->Gallery_user->do_upload($fldid);
	                    echo '<script>alert("Update Success..");
	                    window.location = "' . base_url() . 'admin/userList";
	                    </script>';
	                } else {
	                    echo '<script>alert("Update Failed.");
	                history.go(-1);</script>';
	                }
	            }
	        } else {
	            $id = isset($_REQUEST['id']) ? $_REQUEST['id'] : "";
	            $this->load->library('layouts');
	            $this->lang->load("usermaster", $this->session->userdata('language'));
	            $this->load->model('Department');
	            $data['deptrec'] = $this->Department->department_all();
	            $this->load->model('Section');
	            $data['secrec'] = $this->Section->section_all();

	            $dataum = $this->Usermaster->usermaster_id($this->uri->segment(3));
	            $dataum1 = $this->Usermaster->getUserComp2($this->uri->segment(3));
	            $data['umaster'] = $dataum[0];

	            // var_dump($data['umaster']);
	            // exit();


	            $data['umastercomp'] = $dataum1[0];

	            // var_dump($data['umastercomp']);
	            // exit();
				$data['userMasterID'] = $this->uri->segment(3);
				$dataUserExpiry = $this->Usermaster->userExpiry_id($this->uri->segment(3));
				if($dataUserExpiry){
					$data['userExpiry'] = $dataUserExpiry[0]->numberOfPeriod;
					$data['typeOfPack'] = $dataUserExpiry[0]->typeOfPackage;
				}
				else{
					$data['userExpiry'] = '';
					$data['typeOfPack'] = 1;
				}

				if($data['userExpiry']){
					$data['startDate'] = date("d-m-Y", strtotime($dataUserExpiry[0]->startDate));
					$data['endDate'] = date("d-m-Y", strtotime($dataUserExpiry[0]->endDate));
				}
				else{
					$data['startDate'] = date("d-m-Y");
					$data['endDate'] = date("d-m-Y");
				}

	            $this->load->model('Company/Company_info_model');
	            $data['companyList'] = $this->Company_info_model->company_all();
	            $this->load->model('Language');
	            $data['language'] = $this->Language->language_all();
	            $this->layouts->add_includes('js/validationengine/languages/jquery.validationEngine-' . $this->session->userdata('language') . '.js')
	                    ->add_includes('js/validationengine/jquery.validationEngine.js');
	            $this->layouts->view('admin/usermaster_edit', array('latest' => 'sidebar/latest'), $data);
	        }
	    }

	    public function saveNewPwd() {
	        $this->load->model('systemgeneral/systemgeneral_model');
	        $res = $this->systemgeneral_model->resetUserPwd($this->input->post('userID'), $this->input->post('newpwd'));
	        if ($res) {
	            echo "success";
	        } else {
	            echo "fail";
	        }
	    }

	    public function search() {
	        /* $id = $this->input->post('search_text');
	          $length = strlen($id);
	          $searchdata = substr($id, 1, $length);

	          var_dump($searchdata);

	          switch ($id[0]) {
	          case 'M':
	          $this->load->model('SysMenu');
	          $query = $this->SysMenu->menuMaster_menu($searchdata);
	          echo '<script>window.location.replace("' . base_url() . '' . $query[0]->urls . '")</script>';
	          break;
	          }
	         * */
	        $this->load->library('layouts');
	        $this->load->model('menu');

	        $this->layouts->add_includes('js/datatables/jquery.dataTables.min.js');
	        $searchdata = $this->input->post('search_text');
	        $data["searchKey"] = $searchdata;
	        $data["searchResult"] = $this->menu->doResearch($searchdata);


	        $this->layouts->view('layouts/searchpage', '', $data);
	    }


		public function userLicense() {
	        $this->lang->load("usermaster", $this->session->userdata('language'));
	        $this->load->model('usermaster');

	        //$data['list_user'] = $this->usermaster->usermaster_all();
	        // var_dump($id);
	        $data['user_company'] = $this->usermaster->getAllUserExpiry();
	        // var_dump($data['user_company']);
	        // exit();
	        // $user_company = $this->usermaster->getUserComp('fldid');
	        $this->layouts->view('admin/userLicense', array('Menu' => 'layouts/menu'), $data, true);
	        //echo '<h3>admin user list</h3>';
	    }


		public function changeDate(){
			$this->load->model('Usermaster');


			$typeOfPackage = $this->input->post('typeOfPackage');
			$numberOfPeriod = $this->input->post('numberOfPeriod');
			$startDate = date("d-m-Y");

			$currDate = strtotime(date('d-m-Y'));
			$endDate = strtotime(date("d-m-Y"));

			if($numberOfPeriod != NULL && $numberOfPeriod > 0){
				if($typeOfPackage == 2){

						$minusby1 = $numberOfPeriod * 12;
						//$startDate = date("Y-m-d");
						$endDate = date("Y-m-d", strtotime('+'.$minusby1.' month'));
						$lastDay = date("Y-m-d", strtotime('-1 day', strtotime($endDate)));

				}
				else{

						$minusby1 = $numberOfPeriod;
						//$startDate = date("Y-m-d");
						$endDate = date("Y-m-d", strtotime('+'.$minusby1.' month'));
						$lastDay = date("Y-m-d", strtotime('-1 day', strtotime($endDate)));

				}
			}
			else{
				$lastDay = date("Y-m-d");
			}

			$datainsert = array(
							'startDt' => date('d-m-Y', strtotime($startDate)),
							'lastDt' => date('d-m-Y', strtotime($lastDay)),
						);


			if($typeOfPackage){
				print json_encode(array("status"=>"success", "message"=>$datainsert));
			}else{
				print json_encode(array("status"=>"failed", "message"=>$this->lang->line('failed')));
			}

		}


		public function changeDate2(){
			$this->load->model('Usermaster');


			$typeOfPackage = $this->input->post('typeOfPackage');
			$numberOfPeriod = $this->input->post('numberOfPeriod');
			$startDate = date("d-m-Y");

			$currDate = strtotime(date('d-m-Y'));

			$expiryID = $this->input->post('expiryID');
			$getDate = $this->Usermaster->usermaster_checkEmailExpiryUserID2($expiryID);

			$lastDate = date("Y-m-d", strtotime($getDate[0]->endDate));
			$lastDate2 = strtotime(date("d-m-Y", strtotime($getDate[0]->endDate)));

			if($numberOfPeriod != NULL && $numberOfPeriod > 0){
				if($currDate > $lastDate2){
					if($typeOfPackage == 2){

							$minusby1 = $numberOfPeriod * 12;
							$startDate = date("Y-m-d");
							$lastDate3 = date("Y-m-d", strtotime('-1 day', strtotime($startDate)));
							$endDate = date("Y-m-d", strtotime('+'.$minusby1.' month', strtotime($lastDate3)));
							$lastDay = date("Y-m-d", strtotime($endDate));

					}
					else{

							$minusby1 = $numberOfPeriod;
							$startDate = date("Y-m-d");
							$lastDate3 = date("Y-m-d", strtotime('-1 day', strtotime($startDate)));
							$endDate = date("Y-m-d", strtotime('+'.$minusby1.' month', strtotime($lastDate3)));
							$lastDay = date("Y-m-d", strtotime($endDate));

					}
				}
				else{
					if($typeOfPackage == 2){

							$minusby1 = $numberOfPeriod * 12;
							//$startDate = date("Y-m-d");
							$endDate = date("Y-m-d", strtotime('+'.$minusby1.' month', strtotime($lastDate)));
							$lastDay = date("Y-m-d", strtotime($endDate));

					}
					else{

							$minusby1 = $numberOfPeriod;
							//$startDate = date("Y-m-d");
							$endDate = date("Y-m-d", strtotime('+'.$minusby1.' month', strtotime($lastDate)));
							$lastDay = date("Y-m-d", strtotime($endDate));

					}

				}
			}
			else{
				$lastDay = date("d-m-Y", strtotime($lastDate));
			}

			$datainsert = array(
							//'startDt' => date('d-m-Y', strtotime($startDate)),
							'lastDt' => date('d-m-Y', strtotime($lastDay)),
						);


			if($typeOfPackage){
				print json_encode(array("status"=>"success", "message"=>$datainsert));
			}else{
				print json_encode(array("status"=>"failed", "message"=>$this->lang->line('failed')));
			}

		}

		public function renewUserLicense() {

			$this->load->model('Usermaster');

	        if ($this->input->post('submit')) {

				$editUserExpiry = array(
							'username' => $this->input->post('userid'),
							'typeOfPackage' => $this->input->post('typeOfPack'),
							'numberOfPeriod' => $this->input->post('numberOfPeriod'),
							'startDate' => date("Y-m-d", strtotime($this->input->post('startDate'))),
							'endDate' => date("Y-m-d", strtotime($this->input->post('endDate'))),
						);

				$edit_userExpiry = $this->Usermaster->userExpiry_edit($editUserExpiry, $this->input->post('expiryID'));

				 if($edit_userExpiry){
					echo '<script>alert("Update Success..");
	             	window.location = "' . base_url() . 'admin/userLicense";
	                </script>';
	             }
				 else{
	             	echo '<script>alert("Update Failed.");
	                history.go(-1);</script>';
	             }

			}
			else{

				$id = isset($_REQUEST['id']) ? $_REQUEST['id'] : "";
	            $this->load->library('layouts');
	            $this->lang->load("usermaster", $this->session->userdata('language'));
	            $this->load->model('Department');
	            $data['deptrec'] = $this->Department->department_all();
	            $this->load->model('Section');
	            $data['secrec'] = $this->Section->section_all();

	            $dataum = $this->Usermaster->usermaster_id($this->uri->segment(3));
	            $dataum1 = $this->Usermaster->getUserComp2($this->uri->segment(3));
	            $data['umaster'] = $dataum[0];

	            // var_dump($data['umaster']);
	            // exit();
				$getLang = $this->Usermaster->getLanguage($dataum[0]->language);
				$data['getLang'] = $getLang[0]->description;

				$data['getCompany'] = $dataum1[0]->companyName;


	            $data['umastercomp'] = $dataum1[0];

	            // var_dump($data['umastercomp']);
	            // exit();
				$data['userMasterID'] = $this->uri->segment(3);
				$dataUserExpiry = $this->Usermaster->userExpiry_id($this->uri->segment(3));
				if($dataUserExpiry){
					$data['userExpiry'] = $dataUserExpiry[0]->numberOfPeriod;
					$data['typeOfPack'] = $dataUserExpiry[0]->typeOfPackage;
					$data['expiryID'] = $dataUserExpiry[0]->ID;
				}
				else{
					$data['userExpiry'] = '';
					$data['typeOfPack'] = 1;
				}

				if($data['userExpiry']){
					$data['startDate'] = date("d-m-Y", strtotime($dataUserExpiry[0]->startDate));
					$data['endDate'] = date("d-m-Y", strtotime($dataUserExpiry[0]->endDate));
				}
				else{
					$data['startDate'] = date("d-m-Y");
					$data['endDate'] = date("d-m-Y");
				}

	            $this->load->model('Company/Company_info_model');
	            $data['companyList'] = $this->Company_info_model->company_all();
	            $this->load->model('Language');
	            $data['language'] = $this->Language->language_all();
	            $this->layouts->add_includes('js/validationengine/languages/jquery.validationEngine-' . $this->session->userdata('language') . '.js')
	                    ->add_includes('js/validationengine/jquery.validationEngine.js');
	            $this->layouts->view('admin/renewUserLicense', array('latest' => 'sidebar/latest'), $data);

			}

		}


	}

?>
