load->model('insert_model'); $this->load->model('get_model'); $this->load->model('common_model'); $this->load->library('pagination'); $this->load->library('email'); $this->load->config('email'); } public function index() { $this->load->view('pages/index'); } public function login() { $this->load->view('pages/login'); } public function register() { $this->load->view('pages/register'); } // public function time_slot() // { // $this->load->view('pages/time_slots'); // } public function terms() { $this->load->view('pages/terms'); } public function win_games() { $id = $this->uri->segment(3); $where = '(result = "win" AND game_type = 2)'; $win_game = $this->common_model->getAllData($tbl = 'tbl_game_data', $where); $data['win_game'] = $win_game; $config['base_url'] = base_url() . "PageController/win_games"; $config['use_page_numbers'] = TRUE; $config['total_rows'] = $this->get_model->num_row('tbl_game_data'); $config['per_page'] = 3; $config['url_sigment'] = 3; $config['num_links'] = 2; /*start add boostrap class and styles*/ $config['next_link'] = 'Next'; $config['prev_link'] = 'Prev'; $config['first_link'] = false; $config['last_link'] = false; $config['full_tag_open'] = ''; $config['attributes'] = ['class' => 'page-link']; $config['first_tag_open'] = '
  • '; $config['first_tag_close'] = '
  • '; $config['prev_tag_open'] = '
  • '; $config['prev_tag_close'] = '
  • '; $config['next_tag_open'] = '
  • '; $config['next_tag_close'] = '
  • '; $config['last_tag_open'] = '
  • '; $config['last_tag_close'] = '
  • '; $config['cur_tag_open'] = '
  • '; $config['cur_tag_close'] = '(current)
  • '; $config['num_tag_open'] = '
  • '; $config['num_tag_close'] = '
  • '; $limit = $config['per_page']; $page = $this->uri->segment(3); if ($page > 1) { $offset = ($page - 1) * $limit; } else { $offset = $page; } $this->pagination->initialize($config); $data['win_game'] = $this->get_model->list_by_desc_wh($config['per_page'], $offset, 'tbl_game_data', "id", $where); $this->load->view('pages/win_games', $data); } public function lost_games() { $where1 = '(result = "lost")'; $lost_game = $this->common_model->getAllData($tbl = 'tbl_game_data', $where1); $data['lost_game'] = $lost_game; $config['base_url'] = base_url() . "PageController/lost_games"; $config['use_page_numbers'] = TRUE; $config['total_rows'] = $this->get_model->num_row('tbl_game_data'); $config['per_page'] = 3; $config['url_sigment'] = 3; $config['num_links'] = 2; /*start add boostrap class and styles*/ $config['next_link'] = 'Next'; $config['prev_link'] = 'Prev'; $config['first_link'] = false; $config['last_link'] = false; $config['full_tag_open'] = ''; $config['attributes'] = ['class' => 'page-link']; $config['first_tag_open'] = '
  • '; $config['first_tag_close'] = '
  • '; $config['prev_tag_open'] = '
  • '; $config['prev_tag_close'] = '
  • '; $config['next_tag_open'] = '
  • '; $config['next_tag_close'] = '
  • '; $config['last_tag_open'] = '
  • '; $config['last_tag_close'] = '
  • '; $config['cur_tag_open'] = '
  • '; $config['cur_tag_close'] = '(current)
  • '; $config['num_tag_open'] = '
  • '; $config['num_tag_close'] = '
  • '; $limit = $config['per_page']; $page = $this->uri->segment(3); if ($page > 1) { $offset = ($page - 1) * $limit; } else { $offset = $page; } $this->pagination->initialize($config); $data['lost_game'] = $this->get_model->list_by_desc_wh($config['per_page'], $offset, 'tbl_game_data', "id", $where1); $this->load->view('pages/lost_games', $data); } public function drawn_games() { $where2 = '(result = "drawn")'; $drawn_game = $this->common_model->getAllData($tbl = 'tbl_game_data', $where2); $data['drawn_game'] = $drawn_game; $config['base_url'] = base_url() . "PageController/drawn_games"; $config['use_page_numbers'] = TRUE; $config['total_rows'] = $this->get_model->num_row('tbl_game_data'); $config['per_page'] = 3; $config['url_sigment'] = 3; $config['num_links'] = 2; /*start add boostrap class and styles*/ $config['next_link'] = 'Next'; $config['prev_link'] = 'Prev'; $config['first_link'] = false; $config['last_link'] = false; $config['full_tag_open'] = ''; $config['attributes'] = ['class' => 'page-link']; $config['first_tag_open'] = '
  • '; $config['first_tag_close'] = '
  • '; $config['prev_tag_open'] = '
  • '; $config['prev_tag_close'] = '
  • '; $config['next_tag_open'] = '
  • '; $config['next_tag_close'] = '
  • '; $config['last_tag_open'] = '
  • '; $config['last_tag_close'] = '
  • '; $config['cur_tag_open'] = '
  • '; $config['cur_tag_close'] = '(current)
  • '; $config['num_tag_open'] = '
  • '; $config['num_tag_close'] = '
  • '; $limit = $config['per_page']; $page = $this->uri->segment(3); if ($page > 1) { $offset = ($page - 1) * $limit; } else { $offset = $page; } $this->pagination->initialize($config); $data['drawn_game'] = $this->get_model->list_by_desc_wh($config['per_page'], $offset, 'tbl_game_data', "id", $where2); $this->load->view('pages/drawn_games', $data); } // public function withdrawl_request() // { // $this->load->view('pages/withdrawl_request'); // } public function wallet_transaction() { $this->load->view('pages/wallet_transaction'); } public function tournament_participant() { $this->load->view('pages/tournament_participant'); } public function add_country() { $this->load->view('pages/add_country'); } public function user_payment_history() { $this->load->view('pages/user_payment_history'); } public function leaderboard() { $where = '(status = 1) OR (status=0) OR (status= 0.5)'; $leader_data = $this->get_model->get_all1($tbl = 'tbl_game_data', $where); // var_dump($leader_data); $user_arr = array(); $i = 1; foreach ($leader_data as $leader_key => $leader_value) { $user_id = $leader_value['player1_id']; $tbl = 'tbl_game_data'; $where = '(status = 1 AND player1_id = "' . $user_id . '")'; $win_count = $this->get_model->count_rows($tbl, $where); $where = '(status = 0.5) AND (player1_id = "' . $user_id . '")'; $draw_count = $this->get_model->count_rows($tbl, $where); $where = '(status = 0) AND (player1_id = "' . $user_id . '")'; $lost_count = $this->get_model->count_rows($tbl, $where); $win = $win_count; $drawn = $draw_count; $lost = $lost_count; $where1 = '(user_id = "' . $user_id . '")'; $user_data = $this->get_model->get_all($tbl = 'tbl_user', $where1); // var_dump($user_data); foreach ($user_data as $user_key => $user_value) { $country = $user_value['country']; } $where2 = '(id = "' . $country . '")'; $country_data = $this->get_model->get_all($tbl = 'tbl_country', $where2); foreach ($country_data as $c_key => $c_value) { $country = $c_value['country_name']; } $points = $win_count*1+$draw_count*0.5+$lost_count*0; $user_arr[] = array( "sr_no" => $i++, "profile_photo" => $user_value['profile_photo'], "name" => $user_value['name'], "email" => $user_value['email'], "country_name" => $country, "win"=>$win, "drawn" =>$drawn, "lost"=>$lost, "points"=>$points ); } $config['base_url'] = base_url('leaderboard'); $config['use_page_numbers'] = TRUE; $config['total_rows'] = count($user_arr); $config['per_page'] = 10; $config['uri_segment'] = 2; $config['num_links'] = 2; $config['next_link'] = '>'; $config['prev_link'] = '<'; $config['first_link'] = false; $config['last_link'] = false; $config['full_tag_open'] = ''; $config['attributes'] = ['class' => 'page-link']; $config['first_tag_open'] = '
  • '; $config['first_tag_close'] = '
  • '; $config['prev_tag_open'] = '
  • '; $config['prev_tag_close'] = '
  • '; $config['next_tag_open'] = '
  • '; $config['next_tag_close'] = '
  • '; $config['last_tag_open'] = '
  • '; $config['last_tag_close'] = '
  • '; $config['cur_tag_open'] = '
  • '; $config['cur_tag_close'] = '(current)
  • '; $config['num_tag_open'] = '
  • '; $config['num_tag_close'] = '
  • '; $limit = $config['per_page']; $page = $this->uri->segment(2); $this->pagination->initialize($config); if ($page > 1) { $offset = ($page - 1) * $limit; } else { $offset = $page; } $page_data = array_slice($user_arr, $offset, $limit); if (!empty($user_arr)) { $data['user_data'] = $page_data; // var_dump($page_data); } else { $data['user_data'] = array(); } $this->load->view('pages/leaderboard', $data); } public function tournament_history() { $this->load->view('pages/tournament_history'); } public function tournament_user() { $this->load->view('pages/tournament_user'); } public function forgot_password() { $this->load->view('pages/forgot_password'); } public function first_live_tournament() { $this->load->view('pages/first_live_tournament'); } public function second_live_tournament() { $this->load->view('pages/first_live_tournament'); } public function choose_player() { $this->load->view('pages/choose_player'); } public function all_round() { $this->load->view('pages/all_round'); } }