initial commit
This commit is contained in:
@@ -0,0 +1,143 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Groepen_model mei 2015 */
|
||||
|
||||
class Groepen_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_groepen';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
function getgroep($groepid){
|
||||
$this->sql = "SELECT GR.id,
|
||||
GR.naam,
|
||||
GR.totaantal,
|
||||
SUM(IF( nivo = 2, AX.aantal, 0)) AS som2,
|
||||
SUM(IF( nivo = 3, AX.aantal, 0)) AS som3,
|
||||
SUM(IF( nivo = 4, AX.aantal, 0)) AS som4,
|
||||
(totaantal - SUM(AX.aantal) ) AS som1
|
||||
FROM tb_groepen GR
|
||||
LEFT JOIN tb_aantalxondersteuningsvorm AX
|
||||
ON GR.id = AX.groep_id
|
||||
LEFT JOIN tb_ondersteuningsvormen OV
|
||||
ON OV.id = AX.ondersteuningsvorm_id
|
||||
WHERE GR.id = {$groepid}
|
||||
GROUP BY GR.id";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
function getgroepenlist($orgid, $schooljaarnr, $module){
|
||||
$this->sql = "SELECT id, naam
|
||||
FROM tb_groepen
|
||||
WHERE organisatie_id ={$orgid}
|
||||
AND schooljaarnr = {$schooljaarnr}
|
||||
AND module = {$module}
|
||||
ORDER BY niveau, naam, id";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function get_AantalGroepen($schooljaarnr, $orgid, $module){
|
||||
$this->sql = " SELECT COUNT(id) as aantal
|
||||
FROM tb_groepen
|
||||
WHERE organisatie_id = {$orgid}
|
||||
AND schooljaarnr = {$schooljaarnr}
|
||||
AND module = {$module}";
|
||||
return $this->get_query_row('aantal');
|
||||
}
|
||||
|
||||
function getversiesmetleerlingen($orgid, $schooljaarnr, $schooltype, $module){
|
||||
$this->sql="SELECT SUM(totaantal) AS llnschool
|
||||
FROM tb_groepen
|
||||
WHERE organisatie_id ={$orgid}
|
||||
AND schooljaarnr = {$schooljaarnr}
|
||||
AND schooltype = '{$schooltype}'
|
||||
AND module = {$module} ";
|
||||
return $this->get_query_row('llnschool');
|
||||
|
||||
}
|
||||
|
||||
|
||||
function getgroepen($orgid, $schooljaarnr, $module){
|
||||
$this->sql = "SELECT GR.id,
|
||||
GR.naam,
|
||||
GR.niveau,
|
||||
GR.totaantal,
|
||||
|
||||
SUM(IF( nivo = 2, AX.aantal, 0)) AS som2,
|
||||
SUM(IF( nivo = 3, AX.aantal, 0)) AS som3,
|
||||
SUM(IF( nivo = 4, AX.aantal, 0)) AS som4,
|
||||
(GR.totaantal - IF(SUM(AX.aantal) , SUM(AX.aantal),0) ) AS som1
|
||||
FROM tb_groepen GR
|
||||
LEFT JOIN tb_aantalxondersteuningsvorm AX
|
||||
ON GR.id = AX.groep_id
|
||||
LEFT JOIN tb_ondersteuningsvormen OV
|
||||
ON OV.id = AX.ondersteuningsvorm_id
|
||||
WHERE GR.organisatie_id = {$orgid}
|
||||
AND GR.schooljaarnr = {$schooljaarnr}
|
||||
AND GR.schooltype = 'R'
|
||||
AND GR.module = {$module}
|
||||
GROUP BY GR.id
|
||||
ORDER BY niveau, naam, GR.id ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getgekopieerdegroepen($orgid, $schooljaarnr, $module){
|
||||
$this->sql = "SELECT GR.id,
|
||||
GR.naam,
|
||||
GR.niveau,
|
||||
GR.totaantal,
|
||||
|
||||
SUM(IF( nivo = 2, AX.aantal, 0)) AS som2,
|
||||
SUM(IF( nivo = 3, AX.aantal, 0)) AS som3,
|
||||
SUM(IF( nivo = 4, AX.aantal, 0)) AS som4,
|
||||
(GR.totaantal - IF(SUM(AX.aantal) , SUM(AX.aantal),0) ) AS som1
|
||||
FROM tb_groepen GR
|
||||
LEFT JOIN tb_aantalxondersteuningsvorm AX
|
||||
ON GR.id = AX.groep_id
|
||||
LEFT JOIN tb_ondersteuningsvormen OV
|
||||
ON OV.id = AX.ondersteuningsvorm_id
|
||||
WHERE GR.organisatie_id = {$orgid}
|
||||
AND GR.schooljaarnr = {$schooljaarnr}
|
||||
AND GR.schooltype = 'R'
|
||||
AND GR.module = {$module}
|
||||
GROUP BY GR.id
|
||||
ORDER BY niveau, naam, GR.id ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getGroepenSboSo($orgid, $schooljaarnr){
|
||||
$this->sql = "SELECT GR.id,
|
||||
GR.naam,
|
||||
GR.niveau,
|
||||
GR.totaantal,
|
||||
GR.ondersteuning,
|
||||
SUM(IF( nivo = 5, AX.aantal, 0)) AS som5,
|
||||
SUM(IF( nivo = 6, AX.aantal, 0)) AS som6,
|
||||
SUM(IF( nivo = 7, AX.aantal, 0)) AS som7,
|
||||
SUM(IF( nivo = 8, AX.aantal, 0)) AS som8
|
||||
FROM tb_groepen GR
|
||||
LEFT JOIN tb_aantalxondersteuningsvorm AX
|
||||
ON GR.id = AX.groep_id
|
||||
LEFT JOIN tb_ondersteuningsvormen OV
|
||||
ON OV.id = AX.ondersteuningsvorm_id
|
||||
WHERE GR.organisatie_id = {$orgid}
|
||||
AND GR.schooljaarnr = {$schooljaarnr}
|
||||
AND GR.schooltype = 'SBO'
|
||||
GROUP BY GR.id
|
||||
ORDER BY GR.niveau, GR.naam, GR.id";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
|
||||
function getgroepdetails($groepid){
|
||||
$this->sql=" SELECT id,naam,organisatie_id as orgid,schooljaarnr AS schooljaar,
|
||||
niveau,totaantal,notitie
|
||||
FROM tb_groepen G
|
||||
WHERE G.id = {$groepid}";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user