Files
monpas/application/libraries/monpas/Hoofdstukkeuze.php
T
2021-07-13 12:53:03 +02:00

218 lines
6.7 KiB
PHP

<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Hoofdstukkeuze
{
private $modulenr;
private $modulenaam;
private $clusterid;
private $orgid;
private $vergelijkingid;
private $scorevorm;
private $vorm;
private $data;
private $soort;
private $vergelijking;
private $hoofdstukkeuze = [];
private $selectie;
private $selecties = [];
private $CI;
public function __construct($chapterid, $orgversieid= false, $vergelijkingen)
{
$this->CI =& get_instance();
$this->orgversieid = $orgversieid;
$this->chapterid = $chapterid;
$this->vergelijkingen = $vergelijkingen;
$this->handle();
}
public function getHoofdstukKeuze(){
return $this->hoofdstukkeuze;
}
private function handle()
{
$this->setModuleNr();
$this->setModule();
$this->setClusterID();
$this->setOrgID();
$this->setScorevorm();
$this->setInleiding();
$this->checkModulenummer();
$this->checkClusterID();
$this->setHoofdstukKeuze();
}
private function setModuleNr(){
$this->modulenr =
$this->CI->Hoofdstukken_model->get_fieldvalue(['id'=>$this->chapterid], 'module');
}
private function setModule(){
$this->modulenaam =
$this->CI->Modules_model->get_fieldvalue(
['sysnr'=>$this->modulenr],"naam");
}
private function setClusterID()
{
if ($this->modulenr == 0) return $this->clusterid = FALSE;
$this->clusterid =
$this->CI->Modules_model->get_fieldvalue(
['sysnr' => $this->modulenr], 'cluster_id');
}
private function setOrgID(){
$this->orgid = $this->CI->globorgid;
}
private function setScorevorm(){
if($this->chapterid == 49) return;
$this->scorevorm =
$this->CI->Orgversies_model->get_fieldvalue( ['id' => $this->orgversieid ],'vorm');
}
private function setSelecties(){
$this->selectie = [
'orgversieid' => $this->orgversieid,
'vorm' => $this->scorevorm
];
$this->selecties [] = $this->selectie;
if($this->vergelijkingen){
foreach($this->vergelijkingen as $index => $this->vergelijking){
$this->vergelijkingid = intval($this->vergelijking);
$this->vorm = $this->CI->Orgversies_model->get_fieldvalue( ['id' => $this->vergelijkingid ],'vorm');
$this->selectie = ['orgversieid' => $this->vergelijkingid,
'vorm' => $this->vorm
];
$this->selecties [] = $this->selectie;
}
}
}
private function setInleiding(){//hoofdstukken die niet bij een module/instrument horen
if( $this->chapterid != 1 && $this->chapterid != 49) return;
$this->data = (new Inleiding($this->orgid))->getInleiding();
$this->soort = 'INLEIDING';
}
/**
*
*/
private function checkModulenummer()//hoofstukken bij een instrument dat niet bij een cluster is ingedeeld
{
if ($this->clusterid != 0 && $this->clusterid != 7 && $this->clusterid != 10 && $this->clusterid != 11) return;
if ($this->modulenr == 0) return;
return $this->setSchoolScores();
// else {
// //aanvullen databases lokaal & productie komen niet helemaal overeen lijkt het uitzoeken
// }
}
private function checkClusterID(){//hoofdstukken bij een instrument dat tot een cluster behoort
if(!$this->clusterid) return;
if ($this->clusterid == 1 || $this->clusterid ==7 ) return;// (1)partituren (7) framwork monitoren, Niet in Sop
if( $this->clusterid == 2 ||
$this->clusterid == 3 ||
$this->clusterid == 5 ||
$this->clusterid == 8 ||
$this->clusterid == 13||
$this->clusterid == 14) {
$this->setSchoolScores();
}// (2) tevredenheidsmeters, (3) competentiemeters,(5) expertise scans. Heeft voor alle weergaven scores nodig
if($this->clusterid == 4){
$this->setInspectieOordelen();
}
if($this->clusterid == 6) {
// return $this->setFinancien();
}
if($this->clusterid == 9){
$this->setDiversiteit();
}
}
private function setSchoolScores(){
$this->setSchoolSoort();
$this->setSelecties();
$this->setLijsten();
$lijsten = new Lijsten($this->orgid, $this->selecties);
$this->data = $lijsten->getSopInfo() ;
}
private function setLijsten(){
$lijsten = new Lijsten($this->orgid, $this->selecties);
$this->data = $lijsten->getSopInfo() ;
}
private function setSchoolSoort(){
if($this->scorevorm == 1) {
$this->soort = 'REGULIER';
}
if($this->scorevorm == 2){
$this->soort = 'GEMIDDELD';
}
}
private function setInspectieOordelen()
{
$inspectieOordelen =
(new Inspectieoordelen($this->orgversieid, $this->orgid, $this->clusterid))->getInspectieOordelen();
$inspectieAfbeeldingen =
(new Inspectieafbeeldingen($inspectieOordelen, $this->modulenr, $this->orgversieid, $this->orgid))
->getInspectieAfbeeldingen();
$this->data = $inspectieAfbeeldingen;
$this->soort = 'INSPECTIE';
}
private function setDiversiteit(){
$diversiteit
= (new Diversiteit($this->orgversieid, $this->orgid, $this->modulenr))->getDiversiteit();
$diversiteitAfbeeldingen
= (new Diversiteitafbeeldingen($diversiteit, $this->modulenr, $this->orgversieid))->getDiversiteitAfbeeldingen();
$this->data = $diversiteitAfbeeldingen;
if($this->modulenr == 2 || $this->modulenr == 660)
$this->soort = 'DIVERSITEIT';
if($this->modulenr == 270){
$this->soort ='DIVSBOSO';
}
}
private function setFinancien(){
$financien = (new Financien($this->orgversieid, $this->orgid))->getFinancien();
$financienAfbInfo = (new FinancienAfbInfo($financien, $this->modulenr, $this->orgversieid))->getFinancienAfbInfo() ;
$this->data = $financienAfbInfo;
$this->soort ='FINANCIEEL';
}
private function addModule(){
if(! $this->data) return;
array_push($this->data, ['module' =>$this->modulenaam]);
}
private function setHoofdstukKeuze()
{
$this->hoofdstukkeuze = ['data' => $this->data,
'soort' => $this->soort];
}
}