als gekozen is voor scoretype 4 bij een orgversie (ja,nee, nvt) de optie nvt niet meetellen in het gemiddelde als bij een ijkpunt in een filledversion voor alle opties nvt is gekozen. De optie elf wordt dan grijs
176 lines
6.5 KiB
PHP
176 lines
6.5 KiB
PHP
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
class Userlijsten
|
|
{
|
|
private $CI;
|
|
private $modulenr;
|
|
private $orgversieid;
|
|
private $lijst;
|
|
private $lijsten = [];
|
|
private $nieuwste = 0;
|
|
private $nieuwsteversie;
|
|
|
|
public function getLijsten(){
|
|
return $this->lijsten;
|
|
}
|
|
|
|
public function getNieuwsteVersie(){
|
|
return $this->nieuwsteversie;
|
|
}
|
|
|
|
public function __construct($orguserid, $orgid, $orgversies){
|
|
$this->CI =& get_instance();
|
|
$this->orguserid = $orguserid;
|
|
$this->orgid = $orgid;
|
|
$this->orgversies = $orgversies;
|
|
$this->handle();
|
|
}
|
|
|
|
private function handle(){
|
|
$this->setModulenummer();
|
|
$this->loopOrgVersies();
|
|
$this->loopLijsten();
|
|
}
|
|
|
|
private function setModulenummer(){
|
|
$this->modulenr = $this->CI->session->userdata('module');
|
|
}
|
|
|
|
|
|
private function loopOrgVersies(){
|
|
foreach($this->orgversies as $index => $this->orgversieid){
|
|
$this->lijst = new stdClass();
|
|
$this->setOrgversie();
|
|
$this->setVersieNaam();
|
|
$this->setLabels();
|
|
$this->setOrganisatie();
|
|
$this->setIndividueleScores();
|
|
$this->setVergelijkingen();
|
|
$this->setVergelijkingScores();
|
|
$this->setAmbities();
|
|
$this->setLijst();
|
|
$this->setLijsten();
|
|
}
|
|
}
|
|
|
|
private function setOrgversie(){
|
|
$this->lijst->orgversie = $this->CI->Orgversies_model->get_record_by_id($this->orgversieid);
|
|
|
|
$this->lijst->vantm = "periode " . $this->lijst->orgversie->periodenummer . " van " .
|
|
mysql2date($this->lijst->orgversie->geldigvanaf) . " t/m " . mysql2date($this->lijst->orgversie->geldigtm);
|
|
}
|
|
|
|
private function setVersieNaam(){
|
|
$this->versienaam = $this->CI->Versies_model->get_fieldvalue(['id' => $this->lijst->orgversie->versie_id], 'naam');
|
|
|
|
}
|
|
|
|
private function setLabels(){
|
|
$this->lijst->label = $this->CI->Labels_model->gettabellabel($this->modulenr);
|
|
$this->lijst->label2 = $this->CI->Labels_model->getresultaatlabel($this->modulenr);
|
|
|
|
}
|
|
|
|
private function setOrganisatie(){
|
|
$this->organisatie = $this->CI->Organisaties_model->get_record_by_id($this->orgid);
|
|
|
|
}
|
|
|
|
private function setIndividueleScores(){
|
|
$this->individueel = new Individuelescores($this->orgversieid, $this->orguserid, $this->orgid, $this->lijst->orgversie->scoretype);
|
|
$this->results = $this->individueel->getResults();
|
|
$this->scores = $this->individueel->getScores();
|
|
}
|
|
|
|
private function setVergelijkingen(){
|
|
if(!isset($this->scores) || !$this->scores) return;
|
|
$bestuurid = $this->organisatie->valtonder_id;
|
|
$orgid = $this->CI->Organisaties_model->get_fieldvalue(['id'=>$bestuurid], 'valtonder_id');
|
|
$this->vergelijkingen = (new Schoolscores($this->orgversieid, $orgid, $this->lijst->orgversie->scoretype, 'T'))->getResults() ;
|
|
}
|
|
|
|
private function setVergelijkingScores(){
|
|
if(!isset($this->scores) || !$this->scores) return;
|
|
if( (!isset($this->vergelijkingen) ||! $this->vergelijkingen )) return;
|
|
|
|
foreach($this->vergelijkingen['scores'] AS $i =>$vergelijking){
|
|
$this->scores[$i]->gemV = $vergelijking->gem;
|
|
$this->scores[$i]->kleurV = $vergelijking->kleur;
|
|
$this->scores[$i]->disabledV = $vergelijking->disabled;
|
|
$this->scores[$i]->disablenvtV = $vergelijking->disablenvt;
|
|
}
|
|
}
|
|
private function setAmbities(){
|
|
if(!isset($this->scores) || !$this->scores) return;
|
|
$standaard = new stdClass();
|
|
$standaard->ambitievan = 'standaard';
|
|
$standaard->id = 0;
|
|
$standaard->geldigtm = $this->lijst->orgversie->geldigtm;
|
|
$standaard->geldigvanaf = $this->lijst->orgversie->geldigvanaf;
|
|
$standaard->gemscore = 80;
|
|
$standaard->naam = $this->versienaam;
|
|
$standaard->orgversie_id = $this->lijst->orgversie->id;
|
|
$standaard->periodenummer = $this->lijst->orgversie->periodenummer;
|
|
$standaard->soort = 0;
|
|
$standaard->xijkpunten = ROUND($this->results['aantalY'] * 0.8);
|
|
$standaard->zprocent = 60;
|
|
|
|
if($this->results && $this->results['ambities'] && $this->results['ambities']->gemscore > 0) $this->lijst->ambities = $this->results['ambities'];
|
|
else $this->lijst->ambities = $standaard;
|
|
|
|
if(!isset($this->vergelijkingen) || !$this->vergelijkingen) return;
|
|
|
|
if($this->vergelijkingen['ambities'] && $this->vergelijkingen['ambities']->gemscore > 0 ) $ambitiesV = $this->vergelijkingen['ambities'];
|
|
else $ambitiesV = $standaard;
|
|
if($ambitiesV->ambitievan != $this->lijst->ambities->ambitievan) $this->lijst->ambitiesV = $ambitiesV;
|
|
|
|
|
|
|
|
}
|
|
|
|
private function setLijst(){
|
|
$this->lijst->naam = $this->results['orgnaam'];
|
|
$this->lijst->scores = $this->scores;
|
|
if(isset($this->scores)) {
|
|
$this->lijst->metingen = 1 ;
|
|
$this->lijst->aantalorgs = 1 ;
|
|
$this->lijst->adviezen = $this->results['adviezen'];
|
|
$this->lijst->resultaten = $this->results['resultaten'];
|
|
}
|
|
else{
|
|
$this->lijst->metingen = 0 ;
|
|
$this->lijst->aantalorgs = 1 ;
|
|
$this->lijst->adviezen = false;
|
|
$this->lijst->resultaten = false;
|
|
|
|
}
|
|
$this->lijst->aantalY = $this->results['aantalY'];
|
|
if(!isset($this->vergelijkingen) || !$this->vergelijkingen) return;
|
|
$this->lijst->naamV = $this->vergelijkingen['orgnaam'];
|
|
$metingenV = $this->vergelijkingen['metingen'];
|
|
$this->lijst->metingenV = $metingenV ? $metingenV->aantal : 0;
|
|
$this->lijst->aantalorgsV = $metingenV ? $metingenV->aantalorgs : 0;
|
|
}
|
|
|
|
private function setLijsten(){
|
|
$this->lijsten [] = $this->lijst;
|
|
}
|
|
|
|
private function loopLijsten()
|
|
{
|
|
$this->nieuwste = 0;
|
|
foreach ($this->lijsten as $index => $this->lijst) {
|
|
if (!$this->lijst->orgversie) continue;
|
|
$this->setNieuwsteVersie();
|
|
}
|
|
}
|
|
|
|
private function setNieuwsteVersie(){
|
|
if ($this->lijst->orgversie->periodenummer > $this->nieuwste) {
|
|
$this->nieuwste = $this->lijst->orgversie->periodenummer;
|
|
$this->nieuwsteversie = $this->lijst->orgversie->id;
|
|
}
|
|
}
|
|
|
|
|
|
} |