initial commit
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
<?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 getaantallen($vormid, $orgid,$schooljaarnr, $groepids){
|
||||
$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 ({$groepids})
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Ambities_model januari 2015 */
|
||||
|
||||
class Ambities_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_ambities';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('monpas/Ijkpunten_model');
|
||||
$this->load->model($models);
|
||||
}
|
||||
function getambities( $orgid){
|
||||
$this->sql="SELECT A.id, gem_score AS gemscore, x_ijkpunten AS xijkpunten , z_procent AS zprocent,
|
||||
orgversie_id, A.organisatie_id, OV.geldigvanaf, OV.geldigtm, OV.periodenummer, OV.actief,
|
||||
V.naam
|
||||
FROM tb_ambities A
|
||||
JOIN tb_orgversies OV ON OV.id = orgversie_id
|
||||
JOIN tb_versies V ON V.id = OV.versie_id
|
||||
WHERE A.organisatie_id = {$orgid}";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
function getambitie2($orgversieid, $orgid){
|
||||
$this->sql="SELECT A.id, gem_score AS gemscore, x_ijkpunten AS xijkpunten , z_procent AS zprocent,
|
||||
orgversie_id, OV.geldigvanaf, OV.geldigtm, OV.periodenummer, OV.actief,
|
||||
V.naam
|
||||
FROM tb_ambities A
|
||||
JOIN tb_orgversies OV ON OV.id = A.orgversie_id
|
||||
JOIN tb_versies V ON V.id = OV.versie_id
|
||||
WHERE A.organisatie_id = {$orgid}
|
||||
AND A.orgversie_id = {$orgversieid}";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
function getambitie($orgversieid, $orgid){
|
||||
$this->sql="SELECT A.id, gem_score AS gemscore, x_ijkpunten AS xijkpunten , z_procent AS zprocent
|
||||
FROM tb_ambities A
|
||||
WHERE A.organisatie_id = {$orgid}
|
||||
AND A.orgversie_id = {$orgversieid}";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
function getdefault($aantalY){
|
||||
// $result = array('id' => null, 'gemscore'=>80, 'xijkpunten'=>9, 'zprocent'=>60);
|
||||
$result = new stdClass;
|
||||
$result->id = 'null';
|
||||
$result->gemscore = 80;
|
||||
$minijkpunten = $aantalY * 0.8;
|
||||
$result->xijkpunten = round($minijkpunten);
|
||||
$result->zprocent= 60;
|
||||
return $result;
|
||||
}
|
||||
function getdefault2($orgversieid ){
|
||||
$this->sql = "SELECT 0 AS id , 80 AS gemscore, 9 AS xijkpunten , 60 AS zprocent,
|
||||
OV.id AS orgversie_id,
|
||||
OV.geldigvanaf, OV.geldigtm, OV.periodenummer, OV.actief,
|
||||
V.naam
|
||||
FROM tb_orgversies OV
|
||||
JOIN tb_versies V ON V.id = OV.versie_id
|
||||
WHERE OV.id = {$orgversieid}";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
function getOrgAmbities($orgversieid, $targetorgid){
|
||||
$bgid = null;
|
||||
$kamerid = null;
|
||||
$swvid = null;
|
||||
$organisatie = $this->Organisaties_model->get_record_by_id($targetorgid);
|
||||
$soort = $organisatie->soort;
|
||||
if ($soort ==4){
|
||||
$bgid = $organisatie->valtonder_id;
|
||||
$organisatie = $this->Organisaties_model->get_record_by_id($bgid);
|
||||
$kamerid = $organisatie->valtonder_id;
|
||||
$organisatie = $this->Organisaties_model->get_record_by_id($kamerid);
|
||||
$swvid = $organisatie->valtonder_id;}
|
||||
if ($soort== 3){
|
||||
$bgid = $organisatie->id;
|
||||
$kamerid = $organisatie->valtonder_id;
|
||||
$organisatie = $this->Organisaties_model->get_record_by_id($kamerid);
|
||||
$swvid = $organisatie->valtonder_id;
|
||||
}
|
||||
if ($soort ==2){
|
||||
$kamerid = $organisatie->id;
|
||||
$swvid = $organisatie->valtonder_id;
|
||||
}
|
||||
if ($soort ==1){
|
||||
$swvid = $organisatie->id;
|
||||
}
|
||||
$ambitie = null;
|
||||
if ($bgid){ $ambitie = $this->getambitie($orgversieid, $bgid);
|
||||
}
|
||||
if (!$ambitie && $kamerid){ $ambitie = $this->getambitie($orgversieid, $kamerid);}
|
||||
if (!$ambitie && $swvid){$ambitie = $this->getambitie($orgversieid, $swvid);}
|
||||
|
||||
if (!$ambitie){
|
||||
$aantalY = $this->Ijkpunten_model->telijkpunten($orgversieid);
|
||||
$ambitie =$this->getdefault($aantalY);
|
||||
};
|
||||
return $ambitie;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**Antwoordopties_model april 2021 */
|
||||
|
||||
class Antwoordopties_model extends MY_Model{
|
||||
|
||||
protected $tablename = 'tb_antwoordopties';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
|
||||
function getopties($id){
|
||||
$this->sql="SELECT id, optie, omschrijving
|
||||
FROM tb_antwoordopties
|
||||
WHERE type_nr = {$id} ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getAntwoordopties($scoretype){
|
||||
$this->sql="SELECT id, optie, omschrijving, score_value, type_nr
|
||||
FROM tb_antwoordopties
|
||||
WHERE type_nr = {$scoretype} ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**Antwoordtypes_model september 2015 */
|
||||
|
||||
class Antwoordtypes_model extends MY_Model{
|
||||
|
||||
protected $tablename = 'tb_antwoordtypes';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
function getalltypes(){
|
||||
$this->sql="SELECT AT.sysnr, AT.omschrijving,
|
||||
CASE WHEN count(AO.optie) = count(AO.omschrijving) AND count(AO.omschrijving) > 0 THEN
|
||||
1
|
||||
ELSE 0
|
||||
END AS scoretekst
|
||||
FROM tb_antwoordtypes AT
|
||||
LEFT JOIN tb_antwoordopties AO ON AT.sysnr = AO.type_nr
|
||||
GROUP BY AT.id ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
function gettype($id){
|
||||
$this->sql="SELECT omschrijving
|
||||
FROM tb_antwoordtypes
|
||||
WHERE id = {$id} ";
|
||||
return $this->get_query_row('omschrijving');
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Arrangementen_model juli 2019 */
|
||||
|
||||
class arrangementen_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_arrangementen';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array();
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
function getAantallen($orgid, $schooljaar, $id){
|
||||
$this->sql = "SELECT APA.aantal as aantal, APA.archief
|
||||
FROM tb_arrangementen A
|
||||
JOIN tb_arrangementen_piv_aantal APA ON A.id = APA.arrangement_id
|
||||
JOIN tb_schooljaren S ON S.schooljaarnr = APA.schooljaarnr
|
||||
WHERE A.organisatie_id = {$orgid}
|
||||
AND APA.schooljaarnr = {$schooljaar}
|
||||
AND A.id = {$id}";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
|
||||
function getArrangementen($orgid, $schooljaarnr){
|
||||
$this->sql = "SELECT A.id, A.naam, A.lengte, A.leeftijd
|
||||
FROM tb_arrangementen A
|
||||
WHERE A.organisatie_id = {$orgid}
|
||||
AND A.schooljaarnr <= {$schooljaarnr}
|
||||
ORDER BY A.naam, A.id ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getArrangementenMetAantallen($orgid, $schooljaarnr){
|
||||
$this->sql = "SELECT ARR.id, ARR.naam, ARR.lengte, ARR.leeftijd, APA.aantal, APA.archief
|
||||
FROM tb_arrangementen ARR
|
||||
JOIN tb_arrangementen_piv_aantal APA ON ARR.id = APA.arrangement_id
|
||||
JOIN tb_aantalleerlingen A ON ARR.organisatie_id = A.organisatie_id
|
||||
WHERE A.organisatie_id = {$orgid}
|
||||
AND APA.schooljaarnr = {$schooljaarnr}
|
||||
AND A.schooljaarnr = {$schooljaarnr}
|
||||
AND APA.archief = 'F'
|
||||
ORDER BY ARR.naam ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getArrangementenMetAantallenSop($orgid, $schooljaarnr){
|
||||
$this->sql = "SELECT ARR.id, ARR.naam, ARR.lengte, ARR.leeftijd, APA.aantal, APA.archief
|
||||
FROM tb_arrangementen ARR
|
||||
JOIN tb_arrangementen_piv_aantal APA ON ARR.id = APA.arrangement_id
|
||||
JOIN tb_aantalleerlingen A ON ARR.organisatie_id = A.organisatie_id
|
||||
WHERE A.organisatie_id = {$orgid}
|
||||
AND APA.schooljaarnr = {$schooljaarnr}
|
||||
AND A.schooljaarnr = {$schooljaarnr}
|
||||
ORDER BY APA.aantal DESC ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
|
||||
function getArrangementnamenSop($schooljaarnrs, $orgid)
|
||||
{
|
||||
$this->sql = "SELECT DISTINCT(ARR.id), ARR.naam
|
||||
FROM tb_arrangementen_piv_aantal APA
|
||||
JOIN tb_arrangementen ARR ON APA.arrangement_id = ARR.id
|
||||
JOIN tb_aantalleerlingen A ON ARR.organisatie_id = A.organisatie_id
|
||||
WHERE APA.schooljaarnr IN ({$schooljaarnrs})
|
||||
AND ARR.organisatie_id = {$orgid}
|
||||
AND A.schooljaarnr IN ({$schooljaarnrs})
|
||||
AND A.meetellen = 'T'
|
||||
AND APA.archief = 'F'
|
||||
|
||||
|
||||
";
|
||||
|
||||
return $this->get_query_result();
|
||||
|
||||
}
|
||||
function getArrangement($id, $schooljaarnr){
|
||||
$this->sql = "SELECT A.id, A.naam, A.lengte, A.leeftijd, APA.aantal as aantal, APA.archief
|
||||
FROM tb_arrangementen A
|
||||
JOIN tb_arrangementen_piv_aantal APA ON A.id = APA.arrangement_id
|
||||
WHERE A.id = {$id}
|
||||
AND APA.schooljaarnr = {$schooljaarnr} ";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
|
||||
function getAantalLeerlingenMetArrangement($schooljaarnr, $orgids){
|
||||
$this->sql= "SELECT SUM(APA.aantal) as aantal
|
||||
FROM tb_arrangementen_piv_aantal APA
|
||||
JOIN tb_arrangementen ARR ON APA.arrangement_id = ARR.id
|
||||
JOIN tb_aantalleerlingen A ON ARR.organisatie_id = A.organisatie_id
|
||||
WHERE APA.schooljaarnr = {$schooljaarnr}
|
||||
AND ARR.organisatie_id IN ({$orgids})
|
||||
AND A.schooljaarnr = {$schooljaarnr}
|
||||
AND A.meetellen = 'T'
|
||||
GROUP BY APA.schooljaarnr ";
|
||||
|
||||
return $this->get_query_row('aantal');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Arrangementen_piv_aantal_model sept 2019 */
|
||||
|
||||
class arrangementen_piv_aantal_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_arrangementen_piv_aantal';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array();
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
|
||||
function getAantallen($arrangementid){
|
||||
$this->sql = "SELECT SUM(A.aantal) as totaal
|
||||
FROM tb_arrangementen_piv_aantal A
|
||||
WHERE A.arrangement_id = {$arrangementid} ";
|
||||
return $this->get_query_row('totaal');
|
||||
}
|
||||
|
||||
function getAantallenPerSchooljaar($arrangementid){
|
||||
$this->sql = "SELECT SUM(A.aantal) as subtotaal, naam
|
||||
FROM tb_arrangementen_piv_aantal A
|
||||
JOIN tb_schooljaren S ON A.schooljaarnr = S.id
|
||||
WHERE A.arrangement_id = {$arrangementid}
|
||||
AND A.aantal > 0
|
||||
GROUP BY A.schooljaarnr ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Berichten_model december 2017 */
|
||||
|
||||
class Berichten_model extends MY_Model{
|
||||
|
||||
protected $tablename = 'tb_berichten';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
function getberichten($userid, $frontpage=FALSE){
|
||||
|
||||
$this->sql =" SELECT B.id, B.samenvatting, B.inhoud, B.startdatum
|
||||
FROM tb_berichten B
|
||||
JOIN tb_modulebericht MB ON B.id = MB.bericht_id
|
||||
JOIN tb_licenties L ON MB.modulenr = L.modulenr
|
||||
JOIN tb_organisaties O ON L.orgid = O.id
|
||||
JOIN tb_orgusers OU ON O.id = OU.organisatie_id
|
||||
WHERE OU.user_id = {$userid}
|
||||
AND samenvatting IS NOT NULL
|
||||
AND inhoud IS NOT NULL ";
|
||||
if($frontpage){
|
||||
$this->sql.="AND B.id NOT IN(SELECT bericht_id
|
||||
FROM tb_getoondeberichten
|
||||
WHERE user_id = {$userid}) ";
|
||||
}
|
||||
$this->sql.="GROUP BY B.id
|
||||
ORDER BY B.startdatum DESC ";
|
||||
|
||||
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getalleberichten(){
|
||||
$this->sql ="SELECT id, samenvatting, inhoud, startdatum
|
||||
FROM tb_berichten
|
||||
ORDER BY if( samenvatting IS NULL, 0,1 ),
|
||||
if( inhoud IS NULL, 0, 1 ),
|
||||
startdatum DESC";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getberichtmodules($clusterid, $berichtid){
|
||||
$this->sql=" SELECT M.sysnr as modulenr, M.naam, M.cluster_id AS clusterid
|
||||
FROM tb_modules M
|
||||
JOIN tb_modulebericht MB ON (M.sysnr = MB.modulenr)
|
||||
WHERE MB.bericht_id = {$berichtid}
|
||||
AND M.cluster_id = {$clusterid}
|
||||
ORDER BY M.id ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getberichtenbijmodule($berichtid, $modulenr){
|
||||
$this->sql=" SELECT id
|
||||
FROM tb_modulebericht
|
||||
WHERE bericht_id = {$berichtid}
|
||||
AND modulenr = {$modulenr} ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getberichtclusters($berichtid){
|
||||
$this->sql = " SELECT C.id as clusterid, C.naam as clusternaam
|
||||
FROM tb_modules M
|
||||
JOIN tb_cluster C ON C.id = M.cluster_id
|
||||
JOIN tb_modulebericht MB ON (M.sysnr = MB.modulenr)
|
||||
WHERE MB.bericht_id = {$berichtid}
|
||||
GROUP BY C.id ";
|
||||
return $this->get_query_result();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Bestedingen_model januari 2016 */
|
||||
|
||||
class Bestedingen_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_bestedingen';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('monpas/Bestemmingslabels_model');
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
function getbestedingen($orgid,$jaarnr){
|
||||
$this->sql= "SELECT id, TRUNCATE((bedrag/100),2) AS bedrag, soort , omschrijving, labelnr
|
||||
FROM tb_bestedingen
|
||||
WHERE orgid ={$orgid}
|
||||
AND kalenderjaarnr = {$jaarnr}
|
||||
ORDER BY labelnr";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
function getbesteding($id){
|
||||
$this->sql= "SELECT id,TRUNCATE((bedrag/100),2) AS bedrag, soort , omschrijving, labelnr
|
||||
FROM tb_bestedingen
|
||||
WHERE id ={$id}";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
function getschoolbestedingen($orgid, $jaarnr){
|
||||
$this->sql="SELECT soort, B.labelnr, B.omschrijving, bedrag , BL.omschrijving as naam
|
||||
FROM tb_bestedingen B
|
||||
JOIN tb_bestemmingslabels BL on BL.id = B.labelnr
|
||||
WHERE orgid = {$orgid}
|
||||
AND kalenderjaarnr = {$jaarnr}
|
||||
ORDER BY B.soort, B.labelnr";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getschoolbestedingenpersoort($orgid, $jaarnr,$soort){
|
||||
$this->sql="SELECT soort, B.labelnr, B.omschrijving, bedrag , BL.omschrijving as naam
|
||||
FROM tb_bestedingen B
|
||||
JOIN tb_bestemmingslabels BL on BL.id = B.labelnr
|
||||
WHERE orgid = {$orgid}
|
||||
AND kalenderjaarnr = {$jaarnr}
|
||||
AND B.soort = {$soort}
|
||||
ORDER BY B.labelnr";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
function getsom($bedragenarray, $budgetten,$labels, $wat){
|
||||
$returnarray = array();
|
||||
switch ($wat){
|
||||
case 1: $returnarray['budget'] = $budgetten->basis;
|
||||
$returnarray['soort'] = 1;
|
||||
$returnarray['naam'] = 'Basisondersteuning';
|
||||
break;
|
||||
case 2: $returnarray['budget'] = $budgetten->extra;
|
||||
$returnarray['soort'] = 2;
|
||||
$returnarray['naam'] = 'Extra ondersteuning';
|
||||
break;
|
||||
case 3: $returnarray['budget'] = $budgetten->som;
|
||||
$returnarray['soort'] = 3;
|
||||
$returnarray['naam'] = 'Ondersteuning';
|
||||
break;
|
||||
case 4: $returnarray['budget'] = $budgetten->overig;
|
||||
$returnarray['soort'] = 4;
|
||||
$returnarray['naam'] = 'Overig';
|
||||
break;
|
||||
};// switch
|
||||
$returnarray['totsoort'] = 0;
|
||||
|
||||
if ($bedragenarray){
|
||||
$returnarray['labels'] = array();
|
||||
foreach ($labels as $label){
|
||||
$returnarray['labels'][$label->labelnr]['nr'] =$label->labelnr;
|
||||
$returnarray['labels'][$label->labelnr]['naam'] = $label->omschrijving;
|
||||
$returnarray['labels'][$label->labelnr]['som'] = 0;
|
||||
$returnarray['labels'][$label->labelnr]['details'] = array();
|
||||
};
|
||||
foreach ($bedragenarray as $regel){
|
||||
$returnarray['totsoort'] += $regel->bedrag;
|
||||
$returnarray['labels'][$regel->labelnr]['som'] += $regel->bedrag;
|
||||
$returnarray['labels'][$regel->labelnr]['details'][]= $regel;
|
||||
};// foreach bedragenarray
|
||||
}; // if bedragenarray
|
||||
|
||||
$returnarray['verschil'] = number_format($returnarray['budget'] - $returnarray['totsoort'], 2,'.' , ',');
|
||||
return $returnarray;
|
||||
}
|
||||
|
||||
|
||||
function sumschoolbedragen($bedragenarray,$budgetten){
|
||||
$labels = $this->Bestemmingslabels_model->getsoorten();
|
||||
$somtotaal = 0;
|
||||
if ($bedragenarray){
|
||||
foreach($bedragenarray as $regel){
|
||||
if (!isset($sompersoort[$regel->soort]) ){
|
||||
$sompersoort[$regel->soort] = array();
|
||||
$sompersoort[$regel->soort]['som'] = 0;
|
||||
$sompersoort[$regel->soort]['labels']= array();
|
||||
switch ($regel->soort){
|
||||
case 1: $sompersoort[$regel->soort]['budget'] = $budgetten->basis; break;
|
||||
case 2: $sompersoort[$regel->soort]['budget'] = $budgetten->extra;break;
|
||||
case 3: $sompersoort[$regel->soort]['budget'] = $budgetten->som; break;
|
||||
case 4: $sompersoort[$regel->soort]['budget'] = $budgetten->overig; break;
|
||||
};// switch
|
||||
foreach ($labels as $label){
|
||||
$sompersoort[$regel->soort]['labels'][$label->labelnr]['nr'] =$label->labelnr;
|
||||
$sompersoort[$regel->soort]['labels'][$label->labelnr]['naam'] = $label->omschrijving;
|
||||
$sompersoort[$regel->soort]['labels'][$label->labelnr]['som'] = 0;
|
||||
};
|
||||
}
|
||||
$sompersoort[$regel->soort]['som'] +=$regel->bedrag;
|
||||
|
||||
if (!isset($sompersoort[$regel->soort]['labels'][$regel->labelnr])){
|
||||
$sompersoort[$regel->soort]['labels'][$regel->labelnr]['som']=0;
|
||||
}
|
||||
$sompersoort[$regel->soort]['labels'][$regel->labelnr]['som'] += $regel->bedrag;
|
||||
$sompersoort[$regel->soort]['labels'][$regel->labelnr]['details'][]= $regel;
|
||||
$somtotaal += $regel->bedrag;
|
||||
}; // foreach
|
||||
}; //if
|
||||
return array('totaal' => $somtotaal, 'sompersoort'=>$sompersoort);
|
||||
}
|
||||
function getsompersoort($orgid, $jaarnr){
|
||||
$this->sql ="SELECT soort, sum(bedrag) AS bedrag
|
||||
FROM tb_bestedingen
|
||||
WHERE orgid = {$orgid}
|
||||
AND kalenderjaarnr = {$jaarnr}
|
||||
GROUP BY soort";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
function getsompersoortoverorgs($orgids, $jaarnr){
|
||||
$this->sql ="SELECT soort, sum(bedrag) AS bedrag,T.basisextra
|
||||
FROM tb_bestedingen B
|
||||
JOIN tb_toewijzingen T ON (T.orgid = B.orgid)
|
||||
WHERE B.orgid in ({$orgids})
|
||||
AND B.kalenderjaarnr = {$jaarnr}
|
||||
AND T.kalenderjaarnr = {$jaarnr}
|
||||
GROUP BY soort";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Bestedingopmerkingen_model januari 2016 */
|
||||
|
||||
class Bestedingopmerkingen_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_bestedingopmerkingen';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
function getopmerking($orgid, $jaarnr){
|
||||
$this->sql = "SELECT id AS opmerkingID, opmerking
|
||||
FROM tb_bestedingopmerkingen
|
||||
WHERE organisatie_id = {$orgid}
|
||||
AND kalenderjaarnr = {$jaarnr}";
|
||||
$result=$this->get_query_row();
|
||||
if ($result) {return $result->opmerking;}
|
||||
else {return '';};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Bestedingen_model januari 2016 */
|
||||
|
||||
class Bestemmingslabels_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_bestemmingslabels';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
function getsoorten(){
|
||||
$this->sql = "SELECT *
|
||||
FROM tb_bestemmingslabels";
|
||||
return $this->get_query_result();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** combifactoren_model januari 2015 */
|
||||
|
||||
class Combifactoren_model extends MY_Model{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('shared/Organisaties_model');
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
function getfactoren($orgid){
|
||||
$swvid = $this->Organisaties_model->get_swvid ($orgid);
|
||||
$this->sql = "SELECT ROUND(combi2 / 10,1) as combi2,
|
||||
ROUND(combi3 / 10, 1) as combi3,
|
||||
addtoschool
|
||||
FROM tb_combifactoren
|
||||
WHERE swv_id={$swvid} || swv_id = 0
|
||||
ORDER BY swv_id DESC
|
||||
LIMIT 1" ;
|
||||
return $this->get_query_row();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Compactop_model juni 2019 */
|
||||
|
||||
class Compactsop_model extends MY_Model
|
||||
{
|
||||
|
||||
protected $tablename = 'tb_compactsops';
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$models = array();
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
function downloadCompactSop($id)
|
||||
{
|
||||
$this->load->helper('download');
|
||||
|
||||
$sop = $this->get(['id'=>$id]);
|
||||
$sop= $sop[0];
|
||||
header( 'Content-Description: File Transfer' );
|
||||
header( 'Content-Type: application/pdf' );
|
||||
header( 'Content-disposition:inline; filename="' .$sop->pdfnaam.'"');
|
||||
header( 'Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0' );
|
||||
header( 'Pragma: public' );
|
||||
header( 'Content-Length: ' . filesize( $this->compactsoppath.$sop->pdfnaam ) );
|
||||
readfile( $this->compactsoppath . $sop->pdfnaam );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Sop_model juli 2019 */
|
||||
|
||||
class compactsoponderdelen_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_compactsoponderdelen';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array();
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
function getOnderdelen(){
|
||||
$this->sql = "SELECT *
|
||||
FROM tb_compactsoponderdelen
|
||||
ORDER BY nummer ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
|
||||
function getModuleMetLicentie($orgid, $onderdeelnummer){
|
||||
$this->sql = "SELECT L.modulenr
|
||||
FROM tb_compactsoponderdelen CO
|
||||
JOIN tb_sop_piv_modules SM ON CO.nummer = SM.onderdeel_nr
|
||||
JOIN tb_licenties L ON SM.modulenr = L.modulenr
|
||||
WHERE L.orgid = {$orgid}
|
||||
AND CO.nummer = {$onderdeelnummer}
|
||||
GROUP BY CO.nummer ";
|
||||
return $this->get_query_row("modulenr");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,527 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Diversiteits_model januari 2015 */
|
||||
|
||||
class Diversiteits_model extends MY_Model{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('monpas/Aantalxondersteuningsvorm_model',
|
||||
'monpas/Combifactoren_model',
|
||||
'monpas/Dq_model',
|
||||
'monpas/Groepen_model',
|
||||
'monpas/Ondersteuningsvormen_model',
|
||||
'shared/Organisaties_model');
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
function getnormaantallen($orgid, $schoolsoort){
|
||||
$normaantallen = $this->getaantallenrecursief($orgid, $schoolsoort);
|
||||
if (!$normaantallen) {
|
||||
$normaantallen = $this->Dq_model->getaantallen(1, $schoolsoort);
|
||||
}
|
||||
return $normaantallen;
|
||||
}
|
||||
function getaantallenrecursief($orgid, $schoolsoort){
|
||||
|
||||
$org = $this->Organisaties_model->getorg($orgid);
|
||||
$normaantallen = $this->Dq_model->getaantallen($orgid, $schoolsoort);
|
||||
|
||||
if (!$normaantallen && ($org->id !== $org->valtonder_id)){
|
||||
$normaantallen = $this->getaantallenrecursief($org->valtonder_id, $schoolsoort);
|
||||
};
|
||||
return $normaantallen;
|
||||
}
|
||||
function getaantallenpercategorie($orgid, $schooljaarnr, $schooltype, $module ){
|
||||
$this->sql = "SELECT sum(AO.aantal) as sum , OV.nivo
|
||||
FROM tb_aantalxondersteuningsvorm AO
|
||||
JOIN tb_ondersteuningsvormen OV ON OV.id = AO.ondersteuningsvorm_id
|
||||
JOIN tb_groepen G ON G.id = AO.groep_id
|
||||
WHERE AO.organisatie_id = {$orgid}
|
||||
AND G.schooljaarnr ={$schooljaarnr}
|
||||
AND G.schooltype = '{$schooltype}'
|
||||
AND G.module = {$module}
|
||||
GROUP BY nivo";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
function getallediversiteitsgegevens($schooljaarnr){
|
||||
$orgid = $this->globorgid;
|
||||
$bg = $this->getbgsenscholen($orgid);
|
||||
$maxdq = new stdClass;
|
||||
$maxdq->school = '';
|
||||
$maxdq->dq = 0;
|
||||
$mindq = new stdClass;
|
||||
$mindq->school = '';
|
||||
$mindq->dq = 100;
|
||||
$maxoov = new stdClass;
|
||||
$maxoov->school = '';
|
||||
$maxoov->oov = 0;
|
||||
$grandtotals = new stdClass;
|
||||
$combifactoren = $this->Combifactoren_model->getfactoren($this->globorgid);
|
||||
if ($bg){
|
||||
|
||||
$grandtotals->llng = 0;
|
||||
$grandtotals->cat1 = 0;
|
||||
$grandtotals->cat2 = 0;
|
||||
$grandtotals->cat3 = 0;
|
||||
$grandtotals->cat4 = 0;
|
||||
$grandtotals->cat234 = 0;
|
||||
foreach($bg as $bege){
|
||||
if ($bege->scholen){
|
||||
$bggem = new stdClass;
|
||||
$bggem->brin = '';
|
||||
$bggem->naam='Gemiddeld '.$bege->naamkort;
|
||||
$bggem->aantallln = 0;
|
||||
$bggem->aantalgroepen = 0;
|
||||
$bggem->cat1=0;
|
||||
$bggem->cat2=0;
|
||||
$bggem->cat3=0;
|
||||
$bggem->cat4=0;
|
||||
$bggem->oov=0;
|
||||
$bggem->tgd=0;
|
||||
$bggem->dq=0;
|
||||
$usedaantalscholen = 0;
|
||||
$schoolsoort ='REGULIER';
|
||||
|
||||
foreach($bege->scholen as $school){
|
||||
$school->groepen = $this->Groepen_model->getgroepen($school->id, $schooljaarnr);
|
||||
// volgens mij is voor school het normaantal altijd 22 (groep 1/2 ) of 24 (groep 3/8) maar dat komt toch niet
|
||||
//overeen met per groep. dus toch maar norm ophalen;
|
||||
$normaantallen = $this->getnormaantallen($school->id, $schoolsoort);
|
||||
if (!$normaantallen){
|
||||
$normaantallen = new StdClass;
|
||||
$normaantallen->groep12 = 22;
|
||||
$normaantallen->groep38 = 24;
|
||||
}
|
||||
$tot = 0;
|
||||
$normtot = 0;
|
||||
if ($school->groepen){
|
||||
foreach($school->groepen as $groep){
|
||||
$groepasarray = explode(';',$groep->niveau);
|
||||
$groep->combi = count($groepasarray);
|
||||
|
||||
if ($combifactoren && $combifactoren->addtoschool == "T"){
|
||||
$combiwaarde = 0;
|
||||
if ($groep->combi ==2) $combiwaarde = $combifactoren->combi2;
|
||||
if ($groep->combi >= 3) $combiwaarde = $combifactoren->combi3;
|
||||
} else{
|
||||
$combiwaarde =0;
|
||||
}
|
||||
$tot = $tot + $groep->totaantal + $combiwaarde;
|
||||
$bggem->aantallln = $bggem->aantallln + $groep->totaantal;
|
||||
|
||||
if ((strpos($groep->niveau, '1') !== false) || (strpos($groep->niveau, '2') !== false) ){
|
||||
$normtot = $normtot + $normaantallen->groep12;
|
||||
}
|
||||
else {
|
||||
$normtot = $normtot + $normaantallen->groep38;
|
||||
};
|
||||
|
||||
}; // foreach
|
||||
}
|
||||
$school->aantallln = $tot;
|
||||
$school->aantalgroepen =0 ;
|
||||
if ($school->groepen){
|
||||
$school->aantalgroepen = count($school->groepen);
|
||||
};
|
||||
$bggem->aantalgroepen = $bggem->aantalgroepen + $school->aantalgroepen;
|
||||
|
||||
$aantallenpercat = $this->getaantallenpercategorie($school->id,$schooljaarnr,"R");
|
||||
$aantalmetvraag = 0;
|
||||
$schooltgd =0;
|
||||
if ($aantallenpercat){
|
||||
foreach($aantallenpercat as $aantalpercat){
|
||||
$aantalmetvraag = $aantalmetvraag + $aantalpercat->sum;
|
||||
switch($aantalpercat->nivo){
|
||||
case 2: $school->cat2 = $aantalpercat->sum;
|
||||
$bggem->cat2 = $bggem->cat2 + $aantalpercat->sum;
|
||||
$schooltgd =$schooltgd + ($aantalpercat->sum * 1.5);
|
||||
break;
|
||||
case 3: $school->cat3= $aantalpercat->sum;
|
||||
$schooltgd = $schooltgd + ($aantalpercat->sum * 2);
|
||||
$bggem->cat3 = $bggem->cat3+ $aantalpercat->sum ;
|
||||
break;
|
||||
case 4: $school->cat4 = $aantalpercat->sum;
|
||||
$bggem->cat4 = $bggem->cat4 + $aantalpercat->sum;
|
||||
|
||||
$schooltgd = $schooltgd + ($aantalpercat->sum * 4);
|
||||
break;
|
||||
};
|
||||
}; //foreach
|
||||
}; // if aantallen
|
||||
|
||||
$school->oov = null;
|
||||
if ($school->aantallln > 0) {
|
||||
$school->oov = round(($aantalmetvraag / $school->aantallln) * 100);
|
||||
$school->cat1 =$school->aantallln - $aantalmetvraag;
|
||||
$school->tgd = round($schooltgd + $school->cat1);
|
||||
$school->dq = round(($school->tgd / $normtot) * 100) / 100;
|
||||
$bggem->cat1 = $bggem->cat1 + $school->cat1;
|
||||
$bggem->oov = $bggem->oov + $school->oov;
|
||||
$bggem->tgd = $bggem->tgd + $school->tgd ;
|
||||
$bggem->dq= $bggem->dq + $school->dq;
|
||||
$usedaantalscholen ++;
|
||||
$grandtotals->llng =$grandtotals->llng + $school->aantallln;
|
||||
|
||||
$grandtotals->cat1 = $grandtotals->cat1 + $school->cat1;
|
||||
if (isset($school->cat2)) $grandtotals->cat2 = $grandtotals->cat2 + $school->cat2;
|
||||
if (isset($school->cat3)) $grandtotals->cat3 = $grandtotals->cat3 + $school->cat3;
|
||||
if (isset($school->cat4)) $grandtotals->cat4 = $grandtotals->cat4 + $school->cat4;
|
||||
};
|
||||
if (isset($school->dq)){
|
||||
if ($school->dq > $maxdq->dq) {
|
||||
$maxdq->school = $school->brin ." - ".$school->naamkort;
|
||||
$maxdq->dq = $school->dq;}
|
||||
if ($school->dq < $mindq->dq) {
|
||||
$mindq->school = $school->brin." - ".$school->naamkort;
|
||||
$mindq->dq = $school->dq;}
|
||||
}
|
||||
if (isset($school->oov) && $school->oov > $maxoov->oov) {
|
||||
$maxoov->school = $school->brin." - ".$school->naamkort;
|
||||
$maxoov->oov = $school->oov;}
|
||||
}; // foreach scholen
|
||||
|
||||
if ($usedaantalscholen > 0) {
|
||||
$bgtot = new stdClass;
|
||||
$bgtot->brin = '';
|
||||
$bgtot->naam='Totaal '.$bege->naamkort;
|
||||
$bgtot->aantallln = $bggem->aantallln;
|
||||
$bgtot->aantalgroepen = $bggem->aantalgroepen;
|
||||
$bgtot->cat1= $bggem->cat1;
|
||||
$bgtot->cat2= $bggem->cat2;
|
||||
$bgtot->cat3= $bggem->cat3;
|
||||
$bgtot->cat4= $bggem->cat4;
|
||||
$bgtot->oov= null;
|
||||
$bgtot->tgd= round($bggem->tgd);
|
||||
$bgtot->dq=null;
|
||||
|
||||
$bggem->aantallln = round($bggem->aantallln / $usedaantalscholen);
|
||||
$bggem->groepen = round($bggem->aantalgroepen/$usedaantalscholen);
|
||||
$bggem->cat1 =round($bggem->cat1/ $usedaantalscholen);
|
||||
$bggem->cat2 =round($bggem->cat2/ $usedaantalscholen);
|
||||
$bggem->cat3 =round($bggem->cat3/ $usedaantalscholen);
|
||||
$bggem->cat4 =round($bggem->cat4/ $usedaantalscholen);
|
||||
|
||||
$bggem->oov = round($bggem->oov / $usedaantalscholen ) ;
|
||||
$bggem->tgd = round($bggem->tgd / $usedaantalscholen);
|
||||
$bggem->dq = round(($bggem->dq / $usedaantalscholen) * 100) / 100;
|
||||
array_push($bege->scholen,$bgtot);
|
||||
array_push($bege->scholen,$bggem);
|
||||
}
|
||||
|
||||
} ; // if scholen
|
||||
}; // foreach bg
|
||||
$grandtotals->cat234 = $grandtotals->cat2 + $grandtotals->cat3 + $grandtotals->cat4;
|
||||
}; // if bg
|
||||
|
||||
return array(array('bg'=>$bg,
|
||||
"maxdq" =>$maxdq,
|
||||
"mindq" =>$mindq,
|
||||
"maxoov" => $maxoov,
|
||||
"grandtotals" =>$grandtotals));
|
||||
|
||||
}
|
||||
|
||||
function getallediversiteitsgegevenssboso($schooljaarnr, $licentie){
|
||||
$orgid = $this->globorgid;
|
||||
$bg = $this->getbgsenscholenmetlicentie($orgid, $licentie);
|
||||
$somschooldq = 0;
|
||||
$maxdq = new stdClass;
|
||||
$maxdq->school = '';
|
||||
$maxdq->dq = 0;
|
||||
$mindq = new stdClass;
|
||||
$mindq->school = '';
|
||||
$mindq->dq = 100;
|
||||
$grandtotals = new stdClass;
|
||||
$beschikbaar = 'F';
|
||||
if ($bg){
|
||||
|
||||
$grandtotals->llng = 0;
|
||||
$grandtotals->cat5 = 0;
|
||||
$grandtotals->cat6 = 0;
|
||||
$grandtotals->cat7 = 0;
|
||||
$grandtotals->cat8 = 0;
|
||||
$grandtotals->totaal = 0;
|
||||
foreach($bg as $bege){
|
||||
if ($bege->scholen){
|
||||
$bggem = new stdClass;
|
||||
$bggem->brin = '';
|
||||
$bggem->naam='Gemiddeld '.$bege->naamkort;
|
||||
$bggem->aantallln = 0;
|
||||
$bggem->aantalgroepen = 0;
|
||||
$bggem->cat5=0;
|
||||
$bggem->cat6=0;
|
||||
$bggem->cat7=0;
|
||||
$bggem->cat8=0;
|
||||
$bggem->tgd=0;
|
||||
$bggem->dq=0;
|
||||
$usedaantalscholen = 0;
|
||||
|
||||
foreach($bege->scholen as $school){
|
||||
$school->groepen = $this->Groepen_model->getgroepenSboso($school->id, $schooljaarnr);
|
||||
// volgens mij is voor school het normaantal altijd 22 (groep 1/2 ) of 24 (groep 3/8) maar dat komt toch niet
|
||||
//overeen met per groep. dus toch maar norm ophalen;
|
||||
$normaantallen = 0;
|
||||
$normaantallenSBO = $this->getnormaantallen($school->id, 'SBO');
|
||||
$normaantallenSO = $this->getnormaantallen($school->id, 'SO');
|
||||
if (!$normaantallenSO) {
|
||||
$normaantallenSO = new StdClass;
|
||||
$normaantallenSO->groep12 = 22;
|
||||
$normaantallenSO->groep38 = 24;
|
||||
}
|
||||
if (!$normaantallenSBO) {
|
||||
$normaantallenSBO = new StdClass;
|
||||
$normaantallenSBO->groep12 = 22;
|
||||
$normaantallenSBO->groep38 = 24;
|
||||
}
|
||||
|
||||
$tot = 0;
|
||||
$normtot = 0;
|
||||
|
||||
if ($school->groepen){
|
||||
foreach($school->groepen as $groep){
|
||||
$tot = $tot + $groep->totaantal;
|
||||
$bggem->aantallln = $bggem->aantallln + $groep->totaantal;
|
||||
|
||||
}; // foreach
|
||||
}
|
||||
$school->aantallln = $tot;
|
||||
$school->aantalgroepen =0 ;
|
||||
if ($school->groepen){
|
||||
$school->aantalgroepen = count($school->groepen);
|
||||
};
|
||||
if($school->groepen) {
|
||||
foreach($school->groepen as $groep) {
|
||||
if ($groep->totaantal > 0) {
|
||||
if ((strpos($groep->niveau, '1') !== false) || (strpos($groep->niveau, '2') !== false)) {
|
||||
$groep->normaantal = (($groep->som5 / $groep->totaantal) * $normaantallenSBO->groep12)
|
||||
+ ((($groep->totaantal - $groep->som5) / $groep->totaantal) *
|
||||
$normaantallenSO->groep12);//== factor
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
$groep->normaantal = (($groep->som5 / $groep->totaantal) * $normaantallenSO->groep38)
|
||||
+ ((($groep->totaantal - $groep->som5) / $groep->totaantal) *
|
||||
$normaantallenSO->groep38); //== factor
|
||||
|
||||
|
||||
};
|
||||
$groep->diversiteit = ($groep->som5 * 2) + ($groep->som6 * 3) + ($groep->som7 * 4) +($groep ->som8 * 5);
|
||||
$groep->groepdq = round($groep->diversiteit/$groep->normaantal);
|
||||
$normtot = $normtot + $groep->normaantal;
|
||||
$somschooldq = $somschooldq + $groep->groepdq;
|
||||
}
|
||||
}
|
||||
}
|
||||
$school->normaantal = $normtot;
|
||||
$school->dq =0;
|
||||
if($school->aantalgroepen > 0) {
|
||||
$school->dq = round(($somschooldq / $school->aantalgroepen) * 100) / 100;
|
||||
$bggem->aantalgroepen = $bggem->aantalgroepen + $school->aantalgroepen;
|
||||
}
|
||||
|
||||
|
||||
$aantallenpercat = $this->getaantallenpercategorie($school->id,$schooljaarnr,'SBO', $licentie);
|
||||
$schooltgd =0;
|
||||
if ($aantallenpercat){
|
||||
foreach($aantallenpercat as $aantalpercat){
|
||||
switch($aantalpercat->nivo){
|
||||
case 5: $school->cat5 = $aantalpercat->sum;
|
||||
$bggem->cat5 = $bggem->cat5 + $aantalpercat->sum;
|
||||
$schooltgd = $schooltgd + ($aantalpercat->sum * 2);
|
||||
break;
|
||||
case 6: $school->cat6 = $aantalpercat->sum;
|
||||
$schooltgd = $schooltgd + ($aantalpercat->sum * 3);
|
||||
$bggem->cat6 = $bggem->cat6+ $aantalpercat->sum ;
|
||||
break;
|
||||
case 7: $school->cat7 = $aantalpercat->sum;
|
||||
$bggem->cat7 = $bggem->cat7 + $aantalpercat->sum;
|
||||
$schooltgd = $schooltgd + ($aantalpercat->sum * 4);
|
||||
break;
|
||||
case 8: $school->cat8 = $aantalpercat->sum;
|
||||
$bggem->cat8 = $bggem->cat8 + $aantalpercat->sum;
|
||||
$schooltgd = $schooltgd + ($aantalpercat->sum * 5);
|
||||
break;
|
||||
};
|
||||
}; //foreach
|
||||
}; // if aantallen
|
||||
|
||||
|
||||
|
||||
if ($school->aantallln > 0) {
|
||||
$school->tgd = round($schooltgd);
|
||||
$school->dq = round(($school->tgd / $school->normaantal) * 100) / 100;
|
||||
$bggem->tgd = $bggem->tgd + $school->tgd ;
|
||||
$bggem->dq= $bggem->dq + $school->dq;
|
||||
$usedaantalscholen ++;
|
||||
$grandtotals->llng =$grandtotals->llng + $school->aantallln;
|
||||
if (isset($school->cat5)) $grandtotals->cat5 = $grandtotals->cat5+ $school->cat5;
|
||||
if (isset($school->cat6)) $grandtotals->cat6 = $grandtotals->cat6 + $school->cat6;
|
||||
if (isset($school->cat7)) $grandtotals->cat7 = $grandtotals->cat7 + $school->cat7;
|
||||
if (isset($school->cat8)) $grandtotals->cat8 = $grandtotals->cat8 + $school->cat8;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
if (isset($school->dq)){
|
||||
if ($school->dq > $maxdq->dq) {
|
||||
$maxdq->school = $school->brin ." - ".$school->naamkort;
|
||||
$maxdq->dq = $school->dq;}
|
||||
if ($school->dq < $mindq->dq) {
|
||||
$mindq->school = $school->brin." - ".$school->naamkort;
|
||||
$mindq->dq = $school->dq;}
|
||||
}
|
||||
}; // foreach scholen
|
||||
|
||||
if ($usedaantalscholen > 0) {
|
||||
$bgtot = new stdClass;
|
||||
$bgtot->brin = '';
|
||||
$bgtot->naam='Totaal '.$bege->naamkort;
|
||||
$bgtot->aantallln = $bggem->aantallln;
|
||||
$bgtot->aantalgroepen = $bggem->aantalgroepen;
|
||||
$bgtot->cat5= $bggem->cat5;
|
||||
$bgtot->cat6= $bggem->cat6;
|
||||
$bgtot->cat7= $bggem->cat7;
|
||||
$bgtot->cat8= $bggem->cat8;
|
||||
$bgtot->tgd= round($bggem->tgd);
|
||||
$bgtot->dq=null;
|
||||
|
||||
|
||||
//
|
||||
|
||||
$bggem->aantallln = round($bggem->aantallln / $usedaantalscholen);
|
||||
$bggem->aantalgroepen = round($bggem->aantalgroepen/$usedaantalscholen);
|
||||
$bggem->cat5 =round($bggem->cat5/ $usedaantalscholen);
|
||||
$bggem->cat6 =round($bggem->cat6/ $usedaantalscholen);
|
||||
$bggem->cat7 =round($bggem->cat7/ $usedaantalscholen);
|
||||
$bggem->cat8 =round($bggem->cat8/ $usedaantalscholen);
|
||||
$bggem->tgd = round($bggem->tgd / $usedaantalscholen);
|
||||
$bggem->dq = round(($bggem->dq / $usedaantalscholen) * 100) / 100;
|
||||
array_push($bege->scholen,$bgtot);
|
||||
array_push($bege->scholen,$bggem);
|
||||
}
|
||||
|
||||
} ; // if scholen
|
||||
}; // foreach bg
|
||||
$grandtotals->cat56789 = $grandtotals->cat5 + $grandtotals->cat6 + $grandtotals->cat7 + + $grandtotals->cat8;
|
||||
|
||||
|
||||
if($grandtotals->cat56789 > 0){
|
||||
$beschikbaar = 'T';
|
||||
}
|
||||
}; // if bg
|
||||
|
||||
return array(array('bg'=>$bg,
|
||||
"maxdq" => $maxdq,
|
||||
"mindq" => $mindq,
|
||||
"grandtotals" => $grandtotals,
|
||||
"beschikbaar" => $beschikbaar));
|
||||
}
|
||||
|
||||
function getbgsenscholen($orgid){
|
||||
$bg = null;
|
||||
$bgs = array();
|
||||
$organisatie = $this->Organisaties_model->get_record_by_id($orgid);
|
||||
switch ($organisatie->soort){
|
||||
case 0: $bgs = null; break;
|
||||
case 1: $kamers = $this->Organisaties_model->getorgsvanaf($organisatie->id, false);
|
||||
if ($kamers){
|
||||
foreach($kamers as $kamer){
|
||||
$bg = $this->Organisaties_model->getorgsvanaf($kamer->id, false);
|
||||
if ($bg){
|
||||
$bgs = array_merge($bgs, $bg);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2 : $bgs = $this->Organisaties_model->getorgsvanaf($organisatie->id,false);
|
||||
break;
|
||||
case 3: $bgs[0] =$organisatie;
|
||||
break;
|
||||
}; // switch;
|
||||
if ($bgs){
|
||||
foreach($bgs as $bev){
|
||||
$bev->scholen= $this->Organisaties_model->getorgsvanaf($bev->id, false);
|
||||
}; // foreach
|
||||
}; // if bgs
|
||||
return $bgs;
|
||||
}
|
||||
|
||||
function getbgsenscholenmetlicentie($orgid, $licentie){
|
||||
$bg = null;
|
||||
$bgs = array();
|
||||
$organisatie = $this->Organisaties_model->get_record_by_id($orgid);
|
||||
switch ($organisatie->soort){
|
||||
case 0: $bgs = null; break;
|
||||
case 1: $kamers = $this->Organisaties_model->getorgsvanaf($organisatie->id, false);
|
||||
if ($kamers){
|
||||
foreach($kamers as $kamer){
|
||||
$bg = $this->Organisaties_model->getorgsvanaf($kamer->id, false);
|
||||
if ($bg){
|
||||
$bgs = array_merge($bgs, $bg);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2: $bgs = $this->Organisaties_model->getorgsvanaf($organisatie->id,false);
|
||||
break;
|
||||
case 3: $bgs[0] =$organisatie;
|
||||
break;
|
||||
}; // switch;
|
||||
$licentiebgs = [];
|
||||
if ($bgs){
|
||||
foreach($bgs as $bev){
|
||||
$bev->scholen= $this->Organisaties_model->getorgsvanafmetlicentie($bev->id, $licentie);
|
||||
if($bev->scholen){
|
||||
$licentiebgs [] = $bev;
|
||||
}
|
||||
|
||||
}; // foreach
|
||||
|
||||
|
||||
}; // if bgs
|
||||
|
||||
|
||||
|
||||
return $licentiebgs;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getosvormen($orgid, $schooljaarnr, $minnivo, $maxnivo, $module){
|
||||
$groeparray = [];
|
||||
$os = $this->Ondersteuningsvormen_model->getvormen($orgid, $minnivo, $maxnivo);
|
||||
|
||||
if($minnivo >= 5) {
|
||||
// $groepen = $this->Aantalxondersteuningsvorm_model->getgroepenmetlln($orgid, $schooljaarnr, $minnivo, $maxnivo);
|
||||
$groepen = $this->Groepen_model->getGroepenSboSo($orgid, $schooljaarnr);
|
||||
}
|
||||
else {
|
||||
$groepen = $this->Groepen_model->getgroepen($orgid, $schooljaarnr, $module);
|
||||
}
|
||||
if(!$groepen){
|
||||
return false;
|
||||
}
|
||||
foreach($groepen as $groep){
|
||||
$groepsarray[]=$groep->id;
|
||||
}
|
||||
$groepids = implode(',', $groepsarray);
|
||||
if ($os){
|
||||
foreach($os as $vorm){
|
||||
$vorm->groepsaantallen = $this->Aantalxondersteuningsvorm_model->getaantallen($vorm->id, $orgid,$schooljaarnr, $groepids);
|
||||
|
||||
$vorm->vormtotaal =0;
|
||||
if ($vorm->groepsaantallen){
|
||||
foreach($vorm->groepsaantallen as $aantallen){
|
||||
$vorm->vormtotaal = $vorm->vormtotaal + $aantallen->aantal;
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
return $os;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**Documenten_model januari 2015 */
|
||||
|
||||
class Documenten_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_documenten';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
function gethandleidingen($orgid, $userrole){
|
||||
$this->sql = "SELECT id, schermnaam, documentnaam, nummer
|
||||
FROM tb_documenten
|
||||
WHERE soort = 1
|
||||
AND ({$userrole} & autorisatienivo)
|
||||
AND (organisatie_id = {$orgid} OR organisatie_id = 0)
|
||||
ORDER BY nummer, schermnaam";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Dq_model januari 2015 */
|
||||
|
||||
class Dq_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_dq';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
function getaantallen($orgid, $schoolsoort){
|
||||
$this->sql="SELECT groep12, groep38
|
||||
FROM tb_dq
|
||||
WHERE organisatie_id = {$orgid}
|
||||
AND schooltype = '{$schoolsoort}'
|
||||
ORDER BY volgorde DESC
|
||||
LIMIT 1";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,485 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**filledversions_model april 2015 */
|
||||
|
||||
class Filledversions_model extends MY_Model{
|
||||
|
||||
protected $tablename = 'tb_filledversions';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
function getuserversions($userid){
|
||||
$this->sql= "SELECT FV.id, FV.orgversie_id , FV.versie_id,
|
||||
DATE_FORMAT(geopend,'%d-%m-%Y') AS geopend,
|
||||
DATE_FORMAT(gesloten,'%d-%m-%Y') AS gesloten,
|
||||
naam
|
||||
FROM tb_filledversions FV
|
||||
JOIN tb_orgversies OV ON OV.id = FV.orgversie_id
|
||||
JOIN tb_versies V ON V.id = OV.versie_id
|
||||
WHERE user_id = {$userid}";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
function getfilledversion($orgversieid, $orgid, $fillerid, $wat){
|
||||
$this->sql= "SELECT FV.id, FV.orgversie_id,FV.user_id, FV.notitie, FV.meetellen
|
||||
FROM tb_filledversions FV
|
||||
WHERE FV.orgversie_id = {$orgversieid}
|
||||
AND FV.organisatie_id = {$orgid} ";
|
||||
if ($wat == 2) {$this->sql .= " AND FV.user_id = {$fillerid} ";}
|
||||
return $this->get_query_row();
|
||||
}
|
||||
function getfilledversionbyid($id){
|
||||
$this->sql= "SELECT FV.id, FV.orgversie_id,FV.user_id, FV.notitie, FV.meetellen
|
||||
FROM tb_filledversions FV
|
||||
WHERE id= {$id}" ;
|
||||
return $this->get_query_row();
|
||||
}
|
||||
function getlks($orgid, $orgversieid){
|
||||
$this->sql="SELECT FV.id as filledversionid,concat_ws(' ',U.voornaam, U.tussenvoegsel, U.achternaam) AS fullname, $orgid as orgid, FV.user_id
|
||||
FROM tb_filledversions FV
|
||||
JOIN tb_users U ON U.id = FV.user_id
|
||||
WHERE FV.orgversie_id = {$orgversieid}
|
||||
AND FV.organisatie_id = {$orgid}
|
||||
AND U.actief = 1
|
||||
ORDER BY U.achternaam";
|
||||
|
||||
|
||||
|
||||
return $this->get_query_result();
|
||||
}
|
||||
function countlkrtn($orgid, $orgversieid){
|
||||
$this->sql="SELECT COUNT(FV.user_id) AS aantal
|
||||
FROM tb_filledversions FV
|
||||
JOIN tb_users U ON U.id = FV.user_id
|
||||
WHERE FV.orgversie_id = {$orgversieid}
|
||||
AND FV.organisatie_id = {$orgid}
|
||||
AND U.actief = 1";
|
||||
return $this->get_query_row('aantal');
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getfilledversionsperorg($orgid, $modulenr)
|
||||
{
|
||||
// om de ingevulde lijsten per school op te halen
|
||||
$this->sql = "SELECT DISTINCT(FV.orgversie_id) as id, OV.organisatie_id, periodenummer, OV.actief, versie_id, V.naam,
|
||||
OV.vorm, OV.scoretype, OV.score_omschrijving,
|
||||
DATE_FORMAT(geldigvanaf, '%d-%m-%Y') AS geldigvanaf,
|
||||
DATE_FORMAT(geldigtm, '%d-%m-%Y') AS geldigtm,
|
||||
DATE_FORMAT(invullentm, '%d-%m-%Y') AS invullentm,
|
||||
V.naam
|
||||
FROM tb_filledversions FV
|
||||
JOIN tb_orgversies OV ON OV.id = FV.orgversie_id
|
||||
JOIN tb_versies V ON V.id =OV.versie_id
|
||||
WHERE FV.organisatie_id = {$orgid}
|
||||
AND V.modulenr = {$modulenr}
|
||||
|
||||
ORDER BY OV.actief DESC, OV.periodenummer DESC ";
|
||||
return $this->get_query_result();
|
||||
|
||||
}
|
||||
|
||||
function gettevergelijkenschoolversies($orgids, $modulenr){
|
||||
// om de ingevulde lijsten per school op te halen
|
||||
$this->sql =" SELECT DISTINCT (FV.orgversie_id) AS orgversieid, vorm, scoretype, (OV.versie_id) AS versieid, naam, A.omschrijving
|
||||
FROM tb_filledversions FV
|
||||
JOIN tb_orgversies OV ON OV.id = FV.orgversie_id
|
||||
JOIN tb_versies V ON V.id =OV.versie_id
|
||||
JOIN tb_antwoordtypes A ON A.sysnr = OV.scoretype
|
||||
WHERE FV.organisatie_id IN ({$orgids})
|
||||
AND V.modulenr = {$modulenr}
|
||||
ORDER BY OV.periodenummer DESC";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function gettevergelijkenschoolversies1school($orgid, $modulenr){
|
||||
// om de ingevulde lijsten per school op te halen
|
||||
$this->sql =" SELECT DISTINCT (FV.orgversie_id) AS orgversieid, vorm, scoretype, (OV.versie_id) AS versieid, naam, A.omschrijving
|
||||
FROM tb_filledversions FV
|
||||
JOIN tb_orgversies OV ON OV.id = FV.orgversie_id
|
||||
JOIN tb_versies V ON V.id =OV.versie_id
|
||||
JOIN tb_antwoordtypes A ON A.sysnr = OV.scoretype
|
||||
WHERE FV.organisatie_id ={$orgid}
|
||||
AND V.modulenr = {$modulenr}
|
||||
ORDER BY OV.periodenummer DESC";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getversiesperalleorgs($idlijst, $module){
|
||||
$this->sql = "SELECT DISTINCT(FV.orgversie_id) as id, OV.organisatie_id, periodenummer, OV.actief, versie_id,
|
||||
vorm, scoretype,
|
||||
DATE_FORMAT(geldigvanaf,'%d-%m-%Y') AS geldigvanaf,
|
||||
DATE_FORMAT(geldigtm,'%d-%m-%Y') AS geldigtm,
|
||||
DATE_FORMAT(invullentm,'%d-%m-%Y') AS invullentm,
|
||||
V.naam
|
||||
FROM tb_filledversions FV
|
||||
JOIN tb_orgversies OV ON OV.id = FV.orgversie_id
|
||||
JOIN tb_versies V ON V.id =OV.versie_id
|
||||
WHERE FV.organisatie_id IN ($idlijst)
|
||||
AND V.modulenr = {$module}
|
||||
ORDER BY OV.geldigtm DESC";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getversiesperalleorgs2($idlijst, $module){
|
||||
$this->sql = "SELECT FV.orgversie_id as id, OV.organisatie_id, periodenummer, OV.actief, versie_id,
|
||||
vorm, scoretype,
|
||||
DATE_FORMAT(geldigvanaf,'%d-%m-%Y') AS geldigvanaf,
|
||||
DATE_FORMAT(geldigtm,'%d-%m-%Y') AS geldigtm,
|
||||
DATE_FORMAT(invullentm,'%d-%m-%Y') AS invullentm,
|
||||
V.naam
|
||||
FROM tb_filledversions FV
|
||||
JOIN tb_orgversies OV ON OV.id = FV.orgversie_id
|
||||
JOIN tb_versies V ON V.id =OV.versie_id
|
||||
WHERE FV.organisatie_id IN ($idlijst)
|
||||
AND V.modulenr = {$module}
|
||||
GROUP BY scoretype
|
||||
ORDER BY OV.actief DESC, OV.periodenummer DESC";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getversiesperorgperperiode($orgid, $module, $van, $tm){
|
||||
$this->sql = "SELECT DISTINCT(FV.orgversie_id) as id,
|
||||
OV.organisatie_id, periodenummer, OV.actief, versie_id,
|
||||
vorm, scoretype,
|
||||
DATE_FORMAT(geldigvanaf,'%d-%m-%Y') AS geldigvanaf,
|
||||
DATE_FORMAT(geldigtm,'%d-%m-%Y') AS geldigtm,
|
||||
DATE_FORMAT(invullentm,'%d-%m-%Y') AS invullentm,
|
||||
V.naam
|
||||
FROM tb_filledversions FV
|
||||
JOIN tb_orgversies OV ON OV.id = FV.orgversie_id
|
||||
JOIN tb_versies V ON V.id =OV.versie_id
|
||||
WHERE FV.organisatie_id ={$orgid}
|
||||
AND V.modulenr = {$module}
|
||||
AND OV.geldigvanaf >= '{$van}'
|
||||
AND OV.geldigtm <= '{$tm}'
|
||||
ORDER BY OV.actief DESC, periodenummer DESC";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
// function getEerdereVergelijkbareVersies($orgid, $module, $orgversie){
|
||||
// $this->sql = "SELECT DISTINCT(FV.orgversie_id) as id,
|
||||
// OV.organisatie_id, periodenummer, OV.actief, versie_id,
|
||||
// vorm, scoretype,
|
||||
// DATE_FORMAT(geldigvanaf,'%d-%m-%Y') AS geldigvanaf,
|
||||
// DATE_FORMAT(geldigtm,'%d-%m-%Y') AS geldigtm,
|
||||
// DATE_FORMAT(invullentm,'%d-%m-%Y') AS invullentm,
|
||||
// V.naam
|
||||
// FROM tb_filledversions FV
|
||||
// JOIN tb_orgversies OV ON OV.id = FV.orgversie_id
|
||||
// JOIN tb_versies V ON V.id =OV.versie_id
|
||||
// WHERE FV.organisatie_id = {$orgid}
|
||||
// AND V.modulenr = {$module}
|
||||
// AND OV.id <> {$orgversie->id}
|
||||
// AND V.id = {$orgversie->versie_id}
|
||||
// AND OV.periodenummer < {$orgversie->periodenummer}
|
||||
// AND OV.scoretype = {$orgversie->scoretype}
|
||||
// ORDER BY OV.actief DESC, periodenummer DESC";
|
||||
// return $this->get_query_result();
|
||||
// }
|
||||
|
||||
|
||||
|
||||
function checkperiode($fvid, $van, $tm){
|
||||
$this->sql = "SELECT DISTINCT(FV.orgversie_id) as id
|
||||
FROM tb_filledversions FV
|
||||
JOIN tb_orgversies OV ON OV.id = FV.orgversie_id
|
||||
WHERE FV.id ={$fvid}
|
||||
AND OV.geldigvanaf >= '{$van}'
|
||||
AND OV.geldigtm <= '{$tm}' ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
|
||||
function getlijsten($orgid, $module){
|
||||
$this->sql = "SELECT FV.id AS fvid, periodenummer,
|
||||
OV.vorm, OV.geldigvanaf, OV.geldigtm, V.naam,
|
||||
CONCAT_WS(' ' , U.voornaam, U.tussenvoegsel, U.achternaam) AS usernaam
|
||||
FROM tb_filledversions FV
|
||||
JOIN tb_orgversies OV ON OV.id = FV.orgversie_id
|
||||
JOIN tb_versies V ON V.id = OV.versie_id
|
||||
LEFT JOIN tb_users U ON U.id = FV.user_id
|
||||
WHERE FV.organisatie_id = {$orgid}
|
||||
AND V.modulenr = {$module}
|
||||
ORDER BY periodenummer desc";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getVersieInfoVanOrg($orgversieid, $orgid){
|
||||
$this->sql = "SELECT FV.id, FV.user_id, FV.organisatie_id, OV.id, OV.id, OV.vorm, OV.scoretype
|
||||
FROM tb_filledversions FV
|
||||
JOIN tb_orgversies OV ON FV.orgversie_id = OV.id
|
||||
WHERE FV.organisatie_id = {$orgid}
|
||||
AND OV.id = {$orgversieid} ";
|
||||
return $this->get_query_result();
|
||||
|
||||
}
|
||||
|
||||
|
||||
function getVergelijkbareVersies4($orgversieid, $orgid){
|
||||
$this->sql = "SELECT FIL.id as filledid, ORGV.id, ORGV.versie_id, ORGV.vorm, ORGV.scoretype,
|
||||
DATE_FORMAT(ORGV.geldigvanaf,'%d-%m-%Y') AS geldigvanaf,
|
||||
DATE_FORMAT(ORGV.geldigtm,'%d-%m-%Y') AS geldig,
|
||||
DATE_FORMAT(ORGV.invullentm,'%d-%m-%Y') AS invullentm,
|
||||
ORGV.organisatie_id, FIL.organisatie_id as invuller
|
||||
FROM tb_filledversions FV
|
||||
JOIN tb_orgversies OV ON FV.orgversie_id = OV.id
|
||||
JOIN tb_orgversies ORGV ON OV.organisatie_id = ORGV.organisatie_id
|
||||
JOIN tb_filledversions FIL ON ORGV.id = FIL.orgversie_id
|
||||
WHERE FV.organisatie_id = {$orgid}
|
||||
AND FIL.organisatie_id = {$orgid}
|
||||
AND OV.id = {$orgversieid}
|
||||
AND OV.versie_id = ORGV.versie_id
|
||||
AND OV.scoretype = ORGV.scoretype
|
||||
AND OV.vorm = ORGV.vorm
|
||||
AND OV.geldigtm >= ORGV.geldigtm
|
||||
ORDER BY ORGV.geldigtm DESC
|
||||
LIMIT 2 ";
|
||||
|
||||
return $this->get_query_result();
|
||||
|
||||
}
|
||||
|
||||
function getVergelijkbareVersiesSchoolGemiddelde($orgversieid, $orgid){
|
||||
$this->sql = "SELECT FIL.id as filledid, ORGV.id, ORGV.versie_id, ORGV.vorm, ORGV.scoretype,
|
||||
DATE_FORMAT(ORGV.geldigvanaf,'%d-%m-%Y') AS geldigvanaf,
|
||||
DATE_FORMAT(ORGV.geldigtm,'%d-%m-%Y') AS geldig,
|
||||
DATE_FORMAT(ORGV.invullentm,'%d-%m-%Y') AS invullentm,
|
||||
ORGV.organisatie_id, FIL.organisatie_id as invuller
|
||||
FROM tb_filledversions FV
|
||||
JOIN tb_orgversies OV ON FV.orgversie_id = OV.id
|
||||
JOIN tb_orgversies ORGV ON OV.organisatie_id = ORGV.organisatie_id
|
||||
JOIN tb_filledversions FIL ON ORGV.id = FIL.orgversie_id
|
||||
WHERE FV.organisatie_id = {$orgid}
|
||||
AND FIL.organisatie_id = {$orgid}
|
||||
AND OV.id = {$orgversieid}
|
||||
AND OV.versie_id = ORGV.versie_id
|
||||
AND OV.scoretype = ORGV.scoretype
|
||||
AND OV.vorm = ORGV.vorm
|
||||
AND OV.geldigtm >= ORGV.geldigtm
|
||||
GROUP BY ORGV.id
|
||||
ORDER BY ORGV.geldigtm DESC
|
||||
LIMIT 2 ";
|
||||
|
||||
return $this->get_query_result();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function getVergelijkbareVersies4Ind($orgversieid, $orgid){
|
||||
$this->sql = "SELECT FIL.id as filledid, ORGV.id, ORGV.versie_id, ORGV.vorm, ORGV.scoretype,
|
||||
DATE_FORMAT(ORGV.geldigvanaf,'%d-%m-%Y') AS geldigvanaf,
|
||||
DATE_FORMAT(ORGV.geldigtm,'%d-%m-%Y') AS geldig,
|
||||
DATE_FORMAT(ORGV.invullentm,'%d-%m-%Y') AS invullentm,
|
||||
ORGV.organisatie_id, FIL.organisatie_id as invuller
|
||||
FROM tb_filledversions FV
|
||||
JOIN tb_orgversies OV ON FV.orgversie_id = OV.id
|
||||
JOIN tb_orgversies ORGV ON OV.organisatie_id = ORGV.organisatie_id
|
||||
JOIN tb_filledversions FIL ON ORGV.id = FIL.orgversie_id
|
||||
WHERE FV.organisatie_id = {$orgid}
|
||||
AND FIL.organisatie_id = {$orgid}
|
||||
AND OV.id = {$orgversieid}
|
||||
AND OV.versie_id = ORGV.versie_id
|
||||
AND OV.scoretype = ORGV.scoretype
|
||||
AND OV.vorm = ORGV.vorm
|
||||
AND FV.user_id = FIL.user_id
|
||||
AND OV.geldigtm >= ORGV.geldigtm
|
||||
ORDER BY ORGV.geldigtm DESC
|
||||
LIMIT 2 ";
|
||||
|
||||
return $this->get_query_result();
|
||||
|
||||
}
|
||||
|
||||
function getVergelijkbareVersies3($orgversieid, $orgid){
|
||||
$this->sql = "SELECT FIL.id as filledid, ORGV.id, ORGV.versie_id, ORGV.vorm, ORGV.scoretype, SCHOOL.valtonder_id, SCHOOL.id as schoolid,
|
||||
DATE_FORMAT(ORGV.geldigvanaf,'%d-%m-%Y') AS geldigvanaf,
|
||||
DATE_FORMAT(ORGV.geldigtm,'%d-%m-%Y') AS geldig,
|
||||
DATE_FORMAT(ORGV.invullentm,'%d-%m-%Y') AS invullentm,
|
||||
ORGV.organisatie_id, FIL.organisatie_id as invuller
|
||||
FROM tb_filledversions FV
|
||||
JOIN tb_orgversies OV ON FV.orgversie_id = OV.id
|
||||
JOIN tb_orgversies ORGV ON OV.versie_id = ORGV.versie_id
|
||||
JOIN tb_filledversions FIL ON ORGV.id = FIL.orgversie_id
|
||||
JOIN tb_organisaties SCHOOL ON FIL.organisatie_id = SCHOOL.id
|
||||
JOIN tb_organisaties BG ON SCHOOL.valtonder_id = BG.id
|
||||
WHERE BG.id = {$orgid}
|
||||
AND OV.id = {$orgversieid}
|
||||
AND OV.scoretype = ORGV.scoretype
|
||||
AND OV.vorm = ORGV.vorm
|
||||
AND OV.geldigtm >= ORGV.geldigtm
|
||||
GROUP BY ORGV.id
|
||||
ORDER BY ORGV.geldigtm DESC
|
||||
LIMIT 2 ";
|
||||
|
||||
return $this->get_query_result();
|
||||
|
||||
}
|
||||
|
||||
function getVergelijkbareVersies2($orgversieid, $orgid){
|
||||
$this->sql = "SELECT FIL.id as filledid, ORGV.id, ORGV.versie_id, ORGV.vorm, ORGV.scoretype, SCHOOL.valtonder_id, SCHOOL.id as schoolid,
|
||||
DATE_FORMAT(ORGV.geldigvanaf,'%d-%m-%Y') AS geldigvanaf,
|
||||
DATE_FORMAT(ORGV.geldigtm,'%d-%m-%Y') AS geldig,
|
||||
DATE_FORMAT(ORGV.invullentm,'%d-%m-%Y') AS invullentm,
|
||||
ORGV.organisatie_id, FIL.organisatie_id as invuller
|
||||
FROM tb_filledversions FV
|
||||
JOIN tb_orgversies OV ON FV.orgversie_id = OV.id
|
||||
JOIN tb_orgversies ORGV ON OV.versie_id = ORGV.versie_id
|
||||
JOIN tb_filledversions FIL ON ORGV.id = FIL.orgversie_id
|
||||
JOIN tb_organisaties SCHOOL ON FIL.organisatie_id = SCHOOL.id
|
||||
JOIN tb_organisaties BG ON SCHOOL.valtonder_id = BG.id
|
||||
JOIN tb_organisaties KAMER ON BG.valtonder_id = KAMER.id
|
||||
WHERE KAMER.id = {$orgid}
|
||||
AND OV.id = {$orgversieid}
|
||||
AND OV.scoretype = ORGV.scoretype
|
||||
AND OV.vorm = ORGV.vorm
|
||||
AND OV.geldigtm >= ORGV.geldigtm
|
||||
GROUP BY ORGV.id
|
||||
ORDER BY ORGV.geldigtm DESC
|
||||
LIMIT 2 ";
|
||||
|
||||
return $this->get_query_result();
|
||||
|
||||
}
|
||||
|
||||
function getVergelijkbareVersies1($orgversieid, $orgid){
|
||||
$this->sql = "SELECT FIL.id as filledid, ORGV.id, ORGV.versie_id, ORGV.vorm, ORGV.scoretype, SCHOOL.valtonder_id, SCHOOL.id as schoolid,
|
||||
DATE_FORMAT(ORGV.geldigvanaf,'%d-%m-%Y') AS geldigvanaf,
|
||||
DATE_FORMAT(ORGV.geldigtm,'%d-%m-%Y') AS geldig,
|
||||
DATE_FORMAT(ORGV.invullentm,'%d-%m-%Y') AS invullentm,
|
||||
ORGV.organisatie_id, FIL.organisatie_id as invuller
|
||||
FROM tb_filledversions FV
|
||||
JOIN tb_orgversies OV ON FV.orgversie_id = OV.id
|
||||
JOIN tb_orgversies ORGV ON OV.versie_id = ORGV.versie_id
|
||||
JOIN tb_filledversions FIL ON ORGV.id = FIL.orgversie_id
|
||||
JOIN tb_organisaties SCHOOL ON FIL.organisatie_id = SCHOOL.id
|
||||
JOIN tb_organisaties BG ON SCHOOL.valtonder_id = BG.id
|
||||
JOIN tb_organisaties KAMER ON BG.valtonder_id = KAMER.id
|
||||
JOIN tb_organisaties SWV ON KAMER.valtonder_id = SWV.id
|
||||
WHERE SWV.id = {$orgid}
|
||||
AND OV.id = {$orgversieid}
|
||||
AND OV.scoretype = ORGV.scoretype
|
||||
AND OV.vorm = ORGV.vorm
|
||||
AND OV.geldigtm >= ORGV.geldigtm
|
||||
GROUP BY ORGV.id
|
||||
ORDER BY ORGV.geldigtm DESC
|
||||
LIMIT 2 ";
|
||||
|
||||
return $this->get_query_result();
|
||||
|
||||
}
|
||||
|
||||
function getVergelijkbareVersiesInd($orgversieid, $orgid, $userid){
|
||||
$this->sql = "SELECT FIL.id as filledid, FIL.user_id, ORGV.id, ORGV.versie_id, ORGV.vorm, ORGV.scoretype,
|
||||
DATE_FORMAT(ORGV.geldigvanaf,'%d-%m-%Y') AS geldigvanaf,
|
||||
DATE_FORMAT(ORGV.geldigtm,'%d-%m-%Y') AS geldig,
|
||||
DATE_FORMAT(ORGV.invullentm,'%d-%m-%Y') AS invullentm,
|
||||
ORGV.organisatie_id, FIL.organisatie_id as invuller
|
||||
FROM tb_filledversions FV
|
||||
JOIN tb_orgversies OV ON FV.orgversie_id = OV.id
|
||||
JOIN tb_orgversies ORGV ON OV.organisatie_id = ORGV.organisatie_id
|
||||
JOIN tb_filledversions FIL ON ORGV.id = FIL.orgversie_id
|
||||
WHERE FIL.user_id = {$userid}
|
||||
AND FV.user_id = {$userid}
|
||||
AND FIL.organisatie_id = {$orgid}
|
||||
AND OV.id = {$orgversieid}
|
||||
AND OV.versie_id = ORGV.versie_id
|
||||
AND OV.scoretype = ORGV.scoretype
|
||||
AND OV.vorm = ORGV.vorm
|
||||
AND OV.geldigtm >= ORGV.geldigtm
|
||||
GROUP BY ORGV.id
|
||||
ORDER BY ORGV.geldigtm DESC
|
||||
LIMIT 2";
|
||||
|
||||
return $this->get_query_result();
|
||||
|
||||
}
|
||||
|
||||
|
||||
function telVergelijkbareVersies3($orgversieid, $orgid){
|
||||
$this->sql = "SELECT count(DISTINCT FIL.id) AS meting
|
||||
FROM tb_filledversions FV
|
||||
JOIN tb_orgversies OV ON FV.orgversie_id = OV.id
|
||||
JOIN tb_orgversies ORGV ON OV.versie_id = ORGV.versie_id
|
||||
JOIN tb_filledversions FIL ON ORGV.id = FIL.orgversie_id
|
||||
JOIN tb_organisaties SCHOOL ON FIL.organisatie_id = SCHOOL.id
|
||||
JOIN tb_organisaties BG ON SCHOOL.valtonder_id = BG.id
|
||||
WHERE BG.id = {$orgid}
|
||||
AND OV.id = {$orgversieid}
|
||||
AND OV.scoretype = ORGV.scoretype
|
||||
AND OV.vorm = ORGV.vorm
|
||||
AND OV.geldigtm = ORGV.geldigtm ";
|
||||
|
||||
return $this->get_query_row('meting');
|
||||
}
|
||||
|
||||
|
||||
function telVergelijkbareVersies2($orgversieid, $orgid){
|
||||
$this->sql = "SELECT count(DISTINCT FIL.id) AS meting
|
||||
FROM tb_filledversions FV
|
||||
JOIN tb_orgversies OV ON FV.orgversie_id = OV.id
|
||||
JOIN tb_orgversies ORGV ON OV.versie_id = ORGV.versie_id
|
||||
JOIN tb_filledversions FIL ON ORGV.id = FIL.orgversie_id
|
||||
JOIN tb_organisaties SCHOOL ON FIL.organisatie_id = SCHOOL.id
|
||||
JOIN tb_organisaties BG ON SCHOOL.valtonder_id = BG.id
|
||||
JOIN tb_organisaties KAMER ON BG.valtonder_id = KAMER.id
|
||||
WHERE KAMER.id = {$orgid}
|
||||
AND OV.id = {$orgversieid}
|
||||
AND OV.scoretype = ORGV.scoretype
|
||||
AND OV.vorm = ORGV.vorm
|
||||
AND OV.geldigtm = ORGV.geldigtm ";
|
||||
|
||||
return $this->get_query_row('meting');
|
||||
}
|
||||
|
||||
|
||||
|
||||
function telVergelijkbareVersies1($orgversieid, $orgid){
|
||||
$this->sql = "SELECT count(DISTINCT FIL.id) AS meting
|
||||
FROM tb_filledversions FV
|
||||
JOIN tb_orgversies OV ON FV.orgversie_id = OV.id
|
||||
JOIN tb_orgversies ORGV ON OV.versie_id = ORGV.versie_id
|
||||
JOIN tb_filledversions FIL ON ORGV.id = FIL.orgversie_id
|
||||
JOIN tb_organisaties SCHOOL ON FIL.organisatie_id = SCHOOL.id
|
||||
JOIN tb_organisaties BG ON SCHOOL.valtonder_id = BG.id
|
||||
JOIN tb_organisaties KAMER ON BG.valtonder_id = KAMER.id
|
||||
JOIN tb_organisaties SWV ON KAMER.valtonder_id = SWV.id
|
||||
WHERE SWV.id = {$orgid}
|
||||
AND OV.id = {$orgversieid}
|
||||
AND OV.scoretype = ORGV.scoretype
|
||||
AND OV.vorm = ORGV.vorm
|
||||
AND OV.geldigtm = ORGV.geldigtm ";
|
||||
|
||||
return $this->get_query_row('meting');
|
||||
}
|
||||
|
||||
function telVergelijkbareVersies4Ind($orgversieid, $orgid){
|
||||
$this->sql = "SELECT count(DISTINCT FIL.id) AS meting
|
||||
FROM tb_filledversions FV
|
||||
JOIN tb_orgversies OV ON FV.orgversie_id = OV.id
|
||||
JOIN tb_filledversions FIL ON OV.id = FIL.orgversie_id
|
||||
JOIN tb_organisaties SCHOOL ON FIL.organisatie_id = SCHOOL.id
|
||||
WHERE SCHOOL.id = {$orgid}
|
||||
AND OV.id = {$orgversieid}
|
||||
";
|
||||
|
||||
return $this->get_query_row('meting');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Aantalxondersteuningsvorm_model mei 2015 */
|
||||
|
||||
class Flexsop_gebruikteversies_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_flexsop_gebruikteversies';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
function getVergelijkingen($hoofdstukID){
|
||||
$this->sql = " SELECT orgversie_id
|
||||
FROM tb_flexsop_gebruikteversies
|
||||
WHERE hoofdstuk_id = {$hoofdstukID}
|
||||
ORDER BY volgorde";
|
||||
$versies = $this->get_query_result();
|
||||
$vergelijkingen = [];
|
||||
foreach ($versies ? $versies : [] as $versie){
|
||||
array_push($vergelijkingen, $versie->orgversie_id);
|
||||
}
|
||||
return $vergelijkingen;
|
||||
}
|
||||
}// model
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Getoondeberichten_model december 2017 */
|
||||
|
||||
class Getoondeberichten_model extends MY_Model{
|
||||
|
||||
protected $tablename = 'tb_getoondeberichten';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Groepenxusers_model mei 2015 vervangt leerkrachten */
|
||||
|
||||
class Groepenxusers_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_groepenxusers';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
function getleerkrachten($groepid){
|
||||
$this->sql = " SELECT GU.id AS GUid,
|
||||
U.id as userid,
|
||||
U.aanhef,
|
||||
concat_ws(' ',U.voornaam, U.tussenvoegsel, U.achternaam) AS fullname
|
||||
FROM tb_groepenxusers GU
|
||||
JOIN tb_orgusers OU ON OU.id = GU.orguser_id
|
||||
JOIN tb_users U ON U.id = OU.user_id
|
||||
WHERE groep_id = {$groepid}";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Sop_model oktober 2015 */
|
||||
|
||||
class Hfstprofiel_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_hfstprofiel';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array();
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Home_model mei 2016 */
|
||||
|
||||
class Home_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_home';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**chapters_model januari 2016*/
|
||||
|
||||
class Hoofdstukken_model extends MY_Model{
|
||||
|
||||
protected $tablename = 'tb_hoofdstukken';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
function getstandaardchapters(){
|
||||
$this->sql =" SELECT id, nummer, naam, module
|
||||
FROM tb_hoofdstukken
|
||||
WHERE standaard = 1
|
||||
AND oud = 'N'
|
||||
ORDER BY nummer";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getaddedchapters($profielid){
|
||||
$this->sql="SELECT H.id, H.nummer, H.naam, H.module
|
||||
FROM tb_hoofdstukken H
|
||||
JOIN tb_hfstprofiel HP ON H.id = HP.chapter_id
|
||||
WHERE HP.profiel_id = {$profielid}
|
||||
AND oud = 'N'
|
||||
ORDER BY chapter_id";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
function ls_checkInleiding($profielID){
|
||||
$this->sql=" SELECT if (SI.id, true, false) as insop
|
||||
FROM tb_hoofdstukken H
|
||||
JOIN tb_sopinhouden SI ON ( H.id = SI.chapter_id AND SI.profiel_id = {$profielID})
|
||||
WHERE oud = 'N'";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function ls_getHoofdstukken($profielID){
|
||||
$this->sql=" SELECT H.id, H.nummer, H.naam, H.module, SI.volgorde, H.standaard, SI.id as sopinhoudID,
|
||||
if (SI.id, true, false) as insop,
|
||||
SI.orgversieid
|
||||
FROM tb_hoofdstukken H
|
||||
LEFT JOIN tb_licenties L ON H.module = L.modulenr
|
||||
LEFT JOIN tb_sopinhouden SI ON ( H.id = SI.chapter_id AND SI.profiel_id = {$profielID})
|
||||
WHERE oud = 'N'
|
||||
AND (L.orgid = {$this->globorgid} OR H.id = 49)
|
||||
ORDER BY insop DESC, SI.volgorde, H.naam";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getHoofdstukLabelsSop($sopid){
|
||||
$this->sql="SELECT H.id, H.nummer, H.naam, H.module, SI.volgorde, H.standaard, SI.id as sopinhoudID
|
||||
FROM tb_hoofdstukken H
|
||||
JOIN tb_sopinhouden SI ON H.id = SI.chapter_id
|
||||
WHERE SI.profiel_id = {$sopid}
|
||||
AND oud = 'N'
|
||||
GROUP BY H.id
|
||||
ORDER BY SI.volgorde";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
|
||||
function getStandaardLabelsSop($hfstids = FALSE){
|
||||
$this->sql="SELECT id, nummer, naam, module, volgorde, standaard, null as sopinhoudID
|
||||
FROM tb_hoofdstukken
|
||||
WHERE standaard = 1
|
||||
AND oud = 'N'
|
||||
";
|
||||
if($hfstids){
|
||||
$this->sql.="AND id NOT IN ({$hfstids})";
|
||||
}
|
||||
$this->sql.="ORDER BY volgorde";
|
||||
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getKeuzeLabelsSop($orgid, $hfstids){
|
||||
$this->sql="SELECT H.id, H.nummer, H.naam, H.module, H.volgorde, H.standaard
|
||||
FROM tb_hoofdstukken H
|
||||
JOIN tb_licenties L ON H.module = L.modulenr
|
||||
WHERE L.orgid = {$orgid}
|
||||
AND H.id NOT IN ({$hfstids})
|
||||
AND H.oud = 'N'
|
||||
AND H.standaard = 2
|
||||
ORDER BY volgorde";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getChapterKeuzeSop($orgid){
|
||||
$this->sql="SELECT H.id, H.nummer, H.naam, H.module, H.volgorde
|
||||
FROM tb_hoofdstukken H
|
||||
JOIN tb_licenties L ON H.module = L.modulenr
|
||||
WHERE L.organisatie_id = {$orgid}
|
||||
AND oud = 'N'
|
||||
ORDER BY H.volgorde";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getoldchapters(){
|
||||
$this->sql =" SELECT id, nummer, naam, module
|
||||
FROM tb_hoofdstukken
|
||||
WHERE standaard = 1
|
||||
AND oud = 'Y'
|
||||
ORDER BY nummer";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
|
||||
function getmodule($chapterid){
|
||||
$this->sql="SELECT M.sysnr
|
||||
FROM tb_modules M
|
||||
JOIN tb_hoofdstukken H ON M.sysnr = H.module
|
||||
WHERE H.id = {$chapterid}" ;
|
||||
return $this->get_query_row('sysnr');
|
||||
}
|
||||
|
||||
function getInleidingenOrg($orgid){
|
||||
$this->sql="SELECT SI
|
||||
FROM tb_modules M
|
||||
JOIN tb_hoofdstukken H ON M.sysnr = H.module
|
||||
WHERE H.id = 49 ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**Ijkpunten_model maart 2015 */
|
||||
|
||||
class Ijkpunten_model extends MY_Model{
|
||||
|
||||
protected $tablename = 'tb_ijkpunten';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array( 'shared/Organisaties_model',
|
||||
'monpas/Scores_model');
|
||||
$this->load->model($models);
|
||||
}
|
||||
function getijkpunten($orgversieid){
|
||||
$this->sql="SELECT Y.id, Y.nummer,Y.omschrijving,Y.toelichting
|
||||
FROM tb_orgversies OV
|
||||
JOIN tb_ijkpunten Y ON Y.versie_id = OV.versie_id
|
||||
WHERE OV.id ={$orgversieid}
|
||||
ORDER BY Y.nummer ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
|
||||
|
||||
function telijkpunten($orgversieid){
|
||||
$this->sql="SELECT COUNT(Y.id) AS aantalY
|
||||
FROM tb_orgversies OV
|
||||
JOIN tb_ijkpunten Y ON Y.versie_id = OV.versie_id
|
||||
WHERE OV.id ={$orgversieid} ";
|
||||
return $this->get_query_row('aantalY');
|
||||
}
|
||||
|
||||
function getijkpunten1($versieid){
|
||||
$this->sql="SELECT Y.id, Y.nummer,Y.omschrijving,Y.toelichting
|
||||
FROM tb_ijkpunten Y
|
||||
WHERE Y.versie_id ={$versieid}
|
||||
ORDER BY Y.nummer ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
function getijkpunt($id)
|
||||
{
|
||||
$this->sql = "SELECT id, nummer,omschrijving,toelichting
|
||||
FROM tb_ijkpunten
|
||||
WHERE id ={$id} ";
|
||||
return $this->get_query_row();
|
||||
|
||||
}
|
||||
|
||||
|
||||
function getscores($orgversieid , $orgid){
|
||||
$organisatie = $this->Organisaties_model->get_record_by_id($orgid);
|
||||
$scores = null;
|
||||
// als de organisatie een school is : haal de gemiddelde score op (als de 'ik-versie" wordt gebruikt
|
||||
// let op als ik-versie dan moeten de gegevens van de users worden opgehaald maar
|
||||
// dat gaat vanzelf omdat gezocht wordt naar organisatie (via filled versions);
|
||||
// let op ja nee bezig wordt vertaald naar 10, 0 en 5
|
||||
// let op ja nee nvt wordt vertaald naar 10 0 en niet meegerekend bij aantallen voor gem
|
||||
if ($organisatie->soort ==4) {
|
||||
$scores =$this->Scores_model->calculateschool($orgversieid, $orgid);
|
||||
};
|
||||
// als de organisatie geen school is: haal de gemiddeldse scores over alle organisaties op
|
||||
|
||||
if ($organisatie->soort == 3){
|
||||
$scores = $this->Scores_model->calculateBG($orgversieid, $orgid);
|
||||
}
|
||||
if ($organisatie->soort== 1 || $organisatie->soort == 2){
|
||||
if ($organisatie->soort == 2){
|
||||
$bgs = $this->Organisaties_model->getorgsvanaf($organisatie->id);
|
||||
}
|
||||
if($organisatie->soort ==1){
|
||||
$bgs = $this->Organisaties_model->getbgsonderswv($organisatie->id);
|
||||
}
|
||||
if ($bgs){
|
||||
foreach($bgs as $bg){
|
||||
$bglijst[] = $bg->id;
|
||||
}
|
||||
$lijst = implode(',',$bglijst);
|
||||
$scores=$this->Scores_model->calculateBGs($orgversieid, $lijst);
|
||||
}
|
||||
}
|
||||
return $scores;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**indicatoren_model maart 2015 */
|
||||
|
||||
class Indicatoren_model extends MY_Model{
|
||||
|
||||
protected $tablename = 'tb_indicatoren';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
function getindicatoren($ijkpuntid){
|
||||
$this->sql="SELECT I.id, nummer, omschrijving1, omschrijving2, inspectie,
|
||||
REPLACE(gewicht,'.',',') AS gewicht,
|
||||
IF (count(SC.id) = 0, TRUE,FALSE) AS deleteok
|
||||
FROM tb_indicatoren I
|
||||
LEFT JOIN tb_scores SC ON SC.indicator_id = I.id
|
||||
WHERE I.ijkpunt_id = {$ijkpuntid}
|
||||
GROUP BY I.id
|
||||
ORDER BY nummer";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
function getindicator($id){
|
||||
$this->sql="SELECT I.id, nummer, omschrijving1, omschrijving2, inspectie,
|
||||
REPLACE(gewicht,'.',',') AS gewicht, IF (count(SC.id) = 0, TRUE,FALSE) AS deleteok
|
||||
FROM tb_indicatoren I
|
||||
LEFT JOIN tb_scores SC ON SC.indicator_id = I.id
|
||||
WHERE I.id = {$id}";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Labels_model januari 2015 */
|
||||
|
||||
class Labels_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_labels';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array();
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
function getLabel($sysnr){
|
||||
$this->sql="SELECT waarde
|
||||
FROM tb_translate
|
||||
WHERE modulenr = {$sysnr} ";
|
||||
return $this->get_query_row("waarde");
|
||||
}
|
||||
|
||||
function getLabels($module){
|
||||
$this->sql="SELECT *
|
||||
FROM tb_translate
|
||||
WHERE modulenr = {$module} ";
|
||||
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
|
||||
function getalllabels($module = false){
|
||||
if (! $module) $module = $this->session->userdata('module');
|
||||
$this->sql="SELECT L.omschrijving, T.waarde
|
||||
FROM tb_translate T
|
||||
JOIN tb_labels L on L.id = T.labelid
|
||||
WHERE modulenr = {$module}";
|
||||
$labels = $this->get_query_result();
|
||||
$lbl = array();
|
||||
if ($labels){
|
||||
foreach($labels as $label){
|
||||
$lbl[$label->omschrijving]=$label->waarde;
|
||||
};// foreach
|
||||
}
|
||||
return $lbl;
|
||||
}
|
||||
|
||||
|
||||
function gettabellabel($modulenr){
|
||||
$this->sql="SELECT waarde
|
||||
FROM tb_translate T
|
||||
WHERE modulenr = {$modulenr}
|
||||
AND labelid = 2 ";
|
||||
return $this->get_query_row("waarde");
|
||||
|
||||
}
|
||||
function getresultaatlabel($modulenr){
|
||||
$this->sql="SELECT waarde
|
||||
FROM tb_translate T
|
||||
WHERE modulenr = {$modulenr}
|
||||
AND labelid = 1 ";
|
||||
return $this->get_query_row("waarde");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Leerkrachten_model mei 2015 */
|
||||
|
||||
class Leerkrachten_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_leerkrachten';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
// function getleerkracht($lkid){
|
||||
// $this->sql = "SELECT id, organisatie_id, aanhef, voornaam, tussenvoegsel,achternaam,email
|
||||
// FROM tb_leerkrachten
|
||||
// WHERE id = {$lkid}";
|
||||
// return $this->get_query_row();
|
||||
// }
|
||||
// function getleerkrachten($orgid){
|
||||
// $this->sql = "SELECT id, organisatie_id, aanhef, voornaam, tussenvoegsel,achternaam,email
|
||||
// FROM tb_leerkrachten
|
||||
// WHERE organisatie_id = {$orgid}
|
||||
// ORDER BY achternaam";
|
||||
// return $this->get_query_result();
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,237 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
|
||||
class Maakinhoudnieuw_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_sopinhouden';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array("monpas/Ambities_model",
|
||||
'shared/Users_model',
|
||||
'monpas/Diversiteits_model',
|
||||
'monpas/Filledversions_model',
|
||||
'monpas/Groepen_model',
|
||||
'monpas/Hoofdstukken_model',
|
||||
'monpas/Labels_model',
|
||||
'monpas/Ondersteuningtijden_model',
|
||||
'monpas/Orgversies_model',
|
||||
'monpas/Schooldetails_model',
|
||||
'shared/Schooljaren_model',
|
||||
'monpas/Scores_model',
|
||||
'monpas/Sop_model',
|
||||
'monpas/Standaardteksten_model',
|
||||
'monpas/Wenssituaties_model',
|
||||
'monpas/Hoofdstukken_model');
|
||||
$this->load->model($models);
|
||||
$this->load->library('monpas/kleurcodes');
|
||||
}
|
||||
|
||||
function maakEnSaveInleiding($profielid, $chapterid,$orgversieid){
|
||||
$content = $this->maakInleiding($profielid, $chapterid);
|
||||
$this->SaveContent($profielid, $chapterid,$orgversieid, $content,10);
|
||||
}
|
||||
|
||||
function maakInleiding($profielid, $chapterid){
|
||||
$content = $this->Standaardteksten_model->get(['chapter_id' =>$chapterid],'content' , true);
|
||||
$org = $this->Organisaties_model->get(['id' => $this->globorgid], false, true);
|
||||
$bg = $this->Organisaties_model->get_fieldvalue(["id" => $org->valtonder_id], "naam");
|
||||
$orgdetails = $this->Schooldetails_model->get_details($this->globorgid);
|
||||
$specialfields = $this->Sopviews_model->get(['soort' => "INLEIDING"], false,false);
|
||||
$data = [ 'bevoegdgezag' => $bg,
|
||||
'schoolnaam' => $org->naam,
|
||||
'details' => $orgdetails];
|
||||
|
||||
foreach ($specialfields as $specialfielddefinitie) {
|
||||
$fieldhtml = $this->load->view("monpas/sopkeuze/" . $specialfielddefinitie->pad, ['data' => $data], TRUE);
|
||||
$content = $this->vervangSpecialField($specialfielddefinitie, $content , $fieldhtml);
|
||||
}
|
||||
return $content;
|
||||
} // maak inleiding
|
||||
|
||||
function vervangSpecialField($definitie, $content, $fieldhtml){
|
||||
$vervang = $definitie->vervangingscode;
|
||||
|
||||
$pos = strpos($content, $vervang);
|
||||
if ($pos) {
|
||||
$lengte = strlen($vervang) + 3;
|
||||
$content = substr_replace($content, $fieldhtml, $pos, $lengte);
|
||||
}// if strpos
|
||||
return $content;
|
||||
}
|
||||
|
||||
function SaveContent($profielid, $chapterid, $orgversieid, $content, $volgorde){
|
||||
|
||||
$sopinhoudid = $this->Sopinhouden_model->get(['profiel_id'=> $profielid, 'chapter_id' =>$chapterid], false, true);
|
||||
if ($sopinhoudid){
|
||||
$this->Sopinhouden_model->update_record(['content' =>$content, 'volgorde' =>$volgorde], $sopinhoudid);
|
||||
} else{
|
||||
$data=['profiel_id' => $profielid,
|
||||
'chapter_id' => $chapterid,
|
||||
'content' => $content,
|
||||
'orgversieid' => $orgversieid,
|
||||
'volgorde' => $volgorde];
|
||||
$this->Sopinhouden_model->insert_record($data);
|
||||
}
|
||||
}
|
||||
|
||||
function fVervers($chapterID, $sopinhoudid, $orgversieid, $wat, $vergelijkingen){
|
||||
list($newContent, $orgversieid, $error) = $this->fVerversContent($chapterID, $sopinhoudid,$orgversieid,$wat, $vergelijkingen);
|
||||
|
||||
if (! $error){
|
||||
$this->Sopinhouden_model->update_record(['content' =>$newContent, 'orgversieid'=>$orgversieid ], $sopinhoudid);
|
||||
}
|
||||
return $error;
|
||||
}
|
||||
|
||||
|
||||
function fVerversContent($chapterID, $sopinhoudid, $orgversieid, $wat, $vergelijkingen){
|
||||
$inhoudrecord = $this->Sopinhouden_model->get(['id' =>$sopinhoudid], false ,true);
|
||||
|
||||
if (! $orgversieid || $orgversieid == 0) $orgversieid = $inhoudrecord->orgversieid;
|
||||
|
||||
if ($wat == "TABELLEN") $content = $inhoudrecord->content;
|
||||
else $content = $this->Standaardteksten_model->get(['chapter_id' =>$chapterID],'content', true);
|
||||
|
||||
$error = false;
|
||||
|
||||
if (! $content){
|
||||
$error = "Er zijn nog geen standaardteksten gemaakt voor dit hoofdstuk. Neem contact op met de helpdesk.";
|
||||
return [$content, $orgversieid, $error];
|
||||
}
|
||||
|
||||
if ($chapterID == 49){
|
||||
$data = $this->CreateDataInleiding();
|
||||
$soort = $data['soort'];
|
||||
}
|
||||
elseif ($chapterID == 56 || $chapterID == 57){
|
||||
$soort = 'ALLEENTEKST';
|
||||
}
|
||||
else {
|
||||
$dataArray = $this->CreateData($chapterID, $orgversieid, $vergelijkingen);
|
||||
$soort = $dataArray['soort'];
|
||||
$data = $dataArray['data'];
|
||||
if ( isset($data['lijsten']) )
|
||||
if (! $data['lijsten'][0]->scores){
|
||||
$error = "Er zijn geen ingevulde lijsten (meer) bij de gekozen versie van dit instrument.";
|
||||
return [$content, $orgversieid, $error];
|
||||
}
|
||||
if (isset($data['oordelen']))
|
||||
if (! $data['oordelen']){
|
||||
$error = "Er zijn geen ingevulde lijsten (meer) bij de gekozen versie van dit instrument.";
|
||||
return [$content, $orgversieid, $error];
|
||||
}
|
||||
if (! isset($data['oordelen']) && ! isset($data['lijsten']) && ! $dataArray['soort']=="DIVERSITEIT"){
|
||||
$error = "Er zijn geen ingevulde lijsten (meer) bij de gekozen versie van dit instrument.";
|
||||
return [$content, $orgversieid, $error];
|
||||
}
|
||||
if (! isset($data['versie']) ) $data['versie'] = $this->setVersie($orgversieid);
|
||||
if (! isset($data['school']) ) $data['school'] = $this->Organisaties_model->get_record_by_id($this->globorgid);
|
||||
}
|
||||
|
||||
$specialfields = $this->Sopviews_model->get(['soort' => $soort], false,false);
|
||||
|
||||
|
||||
if ($specialfields) {
|
||||
foreach ($specialfields as $specialfielddefinitie) {
|
||||
|
||||
$fieldhtml = $this->load->view("monpas/sopkeuze/" . $specialfielddefinitie->pad, ['data' => $data], TRUE);
|
||||
|
||||
if ($specialfielddefinitie->type == "GRA") {
|
||||
|
||||
$afbeelding = $this->MaakAfbeelding($fieldhtml, $specialfielddefinitie->tabelid); // was imagecode
|
||||
|
||||
list($content, $error) = $this->resetSpecialField($specialfielddefinitie, $content, $afbeelding);
|
||||
} else {
|
||||
list($content, $error) = $this->resetSpecialField($specialfielddefinitie, $content , $fieldhtml);
|
||||
}
|
||||
}
|
||||
} // if specialfields
|
||||
return [$content, $orgversieid, $error];
|
||||
}
|
||||
|
||||
function MaakAfbeelding($fieldhtml, $idnaam){
|
||||
$image = $this->Phantom_model->create_img($fieldhtml, 'test', FALSE, FALSE, array(650, 0));
|
||||
$image = "<img src='data:image/png;base64," .$image. "' id='" . $idnaam . "' />";
|
||||
return $image;
|
||||
}
|
||||
|
||||
function CreateDataInleiding(){
|
||||
$org = $this->Organisaties_model->get(['id' => $this->globorgid], false, true);
|
||||
$bg = $this->Organisaties_model->get_fieldvalue(["id" => $org->valtonder_id], "naam");
|
||||
$orgdetails = $this->Schooldetails_model->get_details($this->globorgid);
|
||||
|
||||
$data = [ 'bevoegdgezag' => $bg,
|
||||
'schoolnaam' => $org->naam,
|
||||
'details' => $orgdetails,
|
||||
'soort' => 'INLEIDING'];
|
||||
return $data;
|
||||
}
|
||||
|
||||
function createData($chapterID, $orgversieID, $vergelijkingen){
|
||||
$hoofdstukkeuze = new HoofdstukKeuze($chapterID, $orgversieID, $vergelijkingen);
|
||||
return $hoofdstukkeuze->getHoofdstukKeuze();
|
||||
}
|
||||
|
||||
function resetSpecialField($definitie, $content, $fieldhtml){
|
||||
$error = false;
|
||||
$html = new DomDocument();
|
||||
|
||||
libxml_use_internal_errors(true);
|
||||
//$html->loadHTML($content, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
|
||||
// bovenstaande removes de closing </h1> tag op de eerst regel. Weird
|
||||
$html->loadHTML($content);
|
||||
$book = $html->getElementsByTagName('body');
|
||||
if (isset($book->parentNode)) $book->parentNode->removeChild($book); // dit werkt blijkbaar niet omdat $book dan geen parentNode heeft
|
||||
$book = $html->getElementsByTagName('html');
|
||||
if (isset($book->parentNode)) $book->parentNode->removeChild($book);
|
||||
$html->removeChild($html->doctype);
|
||||
|
||||
if (libxml_get_errors()) {
|
||||
log_message('error', 'HTML error in the document');
|
||||
$error= "Maken/verversen van het hoofdstuk is niet gelukt.";
|
||||
libxml_clear_errors();
|
||||
return [$content, $error];
|
||||
}
|
||||
|
||||
if( $html->getElementById($definitie->tabelid) ){
|
||||
$book = $html->getElementById($definitie->tabelid);
|
||||
$book->parentNode->removeChild($book);
|
||||
}
|
||||
|
||||
try{
|
||||
$sxe = simplexml_load_string($fieldhtml);
|
||||
$dom_sxe = dom_import_simplexml($sxe);
|
||||
$dom_sxe = $html->importNode($dom_sxe, true);
|
||||
if ($html->getElementById($definitie->vervangingscode) )
|
||||
$html->getElementById($definitie->vervangingscode)->appendChild($dom_sxe);
|
||||
// onderstaande else kan niet omdat niet altijd alle vervangingscodes worden gebruikt
|
||||
// als niet gebruikt dan moeten ze worden overgeslagen
|
||||
//else $html->appendChild($dom_sxe);
|
||||
} catch(Exception $e) {
|
||||
log_message('error', 'Error while parsing the document');
|
||||
$error= "Maken/verversen van het hoofdstuk is niet gelukt.";
|
||||
return [$content, $error];
|
||||
}
|
||||
|
||||
$content = $html->saveHTML();
|
||||
|
||||
return [$content, $error];
|
||||
}
|
||||
|
||||
function getVolgnummer($profielID){
|
||||
$this->sql = "SELECT MAX(volgorde) + 10 as volgnummer
|
||||
FROM tb_sopinhouden
|
||||
WHERE profiel_id= {$profielID}";
|
||||
return $this->get_query_row('volgnummer');
|
||||
}
|
||||
|
||||
function setVersie($orgversieid){
|
||||
$orgversie = $this->Orgversies_model->get_record_by_id($orgversieid);
|
||||
$versie = $this->Versies_model ->get_record_by_id($orgversie->versie_id);
|
||||
$versie->naam = $versie->naam . ', periode: ' . $orgversie->periodenummer . ': ' . $orgversie->geldigvanaf . ' - ' . $orgversie->geldigtm;
|
||||
return $versie;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Menus_model februari 2015 */
|
||||
|
||||
class Menus_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_menus';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
function getmenu($module, $autorisatienivo){
|
||||
$this->sql="SELECT id, naam, paginanaam,holdernaam
|
||||
FROM tb_menus
|
||||
WHERE ( {$autorisatienivo} & autorisatienivo)
|
||||
AND ((module = {$module}) OR ({$module} !=0 && module = 9))
|
||||
AND valtonder = 0
|
||||
ORDER BY volgorde";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
function getsubmenus($pageid,$autorisatienivo){
|
||||
$this->sql="SELECT id, naam, paginanaam, holdernaam, volgorde
|
||||
FROM tb_menus
|
||||
WHERE ( {$autorisatienivo} & autorisatienivo)
|
||||
AND valtonder= $pageid
|
||||
ORDER BY volgorde" ;
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function gettypes($modulenr){
|
||||
$this->sql="SELECT naam, paginanaam, sop
|
||||
FROM tb_menus
|
||||
WHERE sop IS NOT NULL
|
||||
AND module = {$modulenr}
|
||||
ORDER BY volgorde" ;
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Modulebericht_model december 2017 */
|
||||
|
||||
class Modulebericht_model extends MY_Model{
|
||||
|
||||
protected $tablename = 'tb_modulebericht';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Modules_model februari 2015 */
|
||||
|
||||
class Modules_model extends MY_Model{
|
||||
|
||||
protected $tablename = 'tb_modules';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
function getallmodules(){
|
||||
$this->sql =" SELECT id, sysnr, naam, naamkort
|
||||
FROM tb_modules
|
||||
ORDER BY naam";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
function getmodulesmetlijst(){
|
||||
$this->sql =" SELECT sysnr, naam
|
||||
FROM tb_modules
|
||||
WHERE heeftlijst = 1
|
||||
ORDER BY volgorde";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getversietoegevoegdemodule($chapterid){
|
||||
$this->sql =" SELECT *
|
||||
FROM tb_modules M
|
||||
JOIN tb_hoofdstukken H ON H.module = M.sysnr
|
||||
WHERE H.volgorde = {$chapterid} ";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
|
||||
function getclustersmetberichtselectie($berichtid){
|
||||
$this->sql =" SELECT C.id AS keuzeid, C.naam AS keuzenaam, CL.id, CL.naam
|
||||
FROM tb_cluster C
|
||||
LEFT JOIN tb_cluster CL ON C.id = CL.id
|
||||
JOIN tb_modules M. ON C.id = M.cluster_id
|
||||
JOIN tb_modulebericht ON MB.modulenr = M.sysnr
|
||||
WHERE MB.bericht_id = {$berichtid}
|
||||
ORDER BY CL.id ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getclusters(){
|
||||
$this->sql =" SELECT id AS clusterid, naam
|
||||
FROM tb_cluster
|
||||
ORDER BY id ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
function getmodulesbijcluster($clusterid){
|
||||
$this->sql =" SELECT id, naam, sysnr AS modulenr, cluster_id AS clusterid
|
||||
FROM tb_modules
|
||||
WHERE cluster_id = {$clusterid}
|
||||
ORDER BY id ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function get_instrumenten_ind_org($orgid){
|
||||
$this->sql = "SELECT M.id AS moduleid, M.naam AS modulenaam, M.naamkort AS modulekort, M.cluster_id, M.sysnr,
|
||||
OV.id as orgversieid, OV.scoretype,
|
||||
DATE_FORMAT(OV.geldigvanaf, '%d-%m-%Y') AS geldigvanaf,
|
||||
DATE_FORMAT(OV.geldigtm, '%d-%m-%Y') AS geldigtm,
|
||||
DATE_FORMAT(OV.invullentm, '%d-%m-%Y') AS invullentm,
|
||||
O.id As orgid, O.portal_id, O.soort, O.naam AS orgnaan, O.naamkort as orgnaamkort
|
||||
FROM tb_modules M
|
||||
JOIN tb_versies V ON M.sysnr = V.modulenr
|
||||
JOIN tb_orgversies OV ON V.id = OV.versie_id
|
||||
JOIN tb_filledversions FV ON OV.id = FV.orgversie_id
|
||||
JOIN tb_organisaties O ON O.id = FV.organisatie_id
|
||||
WHERE O.id = {$orgid}
|
||||
AND M.heeftlijst = 1
|
||||
AND OV.vorm = 2
|
||||
AND O.actief = 1
|
||||
GROUP BY M.sysnr
|
||||
ORDER BY M.cluster_id, M.naam ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function get_instrumenten_ingevuld_ind($moduleid, $userid, $orgid){
|
||||
$this->sql = "SELECT OV.id as orgversieid, FV.id as filledid, M.id as moduleid, M.sysnr, V.id as versieid, FV.organisatie_id, OV.periodenummer,
|
||||
OV.actief, OV.scoretype, DATE_FORMAT(OV.geldigtm,'%d-%m-%Y') AS geldigtm, V.naam, OV.vorm
|
||||
FROM tb_filledversions FV
|
||||
JOIN tb_orgversies OV ON OV.id = FV.orgversie_id
|
||||
JOIN tb_versies V ON V.id = OV.versie_id
|
||||
JOIN tb_modules M ON M.sysnr = V.modulenr
|
||||
WHERE M.id= {$moduleid}
|
||||
AND FV.user_id = {$userid}
|
||||
AND FV.organisatie_id ={$orgid}
|
||||
AND M.heeftlijst = 1
|
||||
AND OV.vorm = 2 " ;
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Ondersteuningsvormen_model mei 2015 */
|
||||
|
||||
class Ondersteuningsvormen_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_ondersteuningsvormen';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
function getvormen($orgid, $min, $max){
|
||||
$this->sql="SELECT id, organisatie_id, naam, nivo
|
||||
FROM tb_ondersteuningsvormen
|
||||
WHERE (organisatie_id = 0 OR organisatie_id = {$orgid})
|
||||
AND actief = 1
|
||||
AND nivo BETWEEN {$min} AND {$max}
|
||||
ORDER BY nivo, organisatie_id, volgorde ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Ondersteuningtijden_model mei 2015 */
|
||||
|
||||
class Ondersteuningtijden_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_ondersteuningtijden';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
function getminuten($groepid, $dagnr, $soort){
|
||||
$this->sql="SELECT minuten
|
||||
FROM tb_ondersteuningtijden
|
||||
WHERE groep_id = {$groepid}
|
||||
AND dagnr = {$dagnr}
|
||||
AND soort = '{$soort}'";
|
||||
$result = $this->get_query_row();
|
||||
if ($result) {return $result->minuten;}
|
||||
else {return $result;};
|
||||
}
|
||||
|
||||
function getgroeptijden($groepid){
|
||||
$this->sql = "SELECT dagnr, soort, minuten
|
||||
FROM tb_ondersteuningtijden
|
||||
WHERE groep_id = {$groepid}
|
||||
ORDER BY dagnr ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**Oordelen_model mei 2017 */
|
||||
|
||||
class Oordelen_model extends MY_Model{
|
||||
|
||||
protected $tablename = 'tb_oordelen';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
function getoordelenorgs($orgversieid, $orgid){
|
||||
$this->sql="SELECT Y.nummer ,FV.id,
|
||||
IF (OD.norm_id, OD.norm_id, 0) as normID
|
||||
FROM tb_ijkpunten Y
|
||||
JOIN tb_versies V ON Y.versie_id = V.id
|
||||
JOIN tb_orgversies OV ON OV.versie_id = V.id
|
||||
JOIN tb_filledversions FV ON FV.orgversie_id = OV.id
|
||||
LEFT JOIN tb_oordelen OD ON (OD.filledversion_id = FV.id AND OD.ijkpunt_id = Y.id )
|
||||
WHERE OV.id = {$orgversieid}
|
||||
AND FV.organisatie_id ={$orgid}
|
||||
AND FV.meetellen = 1
|
||||
ORDER BY Y.nummer";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**Orgversies_model maart 2015 */
|
||||
|
||||
class Orgversies_model extends MY_Model{
|
||||
|
||||
protected $tablename = 'tb_orgversies';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
function getallorgversies($orgid, $module, $actief=FALSE){
|
||||
$this->sql="SELECT OV.id,
|
||||
OV.organisatie_id,
|
||||
periodenummer,
|
||||
OV.actief,
|
||||
versie_id,
|
||||
vorm, scoretype,
|
||||
DATE_FORMAT(geldigvanaf,'%d-%m-%Y') as geldigvanaf,
|
||||
DATE_FORMAT(geldigtm,'%d-%m-%Y') as geldigtm,
|
||||
DATE_FORMAT(invullentm,'%d-%m-%Y') as invullentm,
|
||||
V.naam,
|
||||
count(FV.id) AS ingevuld,
|
||||
CASE WHEN count(AO.optie) = count(AO.omschrijving) AND count(AO.omschrijving) > 0 THEN
|
||||
1
|
||||
ELSE 0
|
||||
END AS scoretekst,
|
||||
score_omschrijving
|
||||
FROM tb_orgversies OV
|
||||
JOIN tb_versies V ON V.id = versie_id
|
||||
LEFT JOIN tb_filledversions FV ON FV.orgversie_id = OV.id
|
||||
LEFT JOIN tb_antwoordopties AO ON AO.type_nr = OV.scoretype
|
||||
WHERE OV.organisatie_id = {$orgid}
|
||||
AND V.actief = 1
|
||||
AND V.modulenr = {$module}";
|
||||
if ($actief){
|
||||
$this->sql .=" AND OV.actief = 1";
|
||||
}
|
||||
$this->sql .=" GROUP BY OV.id
|
||||
ORDER BY periodenummer DESC";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getVersieinfo($orgversieid){
|
||||
$this->sql="SELECT OV.id AS orgversieid,
|
||||
OV.organisatie_id,
|
||||
OV.periodenummer,
|
||||
OV.actief,
|
||||
OV.versie_id,
|
||||
OV.vorm, OV.scoretype,
|
||||
DATE_FORMAT(geldigvanaf,'%d-%m-%Y') as geldigvanaf,
|
||||
DATE_FORMAT(geldigtm,'%d-%m-%Y') as geldigtotenmet,
|
||||
DATE_FORMAT(invullentm,'%d-%m-%Y') as invullentm,
|
||||
A.omschrijving,
|
||||
V.naam
|
||||
FROM tb_orgversies OV
|
||||
JOIN tb_versies V ON V.id = versie_id
|
||||
JOIN tb_antwoordtypes A ON A.sysnr = OV.scoretype
|
||||
WHERE OV.id = {$orgversieid}
|
||||
ORDER BY geldigtm DESC";
|
||||
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getkoppeling($id){
|
||||
$this->sql="SELECT OV.id, versie_id,vorm,scoretype, OV.actief, OV.organisatie_id
|
||||
periodenummer, score_omschrijving,
|
||||
DATE_FORMAT(geldigvanaf,'%d-%m-%Y') as geldigvanaf,
|
||||
DATE_FORMAT(geldigtm,'%d-%m-%Y') as geldigtm,
|
||||
DATE_FORMAT(invullentm,'%d-%m-%Y') as invullentm,
|
||||
V.naam ,
|
||||
count(FV.id) AS ingevuld
|
||||
FROM tb_orgversies OV
|
||||
JOIN tb_versies V ON V.id = versie_id
|
||||
LEFT JOIN tb_filledversions FV ON FV.orgversie_id = OV.id
|
||||
WHERE OV.id = {$id}";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
|
||||
function getversie($id){
|
||||
$this->sql="SELECT id, naam, ingangsdatum,systemnorm, actief
|
||||
FROM tb_versies
|
||||
WHERE id = {$id}";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
|
||||
function getVorm($orgversieid){
|
||||
$this->sql= "SELECT vorm
|
||||
FROM tb_orgversies
|
||||
WHERE id = {$orgversieid} ";
|
||||
return $this->get_query_row('vorm');
|
||||
}
|
||||
|
||||
function gettargetversie($orgid, $today){
|
||||
$this->sql="SELECT id, versie_id, gebruikvanaf, vorm
|
||||
FROM tb_orgversies
|
||||
WHERE organisatie_id = {$orgid}
|
||||
AND geldigvanaf <= '{$today}'
|
||||
AND geldigtm >= '{$today}'
|
||||
ORDER BY periodenummer
|
||||
LIMIT 1";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
function getmaxperiode($orgid){
|
||||
$this->sql = "SELECT MAX(periodenummer) AS nummer
|
||||
FROM tb_orgversies
|
||||
WHERE organisatie_id = {$orgid}";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
function getijkpunten($orgversieid){
|
||||
$this->sql="SELECT Y.omschrijving, Y.toelichting , Y.nummer
|
||||
FROM tb_orgversies O
|
||||
JOIN tb_versies V ON V.id = O.versie_id
|
||||
JOIN tb_ijkpunten Y ON Y.versie_id = V.id
|
||||
WHERE O.id = {$orgversieid}
|
||||
ORDER BY Y.nummer ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
function updateactief($orgid, $modulenr){
|
||||
$this->sql="UPDATE tb_orgversies OV
|
||||
JOIN tb_versies V ON V.id = OV.versie_id
|
||||
SET OV.actief =0
|
||||
WHERE OV.organisatie_id = {$orgid}
|
||||
AND V.modulenr={$modulenr}";
|
||||
$this->db->query($this->sql);
|
||||
}
|
||||
|
||||
function get_vergelijkbaar($orgversieid){
|
||||
$this->sql= "SELECT O.id
|
||||
FROM tb_orgversies O
|
||||
JOIN tb_orgversies OV ON O.organisatie_id = OV.organisatie_id
|
||||
WHERE OV.id = {$orgversieid}
|
||||
AND O.versie_id = OV.versie_id
|
||||
AND O.scoretype = OV.scoretype
|
||||
ORDER BY O.geldigtm DESC
|
||||
LIMIT 2 ";
|
||||
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
|
||||
function get_vergelijkbaar2($orgversieid){
|
||||
$this->sql= "SELECT O.id, O.vorm, O.scoretype, O.versie_id, O.periodenummer, O.actief, DATE_FORMAT(O.geldigvanaf,'%d-%m-%Y') AS geldigvanaf,
|
||||
DATE_FORMAT(O.geldigtm,'%d-%m-%Y') AS geldigtm,
|
||||
DATE_FORMAT(O.invullentm,'%d-%m-%Y') AS invullentm
|
||||
FROM tb_orgversies O
|
||||
JOIN tb_orgversies OV ON O.organisatie_id = OV.organisatie_id
|
||||
WHERE OV.id = {$orgversieid}
|
||||
AND O.versie_id = OV.versie_id
|
||||
AND O.scoretype = OV.scoretype
|
||||
AND O.geldigtm <= OV.geldigtm
|
||||
ORDER BY O.geldigtm DESC
|
||||
LIMIT 2 ";
|
||||
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function get_vergelijkbaarSWVKamer($orgversieid){
|
||||
$this->sql= "SELECT O.id, O.vorm, O.scoretype, O.versie_id, O.periodenummer, O.actief, DATE_FORMAT(O.geldigvanaf,'%d-%m-%Y') AS geldigvanaf,
|
||||
DATE_FORMAT(O.geldigtm,'%d-%m-%Y') AS geldigtm,
|
||||
DATE_FORMAT(O.invullentm,'%d-%m-%Y') AS invullentm
|
||||
FROM tb_orgversies O
|
||||
JOIN tb_orgversies OV ON O.organisatie_id = OV.organisatie_id
|
||||
WHERE OV.id = {$orgversieid}
|
||||
AND O.versie_id = OV.versie_id
|
||||
AND O.scoretype = OV.scoretype
|
||||
AND O.geldigtm <= OV.geldigtm
|
||||
ORDER BY O.geldigtm DESC
|
||||
LIMIT 2 ";
|
||||
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getversiecats($orgid, $module){
|
||||
$this->sql="SELECT Y.nummer, Y.omschrijving
|
||||
FROM tb_orgversies OV
|
||||
JOIN tb_versies V ON V.id = versie_id
|
||||
JOIN tb_ijkpunten Y ON Y.versie_id = V.id
|
||||
WHERE OV.organisatie_id = {$orgid}
|
||||
AND modulenr = {$module}
|
||||
AND OV.actief = 1
|
||||
ORDER BY UPPER(omschrijving) DESC";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Schooldetails_model mei 2015 */
|
||||
|
||||
class Schooldetails_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_schooldetails';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
function get_details($schoolid){
|
||||
$this->sql="SELECT id, organisatie_id, straat, plaats, telefoon, email1, web, directie, ib, email2, logo
|
||||
FROM tb_schooldetails
|
||||
WHERE organisatie_id={$schoolid} ";
|
||||
return $this->get_query_row();
|
||||
|
||||
}
|
||||
|
||||
function get_details2($schoolid){
|
||||
$this->sql="SELECT id, organisatie_id,
|
||||
if (straat AND straat is not null, straat, '' ) as straat,
|
||||
if (plaats AND plaats is not null, plaats, '') as plaats,
|
||||
if (telefoon AND telefoon is not null, telefoon,'') as telefoon,
|
||||
if (email1 AND email1 is not null, email1, '') as email1,
|
||||
if (web AND web is not null, web , '') as web,
|
||||
if (directie AND directie is not null, directie ,'') as directie,
|
||||
if (ib AND ib is not null, ib, '') as ib,
|
||||
if (email2 AND email2 is not null, email2, '') as email2
|
||||
FROM tb_schooldetails
|
||||
WHERE organisatie_id={$schoolid}";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
|
||||
function getLogo($orgid){
|
||||
$this->sql = "SELECT concat('../images/logos/', logo) as logo
|
||||
FROM tb_schooldetails
|
||||
WHERE organisatie_id={$orgid}";
|
||||
return $this->get_query_row('logo');
|
||||
}
|
||||
function getschool($orgid){
|
||||
|
||||
$this->sql = "SELECT O.id, O.brin, O.naam, O.naamkort, S.plaats, O.soort,
|
||||
concat('../images/logos/', logo) as logo,
|
||||
S.telefoon, S.straat, S.email1, S.web
|
||||
FROM tb_organisaties O
|
||||
JOIN tb_schooldetails S ON O.id = S.organisatie_id
|
||||
WHERE O.id = {$orgid}";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,727 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**Scores_model maart 2015 */
|
||||
|
||||
class Scores_model extends MY_Model{
|
||||
|
||||
protected $tablename = 'tb_scores';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
function getscores($ijkpuntid, $filledversionid, $vorm){
|
||||
$this->sql="SELECT SC.id, score , scoretype,
|
||||
IF ({$vorm}=1, I.omschrijving1, I.omschrijving2) AS omschrijving,
|
||||
I.nummer, I.inspectie
|
||||
FROM tb_scores SC
|
||||
JOIN tb_indicatoren I ON I.id = SC.indicator_id
|
||||
WHERE filledversion_id = {$filledversionid}
|
||||
AND SC.ijkpunt_id = {$ijkpuntid}
|
||||
|
||||
GROUP BY SC.id ";
|
||||
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
|
||||
function calculateindividualscores($orgversieid, $orgid, $userid){
|
||||
$this->sql="SELECT SC.id, filledversion_id, SC.ijkpunt_id, scoretype, score,
|
||||
SUM(CASE
|
||||
WHEN SC.scoretype = 1 THEN SC.score * 10 * Indi.gewicht
|
||||
WHEN SC.scoretype = 2 THEN SC.score * Indi.gewicht
|
||||
WHEN (SC.scoretype = 3 OR SC.scoretype = 5) THEN
|
||||
CASE
|
||||
WHEN SC.score = 1 THEN 100 * Indi.gewicht
|
||||
WHEN (SC.score = 2 OR SC.score = 0) THEN 0
|
||||
ELSE 50 * Indi.gewicht
|
||||
END
|
||||
WHEN SC.scoretype = 4 THEN
|
||||
CASE
|
||||
WHEN SC.score = 1 THEN 100 * Indi.gewicht
|
||||
ELSE 0
|
||||
END
|
||||
WHEN SC.scoretype = 6 THEN
|
||||
CASE
|
||||
WHEN SC.score = 2 THEN 60 * Indi.gewicht
|
||||
WHEN SC.score = 3 THEN 100 * Indi.gewicht
|
||||
ELSE 0
|
||||
END
|
||||
WHEN SC.scoretype = 7 THEN
|
||||
CASE
|
||||
WHEN SC.score = 1 THEN 100 * Indi.gewicht
|
||||
WHEN SC.score = 2 THEN 66.6 * Indi.gewicht
|
||||
WHEN SC.score = 3 THEN 33.3 * Indi.gewicht
|
||||
ELSE 0
|
||||
END
|
||||
END) AS somscore,
|
||||
|
||||
SUM( IF ((SC.scoretype=4 && score=3), 0, Indi.gewicht) ) AS num,
|
||||
|
||||
Y.nummer, Y.omschrijving, 0 AS aantalscholen, Y.toelichting
|
||||
FROM tb_filledversions FV
|
||||
JOIN tb_scores SC ON SC.filledversion_id = FV.id
|
||||
JOIN tb_indicatoren Indi ON Indi.id = SC.indicator_id
|
||||
JOIN tb_ijkpunten Y ON Y.id = SC.ijkpunt_id
|
||||
WHERE FV.orgversie_id = {$orgversieid}
|
||||
AND FV.organisatie_id = {$orgid}
|
||||
AND FV.user_id ={$userid}
|
||||
AND FV.meetellen = 1
|
||||
GROUP BY SC.ijkpunt_id
|
||||
ORDER BY Y.nummer ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
|
||||
function calculateindividualMonPon($filledversionid){
|
||||
$this->sql = "SELECT SC.id, SC.ijkpunt_id , scoretype, score,
|
||||
sum( (IF(SC.scoretype =1,(SC.score * 10),
|
||||
IF(SC.scoretype =2, SC.score,
|
||||
IF ((SC.scoretype = 3 OR SC.scoretype=5), IF(SC.score=1 , 100, IF((SC.score =2 or SC.score= 0), 0 , 50)),
|
||||
IF (SC.scoretype = 4 , IF(SC.score=1, 100, IF((SC.score=2 or SC.score =0), 0 , 0)) , 0)
|
||||
) )) * Indi.gewicht)) AS somscore,
|
||||
|
||||
sum( IF ((SC.scoretype=4 && score=3), 0, Indi.gewicht) ) AS num,
|
||||
|
||||
Y.nummer, Y.omschrijving, 0 AS aantalscholen, Y.toelichting
|
||||
FROM (SELECT COUNT(*) AS aantal, S.filledversion_id as filledid
|
||||
FROM tb_scores S
|
||||
WHERE S.score > 0
|
||||
GROUP BY S.filledversion_id)
|
||||
AS Q
|
||||
JOIN tb_filledversions FV ON FV.id = Q.filledid
|
||||
JOIN tb_scores SC ON SC.filledversion_id = FV.id
|
||||
JOIN tb_indicatoren Indi ON Indi.id = SC.indicator_id
|
||||
JOIN tb_ijkpunten Y ON Y.id = SC.ijkpunt_id
|
||||
WHERE FV.id = {$filledversionid}
|
||||
AND Q.aantal >= 5
|
||||
AND FV.meetellen = 1
|
||||
GROUP BY SC.ijkpunt_id
|
||||
ORDER BY Y.nummer ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function calculateschool($orgversieid, $orgid)
|
||||
{
|
||||
$gevuldeversies = $this->fGetGevuldeVersies($orgversieid, $orgid);
|
||||
if ($gevuldeversies) {
|
||||
$this->sql = "SELECT SC.id as scoreid, filledversion_id,SC.ijkpunt_id , SC.score, scoretype,
|
||||
SUM(CASE
|
||||
WHEN SC.scoretype = 1 THEN SC.score * 10 * Indi.gewicht
|
||||
WHEN SC.scoretype = 2 THEN SC.score * Indi.gewicht
|
||||
WHEN (SC.scoretype = 3 OR SC.scoretype = 5) THEN
|
||||
CASE
|
||||
WHEN SC.score = 1 THEN 100 * Indi.gewicht
|
||||
WHEN (SC.score = 2 OR SC.score = 0) THEN 0
|
||||
ELSE 50 * Indi.gewicht
|
||||
END
|
||||
WHEN SC.scoretype = 4 THEN
|
||||
CASE
|
||||
WHEN SC.score = 1 THEN 100 * Indi.gewicht
|
||||
ELSE 0
|
||||
END
|
||||
WHEN SC.scoretype = 6 THEN
|
||||
CASE
|
||||
WHEN SC.score = 1 THEN 50 * Indi.gewicht
|
||||
WHEN SC.score = 2 THEN 70 * Indi.gewicht
|
||||
WHEN SC.score = 3 THEN 100 * Indi.gewicht
|
||||
ELSE 0
|
||||
END
|
||||
WHEN SC.scoretype = 7 THEN
|
||||
CASE
|
||||
WHEN SC.score = 1 THEN 100 * Indi.gewicht
|
||||
WHEN SC.score = 2 THEN 66.6 * Indi.gewicht
|
||||
WHEN SC.score = 3 THEN 33.3 * Indi.gewicht
|
||||
ELSE 0
|
||||
END
|
||||
END) AS somscore,
|
||||
|
||||
sum( IF ((SC.scoretype=4 && score=3), 0, Indi.gewicht) ) AS num,
|
||||
|
||||
Y.nummer, Y.omschrijving, 1 AS aantalscholen, Y.toelichting
|
||||
|
||||
FROM tb_scores SC
|
||||
JOIN tb_indicatoren Indi ON Indi.id = SC.indicator_id
|
||||
JOIN tb_ijkpunten Y ON Y.id = SC.ijkpunt_id
|
||||
WHERE SC.filledversion_id IN ({$gevuldeversies})
|
||||
GROUP BY SC.ijkpunt_id
|
||||
ORDER BY Y.nummer";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
function calculateBG($orgversieid, $bgid){
|
||||
$gevuldeversies = $this->fGetGevuldeBestuurVersie($orgversieid, $bgid);
|
||||
if ($gevuldeversies) {
|
||||
$this->sql = "SELECT SC.id,filledversion_id,SC.ijkpunt_id, scoretype,
|
||||
SUM(CASE
|
||||
WHEN SC.scoretype = 1 THEN SC.score * 10 * Indi.gewicht
|
||||
WHEN SC.scoretype = 2 THEN SC.score * Indi.gewicht
|
||||
WHEN (SC.scoretype = 3 OR SC.scoretype = 5) THEN
|
||||
CASE
|
||||
WHEN SC.score = 1 THEN 100 * Indi.gewicht
|
||||
WHEN (SC.score = 2 OR SC.score = 0) THEN 0
|
||||
ELSE 50 * Indi.gewicht
|
||||
END
|
||||
WHEN SC.scoretype = 4 THEN
|
||||
CASE
|
||||
WHEN SC.score = 1 THEN 100 * Indi.gewicht
|
||||
ELSE 0
|
||||
END
|
||||
WHEN SC.scoretype = 6 THEN
|
||||
CASE
|
||||
WHEN SC.score = 2 THEN 60 * Indi.gewicht
|
||||
WHEN SC.score = 3 THEN 100 * Indi.gewicht
|
||||
ELSE 0
|
||||
END
|
||||
WHEN SC.scoretype = 7 THEN
|
||||
CASE
|
||||
WHEN SC.score = 1 THEN 100 * Indi.gewicht
|
||||
WHEN SC.score = 2 THEN 66.6 * Indi.gewicht
|
||||
WHEN SC.score = 3 THEN 33.3 * Indi.gewicht
|
||||
ELSE 0
|
||||
END
|
||||
END)AS somscore,
|
||||
|
||||
sum( IF ((SC.scoretype=4 && SC.score=3), 0, Indi.gewicht) ) AS num,
|
||||
Y.nummer, Y.omschrijving,count(DISTINCT O.id) AS aantalscholen, Y.toelichting
|
||||
FROM tb_filledversions FV
|
||||
JOIN tb_scores SC ON SC.filledversion_id = FV.id
|
||||
JOIN tb_organisaties O ON O.id = FV.organisatie_id
|
||||
JOIN tb_indicatoren Indi ON Indi.id = SC.indicator_id
|
||||
JOIN tb_ijkpunten Y ON Y.id = SC.ijkpunt_id
|
||||
WHERE O.valtonder_id = {$bgid}
|
||||
AND FV.id IN ({$gevuldeversies})
|
||||
GROUP BY SC.ijkpunt_id
|
||||
ORDER BY Y.nummer";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
function calculateBGs($orgversieid, $bgids){
|
||||
$gevuldeversies = $this->fGetGevuldeBestuurVersies($orgversieid, $bgids);
|
||||
|
||||
$this->sql="SELECT SC.id,filledversion_id,SC.ijkpunt_id , scoretype,
|
||||
SUM(CASE
|
||||
WHEN SC.scoretype = 1 THEN SC.score * 10 * Indi.gewicht
|
||||
WHEN SC.scoretype = 2 THEN SC.score * Indi.gewicht
|
||||
WHEN (SC.scoretype = 3 OR SC.scoretype = 5) THEN
|
||||
CASE
|
||||
WHEN SC.score = 1 THEN 100 * Indi.gewicht
|
||||
WHEN (SC.score = 2 OR SC.score = 0) THEN 0
|
||||
ELSE 50 * Indi.gewicht
|
||||
END
|
||||
WHEN SC.scoretype = 4 THEN
|
||||
CASE
|
||||
WHEN SC.score = 1 THEN 100 * Indi.gewicht
|
||||
ELSE 0
|
||||
END
|
||||
WHEN SC.scoretype = 6 THEN
|
||||
CASE
|
||||
WHEN SC.score = 1 THEN 50 * Indi.gewicht
|
||||
WHEN SC.score = 2 THEN 70 * Indi.gewicht
|
||||
WHEN SC.score = 3 THEN 100 * Indi.gewicht
|
||||
ELSE 0
|
||||
END
|
||||
WHEN SC.scoretype = 7 THEN
|
||||
CASE
|
||||
WHEN SC.score = 1 THEN 100 * Indi.gewicht
|
||||
WHEN SC.score = 2 THEN 66.6 * Indi.gewicht
|
||||
WHEN SC.score = 4 THEN 33.3 * Indi.gewicht
|
||||
ELSE 0
|
||||
END
|
||||
END)AS somscore,
|
||||
|
||||
sum( IF ((SC.scoretype=4 && SC.score=3), 0, Indi.gewicht) ) AS num,
|
||||
Y.nummer, Y.omschrijving,count(DISTINCT O.id) AS aantalscholen,Y.toelichting
|
||||
|
||||
FROM tb_filledversions FV
|
||||
JOIN tb_scores SC ON SC.filledversion_id = FV.id
|
||||
JOIN tb_organisaties O ON O.id = FV.organisatie_id
|
||||
JOIN tb_indicatoren Indi ON Indi.id = SC.indicator_id
|
||||
JOIN tb_ijkpunten Y ON Y.id = SC.ijkpunt_id
|
||||
WHERE O.valtonder_id IN ( {$bgids})
|
||||
AND FV.id = {$gevuldeversies}
|
||||
GROUP BY SC.ijkpunt_id
|
||||
ORDER BY Y.nummer";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
|
||||
function calculateOverScholen($orgversieid, $orgstring)
|
||||
{
|
||||
$gevuldeversies = $this->fGetGevuldeSWVVersies($orgversieid, $orgstring);
|
||||
|
||||
if ($gevuldeversies) {
|
||||
$this->sql = "SELECT SC.id,filledversion_id,SC.ijkpunt_id , scoretype,
|
||||
SUM(CASE
|
||||
WHEN SC.scoretype = 1 THEN SC.score * 10 * Indi.gewicht
|
||||
WHEN SC.scoretype = 2 THEN SC.score * Indi.gewicht
|
||||
WHEN (SC.scoretype = 3 OR SC.scoretype = 5) THEN
|
||||
CASE
|
||||
WHEN SC.score = 1 THEN 100 * Indi.gewicht
|
||||
WHEN (SC.score = 2 OR SC.score = 0) THEN 0
|
||||
ELSE 50 * Indi.gewicht
|
||||
END
|
||||
WHEN SC.scoretype = 4 THEN
|
||||
CASE
|
||||
WHEN SC.score = 1 THEN 100 * Indi.gewicht
|
||||
ELSE 0
|
||||
END
|
||||
WHEN SC.scoretype = 6 THEN
|
||||
CASE
|
||||
WHEN SC.score = 2 THEN 60 * Indi.gewicht
|
||||
WHEN SC.score = 3 THEN 100 * Indi.gewicht
|
||||
ELSE 0
|
||||
END
|
||||
WHEN SC.scoretype = 7 THEN
|
||||
CASE
|
||||
WHEN SC.score = 1 THEN 100 * Indi.gewicht
|
||||
WHEN SC.score = 2 THEN 66.6 * Indi.gewicht
|
||||
WHEN SC.score = 3 THEN 33.3 * Indi.gewicht
|
||||
ELSE 0
|
||||
END
|
||||
END)AS somscore,
|
||||
|
||||
sum( IF ((SC.scoretype=4 && SC.score=3), 0, Indi.gewicht) ) AS num,
|
||||
Y.nummer, Y.omschrijving,count(DISTINCT O.id) AS aantalscholen, count(DISTINCT FV.id) AS aantallijsten, Y.toelichting
|
||||
FROM tb_filledversions FV
|
||||
JOIN tb_scores SC ON SC.filledversion_id = FV.id
|
||||
JOIN tb_organisaties O ON O.id = FV.organisatie_id
|
||||
JOIN tb_indicatoren Indi ON Indi.id = SC.indicator_id
|
||||
JOIN tb_ijkpunten Y ON Y.id = SC.ijkpunt_id
|
||||
WHERE FV.id IN ({$gevuldeversies})
|
||||
AND FV.orgversie_id = {$orgversieid}
|
||||
|
||||
GROUP BY SC.ijkpunt_id
|
||||
ORDER BY Y.nummer";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
function calculateOverScholenNieuw($orgversieid, $orgstring){
|
||||
$gevuldeversies = $this->fGetGevuldeSWVVersies($orgversieid, $orgstring);
|
||||
|
||||
$m = "SC.scoretype= 4";
|
||||
$n = "IF (SC.score = 1, (100 * I.gewicht), 0)";
|
||||
$o = "0";
|
||||
$l = "IF ($m, $n, $o)";
|
||||
|
||||
|
||||
$j = "SC.scoretype = 6";
|
||||
$k = "IF (SC.score =1 , (50 * I.gewicht) , IF (SC.score = 2 , (70 * I.gewicht), IF (SC.score = 3, (100 * I.gewicht),0) ))";
|
||||
$i = "IF ($j, $k ,$l)";
|
||||
|
||||
$g = "(SC.scoretype=3 or SC.scoretype=5)";
|
||||
$h = "IF (SC.score = 1, (100 * I.gewicht),
|
||||
IF ((SC.score = 2 or SC.score = 0), (0 * I.gewicht), (50 * I.gewicht) ) ) ";
|
||||
$f = "if ($g, $h, $i)";
|
||||
|
||||
$d = "SC.scoretype = 2";
|
||||
$e = "(SC.score * I.gewicht)";
|
||||
$c = "if($d, $e, $f)";
|
||||
|
||||
$a = "SC.scoretype = 1";
|
||||
$b = "(SC.score * I.gewicht * 10)";
|
||||
|
||||
|
||||
if ($gevuldeversies) {
|
||||
$this->sql = "SELECT SC.id, filledversion_id, SC.ijkpunt_id , scoretype,
|
||||
sum(IF ({$a}, {$b} ,{$c}) )/ sum(IF ((SC.scoretype=4 && SC.score=3), 0, I.gewicht)) AS gem,
|
||||
Y.nummer, Y.omschrijving, count(DISTINCT O.id) AS aantalscholen, count(DISTINCT FV.id) AS aantallijsten, Y.toelichting
|
||||
FROM tb_filledversions FV
|
||||
JOIN tb_scores SC ON SC.filledversion_id = FV.id
|
||||
JOIN tb_organisaties O ON O.id = FV.organisatie_id
|
||||
JOIN tb_indicatoren I ON I.id = SC.indicator_id
|
||||
JOIN tb_ijkpunten Y ON Y.id = SC.ijkpunt_id
|
||||
WHERE FV.id IN ({$gevuldeversies})
|
||||
AND FV.orgversie_id = {$orgversieid}
|
||||
|
||||
GROUP BY SC.ijkpunt_id
|
||||
ORDER BY Y.nummer";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function getlkscores($filledversionid){
|
||||
$this->sql="SELECT
|
||||
SUM(CASE
|
||||
WHEN OV.scoretype = 1 THEN S.score * 10 * Indi.gewicht
|
||||
WHEN OV.scoretype = 2 THEN S.score * Indi.gewicht
|
||||
WHEN (OV.scoretype = 3 OR OV.scoretype = 5) THEN
|
||||
CASE
|
||||
WHEN S.score = 1 THEN 100 * Indi.gewicht
|
||||
WHEN (S.score = 2 OR S.score = 0) THEN 0
|
||||
ELSE 50 * Indi.gewicht
|
||||
END
|
||||
WHEN OV.scoretype = 4 THEN
|
||||
CASE
|
||||
WHEN S.score = 1 THEN 100 * Indi.gewicht
|
||||
ELSE 0
|
||||
END
|
||||
WHEN OV.scoretype = 6 THEN
|
||||
CASE
|
||||
WHEN S.score = 2 THEN 60 * Indi.gewicht
|
||||
WHEN S.score = 3 THEN 100 * Indi.gewicht
|
||||
ELSE 0
|
||||
END
|
||||
WHEN OV.scoretype = 7 THEN
|
||||
CASE
|
||||
WHEN S.score = 1 THEN 100 * Indi.gewicht
|
||||
WHEN S.score = 2 THEN 66.6 * Indi.gewicht
|
||||
WHEN S.score = 3 THEN 33.3 * Indi.gewicht
|
||||
ELSE 0
|
||||
END
|
||||
END) AS somscore,
|
||||
|
||||
SUM( IF((OV.scoretype=4 && S.score=3), 0, Indi.gewicht) ) AS num,
|
||||
|
||||
Y.nummer
|
||||
|
||||
FROM tb_filledversions FV
|
||||
JOIN tb_scores S ON FV.id = S.filledversion_id
|
||||
JOIN tb_indicatoren Indi ON Indi.id = S.indicator_id
|
||||
JOIN tb_ijkpunten Y ON Y.id = S.ijkpunt_id
|
||||
JOIN tb_orgversies OV ON FV.orgversie_id = OV.id
|
||||
WHERE filledversion_id = {$filledversionid}
|
||||
AND FV.meetellen = 1
|
||||
GROUP BY S.ijkpunt_id
|
||||
ORDER BY Y.nummer";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function fCountGevuldeVersies($orgversieid, $orgid){
|
||||
$this->sql =" SELECT COUNT(DISTINCT filledversion_id) as aantal
|
||||
FROM tb_scores S
|
||||
JOIN tb_filledversions FV ON FV.id = S.filledversion_id
|
||||
WHERE FV.orgversie_id = {$orgversieid}
|
||||
AND FV.organisatie_id = {$orgid}
|
||||
AND FV.meetellen = 1
|
||||
AND S.score > 0
|
||||
GROUP BY S.filledversion_id
|
||||
HAVING COUNT(S.id) >= 5";
|
||||
return $this->get_query_result('aantal');
|
||||
}
|
||||
|
||||
|
||||
function fGetGevuldeVersies($orgversieid, $orgid){
|
||||
$this->sql =" SELECT filledversion_id as filledid
|
||||
FROM tb_scores S
|
||||
JOIN tb_filledversions FV ON FV.id = S.filledversion_id
|
||||
WHERE FV.orgversie_id = {$orgversieid}
|
||||
AND FV.organisatie_id = {$orgid}
|
||||
AND FV.meetellen = 1
|
||||
AND S.score > 0
|
||||
GROUP BY S.filledversion_id
|
||||
HAVING COUNT(S.id) >= 5";
|
||||
$FVs= $this->get_query_result();
|
||||
$lijst = '';
|
||||
foreach ($FVs ? $FVs : [] as $FV){
|
||||
if ($lijst != '') $lijst .=','.$FV->filledid;
|
||||
else $lijst = $FV->filledid;
|
||||
}
|
||||
return $lijst;
|
||||
}
|
||||
|
||||
function fCountGevuldeBestuurVersies($orgversieid, $bgid){
|
||||
$this->sql =" SELECT COUNT(DISTINCT filledversion_id) as aantal
|
||||
FROM tb_scores S
|
||||
JOIN tb_filledversions FV ON FV.id = S.filledversion_id
|
||||
JOIN tb_organisaties O ON FV.organisatie_id = O.id
|
||||
WHERE FV.orgversie_id = {$orgversieid}
|
||||
AND O.valtonder_id = {$bgid}
|
||||
AND FV.meetellen = 1
|
||||
AND S.score > 0
|
||||
GROUP BY S.filledversion_id
|
||||
HAVING COUNT(S.id) >= 5";
|
||||
return $this->get_query_result('aantal');
|
||||
}
|
||||
|
||||
|
||||
|
||||
function fGetGevuldeBestuurVersie($orgversieid, $bgid){
|
||||
$this->sql =" SELECT filledversion_id as filledid
|
||||
FROM tb_scores S
|
||||
JOIN tb_filledversions FV ON FV.id = S.filledversion_id
|
||||
JOIN tb_organisaties O ON FV.organisatie_id = O.id
|
||||
WHERE FV.orgversie_id = {$orgversieid}
|
||||
AND O.valtonder_id = {$bgid}
|
||||
AND FV.meetellen = 1
|
||||
AND S.score > 0
|
||||
GROUP BY S.filledversion_id
|
||||
HAVING COUNT(S.id) >= 5";
|
||||
$FVs= $this->get_query_result();
|
||||
$lijst = '';
|
||||
foreach ($FVs ? $FVs : [] as $FV){
|
||||
if ($lijst != '') $lijst .=','.$FV->filledid;
|
||||
else $lijst = $FV->filledid;
|
||||
}
|
||||
return $lijst;
|
||||
}
|
||||
|
||||
function fGetGevuldeBestuurVersies($orgversieid, $bgids){
|
||||
$this->sql =" SELECT filledversion_id as filledid
|
||||
FROM tb_scores S
|
||||
JOIN tb_filledversions FV ON FV.id = S.filledversion_id
|
||||
JOIN tb_organisaties O ON FV.organisatie_id = O.id
|
||||
WHERE FV.orgversie_id = {$orgversieid}
|
||||
AND O.valtonder_id IN {$bgids}
|
||||
AND FV.meetellen = 1
|
||||
AND S.score > 0
|
||||
GROUP BY S.filledversion_id
|
||||
HAVING COUNT(S.id) >= 5";
|
||||
$FVs= $this->get_query_result();
|
||||
$lijst = '';
|
||||
foreach ($FVs ? $FVs : [] as $FV){
|
||||
if ($lijst != '') $lijst .=','.$FV->filledid;
|
||||
else $lijst = $FV->filledid;
|
||||
}
|
||||
return $lijst;
|
||||
}
|
||||
|
||||
|
||||
function fCountGevuldeKamerEnSWVVersies($orgversieid, $orgs){
|
||||
$this->sql =" SELECT COUNT(DISTINCT filledversion_id) as aantal
|
||||
FROM tb_scores S
|
||||
JOIN tb_filledversions FV ON FV.id = S.filledversion_id
|
||||
JOIN tb_organisaties O ON FV.organisatie_id = O.id
|
||||
WHERE FV.orgversie_id = {$orgversieid}
|
||||
AND O.id IN ({$orgs})
|
||||
AND FV.meetellen = 1
|
||||
AND S.score > 0
|
||||
GROUP BY S.filledversion_id
|
||||
HAVING COUNT(S.id) >= 5";
|
||||
|
||||
|
||||
return $this->get_query_row('aantal');
|
||||
}
|
||||
|
||||
|
||||
function fGetGevuldeKamerVersies($orgversieid, $bgs){
|
||||
$this->sql =" SELECT filledversion_id as filledid
|
||||
FROM tb_scores S
|
||||
JOIN tb_filledversions FV ON FV.id = S.filledversion_id
|
||||
JOIN tb_organisaties O ON FV.organisatie_id = O.id
|
||||
WHERE FV.orgversie_id = {$orgversieid}
|
||||
AND O.valtonder_id IN ({$bgs})
|
||||
AND FV.meetellen = 1
|
||||
AND S.score > 0
|
||||
GROUP BY S.filledversion_id
|
||||
HAVING COUNT(S.id) >= 5";
|
||||
$FVs= $this->get_query_result();
|
||||
$lijst = '';
|
||||
foreach ($FVs ? $FVs : [] as $FV){
|
||||
if ($lijst != '') $lijst .=','.$FV->filledid;
|
||||
else $lijst = $FV->filledid;
|
||||
}
|
||||
return $lijst;
|
||||
}
|
||||
|
||||
function fGetGevuldeSWVVersies($orgversieid, $orgstring){
|
||||
$this->sql =" SELECT filledversion_id as filledid
|
||||
FROM tb_scores S
|
||||
JOIN tb_filledversions FV ON FV.id = S.filledversion_id
|
||||
WHERE FV.orgversie_id = {$orgversieid}
|
||||
AND FV.organisatie_id IN ({$orgstring})
|
||||
AND FV.meetellen = 1
|
||||
AND S.score > 0
|
||||
GROUP BY S.filledversion_id
|
||||
HAVING COUNT(S.id) >= 5";
|
||||
$FVs= $this->get_query_result();
|
||||
$lijst = '';
|
||||
foreach ($FVs ? $FVs : [] as $FV){
|
||||
if ($lijst != '') $lijst .=','.$FV->filledid;
|
||||
else $lijst = $FV->filledid;
|
||||
}
|
||||
return $lijst;
|
||||
}
|
||||
|
||||
|
||||
function getgemscores($orgversieid, $orgid){
|
||||
$gevuldeversies = $this->fGetGevuldeVersies($orgversieid, $orgid);
|
||||
|
||||
$p = "SC.scoretype = 7";
|
||||
$q = "IF (SC.score = 1, (100 * I.gewicht),
|
||||
IF (SC.score = 2,(66.6 * I.gewicht), IF (score = 3, (33.3 * I.gewicht), 0 )))";
|
||||
$r = "0";
|
||||
$o = "IF($p, $q, $r)";
|
||||
|
||||
|
||||
$m = "SC.scoretype= 4";
|
||||
$n = "IF (SC.score = 1, (100 * I.gewicht), 0)";
|
||||
|
||||
$l = "IF ($m, $n, $o)";
|
||||
|
||||
$j = "SC.scoretype = 6";
|
||||
$k = "IF (SC.score = 2 , (50 * I.gewicht), IF (SC.score = 3, (100 * I.gewicht),0) )";
|
||||
$i = "IF ($j, $k ,$l)";
|
||||
|
||||
$g = "(SC.scoretype=3 or SC.scoretype=5)";
|
||||
$h = "IF (SC.score = 1, (100 * I.gewicht),
|
||||
IF ((SC.score = 2 or SC.score = 0), (0 * I.gewicht), (50 * I.gewicht) ) ) ";
|
||||
$f = "if ($g, $h, $i)";
|
||||
|
||||
$d = "SC.scoretype = 2";
|
||||
$e = "(SC.score * I.gewicht)";
|
||||
$c = "if($d, $e, $f)";
|
||||
|
||||
$a = "SC.scoretype = 1";
|
||||
$b = "(SC.score * I.gewicht * 10)";
|
||||
|
||||
if ($gevuldeversies) {
|
||||
$this->sql="SELECT sum(IF ({$a}, {$b} ,{$c}) )/ sum(IF ((SC.scoretype=4 && SC.score=3), 0, I.gewicht)) AS gem,
|
||||
Y.omschrijving, Y.toelichting,Y.id as ijkpunt_id,
|
||||
Y.nummer
|
||||
FROM tb_scores SC
|
||||
JOIN tb_indicatoren I ON I.id = SC.indicator_id
|
||||
JOIN tb_ijkpunten Y ON Y.id = SC.ijkpunt_id
|
||||
WHERE SC.filledversion_id IN ({$gevuldeversies})
|
||||
GROUP BY SC.ijkpunt_id
|
||||
ORDER BY Y.nummer";
|
||||
// $this->sql="SELECT sum(
|
||||
// IF (SC.scoretype= 1, (SC.score * I.gewicht * 10),
|
||||
// IF (SC.scoretype = 2, (SC.score * I.gewicht),
|
||||
// IF ((SC.scoretype = 3 OR SC.scoretype =5 OR SC.scoretype = 6),
|
||||
// ( IF (SC.score = 1, (100 * I.gewicht), IF ((SC.score = 2 or SC.score = 0), (0 * I.gewicht), (50 * I.gewicht)) ) ) ,
|
||||
// IF (SC.scoretype=4, IF(SC.score=1, (100 * I.gewicht), IF ((SC.score= 0 or SC.score=2), (0 * I.gewicht), 0) ),0)
|
||||
|
||||
// ) ))) / sum(IF ((SC.scoretype=4 && SC.score=3), 0, I.gewicht)) AS gem,
|
||||
// Y.omschrijving, Y.toelichting,
|
||||
// Y.nummer
|
||||
// FROM tb_scores SC
|
||||
// JOIN tb_indicatoren I ON I.id = SC.indicator_id
|
||||
// JOIN tb_ijkpunten Y ON Y.id = SC.ijkpunt_id
|
||||
// WHERE SC.filledversion_id IN ({$gevuldeversies})
|
||||
// GROUP BY SC.ijkpunt_id
|
||||
// ORDER BY Y.nummer";
|
||||
|
||||
|
||||
// $this->sql="SELECT sum(IF (SC.scoretype= 1, (SC.score * I.gewicht * 10),
|
||||
// IF (SC.scoretype = 2, (SC.score * I.gewicht),
|
||||
// IF ((SC.scoretype = 3 OR SC.scoretype =5), ( IF (SC.score = 1, (100 * I.gewicht), IF ((SC.score = 2 or SC.score = 0), (0 * I.gewicht), (50 * I.gewicht)) ) ) ,
|
||||
// IF (SC.scoretype=4, IF(SC.score=1, (100 * I.gewicht), IF ((SC.score= 0 or SC.score=2), (0 * I.gewicht), 0) ),0)
|
||||
|
||||
// ) ))) / sum(IF ((SC.scoretype=4 && SC.score=3), 0, I.gewicht)) AS gem ,
|
||||
|
||||
// Y.nummer
|
||||
// FROM (SELECT COUNT(*) AS aantal, filledversion_id as filledid
|
||||
// FROM tb_scores
|
||||
// WHERE score > 0
|
||||
// GROUP BY filledversion_id)
|
||||
// AS Q
|
||||
// JOIN tb_filledversions FV ON Q.filledid = FV.id
|
||||
// JOIN tb_scores SC ON FV.id = SC.filledversion_id
|
||||
// JOIN tb_indicatoren I ON I.id = SC.indicator_id
|
||||
// JOIN tb_ijkpunten Y ON Y.id = SC.ijkpunt_id
|
||||
// WHERE FV.orgversie_id = {$orgversieid}
|
||||
// AND FV.organisatie_id = {$orgid}
|
||||
// AND FV.meetellen = 1
|
||||
// AND Q.aantal >= 5
|
||||
// GROUP BY SC.ijkpunt_id
|
||||
// ORDER BY Y.nummer";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function getgewenst($orgid, $orgversieid){
|
||||
$gewenst = $this->Wenssituaties_model->getgewenst($orgversieid, $orgid);
|
||||
if (!$gewenst){
|
||||
$organisatie = $this->Organisaties_model->get_record_by_id($orgid);
|
||||
$where = array("id" =>$organisatie->valtonder_id);
|
||||
$org2id = $this->Organisaties_model->get_fieldvalue($where, 'id');
|
||||
if ($org2id ) {
|
||||
$gewenst =$this->Wenssituaties_model->getgewenst($orgversieid, $org2id);
|
||||
if (!$gewenst){
|
||||
$organisatie = $this->Organisaties_model->get_record_by_id($org2id);
|
||||
$where = array("id" =>$organisatie->valtonder_id);
|
||||
$org3id = $this->Organisaties_model->get_fieldvalue($where, 'id');
|
||||
if ($org3id ) {
|
||||
$gewenst =$this->Wenssituaties_model->getgewenst($orgversieid, $org3id);
|
||||
if (!$gewenst){
|
||||
$organisatie = $this->Organisaties_model->get_record_by_id($org3id);
|
||||
$where = array("id" =>$organisatie->valtonder_id);
|
||||
$org4id = $this->Organisaties_model->get_fieldvalue($where, 'id');
|
||||
if ($org4id) {$gewenst =$this->Wenssituaties_model->getgewenst($orgversieid, $org4id);};
|
||||
}; // bij org4
|
||||
}; // if org3
|
||||
}; // if nog gewenst bij org2 get org3
|
||||
}; // bij org2
|
||||
} ; // if nog gewenst
|
||||
return $gewenst;
|
||||
}
|
||||
|
||||
function getgewenstindividueel($orgid, $orgversieid, $orguserid){
|
||||
$this->sql= "SELECT id, wens
|
||||
FROM tb_wenssituaties
|
||||
WHERE organisatie_id = {$orgid}
|
||||
AND orgversie_id = {$orgversieid}
|
||||
AND orguser_id = {$orguserid}
|
||||
ORDER BY ijkpunt_id ";
|
||||
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getstandaardfrequenties($userid, $orglist,$orgversie){
|
||||
$this->sql="SELECT sum(IF(SC.score = 1, 1,0)) AS onvol,
|
||||
sum(IF(SC.score = 2 , 1,0)) AS vol,
|
||||
sum(IF(SC.score = 3 , 1, 0)) AS goed,
|
||||
Y.omschrijving,
|
||||
Y.nummer,
|
||||
FV.id as fvID,
|
||||
Y.id as ijkpuntID,
|
||||
O.id as oordeelid,
|
||||
if(O.id IS NOT NULL, O.norm, '') as norm,
|
||||
if (O.id IS NOT NULL, O.norm_id, NULL) as normid,
|
||||
if (O.id IS NOT NULL, O.wens_id, NULL) as wensid,
|
||||
Y.toelichting
|
||||
FROM (SELECT COUNT(*) AS aantal, filledversion_id as filledid
|
||||
FROM tb_scores
|
||||
WHERE score > 0
|
||||
GROUP BY filledversion_id)
|
||||
AS Q
|
||||
JOIN tb_filledversions FV ON Q.filledid = FV.id
|
||||
JOIN tb_scores SC ON FV.id = SC.filledversion_id
|
||||
JOIN tb_indicatoren I ON I.id = SC.indicator_id
|
||||
JOIN tb_ijkpunten Y ON Y.id = SC.ijkpunt_id
|
||||
LEFT JOIN tb_oordelen O ON (O.filledversion_id = FV.id and O.ijkpunt_id = SC.ijkpunt_id)
|
||||
WHERE FV.orgversie_id = {$orgversie}
|
||||
AND FV.meetellen = 1
|
||||
AND Q.aantal >= 5
|
||||
AND FV.organisatie_id IN ({$orglist}) ";
|
||||
if ($userid){
|
||||
$this->sql .= " AND FV.user_id = {$userid} ";
|
||||
}
|
||||
$this->sql .=" GROUP BY Y.id";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function telOordelen($orgid,$orgversie){
|
||||
$this->sql="SELECT COUNT(O.id) as oordelen
|
||||
FROM tb_oordelen O
|
||||
JOIN tb_filledversions FV ON O.filledversion_id = FV.id
|
||||
WHERE FV.orgversie_id = {$orgversie}
|
||||
AND FV.organisatie_id = {$orgid} ";
|
||||
return $this->get_query_result('oordelen');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Sop_model oktober 2015 */
|
||||
|
||||
class Sop_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_profielen';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array();
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
function getprofielen($orgid){
|
||||
$this->sql = "SELECT P.id AS profielID, P.naam , O.soort, DATE_FORMAT(P.van,'%d-%m-%Y') as van , DATE_FORMAT( P.tm,'%d-%m-%Y') as tm
|
||||
FROM tb_profielen P
|
||||
JOIN tb_organisaties O ON O.id = P.organisatie_id
|
||||
WHERE P.organisatie_id = {$orgid}
|
||||
AND P.versie = 'OUD'
|
||||
ORDER BY P.van DESC";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getnieuwesops($orgid){
|
||||
$this->sql = "SELECT P.id AS profielID, P.naam , O.soort, DATE_FORMAT(P.van,'%d-%m-%Y') as van , DATE_FORMAT( P.tm,'%d-%m-%Y') as tm
|
||||
FROM tb_profielen P
|
||||
JOIN tb_organisaties O ON O.id = P.organisatie_id
|
||||
WHERE P.organisatie_id = {$orgid}
|
||||
AND P.versie = 'NIEUW'
|
||||
ORDER BY P.van DESC";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getnieuwsop($targetid){
|
||||
$this->sql = "SELECT P.id AS profielID, P.naam , O.soort, DATE_FORMAT(P.van,'%d-%m-%Y') as van, DATE_FORMAT( P.tm,'%d-%m-%Y') as tm
|
||||
FROM tb_profielen P
|
||||
JOIN tb_organisaties O ON O.id = P.organisatie_id
|
||||
WHERE P.id = {$targetid}
|
||||
AND P.versie = 'NIEUW' ";
|
||||
|
||||
return $this->get_query_row();
|
||||
}
|
||||
|
||||
function getprofiel($targetid){
|
||||
$this->sql = "SELECT P.id AS profielID, P.naam , O.soort, DATE_FORMAT(P.van,'%d-%m-%Y') as van, DATE_FORMAT( P.tm,'%d-%m-%Y') as tm
|
||||
FROM tb_profielen P
|
||||
JOIN tb_organisaties O ON O.id = P.organisatie_id
|
||||
WHERE P.id = {$targetid}
|
||||
AND P.versie = 'OUD'
|
||||
ORDER BY P.van DESC";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
function getsopchapterids($profielid){
|
||||
$this->sql="SELECT chapter_id
|
||||
FROM tb_sopinhouden
|
||||
WHERE profiel_id = {$profielid};";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getselectablechapters($orgid, $profielid){
|
||||
$this->sql="SELECT H.id, H.nummer, H.naam, H.module
|
||||
FROM tb_hoofdstukken H
|
||||
JOIN tb_licenties L ON H.module = L.modulenr
|
||||
JOIN tb_modules M ON M.sysnr = H.module
|
||||
WHERE M.heeftlijst = 1
|
||||
AND H.standaard = 2
|
||||
AND L.orgid = {$orgid}
|
||||
AND H.id NOT IN(SELECT chapter_id
|
||||
FROM tb_hfstprofiel
|
||||
WHERE profiel_id = {$profielid})
|
||||
ORDER BY H.nummer ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,788 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Sopinhouden_model oktober 2015 */
|
||||
|
||||
class Sopinhouden_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_sopinhouden';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array(
|
||||
"monpas/Ambities_model",
|
||||
'shared/Users_model',
|
||||
'monpas/Diversiteits_model',
|
||||
'monpas/Filledversions_model',
|
||||
'monpas/Groepen_model',
|
||||
'monpas/Hoofdstukken_model',
|
||||
'monpas/Labels_model',
|
||||
'monpas/Ondersteuningtijden_model',
|
||||
'monpas/Orgversies_model',
|
||||
'monpas/Schooldetails_model',
|
||||
'shared/Schooljaren_model',
|
||||
'monpas/Scores_model',
|
||||
'monpas/Sop_model',
|
||||
'monpas/Standaardteksten_model',
|
||||
'monpas/Wenssituaties_model');
|
||||
$this->load->model($models);
|
||||
$this->load->library('monpas/kleurcodes');
|
||||
}
|
||||
|
||||
function maakcontent($chapterid,$profielid, $targetversieid= FALSE){
|
||||
$content = $this->Standaardteksten_model->get_fieldvalue(array("soort"=>1, "chapter_id"=>$chapterid),'content');
|
||||
$versie = null;
|
||||
if(! $targetversieid || $targetversieid == FALSE){
|
||||
$targetversieid = 0;
|
||||
}
|
||||
|
||||
switch ($chapterid){
|
||||
case 1: $tabelschoolcolofon =$this->getcolofon();
|
||||
$content = $content.$tabelschoolcolofon.'<h2>Visie van onze school</h2><p> </p>';
|
||||
break;
|
||||
|
||||
case 2: $module = 2;
|
||||
$arraytabelsdiversiteit = $this->getdiversiteit234($profielid,$targetversieid, $module);
|
||||
$versie = $arraytabelsdiversiteit['targetjaar'];
|
||||
$tabeldiversiteit2 = $arraytabelsdiversiteit['dvt2'];
|
||||
$pos = strpos($content, "dvt2");
|
||||
$content = substr_replace($content, $tabeldiversiteit2, $pos, 4);
|
||||
$tabeldiversiteit4 = $arraytabelsdiversiteit['dvt4'];
|
||||
$pos = strpos($content, "dvt4");
|
||||
$content = substr_replace($content, $tabeldiversiteit4, $pos , 4);
|
||||
|
||||
$tabeldiversiteit3= $arraytabelsdiversiteit['dvt3'];
|
||||
$pos = strpos($content,"dvt3");
|
||||
$content = substr_replace($content, $tabeldiversiteit3, $pos, 4);
|
||||
$grafiekdiversiteit1 = $arraytabelsdiversiteit['divgrafiek1'];
|
||||
$image = $this->Phantom_model->create_img($grafiekdiversiteit1, 'test.png', FALSE, FALSE, array(650, 300));
|
||||
$pos = strpos($content,"dvt5");
|
||||
$imagedata = "<img src='data:image/png;base64,".$image."' id='divimage1'/>";
|
||||
$content = substr_replace($content, $imagedata, $pos, 4);
|
||||
break;
|
||||
|
||||
case 3: $module = 2;
|
||||
|
||||
$ostabellen = $this->getondersteuning12($profielid,$targetversieid, $module);
|
||||
|
||||
$versie = $ostabellen['targetjaar'];
|
||||
$os1 = $ostabellen['os1'];
|
||||
$pos = strpos($content, "om1");
|
||||
$content = substr_replace($content, $os1, $pos, 3);
|
||||
$os2 = $ostabellen['os2'];
|
||||
$pos = strpos($content, "om2");
|
||||
$content = substr_replace($content, $os2, $pos, 3);
|
||||
break;
|
||||
|
||||
case 6: $result = $this->getenquetetabellen($profielid,1,6,$targetversieid);
|
||||
|
||||
|
||||
$versie = $result['targetversie'];
|
||||
$mbgrafiek = $result['grafiek1'];
|
||||
$imagemb =$this->Phantom_model->create_img($mbgrafiek, 'test', FALSE, FALSE, array(650, 300));
|
||||
$imagedata = "<img src='data:image/png;base64,".$imagemb."' id='mod1image1'/>";
|
||||
$pos = strpos($content,'mbgrafiek1');
|
||||
$content = substr_replace($content, $imagedata, $pos, 10);
|
||||
|
||||
$monbas1 = $result['tabel1'];
|
||||
$pos = strpos($content, 'monbas1');
|
||||
$content = substr_replace($content, $monbas1, $pos, 7);
|
||||
|
||||
$monbas2 = $result['tabel2'];
|
||||
$pos = strpos($content, 'monbas2');
|
||||
$content = substr_replace($content, $monbas2, $pos, 7);
|
||||
break;
|
||||
|
||||
case 7: $result = $this->getenquetetabellen($profielid,4,7,$targetversieid);
|
||||
|
||||
$versie = $result['targetversie'];
|
||||
$smgrafiek = $result['grafiek1'];
|
||||
$imagesm = $this->Phantom_model->create_img($smgrafiek, 'test', FALSE, FALSE, array(650, 300));
|
||||
$imagedata = "<img src='data:image/png;base64,".$imagesm."' id='mod4image1'/>";
|
||||
$pos = strpos($content,'imagesm');
|
||||
$content = substr_replace($content, $imagedata, $pos, 7);
|
||||
|
||||
$sm1 = $result['tabel1'];
|
||||
$pos = strpos($content, 'tabelsm1');
|
||||
$content = substr_replace($content, $sm1, $pos, 8);
|
||||
|
||||
$sm2 = $result['tabel2'];
|
||||
$pos = strpos($content, 'tabelsm2');
|
||||
$content = substr_replace($content, $sm2, $pos, 8);
|
||||
break;
|
||||
case 8: $result = $this->getenquetetabellen($profielid,5,8,$targetversieid);
|
||||
|
||||
$versie = $result['targetversie'];
|
||||
$esgrafiek = $result['grafiek1'];
|
||||
$imagesm = $this->Phantom_model->create_img($esgrafiek, 'test', FALSE, FALSE, array(650, 300));
|
||||
$imagedata = "<img src='data:image/png;base64,".$imagesm."' id='mod5image1'/>";
|
||||
$pos = strpos($content,'esgrafiek1');
|
||||
$content = substr_replace($content, $imagedata, $pos, 10);
|
||||
|
||||
$es1 = $result['tabel1'];
|
||||
$pos = strpos($content, 'estabel1');
|
||||
$content = substr_replace($content, $es1, $pos, 8);
|
||||
|
||||
$es2 = $result['tabel2'];
|
||||
$pos = strpos($content, 'estabel2');
|
||||
$content = substr_replace($content, $es2, $pos, 8);
|
||||
break;
|
||||
case 9:
|
||||
$result = $this->getenquetetabellen($profielid,3,9,$targetversieid);
|
||||
$versie = $result['targetversie'];
|
||||
$tvgrafiek = $result['grafiek1'];
|
||||
$imagetv = $this->Phantom_model->create_img($tvgrafiek, 'test', FALSE, FALSE, array(650, 300));
|
||||
$imagedata = "<img src='data:image/png;base64,".$imagetv."' id='mod3image1'/>";
|
||||
$pos = strpos($content,'tvgrafiek1');
|
||||
$content = substr_replace($content, $imagedata, $pos, 10);
|
||||
|
||||
$tv1 = $result['tabel1'];
|
||||
$pos = strpos($content, 'tvtabel1');
|
||||
$content = substr_replace($content, $tv1, $pos, 8);
|
||||
|
||||
$tv2 = $result['tabel2'];
|
||||
$pos = strpos($content, 'tvtabel2');
|
||||
$content = substr_replace($content, $tv2, $pos, 8);
|
||||
break;
|
||||
case 11: // Ontwikkelagenda Monbas
|
||||
$versie = "";
|
||||
$result = $this->getOntwikkelagenda($profielid, 1,$targetversieid);
|
||||
if($result) {
|
||||
$versie = $result['targetversie'];
|
||||
}
|
||||
$imageoa = $this->Phantom_model->create_img($result['tabel1'], 'test', FALSE, FALSE, array(650, 300));
|
||||
$imagedata = "<img src='data:image/png;base64,".$imageoa."' id='oa1image1'/>";
|
||||
$pos = strpos($content, 'oatabel1');
|
||||
$content = substr_replace($content, $imagedata, $pos,8);
|
||||
|
||||
$oa2 = $result['tabel2'];
|
||||
$pos = strpos($content, 'oatabel2');
|
||||
$content = substr_replace($content, $oa2, $pos,8);
|
||||
break;
|
||||
case 12: // Ontwikkelagenda Schoolmeter
|
||||
|
||||
// $content = '';
|
||||
$versie = "";
|
||||
$result = $this->getOntwikkelagenda($profielid, 4,$targetversieid);
|
||||
if($result) {
|
||||
$versie = $result['targetversie'];
|
||||
}
|
||||
$imageoa = $this->Phantom_model->create_img($result['tabel1'], 'test', FALSE, FALSE, array(650, 300));
|
||||
$imagedata = "<img src='data:image/png;base64,".$imageoa."' id='oa2image1'/>";
|
||||
$pos = strpos($content, 'oatabel3');
|
||||
$content = substr_replace($content, $imagedata, $pos,8);
|
||||
$oa2 = $result['tabel2'];
|
||||
$pos = strpos($content, 'oatabel4');
|
||||
$content = substr_replace($content, $oa2, $pos,8);
|
||||
//
|
||||
break;
|
||||
|
||||
}; // switch
|
||||
|
||||
return array('content' =>$content,
|
||||
'versie' =>$versie);
|
||||
}
|
||||
function getcolofon(){
|
||||
$orgid = $this->globorgid;
|
||||
$details = $this->Schooldetails_model->get_details2($orgid);
|
||||
$organisatie = $this->Organisaties_model->get_record_by_id($orgid);
|
||||
$bg = $this->Organisaties_model->get_record_by_id($organisatie->valtonder_id);
|
||||
$data = array("bevoegdgezag" => $bg->naam,
|
||||
"school" => $organisatie->naam,
|
||||
"details" => $details);
|
||||
return $this->load->view("monpas/sop/schooldetails", $data,TRUE);
|
||||
}
|
||||
function getgroepeninfo($schooljaarnr){
|
||||
$orgid = $this->globorgid;
|
||||
$this->sql="SELECT sum(totaantal) AS llng,
|
||||
count(DISTINCT id) AS groepen,
|
||||
sum( IF(length(niveau)> 1, 1,0 )) AS combi
|
||||
FROM tb_groepen
|
||||
WHERE organisatie_id = {$orgid}
|
||||
AND schooljaarnr = {$schooljaarnr} ";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
|
||||
function getschooljaar($profielid){
|
||||
$targetjaar = false;
|
||||
|
||||
$profiel = $this->Sop_model->get_record_by_id($profielid);
|
||||
$this->sql = "SELECT schooljaarnr, naam
|
||||
FROM tb_schooljaren
|
||||
WHERE start >= '{$profiel->van}'
|
||||
AND start <='{$profiel->tm}'
|
||||
ORDER BY schooljaarnr DESC";
|
||||
$schooljaren= $this->get_query_result();
|
||||
|
||||
//Kijk of voor welk schooljaar er gegevens zijn; neem daarvan het meest recente schooljaar.
|
||||
if ($schooljaren){
|
||||
foreach($schooljaren as $schooljaar){
|
||||
$groepsinfo = $this->getgroepeninfo($schooljaar->schooljaarnr);
|
||||
if ($groepsinfo->groepen > 0){
|
||||
$targetjaar = $schooljaar->schooljaarnr;
|
||||
break;
|
||||
}
|
||||
};//foreach
|
||||
};
|
||||
return $targetjaar;
|
||||
}
|
||||
|
||||
function gettargetjaar($profielid, $orgid,$currentchapterid){
|
||||
// als er een current hoofdstuk is, gebruik dat jaar
|
||||
$where = array("profiel_id"=>$profielid, "chapter_id"=>$currentchapterid);
|
||||
$targetjaar = $this->get_fieldvalue($where, "orgversieid");
|
||||
// als er nog geen current hoofdstuk is; als er al een hoofdstuk is met dezelfde module, gebruik hetzelfde jaar.
|
||||
if (!$targetjaar){
|
||||
$where = array("id"=>$currentchapterid);
|
||||
$module = $this->Hoofdstukken_model->get_fieldvalue($where,'module');
|
||||
$where = array("module"=>$module, "id !="=>$currentchapterid);
|
||||
$otherchapters = $this->Hoofdstukken_model->get_records_where($where);
|
||||
if ($otherchapters){
|
||||
foreach($otherchapters as $otherchapter){
|
||||
$where = array("profiel_id"=>$profielid, "chapter_id"=>$otherchapter->id);
|
||||
$targetjaar = $this->get_fieldvalue($where, "orgversieid");
|
||||
if ($targetjaar) break;
|
||||
}; // foreach
|
||||
}; // if otherchapters
|
||||
}
|
||||
|
||||
//als er dan nog geen target jaar is, bepaal dan het targetjaar aan de hand van de periode
|
||||
if (is_null($targetjaar)){
|
||||
$targetjaar = $this->getschooljaar($profielid);
|
||||
}
|
||||
return $targetjaar;
|
||||
}
|
||||
|
||||
function getdiversiteit234($profielid,$targetversieid, $module){
|
||||
$orgid = $this->globorgid;
|
||||
$swvid = $this->Organisaties_model->get_swvid ($orgid);
|
||||
if ($targetversieid) { $targetjaar=$this->Schooljaren_model->get_fieldvalue(array('id'=> $targetversieid),'schooljaarnr');} // let op is targetid het id en heeft targetjaar het id nodig of iets anders?
|
||||
else {
|
||||
$targetjaar = $this->gettargetjaar($profielid, $orgid,2);
|
||||
}
|
||||
//haal de tabel op
|
||||
$dvt2 = false;
|
||||
$dvt4 = false;
|
||||
$dvt3 = false;
|
||||
$divgrafiek1= false;
|
||||
$totaal = 0;
|
||||
$hoeveelgroepen = 0;
|
||||
$combi = 0;
|
||||
$som1 = 0;
|
||||
$som2 = 0;
|
||||
$som3 = 0;
|
||||
$som4 = 0;
|
||||
$normaantal = 0;
|
||||
$totdiversiteit = 0;
|
||||
$totdq = 0;
|
||||
$schooljaar ='';
|
||||
if ($targetjaar){
|
||||
$schoolsoort = 'REGULIER';
|
||||
$minnivo = 1;
|
||||
$maxnivo = 4;
|
||||
$aantallnschool =0;
|
||||
$normaantallen = $this->Diversiteits_model->getnormaantallen($orgid, $schoolsoort);
|
||||
$groepen = $this->Groepen_model->getgroepen($orgid, $targetjaar, $module);
|
||||
$osvormen = $this->Diversiteits_model->getosvormen($orgid, $targetjaar, $minnivo, $maxnivo, $module);
|
||||
$schooljaar = $this->Schooljaren_model->get_record_by_id($targetjaar);
|
||||
$combifactoren = $this->Combifactoren_model->getfactoren($swvid);
|
||||
$schoolcombifactor = 0;
|
||||
if ($groepen){
|
||||
foreach($groepen as $groep){
|
||||
$groepasarray = explode(';',$groep->niveau);
|
||||
$aantallnschool = $groep->totaantal + $aantallnschool;
|
||||
$combis = count($groepasarray);
|
||||
|
||||
$groep->diversiteit = $groep->som1 + (1.5 * $groep->som2) + (2 * $groep->som3) + (4 * $groep->som4);
|
||||
if ($combis==2 && $groep->totaantal > 0) {
|
||||
$groep->diversiteit = $groep->diversiteit + $combifactoren->combi2;
|
||||
$schoolcombifactor = $schoolcombifactor + $combifactoren->combi2;
|
||||
};
|
||||
if ($combis >=3 && $groep->totaantal > 0) {
|
||||
$groep->diversiteit = $groep->diversiteit + $combifactoren->combi3;
|
||||
$schoolcombifactor = $schoolcombifactor + $combifactoren->combi3;
|
||||
};
|
||||
//if (strpos($groep->niveau,';') >0) {$groep->diversiteit = $groep->diversiteit + 1.5;};
|
||||
|
||||
$factor =$normaantallen->groep38;
|
||||
if (strpos($groep->niveau,'1') !== false || strpos($groep->niveau,'2') !== false) {$factor = $normaantallen->groep12;};
|
||||
$groep->dq= round(($groep->diversiteit / $factor),2);
|
||||
$totaal = $totaal + $groep->totaantal;
|
||||
$hoeveelgroepen = $hoeveelgroepen + 1;
|
||||
if (strpos($groep->niveau, ';') > 0){$combi = $combi + 1;}
|
||||
$som1= $som1 + $groep->som1;
|
||||
$som2= $som2 + $groep->som2;
|
||||
$som3= $som3 + $groep->som3;
|
||||
$som4= $som4 + $groep->som4;
|
||||
if (strpos($groep->niveau,'1') !== false || strpos($groep->niveau,'2') !== false){
|
||||
$normaantal = $normaantal + $normaantallen->groep12;
|
||||
}
|
||||
else {
|
||||
$normaantal = $normaantal + $normaantallen->groep38;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$totdiversiteit = $som1 + (1.5 * $som2) + (2 * $som3) + (4 * $som4);
|
||||
// hier gaat het fout omdat de combifactor voor ieder groep moet worden toegevoegd
|
||||
//en dit ligt buiten de foreach groep
|
||||
if ($aantallnschool > 0){
|
||||
$totdiversiteit= $totdiversiteit + $schoolcombifactor;
|
||||
// if ($combis == 2){$totdiversiteit = $totdiversiteit + $combifactoren->combi2;};
|
||||
// if ($combis >= 3){$totdiversiteit = $totdiversiteit + $combifactoren->combi3;};
|
||||
}
|
||||
|
||||
if ($normaantal > 0){
|
||||
$totdq = $totdiversiteit / $normaantal;
|
||||
};
|
||||
}
|
||||
$data = array('normaantallen' =>$normaantallen,
|
||||
'groepen' =>$groepen,
|
||||
'osvormen' =>$osvormen,
|
||||
'schooljaar' => $schooljaar->naam,
|
||||
'totdiversiteit' => $totdiversiteit,
|
||||
'schooldq' => $totdq);
|
||||
$dvt2 = $this->load->view("monpas/sop/diversiteittabel2", $data,TRUE);
|
||||
$dvt4 = $this->load->view("monpas/sop/diversiteittabel4", $data, TRUE);
|
||||
$data2 = array( 'schooljaar' =>$schooljaar->naam,
|
||||
'totaal' => $totaal,
|
||||
'groepen' => $hoeveelgroepen,
|
||||
"combi" => $combi,
|
||||
'som1' => $som1,
|
||||
'som2' => $som2,
|
||||
'som3' => $som3,
|
||||
'som4' => $som4,
|
||||
'totdiversiteit' => $totdiversiteit,
|
||||
'totdq' => $totdq
|
||||
);
|
||||
$dvt3 = $this->load->view("monpas/sop/diversiteittabel3", $data2,TRUE);
|
||||
$data3=array('groepen' =>$groepen, 'totdq'=>$totdq);
|
||||
$divgrafiek1= $this->load->view("monpas/sop/diversiteitgrafiek1", $data3, TRUE);
|
||||
};
|
||||
|
||||
return array('dvt2' =>$dvt2,
|
||||
'dvt3' =>$dvt3,
|
||||
'dvt4' =>$dvt4,
|
||||
'divgrafiek1' =>$divgrafiek1,
|
||||
'targetjaar' => $targetjaar
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function getondersteuning12($profielid,$targetversieid, $module){
|
||||
$orgid =$this->globorgid;
|
||||
$os1='';
|
||||
$os2='';
|
||||
$som1 = 0;
|
||||
$som2 = 0;
|
||||
$som3 = 0;
|
||||
$som4 = 0;
|
||||
$normaantal = 0;
|
||||
$schooldiversiteit = 0;
|
||||
$schooldq = 0;
|
||||
$totschooltijd = 0;
|
||||
$totG = 0;
|
||||
$totS = 0;
|
||||
$totI = 0;
|
||||
|
||||
if ($targetversieid ) {$targetjaar = $this->Schooljaren_model->get_fieldvalue(array('id'=>$targetversieid), "schooljaarnr"); }
|
||||
else {$targetjaar = $this->gettargetjaar($profielid, $orgid,3);}
|
||||
|
||||
if ($targetjaar){
|
||||
$schooljaar = $this->Schooljaren_model->get_record_by_id($targetjaar);
|
||||
$groepen = $this->Groepen_model->getgroepen($orgid, $targetjaar, $module);
|
||||
$schooltype = "REGULIER";
|
||||
$normaantallen= $this->Diversiteits_model->getnormaantallen($orgid, $schooltype);
|
||||
if ($groepen){
|
||||
foreach($groepen as $groep){
|
||||
$groep->tijden = new stdClass;
|
||||
$groep->tijden = $this->Ondersteuningtijden_model->getgroeptijden($groep->id);
|
||||
$groep->tijdstring='';
|
||||
$groeptot =0;
|
||||
if ($groep->tijden){
|
||||
foreach($groep->tijden as $tijd){
|
||||
$groeptot = $groeptot + $tijd->minuten;
|
||||
|
||||
switch ($tijd->soort){
|
||||
case 'G' : $totG= $totG + $tijd->minuten; break;
|
||||
case 'S' : $totS= $totS + $tijd->minuten; break;
|
||||
case 'I' : $totI= $totI+ $tijd->minuten; break;
|
||||
}
|
||||
|
||||
$uur = floor($tijd->minuten / 60);
|
||||
$minuten = $tijd->minuten % 60;
|
||||
$uur0 ='';
|
||||
if ($uur < 10) $uur0='0';
|
||||
$minuut0 ='';
|
||||
if ($minuten < 10) $minuut0='0';
|
||||
$tijd->tijdstring = $tijd->soort.' '.$uur0.$uur.':'.$minuut0.$minuten;
|
||||
$totschooltijd = $totschooltijd + $tijd->minuten;
|
||||
}
|
||||
|
||||
}
|
||||
$groep->diversiteit = $groep->som1 + (1.5 * $groep->som2) + (2 * $groep->som3) + (4 * $groep->som4);
|
||||
if (strpos($groep->niveau,';') >0) {$groep->diversiteit = $groep->diversiteit + 1.5;};
|
||||
$factor =$normaantallen->groep38;
|
||||
if (strpos($groep->niveau,'1') > 0 || strpos($groep->niveau,'2') > 0) {$factor = $normaantallen->groep12;};
|
||||
$groep->dq= round(($groep->diversiteit / $factor),2);
|
||||
$som1= $som1 + $groep->som1;
|
||||
$som2= $som2 + $groep->som2;
|
||||
$som3= $som3 + $groep->som3;
|
||||
$som4= $som4 + $groep->som4;
|
||||
if (strpos($groep->niveau,'1') > 0 || strpos($groep->niveau,'2') > 0){
|
||||
$normaantal = $normaantal + $normaantallen->groep12;
|
||||
}
|
||||
else {
|
||||
$normaantal = $normaantal + $normaantallen->groep38;
|
||||
}
|
||||
$uur = floor($groeptot / 60);
|
||||
$minuten = $groeptot % 60;
|
||||
$uur0 ='';
|
||||
if ($uur < 10) $uur0='0';
|
||||
$minuut0 ='';
|
||||
if ($minuten < 10) $minuut0='0';
|
||||
$groep->tottijd= $uur0.$uur.':'.$minuut0.$minuten;
|
||||
}
|
||||
$uur = floor($totschooltijd / 60);
|
||||
$minuten = $totschooltijd % 60;
|
||||
$uur0 ='';
|
||||
if ($uur < 10) $uur0='0';
|
||||
$minuut0 ='';
|
||||
if ($minuten < 10) $minuut0='0';
|
||||
$schooltijdstring= $uur0.$uur.':'.$minuut0.$minuten;
|
||||
|
||||
$schooldiversiteit = $som1 + (1.5 * $som2) + (2 * $som3) + (4 * $som4);
|
||||
if ($normaantal > 0){
|
||||
$schooldq = round($schooldiversiteit / $normaantal, 2);
|
||||
};
|
||||
|
||||
|
||||
$data=array('groepen'=>$groepen,
|
||||
'schooljaar'=> $schooljaar->naam,
|
||||
'schooldq' =>$schooldq,
|
||||
'schooltijdstring' =>$schooltijdstring );
|
||||
$os1 = $this->load->view("monpas/sop/ondersteuning1", $data,TRUE);
|
||||
// print_r($os1);
|
||||
// die;
|
||||
}
|
||||
|
||||
$uur = floor($totG / 60);
|
||||
$minuten = $totG % 60;
|
||||
$uur0 ='';
|
||||
if ($uur < 10) $uur0='0';
|
||||
$minuut0 ='';
|
||||
if ($minuten < 10) $minuut0='0';
|
||||
$Gtijdstring= $uur0.$uur.':'.$minuut0.$minuten;
|
||||
|
||||
$uur = floor($totS / 60);
|
||||
$minuten = $totS % 60;
|
||||
$uur0 ='';
|
||||
if ($uur < 10) $uur0='0';
|
||||
$minuut0 ='';
|
||||
if ($minuten < 10) $minuut0='0';
|
||||
$Stijdstring= $uur0.$uur.':'.$minuut0.$minuten;
|
||||
|
||||
$uur = floor($totI / 60);
|
||||
$minuten = $totI % 60;
|
||||
$uur0 ='';
|
||||
if ($uur < 10) $uur0='0';
|
||||
$minuut0 ='';
|
||||
if ($minuten < 10) $minuut0='0';
|
||||
$Itijdstring= $uur0.$uur.':'.$minuut0.$minuten;
|
||||
$data2= array("gtijd"=> $Gtijdstring,
|
||||
'stijd' => $Stijdstring,
|
||||
"itijd"=> $Itijdstring);
|
||||
$os2 = $this->load->view("monpas/sop/ondersteuning2", $data2,TRUE);
|
||||
}
|
||||
return array('os1' => $os1,
|
||||
'os2' => $os2,
|
||||
'targetjaar' => $targetjaar );
|
||||
}
|
||||
|
||||
function gettargetversie($profielid, $orgid,$currentchapterid){
|
||||
// als er een current hoofdstuk is, gebruik die versie
|
||||
$where = array("profiel_id"=>$profielid, "chapter_id"=>$currentchapterid);
|
||||
$targetversieid = $this->get_fieldvalue($where, "orgversieid");
|
||||
|
||||
// als er nog geen current hoofdstuk is maar wel een hoofdstuk is met dezelfde module, gebruik hetzelfde jaar.
|
||||
if (!$targetversieid){
|
||||
$where = array("id"=>$currentchapterid);
|
||||
$module = $this->Hoofdstukken_model->get_fieldvalue($where,'module');
|
||||
$where = array("module"=>$module, "id !="=>$currentchapterid);
|
||||
$otherchapters = $this->Hoofdstukken_model->get_records_where($where);
|
||||
if ($otherchapters){
|
||||
foreach($otherchapters as $otherchapter){
|
||||
$where = array("profiel_id"=>$profielid, "chapter_id"=>$otherchapter->id);
|
||||
$targetversieid = $this->get_fieldvalue($where, "orgversieid");
|
||||
if ($targetversieid) break;
|
||||
}; // foreach
|
||||
}; // if otherchapters
|
||||
}
|
||||
//als er dan nog geen targetversie is, bepaal dan het targetversie aan de hand van de periode
|
||||
if (!$targetversieid){
|
||||
$profiel=$this->Sop_model->get_record_by_id($profielid);
|
||||
$versies = $this->Filledversions_model->getversiesperorgperperiode($orgid, $module, $profiel->van, $profiel->tm);
|
||||
if ($versies){
|
||||
$targetversie = $this->Orgversies_model->get_record_by_id($versies[0]->id);
|
||||
$targetversieid = $targetversie->id;
|
||||
};
|
||||
}
|
||||
return $targetversieid;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getenquetetabellen($profielid, $module, $chapterid, $targetversieid){
|
||||
$orgid = $this->globorgid;
|
||||
|
||||
$grafiek ='';
|
||||
$tabel1 = '';
|
||||
$tabel2 = '';
|
||||
|
||||
$scores = '';
|
||||
$ambitie = '';
|
||||
$profiel = $this->Sop_model->get_record_by_id($profielid);
|
||||
//zoek de gewenste versie
|
||||
if (!$targetversieid ){
|
||||
$targetversieid = $this->gettargetversie($profielid, $orgid,$chapterid);
|
||||
}
|
||||
if ($targetversieid) {
|
||||
$scores = $this->Scores_model->calculateschool($targetversieid, $orgid);
|
||||
$ambitie = $this->Ambities_model->getOrgAmbities($targetversieid, $orgid);
|
||||
}
|
||||
|
||||
if (!$targetversieid || !$scores){
|
||||
return array('grafiek1' => '',
|
||||
'tabel1' => '',
|
||||
'tabel2' => '',
|
||||
'targetversie' => $targetversieid);
|
||||
}
|
||||
$totgem = 0 ;
|
||||
$totaantal= 0;
|
||||
$ijkpuntenok = 0;
|
||||
$welkehoogste = 0;
|
||||
$hoogstescore = -1;
|
||||
$welkelaagste = 0;
|
||||
$laagstescore = 101;
|
||||
if ($scores){
|
||||
foreach($scores as $score){
|
||||
$gem = 0;
|
||||
|
||||
if ($score->num > 0) {
|
||||
$gem=$score->somscore / $score->num;
|
||||
};
|
||||
$totgem= $totgem + $gem;
|
||||
$totaantal=$totaantal + 1;
|
||||
|
||||
$score->kleurcode=$this->kleurcodes->getkleur($gem);
|
||||
|
||||
if ($gem > $hoogstescore){
|
||||
$hoogstescore = $gem;
|
||||
$welkehoogste = $score->nummer;
|
||||
}
|
||||
if ($gem <= $laagstescore){
|
||||
$laagstescore = $gem;
|
||||
$welkelaagste = $score->nummer;
|
||||
}
|
||||
if ($ambitie && $gem >= $ambitie->zprocent) {$ijkpuntenok = $ijkpuntenok + 1;};
|
||||
|
||||
}
|
||||
if ($totaantal >0){ $totgem= round($totgem/ $totaantal, 2);}
|
||||
}
|
||||
$totgemkleur= $this->kleurcodes->getkleur($totgem);
|
||||
// foreach scores bereken som en dus totgem en ijkpuntenok
|
||||
$tabelid='';
|
||||
switch ($module){
|
||||
case 1: $tabelid = "tabelmb1"; break;
|
||||
case 3: $tabelid = "tabeltv1"; break;
|
||||
case 4: $tabelid = "tabelsm1"; break;
|
||||
case 5: $tabelid = "tabeles1"; break;
|
||||
}
|
||||
$labels = $this->Labels_model->getalllabels($module);
|
||||
$kleurtabel = $this->kleurcodes->getkleurlegenda();
|
||||
|
||||
$orgversie = $this->Orgversies_model->get_record_by_id($targetversieid);
|
||||
$vantm = "geen periode bekend.";
|
||||
if ($orgversie){
|
||||
$vantm = "Gegevens uit periode ".$orgversie->periodenummer." van ".mysql2date($orgversie->geldigvanaf)." t/m ".mysql2date($orgversie->geldigtm);
|
||||
};
|
||||
$data=array( "tabelid" => $tabelid,
|
||||
"ambitie" => $ambitie,
|
||||
"labels" => $labels,
|
||||
"scores" => $scores,
|
||||
'totgem' => $totgem,
|
||||
'totgemkleur' =>$totgem,
|
||||
'ijkpuntenok' => $ijkpuntenok,
|
||||
'welkehoogste' => $welkehoogste,
|
||||
'hoogstescore' => round($hoogstescore,1),
|
||||
'welkelaagste' => $welkelaagste,
|
||||
'laagstescore' => round($laagstescore,1) ,
|
||||
"kleurtabel" =>$kleurtabel,
|
||||
"vantm" =>$vantm);
|
||||
$tabel1 = $this->load->view("monpas/sop/monbastabel1", $data,TRUE);
|
||||
$grafiek = $this->load->view("monpas/sop/monbasgrafiek1",$data, TRUE);
|
||||
|
||||
$aantalijkpunten = 0;
|
||||
$ijkpunten = $this->Orgversies_model->getijkpunten( $targetversieid);
|
||||
|
||||
if ($ijkpunten){
|
||||
$aantalijkpunten=count($ijkpunten);
|
||||
};
|
||||
|
||||
$targetversie = $this->Orgversies_model->get_record_by_id($targetversieid);
|
||||
if ($targetversie->vorm == 1){
|
||||
// school vorm
|
||||
$lks = $this->getorgscores($orgid, $targetversieid,$aantalijkpunten);
|
||||
}
|
||||
else{
|
||||
$lks= $this->getlksscores($orgid, $targetversieid,$aantalijkpunten);
|
||||
}
|
||||
|
||||
$tabelid = '';
|
||||
switch ($module){
|
||||
case 1: $tabelid = "tabelmb2"; break;
|
||||
case 3: $tabelid = "tabeltv2"; break;
|
||||
case 4: $tabelid = "tabelsm2"; break;
|
||||
case 5: $tabelid = "tabeles2"; break;
|
||||
}
|
||||
$data = array( 'tabelid' =>$tabelid,
|
||||
'lks' =>$lks,
|
||||
'aantalijkpunten' => $aantalijkpunten,
|
||||
'ijkpunten' => $ijkpunten,
|
||||
'versievorm' => $targetversie->vorm);
|
||||
$tabel2 = $this->load->view("monpas/sop/monbastabel2", $data,TRUE);
|
||||
|
||||
return array ('grafiek1' => $grafiek,
|
||||
'tabel1' => $tabel1,
|
||||
'tabel2' => $tabel2,
|
||||
'targetversie' => $targetversieid);
|
||||
}
|
||||
|
||||
|
||||
function getlksscores($orgid, $orgversieid,$aantalijkpunten){
|
||||
$lks = $this->Filledversions_model->getlks($orgid, $orgversieid);
|
||||
if ($lks){
|
||||
foreach($lks as $lk){
|
||||
$lk->scores = $this->Scores_model->getlkscores($lk->filledversionid);
|
||||
$som = 0;
|
||||
if ($lk->scores){
|
||||
foreach($lk->scores as $score){
|
||||
$score->gem = new stdClass();
|
||||
$score->gem = $score->somcore / $score->num;
|
||||
$score->colorcode = $this->kleurcodes->getkleur($score->gem);
|
||||
$som = $som + $score->gem;
|
||||
}
|
||||
$lk->lkgem = round($som / $aantalijkpunten, 0);
|
||||
$lk->colorcode = $this->kleurcodes->getkleur($lk->lkgem);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $lks;
|
||||
}
|
||||
function getorgscores($orgid, $orgversieid,$aantalijkpunten){
|
||||
|
||||
$lks = array();
|
||||
$lks[0] = new stdClass;
|
||||
$fv = $this->Filledversions_model->getfilledversion($orgversieid, $orgid, 0, 1);
|
||||
$lks[0]->filledversionid = $fv->id;
|
||||
$lks[0]->fullname = $this->Organisaties_model->get_record_by_id($orgid, "naam",true);
|
||||
$lks[0]->orgid = $orgid;
|
||||
$lks[0]->scores = $this->Scores_model->getgemscores($orgversieid, $orgid);
|
||||
|
||||
if ($lks[0]->scores){
|
||||
$som = 0;
|
||||
foreach($lks[0]->scores as $score){
|
||||
$score->colorcode = $this->kleurcodes->getkleur($score->gem);
|
||||
$som = $som + $score->gem;
|
||||
}
|
||||
$lks[0]->lkgem = round($som / $aantalijkpunten, 0);
|
||||
$lks[0]->colorcode = $this->kleurcodes->getkleur($lks[0]->lkgem);
|
||||
}
|
||||
return $lks;
|
||||
}
|
||||
function getOntwikkelagenda($profielid, $module,$targetversieid){
|
||||
$tabel1='';
|
||||
$tabel2='';
|
||||
$orgid = $this->globorgid;
|
||||
$profiel = $this->Sop_model->get_record_by_id($profielid);
|
||||
$scores = [];
|
||||
|
||||
if ($module == 1) $chapterid = 11;
|
||||
else $chapterid = 12;
|
||||
if (! $targetversieid) {
|
||||
$targetversieid =$this->gettargetversie($profielid, $orgid,$chapterid);
|
||||
}
|
||||
if ($targetversieid){
|
||||
$targetversie = $this->Orgversies_model->get_record_by_id($targetversieid);
|
||||
$scores = $this->Scores_model->calculateschool($targetversieid, $orgid);
|
||||
$ambitie = $this->Ambities_model->getOrgAmbities($targetversieid, $orgid);
|
||||
|
||||
if($targetversie->scoretype == 7){
|
||||
$grens1 = 33;
|
||||
$grens2 = 66;
|
||||
$grens3 = 100;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (!$targetversieid){
|
||||
return array( 'tabel1' => '',
|
||||
'tabel2' => '');
|
||||
}
|
||||
$gewenst = $this->Scores_model->getgewenst($orgid, $targetversieid);
|
||||
$i =0;
|
||||
|
||||
$scores = $scores ? $scores : [];
|
||||
|
||||
foreach($scores as $score){
|
||||
$score->gem = 0;
|
||||
if ($score->num > 0) {
|
||||
$score->gem= round($score->somscore / $score->num,1);
|
||||
}
|
||||
$score->huidig = $this->kleurcodes->getnummer($score->gem);
|
||||
if($targetversie->scoretype == 7){
|
||||
if($score->gem == $grens3) $score->huidig = 4;
|
||||
if($score->gem < $grens3) $score->huidig = 3;
|
||||
if($score->gem < $grens2) $score->huidig = 2;
|
||||
if($score->gem < $grens1) $score->huidig = 1;
|
||||
}
|
||||
|
||||
if ($gewenst){
|
||||
$score->wens = $gewenst[$i]->wens;
|
||||
$i = $i + 1;
|
||||
};
|
||||
}; //foreach
|
||||
|
||||
$labels = $this->Labels_model->getalllabels($module);
|
||||
$kleurtabel = $this->kleurcodes->getkleurlegenda();
|
||||
if($targetversie->scoretype == 7){
|
||||
$kleurtabel = $this->kleurcodes->getKleurlegendaType($targetversie->scoretype);
|
||||
}
|
||||
$data= array( "scores" => $scores,
|
||||
"labels" => $labels,
|
||||
"module" => $module,
|
||||
"kleurtabel" => $kleurtabel);
|
||||
$tabel1 = $this->load->view("monpas/sop/ontwikkelagenda", $data,TRUE);
|
||||
$data = array( "scores" => $scores,
|
||||
"labels" => $labels,
|
||||
"module" => $module);
|
||||
$tabel2 = $this->load->view("monpas/sop/ontwikkelagenda2", $data,TRUE);
|
||||
return array(
|
||||
'tabel1' => $tabel1,
|
||||
'tabel2' => $tabel2,
|
||||
'targetversie' => $targetversieid);
|
||||
}
|
||||
|
||||
function getPagvolgorde($profielID){
|
||||
$this->sql = "SELECT id as sopinhoudID, volgorde
|
||||
FROM tb_sopinhouden
|
||||
WHERE profiel_id = {$profielID}
|
||||
ORDER BY volgorde";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Sop_model oktober 2015 */
|
||||
|
||||
class Sopviews_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_sopviews';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array();
|
||||
$this->load->model($models);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Sorteerlabels_model februari 2018 */
|
||||
|
||||
class Sorteerlabels_model extends MY_Model{
|
||||
|
||||
protected $tablename = 'tb_sorteerlabels';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
function get_labels($criteriumid){
|
||||
$this->sql =" SELECT id as waardeid, sortering_id, naam, volgorde
|
||||
FROM tb_sorteerlabels
|
||||
WHERE sortering_id = {$criteriumid}
|
||||
ORDER BY volgorde, id ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getSchoolLabel($schoolid, $criteriumid){
|
||||
$this->sql = " SELECT L.id
|
||||
FROM tb_sorteerlabels L
|
||||
JOIN tb_sorteerlabels_org O ON L.id = O.label_id
|
||||
WHERE L.sortering_id = {$criteriumid}
|
||||
AND O.organisatie_id = {$schoolid} ";
|
||||
return $this->get_query_row('id');
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Sorteerlabelsorg_model februari 2018 */
|
||||
|
||||
class Sorteerlabelsorg_model extends MY_Model{
|
||||
|
||||
protected $tablename = 'tb_sorteerlabels_org';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Sorteringen_model februari 2018 */
|
||||
|
||||
class Sorteringen_model extends MY_Model{
|
||||
|
||||
protected $tablename = 'tb_sorteringen';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
function get_criteriabijSWV($swvID){
|
||||
$this->sql =" SELECT id, swv_id, naam
|
||||
FROM tb_sorteringen
|
||||
WHERE swv_id= {$swvID}
|
||||
ORDER BY naam ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getSchoolIndeling($schoolid, $sorteerid){
|
||||
$this->sql =" SELECT SL.id as waardeid, SL.naam AS waarde
|
||||
FROM tb_sorteringen S
|
||||
JOIN tb_sorteerlabels SL ON S.id = SL.sortering_id
|
||||
JOIN tb_sorteerlabels_org LO ON LO.label_id = SL.id
|
||||
WHERE LO.organisatie_id = {$schoolid}
|
||||
AND S.id = {$sorteerid} ";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Standaardteksten_model oktober 2015 */
|
||||
|
||||
class Standaardteksten_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_standaardteksten';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array();
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
//Teksten_model april 2018 */
|
||||
|
||||
class Teksten_model extends MY_Model{
|
||||
|
||||
protected $tablename = 'tb_teksten';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
function gettekst($modulenr, $naam){
|
||||
$this->sql ="SELECT text
|
||||
FROM tb_teksten T
|
||||
JOIN tb_menus M ON T.modulenr = M.module
|
||||
WHERE T.modulenr = {$modulenr}
|
||||
AND M.paginanaam = '{$naam}'
|
||||
";
|
||||
|
||||
return $this->get_query_row('text');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** TLV_model juli 2019 */
|
||||
|
||||
class tlvs_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_tlvs';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array();
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
function getAantalTLVs($orgid, $schooljaarnr){
|
||||
$this->sql = "SELECT T.id, T.aantal, T.soort, T.zwaarte
|
||||
FROM tb_tlvs T
|
||||
JOIN tb_schooljaren S ON T.schooljaarnr = S.schooljaarnr
|
||||
WHERE T.organisatie_id = {$orgid}
|
||||
AND T.schooljaarnr = {$schooljaarnr}
|
||||
ORDER BY T.soort ";
|
||||
return $this->get_query_result();
|
||||
|
||||
}
|
||||
|
||||
function getAantalLeerlingenMetTLV($schooljaarnr, $orgids){
|
||||
$this->sql = "SELECT SUM(COALESCE(T.aantal, 0)) as aantal, T.soort, T.zwaarte
|
||||
FROM tb_tlvs T
|
||||
JOIN tb_schooljaren S ON T.schooljaarnr = S.schooljaarnr
|
||||
JOIN tb_aantalleerlingen A ON T.organisatie_id = A.organisatie_id
|
||||
WHERE T.organisatie_id in ({$orgids})
|
||||
AND T.schooljaarnr = {$schooljaarnr}
|
||||
AND A.schooljaarnr = {$schooljaarnr}
|
||||
AND A.meetellen = 'T'
|
||||
GROUP BY T.zwaarte
|
||||
ORDER BY T.soort, T.zwaarte = 'zwaar' , T.zwaarte = 'licht', T.zwaarte = 'hoog',
|
||||
T.zwaarte = 'midden', T.zwaarte = 'laag' ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getAantalTLVsSop($schooljaarnr, $orgid){
|
||||
$this->sql = "SELECT SUM(COALESCE(T.aantal, 0)) as aantal
|
||||
FROM tb_tlvs T
|
||||
JOIN tb_schooljaren S ON T.schooljaarnr = S.schooljaarnr
|
||||
JOIN tb_aantalleerlingen A ON T.organisatie_id = A.organisatie_id
|
||||
WHERE T.organisatie_id = {$orgid}
|
||||
AND T.schooljaarnr = {$schooljaarnr}
|
||||
AND A.schooljaarnr = {$schooljaarnr}
|
||||
AND A.meetellen = 'T' ";
|
||||
return $this->get_query_row('aantal');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Toewijzingen_model januari 2016 */
|
||||
|
||||
class Toewijzingen_model extends MY_Model{
|
||||
|
||||
protected $tablename = 'tb_toewijzingen';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array();
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
function gettoewijzingen($orgid){
|
||||
$this->sql = "SELECT T.id, basis, extra, som, overig, vastgelegd,basisextra, basisextravast,
|
||||
K.naam, K.jaarnr, IF(T.id >0, T.jaarclosed,'F') as jaarclosed
|
||||
FROM tb_kalenderjaren K
|
||||
LEFT JOIN (SELECT * FROM tb_toewijzingen WHERE orgid = {$orgid}) T
|
||||
ON T.kalenderjaarnr = K.jaarnr
|
||||
ORDER BY K.jaarnr DESC";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
function gettoewijzingperjaar($orgid, $jaarnr){
|
||||
$this->sql = " SELECT id, basis, extra, som, overig, basisextra, jaarclosed
|
||||
FROM tb_toewijzingen
|
||||
WHERE orgid = {$orgid}
|
||||
AND kalenderjaarnr = {$jaarnr}";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
function gettoewijzingenperjaaroverorgs($orgids, $jaarnr){
|
||||
$this->sql = " SELECT id,
|
||||
round(sum(basis) /100) as basis,
|
||||
round(sum(extra) /100 ) as extra,
|
||||
round(sum(basis + extra) /100) as totaal
|
||||
FROM tb_toewijzingen
|
||||
WHERE orgid in ({$orgids})
|
||||
AND kalenderjaarnr = {$jaarnr}
|
||||
GROUP BY kalenderjaarnr";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
|
||||
function UpdateToewijzingen($orgid, $jaarnr){
|
||||
$where=array("orgid"=>$orgid, "kalenderjaarnr" =>$jaarnr);
|
||||
$record = $this->get_records_where($where, TRUE);
|
||||
|
||||
if ($record){
|
||||
$data = array("jaarclosed" => "T");
|
||||
$this->update_record($data, $record->id);}
|
||||
else {
|
||||
$data=array("orgid" =>$orgid,
|
||||
"kalenderjaarnr" => $jaarnr,
|
||||
"jaarclosed" => "T");
|
||||
$newid = $this->insert_record($data);
|
||||
};
|
||||
}
|
||||
function getNextJaar($orgid){
|
||||
$this->sql= "SELECT max(kalenderjaarnr) as kalenderjaarnr
|
||||
FROM tb_toewijzingen
|
||||
WHERE orgid= {$orgid}
|
||||
AND jaarclosed = 'T'
|
||||
ORDER BY kalenderjaarnr DESC";
|
||||
$closedjaar=$this->get_query_row('kalenderjaarnr');
|
||||
return $closedjaar + 1;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**Versies_model maart 2015 */
|
||||
|
||||
class Versies_model extends MY_Model{
|
||||
|
||||
protected $tablename = 'tb_versies';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
function getallversies($module){
|
||||
$this->sql="SELECT id, naam, ingangsdatum,systemnorm, actief
|
||||
FROM tb_versies
|
||||
WHERE modulenr = {$module}
|
||||
ORDER BY ingangsdatum DESC";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
function getversie($id){
|
||||
$this->sql="SELECT id, naam, ingangsdatum,systemnorm, actief
|
||||
FROM tb_versies
|
||||
WHERE id = {$id}";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
function getversiesbymodule($module){
|
||||
$this->sql = "SELECT id, naam, ingangsdatum
|
||||
FROM tb_versies
|
||||
WHERE actief = 1
|
||||
AND modulenr = {$module}";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**Wenssituaties_model april 2015 */
|
||||
|
||||
class Wenssituaties_model extends MY_Model{
|
||||
|
||||
protected $tablename = 'tb_wenssituaties';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
function getgewenst($orgversieid, $orgid){
|
||||
$this->sql = "SELECT id, ijkpunt_id, wens
|
||||
FROM tb_wenssituaties
|
||||
WHERE organisatie_id = {$orgid}
|
||||
AND orgversie_id = {$orgversieid}";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
function getgewenstvoorpartituur($orgversieid, $orgid){
|
||||
$this->sql = "SELECT nummer, wens , orgversie_id
|
||||
FROM tb_wenssituaties W
|
||||
JOIN tb_ijkpunten Y ON Y.id = W.ijkpunt_id
|
||||
WHERE organisatie_id ={$orgid}
|
||||
AND orgversie_id = {$orgversieid}
|
||||
ORDER BY nummer";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getGewenstLeerkracht($filledversionid){
|
||||
$this->sql = "SELECT W.id, W.ijkpunt_id, W.wens, Y.nummer
|
||||
FROM tb_wenssituaties W
|
||||
JOIN tb_ijkpunten Y ON W.ijkpunt_id = Y.id
|
||||
JOIN tb_orgusers OU ON W.orguser_id = OU.id
|
||||
JOIN tb_users U ON OU.user_id = U.id
|
||||
JOIN tb_filledversions FV ON U.id = FV.user_id
|
||||
WHERE FV.id = {$filledversionid}
|
||||
ORDER BY Y.nummer";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user