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 @@ -52,14 +52,28 @@ class Uitslag extends CI_Controller
foreach ($scores as $score) {
$scoremaxsg = $this->Uitslag_model->get_max_punten_detail($score['spelgebiedid']);
$scoreitem = ($score['score']/$scoremaxsg['maxscore']) * $totaalpsg * $scoremaxsg['gewicht'];
$data['uitslag'][$subgroep['id']][$score['spelgebiedid']] = $scoreitem;
$data['uitslag'][$subgroep['id']]['total'] = $data['uitslag'][$subgroep['id']]['total'] + $scoreitem;
$uitslagr[$subgroep['id']][$score['spelgebiedid']] = $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
$data['subgroepen'] = $subgroepen;
$data['spelgebieden'] = $spelgebieden;
$data['uitslag'] = $uitslag;
// Header
$this->load->view('header', $data);
@ -112,5 +126,5 @@ class Uitslag extends CI_Controller @@ -112,5 +126,5 @@ class Uitslag extends CI_Controller
// Footer
$this->load->view('footer');
}
}

2
application/views/footer.php

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

2
application/views/uitslag_ranking.php

@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
<thead>
<tr>
<th>#</th>
<th>Nr</th>
<th>Themanaam</th>
<th>Groep</th>
<?php foreach ($spelgebieden as $spelgebied) {
@ -17,6 +18,7 @@ @@ -17,6 +18,7 @@
<tbody>
<?php foreach ($subgroepen as $subgroep) { ?>
<tr>
<td><?php echo $uitslag[$subgroep['id']]['rang']?></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><?php echo $subgroep['groepsnaam']?></td>

Loading…
Cancel
Save