77 lines
2.7 KiB
PHP
77 lines
2.7 KiB
PHP
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
/** Sop_model oktober 2015 */
|
|
|
|
class Sop_model extends MY_Model{
|
|
|
|
|
|
protected $tablename = 'tb_profielen';
|
|
|
|
function __construct(){
|
|
parent::__construct();
|
|
$models = array();
|
|
$this->load->model($models);
|
|
}
|
|
|
|
function getprofielen($orgid){
|
|
$this->sql = "SELECT P.id AS profielID, P.naam , O.soort, DATE_FORMAT(P.van,'%d-%m-%Y') as van , DATE_FORMAT( P.tm,'%d-%m-%Y') as tm
|
|
FROM tb_profielen P
|
|
JOIN tb_organisaties O ON O.id = P.organisatie_id
|
|
WHERE P.organisatie_id = {$orgid}
|
|
AND P.versie = 'OUD'
|
|
ORDER BY P.van DESC";
|
|
return $this->get_query_result();
|
|
}
|
|
|
|
function getnieuwesops($orgid){
|
|
$this->sql = "SELECT P.id AS profielID, P.naam , O.soort, DATE_FORMAT(P.van,'%d-%m-%Y') as van , DATE_FORMAT( P.tm,'%d-%m-%Y') as tm
|
|
FROM tb_profielen P
|
|
JOIN tb_organisaties O ON O.id = P.organisatie_id
|
|
WHERE P.organisatie_id = {$orgid}
|
|
AND P.versie = 'NIEUW'
|
|
ORDER BY P.van DESC";
|
|
return $this->get_query_result();
|
|
}
|
|
|
|
function getnieuwsop($targetid){
|
|
$this->sql = "SELECT P.id AS profielID, P.naam , O.soort, DATE_FORMAT(P.van,'%d-%m-%Y') as van, DATE_FORMAT( P.tm,'%d-%m-%Y') as tm
|
|
FROM tb_profielen P
|
|
JOIN tb_organisaties O ON O.id = P.organisatie_id
|
|
WHERE P.id = {$targetid}
|
|
AND P.versie = 'NIEUW' ";
|
|
|
|
return $this->get_query_row();
|
|
}
|
|
|
|
function getprofiel($targetid){
|
|
$this->sql = "SELECT P.id AS profielID, P.naam , O.soort, DATE_FORMAT(P.van,'%d-%m-%Y') as van, DATE_FORMAT( P.tm,'%d-%m-%Y') as tm
|
|
FROM tb_profielen P
|
|
JOIN tb_organisaties O ON O.id = P.organisatie_id
|
|
WHERE P.id = {$targetid}
|
|
AND P.versie = 'OUD'
|
|
ORDER BY P.van DESC";
|
|
return $this->get_query_row();
|
|
}
|
|
function getsopchapterids($profielid){
|
|
$this->sql="SELECT chapter_id
|
|
FROM tb_sopinhouden
|
|
WHERE profiel_id = {$profielid};";
|
|
return $this->get_query_result();
|
|
}
|
|
|
|
function getselectablechapters($orgid, $profielid){
|
|
$this->sql="SELECT H.id, H.nummer, H.naam, H.module
|
|
FROM tb_hoofdstukken H
|
|
JOIN tb_licenties L ON H.module = L.modulenr
|
|
JOIN tb_modules M ON M.sysnr = H.module
|
|
WHERE M.heeftlijst = 1
|
|
AND H.standaard = 2
|
|
AND L.orgid = {$orgid}
|
|
AND H.id NOT IN(SELECT chapter_id
|
|
FROM tb_hfstprofiel
|
|
WHERE profiel_id = {$profielid})
|
|
ORDER BY H.nummer ";
|
|
return $this->get_query_result();
|
|
}
|
|
}
|