tussenopslag
This commit is contained in:
@@ -15,6 +15,7 @@ class Streefcijfers extends MY_Controller{
|
||||
};// if
|
||||
}
|
||||
|
||||
|
||||
function gethierarchie($selfid){
|
||||
if (!$this->userid) die;
|
||||
$organisatie= $this->Organisaties_model->get_record_by_id($selfid);
|
||||
@@ -127,8 +128,19 @@ class Streefcijfers extends MY_Controller{
|
||||
return $ambitieorgs;
|
||||
|
||||
}
|
||||
function checkrecht(){
|
||||
if (!$this->userid) die;
|
||||
$manage = 'F';
|
||||
if($this->super) $manage = 'T';
|
||||
else {
|
||||
$result = $this->Autorisatiesnivos_model->checkmanage($this->userid, $this->orgid);
|
||||
if($result) $manage = 'T';
|
||||
}
|
||||
$this->json($manage);
|
||||
}
|
||||
|
||||
function mh_getorgversies_ambities(){
|
||||
|
||||
function getambitie(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->uri->segment(4);
|
||||
$module = $this->session->userdata('module');
|
||||
@@ -148,31 +160,41 @@ function mh_getorgversies_ambities(){
|
||||
}
|
||||
$toporgs = rtrim($toporgs, ',' );
|
||||
|
||||
$orgversies = $this->Orgversies_model->getorgversies($toporgs, $module);
|
||||
if(!$orgversies) echo json_encode("geen orgversies");
|
||||
$ambitie = $this->Ambities_model->mh_get_ambitie($module, $ambitieorgs, $toporgs);
|
||||
if(!$ambitie) return json_encode("Er is geen actieve versie bij het instrument");
|
||||
|
||||
$ambities = [];
|
||||
foreach($orgversies as $orgversie) {
|
||||
$ambitie = $this->Ambities_model->get_ambities_orgversie($orgversie->id, $ambitieorgs, $toporgs);
|
||||
if ($ambitie) $ambtities [] = $ambitie;
|
||||
else {
|
||||
$aantalY = $this->Ijkpunten_model->telijkpunten($orgversie->id);
|
||||
$ambities[] = ['id' => 0,
|
||||
'gemscore' => 80,
|
||||
'aantalY' => $aantalY,
|
||||
'xijkpunten' => round($aantalY * 0.8),
|
||||
'z_procent' => 60,
|
||||
'orgversieid' => $orgversie->id,
|
||||
'geldigvanaf' => $orgversie->geldigvanaf,
|
||||
'geldigtm' => $orgversie->geldigtm,
|
||||
'periodenummer' => $orgversie->periodenummer,
|
||||
'actief' => $orgversie->actief,
|
||||
'naam' => $orgversie->naam,
|
||||
'soort' => 0];
|
||||
}
|
||||
echo json_encode($ambitie);
|
||||
|
||||
echo json_encode($ambities);
|
||||
}
|
||||
|
||||
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);
|
||||
if(!$result) return;
|
||||
}
|
||||
$bestaand = $this->Ambities_model->get_fieldvalue(['organisatie_id'=>$orgid,
|
||||
'orgversie_id' =>$orgversieid], 'id');
|
||||
if(!$bestaand) {
|
||||
$id = $this->Ambities_model->insert_record([
|
||||
'organisatie_id' => $orgid,
|
||||
'orgversie_id' => $orgversieid,
|
||||
'gem_score' => $this->clean_input("gemscore"),
|
||||
'x_ijkpunten' => $this->clean_input("xijkpunten"),
|
||||
'z_procent' => $this->clean_input("zprocent")
|
||||
|
||||
]);
|
||||
}
|
||||
$this->json($id);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user