Browse Source

Ranking

master
Rogier Neeleman 8 years ago
parent
commit
71c1476f89
  1. 20
      application/controllers/Uitslag.php
  2. 2
      application/views/footer.php
  3. 2
      application/views/uitslag_ranking.php

20
application/controllers/Uitslag.php

@ -52,14 +52,28 @@ class Uitslag extends CI_Controller
foreach ($scores as $score) { foreach ($scores as $score) {
$scoremaxsg = $this->Uitslag_model->get_max_punten_detail($score['spelgebiedid']); $scoremaxsg = $this->Uitslag_model->get_max_punten_detail($score['spelgebiedid']);
$scoreitem = ($score['score']/$scoremaxsg['maxscore']) * $totaalpsg * $scoremaxsg['gewicht']; $scoreitem = ($score['score']/$scoremaxsg['maxscore']) * $totaalpsg * $scoremaxsg['gewicht'];
$data['uitslag'][$subgroep['id']][$score['spelgebiedid']] = $scoreitem; $uitslagr[$subgroep['id']][$score['spelgebiedid']] = $scoreitem;
$data['uitslag'][$subgroep['id']]['total'] = $data['uitslag'][$subgroep['id']]['total'] + $scoreitem; $uitslagr[$subgroep['id']]['total'] = $data['uitslag'][$subgroep['id']]['total'] + $scoreitem;
} }
} }
$uitslagorder = array();
foreach ($uitslagr as $key=>$val) {
$uitslagorder[$key] = $val['total'];
}
arsort($uitslagorder);
$i = 1;
foreach ($uitslagorder as $key=>$val) {
$uitslag[$key] = $uitslagr[$key];
$uitslag[$key]['rang'] = $i;
$i++;
}
// Prepare data // Prepare data
$data['subgroepen'] = $subgroepen; $data['subgroepen'] = $subgroepen;
$data['spelgebieden'] = $spelgebieden; $data['spelgebieden'] = $spelgebieden;
$data['uitslag'] = $uitslag;
// Header // Header
$this->load->view('header', $data); $this->load->view('header', $data);
@ -112,5 +126,5 @@ class Uitslag extends CI_Controller
// Footer // Footer
$this->load->view('footer'); $this->load->view('footer');
} }
} }

2
application/views/footer.php

@ -19,7 +19,7 @@
$(document).ready(function() { $(document).ready(function() {
$('#maintable').dataTable( { $('#maintable').dataTable( {
"paging": false, "paging": false,
"order": [[ 0, "asc" ]], "order": [[ 1, "asc" ]],
"info": false "info": false
} ); } );
} ); } );

2
application/views/uitslag_ranking.php

@ -6,6 +6,7 @@
<thead> <thead>
<tr> <tr>
<th>#</th> <th>#</th>
<th>Nr</th>
<th>Themanaam</th> <th>Themanaam</th>
<th>Groep</th> <th>Groep</th>
<?php foreach ($spelgebieden as $spelgebied) { <?php foreach ($spelgebieden as $spelgebied) {
@ -17,6 +18,7 @@
<tbody> <tbody>
<?php foreach ($subgroepen as $subgroep) { ?> <?php foreach ($subgroepen as $subgroep) { ?>
<tr> <tr>
<td><?php echo $uitslag[$subgroep['id']]['rang']?></td>
<td><?php echo $subgroep['nummer']?></td> <td><?php echo $subgroep['nummer']?></td>
<td><a href="<?php echo base_url('/uitslag/groep/'.$subgroep['id']); ?>"><?php echo $subgroep['themanaam']?></a></td> <td><a href="<?php echo base_url('/uitslag/groep/'.$subgroep['id']); ?>"><?php echo $subgroep['themanaam']?></a></td>
<td><?php echo $subgroep['groepsnaam']?></td> <td><?php echo $subgroep['groepsnaam']?></td>

Loading…
Cancel
Save