ouders in monpas
This commit is contained in:
@@ -15,6 +15,7 @@ class Portal extends MY_Controller {
|
||||
"monpas/Home_model",
|
||||
"monpas/Orgversies_model",
|
||||
"monpas/Scores_model",
|
||||
"monpas/Menus_model",
|
||||
"monpas/Labels_model",
|
||||
"monpas/Modules_model");
|
||||
$this->load->model($models);
|
||||
@@ -34,33 +35,68 @@ class Portal extends MY_Controller {
|
||||
|
||||
|
||||
function getlicenties() {
|
||||
$userniveau = $this->Autorisatienivos_model->checknivo($this->userid, $this->globorgid);
|
||||
$ongeclusterdId = 0;
|
||||
$isCluster = 'F';
|
||||
$ongeclusterd = $this->Licenties_model->get_ongeclusterd($this->globorgid, $ongeclusterdId);
|
||||
if ($ongeclusterd){
|
||||
foreach ($ongeclusterd as $bolletje) {
|
||||
$bolletje->isCluster = $isCluster;//geen knop om het cluster te openen en te sluiten
|
||||
}
|
||||
} else {
|
||||
$ongeclusterd = [];
|
||||
};
|
||||
$isCluster = 'F';
|
||||
$ongeclusterd = [];
|
||||
$results = $this->Licenties_model->get_ongeclusterd($this->globorgid, $ongeclusterdId);// bolletjes zonder cluster
|
||||
if ($results) {
|
||||
foreach ($results as $result) {
|
||||
$pagniveau = $this->Menus_model->get_fieldvalue(['holdernaam'=>'home', 'module'=>$result->sysnr ], 'autorisatienivo');//nivo van de homepage van het instrument
|
||||
if ($pagniveau > $userniveau) {// als de user het instrument niet mag gebruiken moet het bolletje ook niet getoond worden
|
||||
$result->isCluster = $isCluster;//geen knop om het cluster te openen en te sluiten
|
||||
$ongeclusterd [] = $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
$isCluster = 'T';
|
||||
$clusters = $this->Licenties_model->get_clusters_org($this->globorgid);
|
||||
if($clusters) {
|
||||
$i = -1;
|
||||
foreach ($clusters as $cluster) {
|
||||
$i ++;
|
||||
if ($cluster->aantalmodules == 1) {
|
||||
$cluster->isCluster = "F";
|
||||
$newitem = $this->Licenties_model->get_ongeclusterd($this->globorgid, $cluster->id);
|
||||
$ongeclusterd = array_merge($ongeclusterd, $newitem);
|
||||
unset($clusters[$i]);
|
||||
} else {
|
||||
$cluster->isCluster = $isCluster; //ivm knop om het cluster te openen en te sluiten
|
||||
$cluster->sub = $this->Licenties_model->get_licentie_cluster($this->globorgid, $cluster->id);//instrumenten bij het cluster
|
||||
$cluster->cluster_id = $cluster->id; //zodat cluster en instrument eenzelfde attribuut hebben
|
||||
}
|
||||
};
|
||||
$i++;
|
||||
if ($cluster->aantalmodules > 1) {// bolletje met link want meer instrumenten bij bolletje
|
||||
$instrumenten = $this->Licenties_model->get_licentie_cluster($this->globorgid, $cluster->id);
|
||||
$array = [];
|
||||
foreach ($instrumenten as $instrument) {
|
||||
$pagniveau = $this->Menus_model->get_fieldvalue(['holdernaam' => 'home', 'module' => $instrument->sysnr], 'autorisatienivo');
|
||||
if ($pagniveau > $userniveau) {
|
||||
$array[] = $instrument;
|
||||
}
|
||||
}
|
||||
if (count($array) > 1) {
|
||||
$cluster->isCluster = $isCluster; //ivm knop om het cluster te openen en te sluiten
|
||||
$cluster->sub = $array;//instrumenten bij het cluster
|
||||
$cluster->cluster_id = $cluster->id; //zodat cluster en instrument eenzelfde attribuut hebben
|
||||
} else if (count($array) == 1) { //toegang tot maar 1 instrument dus geen menu
|
||||
$cluster->isCluster = "F";
|
||||
$array[0]->kleur1 = $cluster->kleur1;
|
||||
$array[0]->kleur2 = $cluster->kleur2;
|
||||
|
||||
$ongeclusterd = array_merge($ongeclusterd, $array);
|
||||
unset($clusters[$i]);
|
||||
}
|
||||
else{
|
||||
$cluster->isCluster = "F";
|
||||
unset($clusters[$i]);
|
||||
}
|
||||
}
|
||||
else if ($cluster->aantalmodules == 1) { //1 instrument bij bolletje
|
||||
$cluster->isCluster = "F";
|
||||
$newitem = $this->Licenties_model->get_ongeclusterd($this->globorgid, $cluster->id);
|
||||
$pagniveau = $this->Menus_model->get_fieldvalue(['holdernaam' => 'home', 'module' =>$newitem[0]->sysnr], 'autorisatienivo');
|
||||
if ($pagniveau > $userniveau) {
|
||||
$ongeclusterd = array_merge($ongeclusterd, $newitem);
|
||||
}
|
||||
unset($clusters[$i]);
|
||||
}
|
||||
|
||||
|
||||
else{// geen toegang tot instrumenten bij cluster
|
||||
unset($clusters[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
}; // if $clusters
|
||||
|
||||
if (! $ongeclusterd){
|
||||
@@ -70,7 +106,9 @@ class Portal extends MY_Controller {
|
||||
$clusters = [];
|
||||
};
|
||||
|
||||
$licenties = array_merge($ongeclusterd, $clusters);
|
||||
|
||||
$licenties = array_merge($clusters, $ongeclusterd);
|
||||
|
||||
usort($licenties, array($this, 'opAlfabet'));//bollen op alfbetische volgorde
|
||||
|
||||
echo json_encode($licenties);
|
||||
|
||||
Reference in New Issue
Block a user