initial commit
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Licenties_model mei 2015 */
|
||||
|
||||
class Licenties_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_licenties';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
function get_licentie($orgid){
|
||||
$this->sql = "SELECT M.id, M.sysnr, M.naam, M.naamkort
|
||||
FROM tb_organisaties O
|
||||
JOIN tb_licenties L ON L.orgid = O.id
|
||||
JOIN tb_modules M on M.sysnr = L.modulenr
|
||||
WHERE O.id = {$orgid}
|
||||
AND actief = 1
|
||||
ORDER BY M.volgorde";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
|
||||
function get_ongeclusterd($orgid, $clusterId){
|
||||
$this->sql = "SELECT M.id, M.sysnr, M. cluster_id, M.naam,M.naamkort,
|
||||
IF (C.id, C.kleur1, '#ffffff') as kleur1,
|
||||
IF (C.id , C.kleur2, '#ebebeb' ) as kleur2
|
||||
FROM tb_organisaties O
|
||||
JOIN tb_licenties L ON L.orgid = O.id
|
||||
JOIN tb_modules M on M.sysnr = L.modulenr
|
||||
LEFT JOIN tb_cluster C ON C.id = M.cluster_id
|
||||
WHERE O.id = {$orgid}
|
||||
AND actief = 1
|
||||
AND M.cluster_id = {$clusterId}
|
||||
ORDER BY M.naam ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function get_clusters_org($orgid){
|
||||
|
||||
$this->sql = "SELECT C.id, C.naam, count(M.id) as aantalmodules, C.kleur1, C.kleur2
|
||||
FROM tb_organisaties O
|
||||
|
||||
JOIN tb_licenties L ON L.orgid = O.id
|
||||
JOIN tb_modules M on M.sysnr = L.modulenr
|
||||
JOIN tb_cluster C on C.id = M.cluster_id
|
||||
WHERE O.id = {$orgid}
|
||||
AND actief = 1
|
||||
GROUP BY C.naam ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function get_1licentie_bij_cluster_org($orgid){
|
||||
$this->sql = "SELECT M.id, M.sysnr, M.cluster_id, M.naam, M.naamkort
|
||||
FROM tb_organisaties O
|
||||
JOIN tb_licenties L ON L.orgid = O.id
|
||||
JOIN tb_modules M on M.sysnr = L.modulenr
|
||||
JOIN tb_cluster C on C.id = M.cluster_id
|
||||
WHERE O.id = {$orgid}
|
||||
AND actief = 1
|
||||
GROUP BY C.naam
|
||||
HAVING COUNT(M.id) < 2 ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
|
||||
function get_clusterNaam($clusterId){
|
||||
$this->sql = "SELECT naam
|
||||
FROM tb_cluster
|
||||
WHERE id = {$clusterId} ";
|
||||
|
||||
return $this->get_query_row('naam');
|
||||
}
|
||||
|
||||
|
||||
function getmodulelicentie($orgid, $sysnr){
|
||||
$this->sql ="SELECT id
|
||||
FROM tb_licenties
|
||||
WHERE orgid = {$orgid}
|
||||
AND modulenr = {$sysnr}";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function get_licentie_cluster($orgid, $clusterid){
|
||||
$this->sql = "SELECT M.id, M.cluster_id, M.naam, M.naamkort, M.sysnr
|
||||
FROM tb_organisaties O
|
||||
JOIN tb_licenties L ON L.orgid = O.id
|
||||
JOIN tb_modules M on M.sysnr = L.modulenr
|
||||
JOIN tb_cluster C on C.id = M.cluster_id
|
||||
WHERE O.id = {$orgid}
|
||||
AND C.id = {$clusterid}
|
||||
AND actief = 1 ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user