Files
monpas/application/controllers/monpas/Overzichtscores.php
T
2021-07-10 16:25:16 +02:00

156 lines
5.0 KiB
PHP

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Overzichtscores extends MY_Controller{
function __construct(){
parent::__construct();
$models = array("shared/Users_model",
"shared/Orgusers_model",
"monpas/Filledversions_model" ,
"monpas/Modules_model",
"monpas/Orgversies_model",
"monpas/Oordelen_model",
"monpas/Ijkpunten_model",
"monpas/Indicatoren_model",
"monpas/Scores_model",
"shared/Session_model",
"Phantom_model");
$this->load->model($models);
$this->load->helper('string');
if ( ! $this->check_online_status() ) {
echo json_encode( array('offline' => TRUE) );
die;
};// if
}
function getscores(){
$orguserid = $this->input->post("orguserid");
$userid = false;
if ($orguserid && $orguserid !== 'false'){
$userid = $this->Orgusers_model->get(['id'=>$orguserid],'user_id', true);
}
$orgid = $this->clean_input("orgid");
$orgversie = $this->clean_input("orgversieid");
if (!$orguserid) {$orgstring = implode(',' , $this->Organisaties_model->getscholenondertarget($orgid));}
else {$orgstring = $orgid ;}
$data = $this->Scores_model->getstandaardfrequenties($userid, $orgstring,$orgversie);
echo json_encode($data);
}
// function getuserstatus(){
// echo json_encode($this->super);
// }//schoolmanagement mag eigen normen wijzigen nav omzettabel 23 nov 2017
function geteditrecht(){
if (!$this->userid) die;
$orgid = $this->uri->segment(4);
$bgid = $this->Organisaties_model->get_fieldvalue(array('id'=>$orgid), 'valtonder_id');
$kamerid = $this->Organisaties_model->get_fieldvalue(array('id'=>$bgid), 'valtonder_id');
$recht = false;
if($this->userrole<= 8){// werkt bij swv
$recht = true;
}
if($this->globorgid == $kamerid && $this->userrole <= 32){//werkt bij kamer
$recht == true;
}
if($this->globorgid == $bgid && $this->uderrole <=128){//werkt bij bg
$recht = true;
}
if($this->globorgid == $orgid && $this->userrole <= 256){//management op school
$recht = true;
}
echo json_encode($recht);
}
function saveOordeel(){
$newID= false;
$oordeelID = $this->input->post("oordeelID");
$norm = "";
$normid = $this->clean_input('normID');
switch($normid){
case 1: $norm = "zeer zwak"; break;
case 2: $norm = "onvoldoende"; break;
case 3: $norm = "voldoende"; break;
case 4: $norm = "goed"; break;
};
if (!$oordeelID){
$data=['filledversion_id' =>$this->clean_input('fvID'),
'ijkpunt_id' =>$this->clean_input('ijkID'),
'norm_id' =>$normid,
'norm' =>$norm
];
$newID = $this->Oordelen_model->insert_record($data);
}else {
$data=['norm_id' =>$normid,
'norm' =>$norm
];
$newID = $this->Oordelen_model->update_record($data, $oordeelID);
}
echo json_encode($newID);
}
function savegewenst(){
$wensarray = $this->input->post('wensarray');
foreach($wensarray as $wens){
if ($wens['oordeelid']){
$data = ['wens_id' =>$wens['gewenst'] ];
$this->Oordelen_model->update_record($data, $wens['oordeelid']);
} else{
$data =['wens_id' =>$wens['gewenst'],
'filledversion_id'=>$wens['fvID'],
'ijkpunt_id' =>$wens['ijkID'],
'norm_id' =>0];
$this->Oordelen_model->insert_record($data);
}
}
}
function pdfstandaarden(){
$inputstring = $this->input->post('data');
$input = json_decode($inputstring);
$school = $input->school;
$versie = $input->versie;
$standaarden = $input->standaarden;
$instrument = $this->Modules_model->get_fieldvalue(array("sysnr" =>$this->module), "naam") ;
$data = ['instrument' =>$instrument,
'school' =>$school,
'versie' =>$versie,
'today' =>Date('d-m-Y'),
'standaarden' =>json_decode($standaarden)];
$html = $this->load->view("monpas/reports/pdfstandaarden", $data, true);
$filenaam="standaarden";
$this->Phantom_model->create_pdf($html, $filenaam, FALSE, FALSE, FALSE);
}
function printontwikkelmatrix(){
if (!$this->userid) die;
$inputstring = $this->input->get('json');
$input = json_decode($inputstring);
$school = $input->school;
$versie = $input->versie;
$instrument = $this->Modules_model->get_fieldvalue(array("sysnr" =>$this->module), "naam") ;
$labels = $this->Labels_model->getalllabels();
$standaarden = $input->resultaten;
$data = ['instrument' =>$instrument,
'labels' =>$labels,
'school' =>$school,
'versie' =>$versie,
'today' =>Date('d-m-Y'),
'standaarden' =>$standaarden];
$html = $this->load->view("monpas/reports/ontwikkelmatrix2", $data, true);
$filenaam="ontwikkelmatrix";
$this->Phantom_model->create_pdf($html, $filenaam, FALSE, FALSE, FALSE);
}
}