Files
monpas/application/libraries/monpas/Diversiteitafbeeldingen.php
T

372 lines
13 KiB
PHP

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Diversiteitafbeeldingen {
private $CI;
private $normaantallen;
private $normaantallensbo;
private $normaantallenso;
private $normaantal;
private $normtot =0;
private $schooljaar;
private $groepen;
private $groep;
private $vormen;
private $combifactor;
private $combifactoren;
private $schoolfactor;
private $tijd;
private $uur;
private $uur0;
private $minuut0;
private $string;
private $schoolminuten= 0;
private $schooltijdstring;
private $minuten;
private $totG = 0;
private $totS = 0;
private $totI = 0;
private $gtijd;
private $itijd;
private $stijd;
private $factorenTot = 0;
private $combis;
private $combi;
private $totaal = 0;
private $aantalgroepen = 0;
private $som1 =0;
private $som2 =0;
private $som3 =0;
private $som4 =0;
private $som5 =0;
private $som6 =0;
private $som7 =0;
private $som8 =0;
private $totdiversiteit;
private $somdq;
private $totdq;
private $diversiteitafbeeldingen =[];
public function __construct($diversiteit, $modulenr, $orgversieid){
$this->CI = & get_instance();
$this->modulenr = $modulenr;
$this->orgversieid = $orgversieid;
$this->diversiteit = $diversiteit;
$this->handle();
}
public function getDiversiteitAfbeeldingen(){
return $this->diversiteitafbeeldingen;
}
private function handle(){
$this->setNormaantallen();
$this->setSchooljaar();
$this->setGroepen();
$this->setOndersteuningsvormen();
$this->setFactoren();
$this->loopGroepen();
$this->setTotDiversiteit();
$this->setDQ();
$this->setDiversiteitAfbeeldingen();
}
private function setNormaantallen()
{
if($this->modulenr == 2 || $this->modulenr == 660) {
$this->normaantallen = $this->diversiteit['normaantallen']['regulier'];
}
if($this->modulenr == 270){
$this->normaantallensbo = $this->diversiteit['normaantallen']['sbo'];
$this->normaantallenso = $this->diversiteit['normaantallen']['so'];
}
}
private function setSchooljaar(){
$this->schooljaar = $this->diversiteit['schooljaar'];
}
private function setGroepen(){
$this->groepen = $this->diversiteit['groepen'];
}
private function setOndersteuningsvormen(){
$this->vormen = $this->diversiteit['vormen'];
}
private function setFactoren(){
if($this->diversiteit['factoren']) {
$this->combifactoren = $this->diversiteit['factoren'];
}
}
private function loopGroepen(){
if(!$this->groepen) return;
foreach ($this->groepen as $index => $this->groep){
$this->groep->totminuten = 0;
$this->groep->tottijd = 0;
$this->groep->minuten1 = 0;
$this->groep->minuten2 = 0;
$this->groep->minuten3 = 0;
$this->groep->minuten4 = 0;
$this->groep->minuten5 = 0;
$this->groep->dagtijd1 =0;
$this->groep->dagtijd2 =0;
$this->groep->dagtijd3 =0;
$this->groep->dagtijd4 =0;
$this->groep->dagtijd5 =0;
$this->groep->deelfactoren = 0;
$this->loopTijden();
$this->setGroepTijdstring();
$this->setSchoolMinuten();
$this->setSchoolTijdstring();
$this->setCombis();
$this->setDiversiteitfactor();
$this->setDiversiteitGroep();
$this->setSchoolFactor();
$this->setDeelfactor();
$this->setDiversiteitsquotient();
$this->setFactorenTotaal();
$this->setTotaal();
$this->telGroepen();
$this->setDQSom();
$this->telCombi();
$this->telSommen();
$this->telNormaantal();
}
}
private function loopTijden(){
if(!$this->groep->tijden) return;
foreach($this->groep->tijden as $this->tijd){
$this->setMinutenTotaal();
$this->setSoortTotaal();
$this->setTijdPerSoortString();
$this->setTijdStringPerdag();
}
}
private function setMinutenTotaal(){
$this->groep->totminuten = $this->groep->totminuten + $this->tijd->minuten;
}
private function setSoortTotaal(){
switch ($this->tijd->soort){
case 'G' : $this->totG= $this->totG + $this->tijd->minuten; break;
case 'S' : $this->totS= $this->totS + $this->tijd->minuten; break;
case 'I' : $this->totI= $this->totI+ $this->tijd->minuten; break;
}
}
private function setTijdStringPerDag(){
$this->groep->{'minuten' . $this->tijd->dagnr} = $this->groep->{'minuten' . $this->tijd->dagnr} + $this->tijd->minuten;
$dagminuten = $this->groep->{'minuten' . $this->tijd->dagnr};
$this->groep->{'dagtijd' . $this->tijd->dagnr} = $this->maakTijdstring($dagminuten);
}
private function setTijdPerSoortString(){
$this->gtijd = $this->maakTijdstring($this->totG);
$this->stijd = $this->maakTijdstring($this->totS);
$this->itijd = $this->maakTijdstring($this->totI);
}
private function setGroepTijdstring(){
$this->groep->tottijd= $this->maakTijdstring($this->groep->totminuten);
}
private function setSchoolMinuten(){
$this->schoolminuten = $this->schoolminuten + $this->groep->totminuten;
}
private function setSchoolTijdstring(){
$this->schooltijdstring = $this->maakTijdstring($this->schoolminuten);
}
private function maakTijdstring($inputminuten){
$this->uur = floor($inputminuten / 60);
$this->minuten = $inputminuten % 60;
$this->uur0 ='';
if ($this->uur < 10) $this->uur0='0';
$this->minuut0 ='';
if ($this->minuten < 10) $this->minuut0='0';
$this->string = $this->uur0.$this->uur.':'.$this->minuut0.$this->minuten;
return $this->string;
}
private function setCombis(){
$array = explode(';', $this->groep->niveau);
$this->combis = count($array);
}
private function setDiversiteitfactor(){
$this->combifactor = 0;
if($this->modulenr == 270) return;
if($this->combis == 2){
$this->combifactor= $this->combifactoren->combi2;
}
if($this->combis >2){
$this->combifactor = $this->combifactoren->combi3;
}
}
private function setDiversiteitGroep(){
if($this->modulenr == 2 || $this->modulenr == 660) {
$diversiteit = $this->groep->som1 + (1.5 * $this->groep->som2) +
(2 * $this->groep->som3) + (4 * $this->groep->som4);
if($diversiteit == 0){
$this->groep->groepdiversiteit = 0;
}
else {
$this->groep->groepdiversiteit =
$diversiteit +
$this->combifactor;
}
}
if($this->modulenr == 270) {
$diversiteit =
(2* $this->groep->som5) + (3 * $this->groep->som6) +
(4 * $this->groep->som7) + (5 * $this->groep->som8);
if($diversiteit == 0){
$this->groep->groepdiversiteit = 0;
}
else {
$this->groep->groepdiversiteit =
$diversiteit;
}
}
}
private function setSchoolFactor(){
if($this->modulenr == 270) return;
if($this->groep->groepdiversiteit == 0) return;
$this->schoolfactor = $this->schoolfactor + $this->combifactor;
}
private function setDeelfactor(){
$this->normaantal = new stdClass();
if($this->modulenr== 2 || $this->modulenr == 660) {
$this->normaantal->deelfactor = $this->normaantallen->groep38;
if (strpos($this->groep->niveau,'1') !== false || strpos($this->groep->niveau,'2') !== false) {
$this->normaantal->deelfactor = $this->normaantallen->groep12;
};
}
if($this->modulenr == 270){
if($this->groep->totaantal ==0){
$this->normaantal->deelfactor = 0;
return;
}
$this->normaantal->deelfactorsbo = $this->normaantallensbo->groep38;
if (strpos($this->groep->niveau,'1') !== false || strpos($this->groep->niveau,'2') !== false) {
$this->normaantal->deelfactorsbo = $this->normaantallensbo->groep12;
};
$this->normaantal->deelfactorso = $this->normaantallenso->groep38;
if (strpos($this->groep->niveau,'1') !== false || strpos($this->groep->niveau,'2') !== false) {
$this->normaantal->deelfactorso = $this->normaantallenso->groep12;
};
$this->normaantal->deelfactor = (($this->groep->som5 / $this->groep->totaantal) * $this->normaantal->deelfactorsbo) +
(($this->groep->totaantal - $this->groep->som5) / $this->groep->totaantal) * $this->normaantal->deelfactorso;
}
}
private function setDiversiteitsquotient(){
$this->groep->deelfactoren = $this->groep->deelfactoren + $this->normaantal->deelfactor;
if($this->groep->deelfactoren > 0) {
$this->groep->dq = round(($this->groep->groepdiversiteit / $this->groep->deelfactoren), 2);
}
}
private function setFactorenTotaal(){
$this->factorenTot = $this->factorenTot + $this->groep->deelfactoren;
}
private function setTotaal(){
$this->totaal =
$this->totaal + $this->groep->totaantal;
}
private function telGroepen(){
if($this->groep->totaantal > 0) {
$this->aantalgroepen = $this->aantalgroepen + 1;
}
}
private function setDQSom(){
if($this->aantalgroepen > 0) {
$this->somdq = $this->somdq+ $this->groep->dq;
}
}
private function telCombi(){
if($this->modulenr == 270) return;
if (strpos($this->groep->niveau, ';') > 0){
$this->combi = $this->combi + 1;}
}
private function telSommen(){
for($i =1; $i <= 8; $i++) {
if (isset($this->groep->{'som'.$i})) {
$this->{'som' . $i} = $this->{'som' . $i} + $this->groep->{'som' . $i};
}
}
}
private function telNormaantal(){
$this->normtot = $this->normtot + $this->normaantal->deelfactor;
}
private function setTotDiversiteit(){
if($this->modulenr == 2 || $this->modulenr == 660) {
$this->totdiversiteit = $this->som1 + (1.5 * $this->som2) + (2 * $this->som3) + (4 * $this->som4) + $this->schoolfactor;
}
if($this->modulenr == 270){
$this->totdiversiteit = (2* $this->som5) + (3 * $this->som6) + (4 * $this->som7) + (5 * $this->som8) + $this->schoolfactor;
}
}
private function setDQ(){
$this->totdq = 0;
if($this->aantalgroepen > 0 && $this->factorenTot > 0) {
// $this->totdq = round(($this->somdq / $this->aantalgroepen), 2); Deze kun je wel beter narekenen
if($this->modulenr == 2 || $this->modulenr == 660) {
$this->totdq = $this->totdiversiteit / $this->factorenTot;
}
if($this->modulenr == 270){
$this->totdq = round(($this->somdq / $this->aantalgroepen), 2);
}
}
}
private function setDiversiteitAfbeeldingen(){
$this->diversiteitafbeeldingen =[
'schooljaar' => $this->schooljaar,
'schooltijdstring' => $this->schooltijdstring,
'totaal' => $this->totaal,
'osvormen' => $this->vormen,
'groepen' => $this->groepen,
'aantalgroepen' => $this->aantalgroepen,
'schooldq' => $this->totdq,
'totdq' => $this->totdq,
'combi' => $this->combi,
'som1' => $this->som1,
'som2' => $this->som2,
'som3' => $this->som3,
'som4' => $this->som4,
'som5' => $this->som5,
'som6' => $this->som6,
'som7' => $this->som7,
'som8' => $this->som8,
'gtijd' => $this->gtijd,
'stijd' => $this->stijd,
'itijd' => $this->itijd,
'totdiversiteit' => $this->totdiversiteit,
'normtot' => $this->normtot,
'normaantallen' => $this->normaantallen
];
}
}