initial commit

This commit is contained in:
2021-07-10 16:25:16 +02:00
parent bff57cbf45
commit 20fb7267a8
2426 changed files with 792090 additions and 0 deletions
+117
View File
@@ -0,0 +1,117 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Menu extends MY_Controller{
function __construct(){
parent::__construct();
$models = array("shared/Users_model",
'shared/Organisaties_model',
"monpas/Menus_model",
"monpas/Modules_model",
"monpas/Documenten_model",
"shared/Licenties_model",
"ijkpartituur/pages_model");
$this->load->model($models);
$this->load->helper('string');
if ( ! $this->check_online_status() ) {
echo json_encode( array('offline' => TRUE) );
die;
};// if
}
public function get_menu(){
$menu = new stdClass;
$user = new stdClass;
$organisatie = new stdClass;
$module = $this->session->userdata['module'];
$modulenaam = '';
if ($module >=0){
if (0 == $module) {$modulenaam = "Instrumenten";}
else {$modulenaam= $this->Modules_model->get_fieldvalue(array("sysnr" => $module), 'naamkort'); }
$menu = $this->Menus_model->getmenu($module,$this->userrole);
foreach($menu as $menuitem){
if($menuitem->holdernaam == "sophoofd"){
$menuitem->subpaginas = $this->Menus_model->getsubmenus($menuitem->id, $this->userrole);
}
}
$licenties = null;
$licenties = $this->Licenties_model->get_licentie($this->orgid);
// als licenties voor 1 module, disable de portal knop
if ($licenties && $menu && (count($licenties) <= 1)) {
$i = 0;
$target = -1;
foreach($menu as $item){
if ($item->naam == "stop") $target = $i;
$i ++;
}
if ($target > -1) unset($menu[$target]);
}
$user = $this->Users_model->get_fullname($this->userid);
$organisatie = $this->Organisaties_model->get_orgnaam($this->globorgid);
}
$org = $this->Organisaties_model->get_record_by_id($this->globorgid);
if ($org){
foreach ($menu as $menuitem){
if (strtoupper($menuitem->naam) == "sophoofd"){
switch ($org->soort){
case 1: $menuitem->naam = "SWOP"; break;
case 2: $menuitem->naam = "KOP" ; break;
case 3: $menuitem->naam ="BOP"; break;
default: $menuitem->naam = "SOP";
};//switch
}; //if
}; // foreach
}; //if organisatie
echo json_encode(array( 'module' =>$module,
'modulenaam' => $modulenaam,
'menu' =>$menu,
'user' => $user,
'organisatie' => $organisatie));
}
function gethandleidingen(){
$handleidingen = $this->Documenten_model->gethandleidingen($this->globorgid, $this->userrole);
echo json_encode($handleidingen);
}
function downloadhandleiding(){
if( ! $this->userid ) return;
$handleidingid = $this->uri->segment(4);
$handleiding = $this->Documenten_model->get_record_by_id($handleidingid);
$this->load->helper('download');
// $data = file_get_contents($this->rootpath ."/documents/".$handleiding->documentnaam);
$data = file_get_contents("/home/mps/prod/documents/".$handleiding->documentnaam);//TW: rootpath is verkeerd door symlink
force_download($handleiding->documentnaam, $data);
}
function getsubmenu(){
//TODO clean input
$pageid = $this->uri->segment(4);
$submenus = $this->Menus_model->getsubmenus($pageid, $this->userrole);
echo json_encode($submenus);
}
function getmodule(){
echo json_encode($this->module);
}
// function scriptSetModules(){
// $organisaties = $this->Organisaties_model->getall();
// foreach($organisaties as $organisatie){
// if ($organisatie->monbas == 1){
// $data=array('orgid' =>$organisatie->id, 'modulenr'=>1);
// $this->Licenties_model->insert_record($data);
// }
// if ($organisatie->mondiv == 1){
// $data=array('orgid' =>$organisatie->id, 'modulenr'=>2);
// $this->Licenties_model->insert_record($data);
// }
// }; // foreach
// echo 'klaar';
// }
}