Advertisement
Guest User

PVP_Statistics

a guest
May 26th, 2015
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.65 KB | None | 0 0
  1. <?php
  2.  
  3. class PVP_Statistics extends MX_Controller
  4. {
  5.     function __construct()
  6.     {
  7.         //Call the constructor of MX_Controller
  8.         parent::__construct();
  9.        
  10.         $this->load->model("data_model");
  11.         $this->load->config('pvp_statistics/pvps_config');
  12.     }
  13.    
  14.     public function index($RealmId = false)
  15.     {
  16.         $this->template->setTitle("PVP Statistics");
  17.        
  18.         $user_id = $this->user->getId();
  19.        
  20.         $data = array(
  21.             'user_id'           => $user_id,
  22.             'realms_count'      => count($this->realms),
  23.             'selected_realm'    => $RealmId,
  24.             'url'               => $this->template->page_url,
  25.         );
  26.        
  27.         // Get the realms
  28.         if (count($this->realms) > 0)
  29.         {
  30.             foreach ($this->realms->getRealms() as $realm)
  31.             {
  32.                 //Set the first realm as realmid
  33.                 if (!$RealmId)
  34.                 {
  35.                     $RealmId = $realm->getId();
  36.                     $data['selected_realm'] = $RealmId;
  37.                 }
  38.                    
  39.                 $data['realms'][$realm->getId()] = array('name' => $realm->getName());
  40.             }
  41.         }
  42.        
  43.         //Set the realmid for the data model
  44.         $this->data_model->setRealm($RealmId);
  45.        
  46.         //Get the top teams
  47.         $data['Teams2'] = $this->data_model->getTeams($this->config->item("arena_teams_limit"), 2);
  48.         $data['Teams3'] = $this->data_model->getTeams($this->config->item("arena_teams_limit"), 3);
  49.         $data['Teams5'] = $this->data_model->getTeams($this->config->item("arena_teams_limit"), 5);
  50.        
  51.         //Get Top Honorable Kills Players
  52.         $data['TopHK'] = $this->data_model->getTopHKPlayers($this->config->item("hk_players_limit"));
  53.        
  54.         $output = $this->template->loadPage("pvp_statistics.tpl", $data);
  55.  
  56.         $this->template->box("PVP Statistics", $output, true, "modules/pvp_statistics/css/style.css", "modules/pvp_statistics/js/scripts.js");
  57.     }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement