Browse Source

Subgroep info added

master
Rogier Neeleman 9 years ago
parent
commit
7eb7d6b78c
  1. 67
      application/controllers/Info.php
  2. 44
      application/models/Info_model.php
  3. 29
      application/views/info_subgroep.php
  4. 46
      application/views/info_subgroepen.php

67
application/controllers/Info.php

@ -0,0 +1,67 @@ @@ -0,0 +1,67 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Info Class
*/
class Info extends CI_Controller
{
public function __construct()
{
parent::__construct();
if(! $this->session->userdata('validated')){
redirect(base_url('/login'));
}
}
public function index()
{
$data['page'] = 'info';
// Get data
$this->load->model('Info_model');
$subgroepen = $this->Info_model->get_subgroep_list();
// Prepare data
$data['subgroepen'] = array();
foreach ($subgroepen as $subgroep)
{
$data['subgroepen'][$subgroep['id']] = $subgroep['nummer'].': '.$subgroep['themanaam'];
}
// Header
$this->load->view('header', $data);
// login page
$this->load->view('info_subgroepen', $data);
// Footer
$this->load->view('footer');
}
public function subgroep()
{
$data['page'] = 'info';
$subgroepid = $this->security->xss_clean($this->input->post('subgroepid'));
// Get data
$this->load->model('Info_model');
$data['subgroepinfo'] = $this->Info_model->get_subgroep_info($subgroepid);
// Header
$this->load->view('header', $data);
//echo "<pre>";
//print_r($data);
//echo "<pre>";
// login page
$this->load->view('info_subgroep', $data);
// Footer
$this->load->view('footer');
}
}

44
application/models/Info_model.php

@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Regio model
*/
class Info_model extends CI_Model
{
public function __construct()
{
parent::__construct();
}
public function get_subgroep_list()
{
$this->db->select('id, naam, themanaam, nummer');
$this->db->from('subgroep');
$this->db->where('regioid', $this->session->regio);
$this->db->where('jaar', date('Y'));
$this->db->order_by('nummer', 'ASC');
$query = $this->db->get();
return $query->result_array();
}
public function get_subgroep_info($id)
{
$this->db->select('subgroep.naam AS naam, themanaam, nummer, groep.naam AS groepsnaam, groep.plaats');
$this->db->from('subgroep');
$this->db->where('subgroep.regioid', $this->session->regio);
$this->db->where('jaar', date('Y'));
$this->db->where('subgroep.id', $id);
$this->db->join('groep', 'subgroep.groepid=groep.id');
$this->db->order_by('nummer', 'ASC');
$query = $this->db->get();
return $query->row();
}
}

29
application/views/info_subgroep.php

@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
<div class="container">
<hr>
<div class="row">
<div class="col-md-4 col-md-offset-4">
<table class="table table-condensed ">
<tr>
<td class="text-right"><b>Nummer</b></td>
<td><?php echo $subgroepinfo->nummer; ?></td>
</tr>
<tr>
<td class="text-right"><b>Themanaam</b></td>
<td><?php echo $subgroepinfo->themanaam; ?></td>
</tr>
<tr>
<td class="text-right"><b>Naam</b></td>
<td><?php echo $subgroepinfo->naam; ?></td>
</tr>
<tr>
<td class="text-right"><b>Groepsnaam</b></td>
<td><?php echo $subgroepinfo->groepsnaam; ?></td>
</tr>
<tr>
<td class="text-right"><b>Plaats</b></td>
<td><?php echo $subgroepinfo->plaats; ?></td>
</tr>
</table>
</div>
</div
</div>

46
application/views/info_subgroepen.php

@ -0,0 +1,46 @@ @@ -0,0 +1,46 @@
<div class="container">
<hr>
<?php if (count($subgroepen) != 0) { ?>
<?php echo form_open(base_url().'info/subgroep'); ?>
<p>
<div class="row">
<div class="text-center">
<?php echo form_dropdown('subgroepid', $subgroepen); ?>
</div>
</div>
</p>
<p>
<div class="row">
<div class="text-center">
<button type="submit" class="btn btn-primary btn-lg">Geef info</button>
</div>
</div>
</p>
<?php echo form_close(); ?>
<?php } else { ?>
<p>
<div class="row">
<div class="text-center">
Er zijn geen groepen te vinden.
</div>
</div>
</p>
<p>
<div class="row">
<div class="text-center">
<button type="button" class="btn btn-error btn-lg" disabled="disabled">
<span class="glyphicon glyphicon-ok"></span>
</button>
</div>
</div>
</p>
<?php } ?>
</div>
Loading…
Cancel
Save