Files
monpas/application/models/monpas/Aantalxondersteuningsvorm_model.php
T

67 lines
2.2 KiB
PHP

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/** Aantalxondersteuningsvorm_model mei 2015 */
class Aantalxondersteuningsvorm_model extends MY_Model{
protected $tablename = 'tb_aantalxondersteuningsvorm';
function __construct(){
parent::__construct();
$models = array('');
$this->load->model($models);
}
function getaantal($groepid, $ondersteuningsvorm){
$this->sql = " SELECT aantal
FROM tb_aantalxondersteuningsvorm
WHERE groep_id = {$groepid}
AND ondersteuningsvorm_id = {$ondersteuningsvorm}";
return $this->get_query_row();
}
function getdetails($groepid, $ondersteuningsvorm){
$this->sql = " SELECT *
FROM tb_aantalxondersteuningsvorm
WHERE groep_id = {$groepid}
AND ondersteuningsvorm_id = {$ondersteuningsvorm}";
return $this->get_query_row();
}
function aantalGebruikt($orgid, $groepid, $ondersteuningsvorm){
$this->sql = " SELECT SUM(aantal) AS aantal
FROM tb_aantalxondersteuningsvorm
WHERE organisatie_id = {$orgid}
AND ondersteuningsvorm_id = {$ondersteuningsvorm}
AND groep_id <> {$groepid}";
return $this->get_query_row('aantal');
}
function getaantallen($vormid, $orgid, $schooljaarnr, $groepsids){
$this->sql ="SELECT G.id, G.naam, IF(AOS.id,aantal,0) AS aantal
FROM tb_groepen G
LEFT JOIN tb_aantalxondersteuningsvorm AOS ON ( G.id = AOS.groep_id
AND AOS.ondersteuningsvorm_id = {$vormid})
WHERE G.organisatie_id = {$orgid}
AND G.schooljaarnr = {$schooljaarnr}
AND G.id IN ({$groepsids})
ORDER BY G.niveau, G.naam, G.id";
return $this->get_query_result();
}
function getgroepenmetlln($orgid,$schooljaarnr, $minnivo, $maxnivo){
$this->sql ="SELECT G.id
FROM tb_groepen G
JOIN tb_aantalxondersteuningsvorm AOS ON G.id = AOS.groep_id
JOIN tb_ondersteuningsvormen OV ON OV.id = AOS.ondersteuningsvorm_id
WHERE G.organisatie_id = {$orgid}
AND G.schooljaarnr= {$schooljaarnr}
AND OV.nivo BETWEEN {$minnivo} AND {$maxnivo}
GROUP BY G.id
";
return $this->get_query_result();
}
}