138 lines
3.5 KiB
PHP
138 lines
3.5 KiB
PHP
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
class
|
|
Schooljaarversies
|
|
{
|
|
private $CI;
|
|
private $chapterid;
|
|
private $profielid;
|
|
private $profiel;
|
|
private $schooltype;
|
|
private $schooljaarid;
|
|
private $filledversies =[];
|
|
private $aantallln;
|
|
private $sopversies =[];
|
|
private $versie;
|
|
private $schooljaarversies = [];
|
|
private $sopaanwezig = 'F';
|
|
private $versies;
|
|
|
|
public function __construct($chapterid, $profielid, $modulenr)
|
|
{
|
|
$this->CI =& get_instance();
|
|
$this->chapterid = $chapterid;
|
|
$this->profielid = $profielid;
|
|
$this->modulenr = $modulenr;
|
|
$this->handle();
|
|
}
|
|
|
|
public function getModuleNummer(){
|
|
return $this->modulenr;
|
|
}
|
|
|
|
public function getSopAanwezig(){
|
|
return $this->sopaanwezig;
|
|
}
|
|
|
|
public function getFilledVersies(){
|
|
return $this->filledversies;
|
|
}
|
|
|
|
public function getSchooljaarid(){
|
|
return $this->schooljaarid;
|
|
}
|
|
|
|
private function handle()
|
|
{
|
|
|
|
$this->setProfiel();
|
|
|
|
$this->setSchooltype();
|
|
|
|
$this->setSchoolJaarVersies();
|
|
|
|
$this->loopSchooljaarVersies();
|
|
|
|
$this->setSopVersies();
|
|
|
|
$this->setSopAanwezig();
|
|
|
|
$this->setSchooljaarid();
|
|
|
|
$this->setVersies();
|
|
}
|
|
|
|
|
|
|
|
private function setProfiel(){
|
|
$this->profiel = $this->CI->Sop_model->get_record_by_id($this->profielid);
|
|
}
|
|
|
|
private function setSchooltype(){
|
|
if(!$this->modulenr) return;
|
|
if($this->modulenr == 2 || $this->modulenr == 660) $this->schooltype = 'R';
|
|
if ($this->modulenr == 270) $this->schooltype = 'SBO';
|
|
}
|
|
|
|
private function setSchooljaarVersies(){
|
|
$this->schooljaarversies = $this->CI->Schooljaren_model->getschooljaren();
|
|
}
|
|
|
|
|
|
private function loopSchooljaarVersies(){
|
|
if(!$this->modulenr) return;
|
|
foreach($this->schooljaarversies as $index =>$this->versie){
|
|
$this->setGevuldeVersies();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private function setGevuldeVersies(){
|
|
if(!$this->modulenr) return;
|
|
$this->aantallln = $this->CI->Groepen_model->countleerlingen(
|
|
$this->CI->globorgid, $this->versie->schooljaarnr, $this->schooltype, $this->modulenr);
|
|
|
|
if(isset($this->aantallln)){
|
|
if ($this->aantallln > 0) {
|
|
array_push($this->filledversies, $this->versie);
|
|
}
|
|
}
|
|
}
|
|
|
|
private function setSopVersies(){
|
|
if(!$this->modulenr) return;
|
|
foreach($this->filledversies as $index=> $this->versie){
|
|
if($this->versie->start >= $this->profiel->van
|
|
&& $this->versie->eind <= $this->profiel->tm){
|
|
array_push($this->sopversies, $this->versie);
|
|
}
|
|
}
|
|
}
|
|
|
|
private function setSopAanwezig(){
|
|
if(!$this->modulenr) return;
|
|
if($this->sopversies) $this->sopaanwezig = "T";
|
|
}
|
|
|
|
private function setSchooljaarid(){
|
|
if (!$this->filledversies) return;
|
|
|
|
if($this->sopaanwezig === 'F'){
|
|
$this->schooljaarid = $this->filledversies[0]->schooljaarnr;
|
|
}
|
|
|
|
if($this->sopaanwezig === 'T'){
|
|
$this->schooljaarid = $this->sopversies[0]->schooljaarnr;
|
|
}
|
|
}
|
|
|
|
private function setVersies(){
|
|
if(!$this->modulenr) $this->versies = [];
|
|
$this->versies =[
|
|
"orgversieid" => $this->schooljaarid,
|
|
"filledversies" => $this->filledversies,
|
|
"aanwezig" => $this->sopaanwezig
|
|
];
|
|
}
|
|
} |