45 lines
1.4 KiB
PHP
45 lines
1.4 KiB
PHP
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
/** Modules_model februari 2015 */
|
|
|
|
class Functies_model extends MY_Model{
|
|
|
|
|
|
protected $tablename = 'tb_functies';
|
|
|
|
function __construct(){
|
|
parent::__construct();
|
|
$models = array('');
|
|
$this->load->model($models);
|
|
}
|
|
function getFunctiesBijModule($moduleid){
|
|
$this->sql =" SELECT F.id as functie_id
|
|
FROM tb_functies F
|
|
JOIN tb_functies_modules FM ON FM.functie_id = F.id
|
|
JOIN tb_modules M ON FM.module_id = M.id
|
|
WHERE M.id = {$moduleid}
|
|
ORDER BY F.naam";
|
|
return $this->get_query_result();
|
|
}
|
|
|
|
function getFuncties(){
|
|
$this->sql = "SELECT id as functie_id, naam, naamkort
|
|
FROM tb_functies
|
|
ORDER BY naam";
|
|
return $this->get_query_result();
|
|
}
|
|
|
|
function getFunctiesOrguser($orgid, $userid){
|
|
$this->sql= "SELECT F.id as functieid, F.naam as functienaam, U.id AS userid, concat_ws(' ', U.voornaam, U.tussenvoegsel, U.achternaam) AS fullname
|
|
FROM tb_functies F
|
|
JOIN tb_functies_orgusers FOU ON F.id = FOU.functie_id
|
|
JOIN tb_orgusers OU ON OU.id = FOU.orguser_id
|
|
JOIN tb_users U ON U.id = OU.user_id
|
|
WHERE OU.organisatie_id = {$orgid}
|
|
AND OU.user_id = {$userid}
|
|
ORDER BY F.naam ";
|
|
return $this->get_query_result();
|
|
|
|
}
|
|
|
|
} |