129 lines
4.7 KiB
PHP
129 lines
4.7 KiB
PHP
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
/**chapters_model januari 2016*/
|
|
|
|
class Hoofdstukken_model extends MY_Model{
|
|
|
|
protected $tablename = 'tb_hoofdstukken';
|
|
|
|
function __construct(){
|
|
parent::__construct();
|
|
$models = array('');
|
|
$this->load->model($models);
|
|
}
|
|
function getstandaardchapters(){
|
|
$this->sql =" SELECT id, nummer, naam, module
|
|
FROM tb_hoofdstukken
|
|
WHERE standaard = 1
|
|
AND oud = 'N'
|
|
ORDER BY nummer";
|
|
return $this->get_query_result();
|
|
}
|
|
|
|
function getaddedchapters($profielid){
|
|
$this->sql="SELECT H.id, H.nummer, H.naam, H.module
|
|
FROM tb_hoofdstukken H
|
|
JOIN tb_hfstprofiel HP ON H.id = HP.chapter_id
|
|
WHERE HP.profiel_id = {$profielid}
|
|
AND oud = 'N'
|
|
ORDER BY chapter_id";
|
|
return $this->get_query_result();
|
|
}
|
|
function ls_checkInleiding($profielID){
|
|
$this->sql=" SELECT if (SI.id, true, false) as insop
|
|
FROM tb_hoofdstukken H
|
|
JOIN tb_sopinhouden SI ON ( H.id = SI.chapter_id AND SI.profiel_id = {$profielID})
|
|
WHERE oud = 'N'";
|
|
return $this->get_query_result();
|
|
}
|
|
|
|
function ls_getHoofdstukken($profielID){
|
|
$this->sql=" SELECT H.id, H.nummer, H.naam, H.module, SI.volgorde, H.standaard, SI.id as sopinhoudID,
|
|
if (SI.id, true, false) as insop,
|
|
SI.orgversieid
|
|
FROM tb_hoofdstukken H
|
|
LEFT JOIN tb_licenties L ON H.module = L.modulenr
|
|
LEFT JOIN tb_sopinhouden SI ON ( H.id = SI.chapter_id AND SI.profiel_id = {$profielID})
|
|
WHERE oud = 'N'
|
|
AND (L.orgid = {$this->globorgid} OR H.id = 49)
|
|
ORDER BY insop DESC, SI.volgorde, H.naam";
|
|
return $this->get_query_result();
|
|
}
|
|
|
|
function getHoofdstukLabelsSop($sopid){
|
|
$this->sql="SELECT H.id, H.nummer, H.naam, H.module, SI.volgorde, H.standaard, SI.id as sopinhoudID
|
|
FROM tb_hoofdstukken H
|
|
JOIN tb_sopinhouden SI ON H.id = SI.chapter_id
|
|
WHERE SI.profiel_id = {$sopid}
|
|
AND oud = 'N'
|
|
GROUP BY H.id
|
|
ORDER BY SI.volgorde";
|
|
return $this->get_query_result();
|
|
}
|
|
|
|
|
|
function getStandaardLabelsSop($hfstids = FALSE){
|
|
$this->sql="SELECT id, nummer, naam, module, volgorde, standaard, null as sopinhoudID
|
|
FROM tb_hoofdstukken
|
|
WHERE standaard = 1
|
|
AND oud = 'N'
|
|
";
|
|
if($hfstids){
|
|
$this->sql.="AND id NOT IN ({$hfstids})";
|
|
}
|
|
$this->sql.="ORDER BY volgorde";
|
|
|
|
return $this->get_query_result();
|
|
}
|
|
|
|
function getKeuzeLabelsSop($orgid, $hfstids){
|
|
$this->sql="SELECT H.id, H.nummer, H.naam, H.module, H.volgorde, H.standaard
|
|
FROM tb_hoofdstukken H
|
|
JOIN tb_licenties L ON H.module = L.modulenr
|
|
WHERE L.orgid = {$orgid}
|
|
AND H.id NOT IN ({$hfstids})
|
|
AND H.oud = 'N'
|
|
AND H.standaard = 2
|
|
ORDER BY volgorde";
|
|
return $this->get_query_result();
|
|
}
|
|
|
|
|
|
|
|
function getChapterKeuzeSop($orgid){
|
|
$this->sql="SELECT H.id, H.nummer, H.naam, H.module, H.volgorde
|
|
FROM tb_hoofdstukken H
|
|
JOIN tb_licenties L ON H.module = L.modulenr
|
|
WHERE L.organisatie_id = {$orgid}
|
|
AND oud = 'N'
|
|
ORDER BY H.volgorde";
|
|
return $this->get_query_result();
|
|
}
|
|
|
|
function getoldchapters(){
|
|
$this->sql =" SELECT id, nummer, naam, module
|
|
FROM tb_hoofdstukken
|
|
WHERE standaard = 1
|
|
AND oud = 'Y'
|
|
ORDER BY nummer";
|
|
return $this->get_query_result();
|
|
}
|
|
|
|
|
|
function getmodule($chapterid){
|
|
$this->sql="SELECT M.sysnr
|
|
FROM tb_modules M
|
|
JOIN tb_hoofdstukken H ON M.sysnr = H.module
|
|
WHERE H.id = {$chapterid}" ;
|
|
return $this->get_query_row('sysnr');
|
|
}
|
|
|
|
function getInleidingenOrg($orgid){
|
|
$this->sql="SELECT SI
|
|
FROM tb_modules M
|
|
JOIN tb_hoofdstukken H ON M.sysnr = H.module
|
|
WHERE H.id = 49 ";
|
|
return $this->get_query_result();
|
|
}
|
|
|
|
} |