|
|
|
<?php
|
|
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Info Class
|
|
|
|
*/
|
|
|
|
class Uitslag extends CI_Controller
|
|
|
|
{
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
if(! $this->session->userdata('validated')){
|
|
|
|
redirect(base_url('/login'));
|
|
|
|
}
|
|
|
|
if (! ($this->session->admin == '1' OR $this->session->superadmin == '1')) {
|
|
|
|
redirect(base_url('/dashboard'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function index()
|
|
|
|
{
|
|
|
|
$data['page'] = 'uitslag';
|
|
|
|
|
|
|
|
// Get data
|
|
|
|
$this->load->model('Uitslag_model');
|
|
|
|
$subgroepen = $this->Uitslag_model->get_subgroep_list();
|
|
|
|
$spelgebieden = $this->Uitslag_model->get_spelgebieden_list();
|
|
|
|
$maxpuntenraw = $this->Uitslag_model->get_max_punten();
|
|
|
|
|
|
|
|
foreach ($maxpuntenraw as $max) {
|
|
|
|
$maxpunten[$max['spelgebiedid']]['maxscore'] = $max['maxscore'];
|
|
|
|
$maxpunten[$max['spelgebiedid']]['naam'] = $max['naam'];
|
|
|
|
$maxpunten[$max['spelgebiedid']]['gewicht'] = $max['gewicht'];
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($subgroepen as $subgroep) {
|
|
|
|
$data['uitslag'][$subgroep['id']]['total'] = 0;
|
|
|
|
$scores = $this->Uitslag_model->get_subgroep_punten($subgroep['id']);
|
|
|
|
|
|
|
|
foreach ($scores as $score) {
|
|
|
|
$scoreitem = (($score['score']/$maxpunten[$score['spelgebiedid']]['maxscore'])*100)*$maxpunten[$score['spelgebiedid']]['gewicht'];
|
|
|
|
$data['uitslag'][$subgroep['id']][$score['spelgebiedid']] = $scoreitem;
|
|
|
|
$data['uitslag'][$subgroep['id']]['total'] = $data['uitslag'][$subgroep['id']]['total'] + $scoreitem;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Prepare data
|
|
|
|
$data['subgroepen'] = $subgroepen;
|
|
|
|
$data['spelgebieden'] = $spelgebieden;
|
|
|
|
|
|
|
|
// Header
|
|
|
|
$this->load->view('header', $data);
|
|
|
|
|
|
|
|
// Ranking page
|
|
|
|
$this->load->view('uitslag_ranking', $data);
|
|
|
|
|
|
|
|
// Footer
|
|
|
|
$this->load->view('footer');
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|