Files
monpas/application/models/monpas/Menus_model.php
T
2022-05-23 13:02:26 +02:00

66 lines
2.2 KiB
PHP

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/** Menus_model februari 2015 */
class Menus_model extends MY_Model{
protected $tablename = 'tb_menus';
function __construct(){
parent::__construct();
$models = array('');
$this->load->model($models);
}
function getmenu($module, $autorisatienivo, $orgsoort){
$this->sql="SELECT id, naam, paginanaam,holdernaam
FROM tb_menus
WHERE ( {$autorisatienivo} & autorisatienivo)
AND ((module = {$module}) OR ({$module} !=0 && module = 9))
AND valtonder = 0 ";
switch($orgsoort){
case 1: $this->sql.=" AND(orgniveau = 'ALL' OR orgniveau = 'SWV' OR orgniveau = 'BGRESWV') ";
break;
case 2: $this->sql.= "AND(orgniveau = 'ALL' OR orgniveau = 'REGIO' OR orgniveau = 'BGRESWV') ";
break;
case 3: $this->sql.= "AND(orgniveau = 'ALL' OR orgniveau = 'BG' OR orgniveau = 'BGRESWV') ";
break;
case 4: $this->sql.= "AND(orgniveau = 'ALL' OR orgniveau = 'SCHOOL') ";
break;
}
$this->sql.="ORDER BY volgorde ";
return $this->get_query_result();
}
function getsubmenus($pageid,$autorisatienivo, $orgsoort){
$this->sql="SELECT id, naam, paginanaam, holdernaam, volgorde
FROM tb_menus
WHERE ( {$autorisatienivo} & autorisatienivo)
AND valtonder = $pageid " ;
switch($orgsoort){
case 1: $this->sql.=" AND(orgniveau = 'ALL' OR orgniveau = 'SWV' OR orgniveau = 'BGRESWV') ";
break;
case 2: $this->sql.= "AND(orgniveau = 'ALL' OR orgniveau = 'REGIO' OR orgniveau = 'BGRESWV') ";
break;
case 3: $this->sql.= "AND(orgniveau = 'ALL' OR orgniveau = 'BG' OR orgniveau = 'BGRESWV') ";
break;
case 4: $this->sql.= "AND(orgniveau = 'ALL' OR orgniveau = 'SCHOOL') ";
break;
}
$this->sql.=" ORDER BY volgorde ";
return $this->get_query_result();
}
function gettypes($modulenr){
$this->sql="SELECT naam, paginanaam, sop
FROM tb_menus
WHERE sop IS NOT NULL
AND module = {$modulenr}
ORDER BY volgorde" ;
return $this->get_query_result();
}
}