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

class Profile extends Admin_Controller {
	public function __construct () {
		parent::__construct ();
		
		$this->load->model ( 'admin/dashboard_model', 'dashboard_model' );
		$this->load->library ( 'pagination' );
		$this->load->library ( 'functions' );
	}
	
    //  Smart object / Devices listing
	public function index () {
	    	
// 	 $params = $this->input->get ();
// 		$arg = array ();
// 		$users = array ();
		
// 		if( isset ( $params ) ) {
// 			$arg = $params;
// 		}
		
// 		if( isset( $params['show_records'] ) && $params['show_records'] > 0 ) {
// 			$per_page_record = $params['show_records'];
// 		} else {
// 			$per_page_record = 10;
// 		}
		
// 		$page = ( $this->uri->segment ( 4 ) ) ? $this->uri->segment ( 4 ) : 0;
		
// 		if( $page > 0 ) {
// 			$page = ( $page - 1 ) * $per_page_record;
// 		}
	
// 		$count = $this->dashboard_model->get_users ( array ( 'count' => true ) + $arg );
	
// 		$url = base_url ( 'admin/user_management/index' );

// 		$config = $this->functions->pagination_config ( $url, $count, $per_page_record );
// 		$config['use_page_numbers'] = TRUE;		
// 		$this->pagination->initialize ( $config );
	
// 		$arg['limit'] =  $per_page_record;
// 		$arg['offset'] =  $page;
	
// 		$users = $this->dashboard_model->get_users ( $arg );
		
// 		if ( ! empty ( $users ) ) {
// 		    foreach ( $users as $k => $user ) {
// 		        $subscription = $this->functions->get_subscription ( $user['id'] );
// 		        if ( ! empty ( $subscription ) ) {
// 		            $users[$k]['plan'] = $subscription['package_name'];
// 		        } else {
// 		            $users[$k]['plan'] = 'free';
// 		        }
		        
// 		    }
// 		}
		
// 		$data['offset']  = $page;
// 		$data['per_page_limit']  = $page + $per_page_record;
// 		$data['total_users']  = $count;    	
	    	
	    	
	    	
	    $data['teams']=$this->dashboard_model->get_teams();
		$data['view']   = 'admin/profile/index';
		
		$this->load->view ( 'admin/layout', $data );
	}

	public function details ($id) {
	
	    $data['team']=$this->dashboard_model->get_team($id);
	    $data['members']=$this->dashboard_model->get_team_members($id);
		$data['view']   = 'admin/profile/details';
		$this->load->view ( 'admin/layout', $data );
	}

}
?>