tussenstand
This commit is contained in:
@@ -6,7 +6,8 @@ class Streefcijfers extends MY_Controller{
|
||||
$models = array( "shared/Users_model",
|
||||
'shared/Organisaties_model',
|
||||
"monpas/Orgversies_model",
|
||||
"monpas/Ambities_model");
|
||||
"monpas/Ambities_model",
|
||||
"monpas/Modules_model" );
|
||||
$this->load->model($models);
|
||||
$this->load->helper('string');
|
||||
if ( ! $this->check_online_status() ) {
|
||||
@@ -128,6 +129,9 @@ class Streefcijfers extends MY_Controller{
|
||||
return $ambitieorgs;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function checkrecht(){
|
||||
if (!$this->userid) die;
|
||||
$manage = 'F';
|
||||
@@ -136,20 +140,23 @@ class Streefcijfers extends MY_Controller{
|
||||
$result = $this->Autorisatiesnivos_model->checkmanage($this->userid, $this->orgid);
|
||||
if($result) $manage = 'T';
|
||||
}
|
||||
$this->json($manage);
|
||||
$soort = $this->Organisaties_model->get_fieldvalue(['id'=>$this->globorgid],'soort');
|
||||
$this->json(['manage'=>$manage,
|
||||
'soort' => $soort]);
|
||||
}
|
||||
|
||||
|
||||
function getambitie(){
|
||||
function getambities(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->uri->segment(4);
|
||||
$module = $this->session->userdata('module');
|
||||
|
||||
$ambitieorgs = '';
|
||||
$ambitieorgs = $this->getAmbitieOrgs($orgid, $ambitieorgs);
|
||||
$ambitieorgs = rtrim($ambitieorgs, ',');
|
||||
$module = $this->session->userdata('module');
|
||||
$modulenaam = $this->Modules_model->get_fieldvalue(['sysnr'=>$module], 'naam');
|
||||
$org = $this->Organisaties_model->get_record_by_id($this->globorgid);
|
||||
$bovenliggend = '';
|
||||
$bovenliggend = $this->getAmbitieOrgs($this->globorgid, $bovenliggend);
|
||||
$bovenliggend = rtrim($bovenliggend, ',');
|
||||
|
||||
$toporgsarray = explode(',', $ambitieorgs);
|
||||
$toporgsarray = explode(',', $bovenliggend);
|
||||
$toporgs = '';
|
||||
$index = 0;
|
||||
for($i = count($toporgsarray)-1; $i >= 0 ; $i--) {
|
||||
@@ -159,12 +166,52 @@ function getambitie(){
|
||||
}
|
||||
}
|
||||
$toporgs = rtrim($toporgs, ',' );
|
||||
|
||||
$onderliggend = '';
|
||||
if($org->soort < 4){
|
||||
$orgs = $this->Organisaties_model->getlistrecursief($this->globorgid, []);
|
||||
$onderliggend = implode(',', $orgs);
|
||||
$ambitieorgs = $onderliggend .','. $bovenliggend;
|
||||
}
|
||||
if($org->soort == 4 ) $ambitieorgs = $bovenliggend;
|
||||
$standaardNodig = true;
|
||||
$ambities = [];
|
||||
$aantalY = $this->Ijkpunten_model->telijkpunten_bij_orgs($toporgs, $module);
|
||||
$ambitie = $this->Ambities_model->mh_get_ambitie($module, $ambitieorgs, $toporgs, $aantalY);
|
||||
if(!$ambitie) return json_encode("Er is geen actieve versie bij het instrument");
|
||||
$ambities = $this->Ambities_model->mh_get_ambities($module, $ambitieorgs, $toporgs);
|
||||
if($ambities){
|
||||
foreach( $ambities AS $ambitie){
|
||||
if($ambitie->soort <= $org->soort){
|
||||
$standaardNodig = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($ambitie);
|
||||
if(!$ambities || $standaardNodig) {
|
||||
$orgversie = $this->Orgversies_model->getAmbitieVersie($toporgs, $module);
|
||||
if (!$orgversie) {
|
||||
$this->json("geen results");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
|
||||
$ambitie = new stdClass();
|
||||
$ambitie->ambitievan = 'standaard';
|
||||
$ambitie->id = 0;
|
||||
$ambitie->geldigtm = $orgversie->geldigtm;
|
||||
$ambitie->geldigvanaf = $orgversie->geldigvanaf;
|
||||
$ambitie->gemscore = 80;
|
||||
$ambitie->naam = $orgversie->naam;
|
||||
|
||||
$ambitie->orgversie_id = $orgversie->orgversie_id;
|
||||
$ambitie->periodenummer = $orgversie->periodenummer;
|
||||
$ambitie->soort = 0;
|
||||
$ambitie->xijkpunten = ROUND($aantalY * 0.8);
|
||||
$ambitie->zprocent = 60;
|
||||
$ambities[] = $ambitie;
|
||||
}
|
||||
}
|
||||
$this->json(['aantalY' => $aantalY,
|
||||
'ambities' => $ambities,
|
||||
'module' => $modulenaam]);
|
||||
|
||||
}
|
||||
|
||||
@@ -172,24 +219,20 @@ function saveAmbitie(){
|
||||
if (!$this->userid) die;
|
||||
|
||||
$orgversieid = $this->clean_input("orgversieid");
|
||||
$orgid = $this->clean_input("orgid");
|
||||
|
||||
|
||||
|
||||
if($this->super == false) {
|
||||
if ($orgid != $this->orgid) return;
|
||||
$result = $this->Autorisatiesnivos_model->checkmanage($this->userid, $this->orgid);
|
||||
$result = $this->Autorisatiesnivos_model->checkmanage($this->userid, $this->globorgid);
|
||||
$saveorg = $this->globorgid;
|
||||
if (!$result) return;
|
||||
}
|
||||
else{
|
||||
$saveorg = $orgid;
|
||||
$saveorg = $this->globorgid;
|
||||
}
|
||||
$bestaand = $this->Ambities_model->get_fieldvalue(['organisatie_id'=>$orgid,
|
||||
$bestaand = $this->Ambities_model->get_fieldvalue(['organisatie_id'=>$saveorg,
|
||||
'orgversie_id' =>$orgversieid], 'id');
|
||||
if(!$bestaand) {
|
||||
$id = $this->Ambities_model->insert_record([
|
||||
'organisatie_id' => $orgid,
|
||||
'organisatie_id' => $saveorg,
|
||||
'orgversie_id' => $orgversieid,
|
||||
'gem_score' => $this->clean_input("gemscore"),
|
||||
'x_ijkpunten' => $this->clean_input("xijkpunten"),
|
||||
@@ -269,10 +312,10 @@ function saveAmbitie(){
|
||||
if (!$this->userid) die;
|
||||
$id=$this->clean_input("id");
|
||||
// zoek of de ambitie voor een nieuwe organisatie is
|
||||
$alaanwezig = $this->Ambities_model->check_for_record(array("organisatie_id"=>$this->clean_input("organisatie_id"),
|
||||
$alaanwezig = $this->Ambities_model->check_for_record(array("organisatie_id"=>$this->globorgid,
|
||||
"orgversie_id" => $this->clean_input("orgversie_id")) );
|
||||
if ($id ==0 || !$alaanwezig ){
|
||||
$data=array("organisatie_id" => $this->clean_input("organisatie_id"),
|
||||
$data=array("organisatie_id" => $this->globorgid,
|
||||
"orgversie_id" => $this->clean_input("orgversie_id"),
|
||||
"gem_score" => $this->clean_input("gemscore"),
|
||||
"x_ijkpunten" => $this->clean_input("xijkpunten"),
|
||||
|
||||
Reference in New Issue
Block a user