initial commit
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**aantallln_model sept 2019 */
|
||||
|
||||
class aantalleerlingen_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_aantalleerlingen';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
function getAantalleerlingen($orgid, $schooljaarnr){
|
||||
$this->sql = "SELECT aantal
|
||||
FROM tb_aantalleerlingen
|
||||
WHERE schooljaarnr <= {$schooljaarnr}
|
||||
AND organisatie_id = {$orgid}
|
||||
ORDER BY schooljaarnr DESC";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getAantalleerlingenInvullen($orgid, $schooljaarnr){
|
||||
$this->sql = "SELECT aantal, notitie, meetellen
|
||||
FROM tb_aantalleerlingen
|
||||
WHERE schooljaarnr = {$schooljaarnr}
|
||||
AND organisatie_id = {$orgid} ";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
|
||||
function get_gevulde_schooljaren($schoolids){
|
||||
$this->sql= " SELECT A.schooljaarnr, S.naam
|
||||
FROM tb_schooljaren S
|
||||
JOIN tb_aantalleerlingen A ON S.schooljaarnr = A.schooljaarnr
|
||||
WHERE A.organisatie_id IN ({$schoolids})
|
||||
AND A.aantal > 0
|
||||
AND A.meetellen = 'T'
|
||||
GROUP BY A.schooljaarnr
|
||||
ORDER BY A.schooljaarnr DESC";
|
||||
return $this->get_query_result();
|
||||
|
||||
}
|
||||
function get_gevuldeschooljaren_Sop($schooljaarnr, $schoolid){
|
||||
$this->sql= " SELECT A.schooljaarnr, S.naam
|
||||
FROM tb_schooljaren S
|
||||
JOIN tb_aantalleerlingen A ON S.schooljaarnr = A.schooljaarnr
|
||||
WHERE A.organisatie_id = {$schoolid}
|
||||
AND A.aantal > 0
|
||||
AND A.schooljaarnr <= {$schooljaarnr}
|
||||
AND A.meetellen = 'T'
|
||||
ORDER BY A.schooljaarnr DESC";
|
||||
return $this->get_query_result();
|
||||
|
||||
}
|
||||
|
||||
|
||||
function get_omvang($schooljaarnr, $orgs){
|
||||
$this->sql=" SELECT A.schooljaarnr, S.naam, SUM(A.aantal) as aantal
|
||||
FROM tb_schooljaren S
|
||||
JOIN tb_aantalleerlingen A ON S.schooljaarnr = A.schooljaarnr
|
||||
WHERE A.organisatie_id IN ({$orgs})
|
||||
AND A.schooljaarnr = {$schooljaarnr}
|
||||
AND A.aantal > 0
|
||||
AND A.meetellen = 'T' ";
|
||||
|
||||
return $this->get_query_row();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Autorisatienivos_model januari 2015 */
|
||||
|
||||
class Autorisatienivos_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_autorisatienivos';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array();
|
||||
$this->load->model($models);
|
||||
}
|
||||
function check_level($role, $level){
|
||||
$this->sql = "SELECT (".$role." & ".$level.") AS checker";
|
||||
$query = $this->db->query($this->sql);
|
||||
$row = $query->row();
|
||||
return $row->checker;
|
||||
}
|
||||
function getnivos($hierarchie){
|
||||
$this->sql="SELECT id, naam
|
||||
FROM tb_autorisatienivos
|
||||
WHERE hierarchie <= {$hierarchie}
|
||||
ORDER BY hierarchie DESC";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
function getusernivo($userid){
|
||||
$this->sql="SELECT nivo
|
||||
FROM tb_autorisatienivos AN
|
||||
JOIN tb_autorisaties A ON A.nivo_id = AN.id
|
||||
JOIN tb_orgusers OU ON OU.id = A.orguser_id
|
||||
JOIN tb_users U ON U.id = OU.user_id
|
||||
WHERE U.id = 1
|
||||
ORDER BY AN.nivo DESC
|
||||
LIMIT 0,1";
|
||||
|
||||
$result= $this->get_query_row();
|
||||
if ($result) {return $result->nivo;}
|
||||
else {return null ;};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Autorisaties_model januari 2015 */
|
||||
|
||||
class Autorisaties_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_autorisaties';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('ijkpartituur/Partituurs_model');
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
function check_autorisatie($role, $level){
|
||||
$this->sql = "SELECT (".$role." & ".$level.") AS checker";
|
||||
$query = $this->db->query($this->sql);
|
||||
$row = $query->row();
|
||||
return $row->checker;
|
||||
}
|
||||
function check_write(){
|
||||
if($this->super) return TRUE;
|
||||
if($this->orgid==$this->globorgid && $this->check_autorisatie($this->userrole, WRITER)) return TRUE;
|
||||
return false;
|
||||
}
|
||||
|
||||
function check_partituur_access($partituurid, $type){
|
||||
$read = TRUE;
|
||||
$write= TRUE;
|
||||
|
||||
if(!$this->super){
|
||||
$partorgid = $this->Partituurs_model->get_record_by_id($partituurid, 'partituur_organisatie_id');
|
||||
if($this->globorgid!=$partorgid){
|
||||
$read = FALSE;
|
||||
$write= FALSE;
|
||||
}else{
|
||||
// aangepast van $this->role naar $this->userrole
|
||||
if(!$this->check_autorisatie(WRITER, $this->userrole)){
|
||||
$write = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($type==1){
|
||||
return $read;
|
||||
}else{
|
||||
return $write;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Filefolders_model oktober 2017 - LS*/
|
||||
|
||||
class Filefolders_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_filefolders';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array("shared/Files_model");
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
function get_folders($module, $orgid){
|
||||
$this->sql = "SELECT id, organisatie_id, valtonder, nummer, naam
|
||||
FROM tb_filefolders
|
||||
WHERE modulenr= {$module}
|
||||
AND organisatie_id = {$orgid}
|
||||
AND id = valtonder
|
||||
ORDER BY nummer , naam ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function get_subfolders($folder){
|
||||
if ($folder){
|
||||
$this->sql = "SELECT id, organisatie_id, valtonder, nummer, naam
|
||||
FROM tb_filefolders
|
||||
WHERE valtonder = {$folder->id}
|
||||
AND id != valtonder
|
||||
ORDER BY nummer , naam ";
|
||||
$folders = $this->get_query_result();
|
||||
if ($folders){
|
||||
foreach($folders as $folder2){
|
||||
$folder2->files = $this->Files_model->get_files($folder2->id);
|
||||
$folder2->subfolders= $this->get_subfolders($folder2);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $folders;
|
||||
}
|
||||
|
||||
function get_folder($id){
|
||||
$this->sql = "SELECT id, organisatie_id, valtonder, nummer, naam
|
||||
FROM tb_filefolders
|
||||
WHERE id = {$id}";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
|
||||
function get_folder_by_cat($orgid, $catid, $catnaam, $modulenr){
|
||||
$uppernaam = strtoupper(addslashes($catnaam));
|
||||
$this->sql ="SELECT id
|
||||
FROM tb_filefolders
|
||||
WHERE organisatie_id = {$orgid}
|
||||
AND modulenr = {$modulenr}
|
||||
AND (instrumentcat = {$catid} OR UPPER(naam) ='{$uppernaam}' )";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Files_model oktober 2017 - LS*/
|
||||
|
||||
class Files_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_files';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
function file_exists($naam,$module, $orgid){
|
||||
//wordt gebruikt in upload php om te bepalen of de file al is geupload
|
||||
$this->sql = "SELECT F.id
|
||||
FROM tb_files F
|
||||
JOIN tb_filefolders FF ON FF.id = F.folder_id
|
||||
WHERE FF.modulenr= {$module}
|
||||
AND original_name = '{$naam}'
|
||||
AND F.organisatie_id = {$orgid}";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
|
||||
function get_files($folderID){
|
||||
$this->sql="SELECT id,
|
||||
original_name as naam ,
|
||||
DATE_FORMAT(modified, '%d-%m-%Y') as modified,
|
||||
if (extension ='.pdf' OR conversion_status= 'WORD-PDF-CONVERSION-SUCCEEDED', true,false) as pdf,
|
||||
if (owner = {$this->userid} , true, false) as owner
|
||||
FROM tb_files
|
||||
WHERE folder_id = {$folderID}
|
||||
ORDER BY UPPER(original_name)";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
function zoek_files($zoekterm, $orgID){
|
||||
$zoekterm =strtoupper($zoekterm);
|
||||
$this->sql = "SELECT F.original_name as naam,
|
||||
F.folder_id,
|
||||
FF.naam as foldernaam,
|
||||
M.naamkort,
|
||||
M.sysnr as modulenr
|
||||
FROM tb_files F
|
||||
JOIN tb_filefolders FF ON FF.id = F.folder_id
|
||||
JOIN tb_modules M ON M.sysnr = FF.modulenr
|
||||
WHERE UPPER(original_name) LIKE '%{$zoekterm}%'
|
||||
AND F.organisatie_id = {$orgID}
|
||||
ORDER BY UPPER(original_name)";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?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();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Modules_model februari 2015 */
|
||||
|
||||
class Functies_modules_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_functies_modules';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**kalenderjaren_model mei 2015 */
|
||||
|
||||
class kalenderjaren_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_kalenderjaren';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
function getkalenderjaren(){
|
||||
$this->sql = "SELECT jaarnr, naam, van,tm
|
||||
FROM tb_kalenderjaren
|
||||
ORDER BY jaarnr DESC";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
function getkalenderjarenMetMax($targetjaar){
|
||||
$this->sql = "SELECT jaarnr, naam, van,tm
|
||||
FROM tb_kalenderjaren
|
||||
WHERE jaarnr <= {$targetjaar}
|
||||
ORDER BY jaarnr DESC";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,527 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Organisaties_model januari 2015 */
|
||||
|
||||
class Organisaties_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_organisaties';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
function is_bg($orgid){
|
||||
//return TRUE als organisatie is bg
|
||||
$this->sql = "SELECT * FROM tb_organisaties WHERE valtonder_id = {$orgid}";
|
||||
if($this->get_query_result($this->sql)){
|
||||
return TRUE;
|
||||
}else{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
function get_orgnaam($globorgid){
|
||||
$this->sql ="SELECT naamkort
|
||||
FROM tb_organisaties
|
||||
WHERE id = $globorgid";
|
||||
$org = $this->get_query_row();
|
||||
if ($org) {return $org->naamkort;};
|
||||
}
|
||||
|
||||
function getallBGs(){
|
||||
$this->sql="SELECT O.id, brin, naam, naamkort, plaats,
|
||||
(SELECT count(OU.id) FROM tb_orgusers OU WHERE OU.organisatie_id = O.id ) AS aantal
|
||||
FROM tb_organisaties O
|
||||
WHERE O.id = valtonder_id
|
||||
AND actief = 1
|
||||
AND O.id <> 1
|
||||
ORDER BY valtonder_id, UPPER(naamkort)";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getScholen($bgID){
|
||||
$this->sql ="SELECT O.id, brin, naam, naamkort, plaats,
|
||||
(SELECT count(OU.id) FROM tb_orgusers OU WHERE OU.organisatie_id = O.id ) AS aantal,
|
||||
(SELECT count(IFS.id) FROM tb_indicatorscores IFS WHERE IFS.organisatie_id = O.id) AS aantalscores,
|
||||
(SELECT count(SK.id) FROM tb_schoolkenmerken SK WHERE SK.organisatie_id = O.id) AS aantalkenmerken
|
||||
FROM tb_organisaties O
|
||||
WHERE O.id <> {$bgID}
|
||||
AND valtonder_id = {$bgID}
|
||||
AND actief = 1
|
||||
ORDER BY UPPER(naamkort)";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
function getOrganisatie($orgid){
|
||||
$this->sql ="SELECT O.id, brin, naam, naamkort, plaats, soort, valtonder_id ,
|
||||
(SELECT count(OU.id) FROM tb_orgusers OU WHERE OU.organisatie_id = O.id ) AS aantal
|
||||
FROM tb_organisaties O
|
||||
WHERE id=$orgid
|
||||
AND actief = 1";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
function checkbrin($orgid=false, $brin){
|
||||
$this->sql =" SELECT COUNT(id) as aantal
|
||||
FROM tb_organisaties
|
||||
WHERE lower(brin) = lower('{$brin}')";
|
||||
if ($orgid){
|
||||
$this->sql .=" AND id <> {$orgid}";
|
||||
};
|
||||
|
||||
return $this->get_query_row();
|
||||
}
|
||||
function checkdeleteok($bgid){
|
||||
$this->sql="SELECT COUNT(id) as aantal
|
||||
FROM tb_organisaties
|
||||
WHERE valtonder_id = {$bgid}
|
||||
AND id <> {$bgid}";
|
||||
$scholen = $this->get_query_row();
|
||||
if ($scholen->aantal > 0) {return false ;}
|
||||
else{
|
||||
// controleer of er gebruikers zijn
|
||||
$this->sql = "SELECT count(id) as aantal
|
||||
FROM tb_orgusers
|
||||
WHERE organisatie_id = {$bgid}";
|
||||
|
||||
$users = $this->get_query_row();
|
||||
if ($users->aantal > 0) {return false ;}
|
||||
else {return true; };
|
||||
}
|
||||
}
|
||||
function getallorgs(){
|
||||
$this->sql="SELECT id, naamkort, brin, plaats
|
||||
FROM tb_organisaties
|
||||
WHERE actief = 1
|
||||
ORDER BY UPPER(naamkort)";
|
||||
// in de query nog een check op orguser? hoeft nu niet omdat deze functie alleen werkt voor super en helpdesk
|
||||
// voor andere users zie de functie hieronder getuserorgs
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getuserorgs($userid){
|
||||
$this->sql="SELECT O.id, naamkort, brin, plaats
|
||||
FROM tb_organisaties O
|
||||
JOIN tb_orgusers OU ON OU.organisatie_id = O.id
|
||||
JOIN tb_autorisaties A ON A.orguser_id = OU.id
|
||||
JOIN tb_autorisatienivos AN ON AN.id = A.nivo_id
|
||||
WHERE OU.user_id = {$userid}
|
||||
AND AN.nivo > 0";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
function getorgs($soort, $valtonderid = FALSE, $actief = FALSE){
|
||||
$this->sql="SELECT id, naam,naamkort, brin,valtonder_id, soort,plaats
|
||||
FROM tb_organisaties
|
||||
WHERE soort = {$soort}
|
||||
AND id <> 1";
|
||||
|
||||
if ($valtonderid) {
|
||||
$this->sql .=" AND valtonder_id = {$valtonderid} " ;
|
||||
}
|
||||
if ($actief){
|
||||
$this->sql .= " AND actief = 1" ;
|
||||
}
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getscholenonderkamer($kamerid){
|
||||
$this->sql="SELECT O.id, O.soort, O.naam as fullname, O.naamkort, O.plaats, O.brin
|
||||
FROM tb_organisaties O
|
||||
JOIN tb_organisaties BG ON O.valtonder_id = BG.id
|
||||
WHERE BG.valtonder_id = {$kamerid}
|
||||
AND O.actief = 1
|
||||
AND O.soort = 4
|
||||
ORDER BY O.naamkort";
|
||||
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getscholenonderswv($swvid){
|
||||
$this->sql="SELECT O.id, O.naam as fullname, O.naamkort, O.plaats, O.brin
|
||||
FROM tb_organisaties O
|
||||
JOIN tb_organisaties BG ON O.valtonder_id = BG.id
|
||||
JOIN tb_organisaties K ON BG.valtonder_id = K.id
|
||||
AND K.valtonder_id = {$swvid}
|
||||
AND O.actief = 1
|
||||
AND O.soort =4
|
||||
ORDER BY O.naamkort";
|
||||
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getorgsonderbestuurMetLicentie( $orgid, $module){
|
||||
$this->sql="SELECT O.id, O.soort, O.naam as fullname, O.naamkort, O.plaats, O.brin
|
||||
FROM tb_organisaties O
|
||||
JOIN tb_licenties L ON O.id = L.orgid
|
||||
JOIN tb_licenties L2 ON O.valtonder_id = L2.orgid
|
||||
WHERE valtonder_id = {$orgid}
|
||||
AND id <> {$orgid}
|
||||
AND actief = 1
|
||||
AND L.module = {$module}
|
||||
AND L2.module = {$module}
|
||||
ORDER BY naamkort";
|
||||
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
|
||||
function getScholenOnderKamerMetLicentie($kamerid, $module){
|
||||
$this->sql="SELECT O.id, O.soort, O.naam as fullname, O.naamkort, O.plaats, O.brin
|
||||
FROM tb_organisaties O
|
||||
JOIN tb_organisaties BG ON O.valtonder_id = BG.id
|
||||
JOIN tb_licenties L ON O.id = L.orgid
|
||||
JOIN tb_licenties L2 ON BG.valtonder_id = L2.id
|
||||
WHERE BG.valtonder_id = {$kamerid}
|
||||
AND O.actief = 1
|
||||
AND O.soort = 4
|
||||
AND L.module = {$module}
|
||||
AND L2.module = {$module}
|
||||
ORDER BY O.naamkort";
|
||||
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getScholenOnderSwvMetLicentie($swvid, $module){
|
||||
$this->sql="SELECT O.id, O.naam as fullname, O.naamkort, O.plaats, O.brin
|
||||
FROM tb_organisaties O
|
||||
JOIN tb_organisaties BG ON O.valtonder_id = BG.id
|
||||
JOIN tb_organisaties K ON BG.valtonder_id = K.id
|
||||
JOIN tb_licenties L ON O.id = L.orgid
|
||||
JOIN tb_licenties L2 ON K.valtonder_id = L2.orgid
|
||||
AND K.valtonder_id = {$swvid}
|
||||
AND L.modulenr = {$module}
|
||||
AND L2.modulenr = {$module}
|
||||
AND O.actief = 1
|
||||
AND O.soort = 4
|
||||
ORDER BY O.naamkort";
|
||||
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getorgsvanaf( $toplevelid,$sublevelid = false){
|
||||
$this->sql="SELECT id, soort, naam, naamkort, plaats,brin
|
||||
FROM tb_organisaties
|
||||
WHERE valtonder_id = {$toplevelid}
|
||||
AND id <> {$toplevelid}
|
||||
AND actief = 1";
|
||||
if ($sublevelid) {$this->sql .=" AND id ={$sublevelid} " ; } ;
|
||||
$this->sql .= " ORDER BY naamkort ";
|
||||
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function get_schoolIDs_onder($orgid){
|
||||
$this->sql="SELECT DISTINCT(SCHOOL.id) as id
|
||||
FROM tb_organisaties SCHOOL
|
||||
JOIN tb_organisaties BESTUUR ON SCHOOL.valtonder_id = BESTUUR.id
|
||||
JOIN tb_organisaties KAMER ON BESTUUR.valtonder_id = KAMER.id
|
||||
WHERE (BESTUUR.id = {$orgid} OR KAMER.id = {$orgid} OR KAMER.valtonder_id = {$orgid})
|
||||
AND SCHOOL.soort = 4
|
||||
AND SCHOOL.actief = 1";
|
||||
;
|
||||
|
||||
return $this->get_query_result();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function getorgsvanafmetlicentie( $toplevelid, $licentie){
|
||||
$this->sql="SELECT O.id, O.soort, O.naam, O.naamkort, O.plaats, O.brin
|
||||
FROM tb_organisaties O
|
||||
JOIN tb_licenties L ON O.id = L.orgid
|
||||
WHERE valtonder_id = {$toplevelid}
|
||||
AND O.id <> {$toplevelid}
|
||||
AND L.modulenr = {$licentie}
|
||||
AND O.actief = 1
|
||||
ORDER BY O.naamkort";
|
||||
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getorgsonderbestuur( $orgid){
|
||||
$this->sql="SELECT id, soort, naam as fullname, naamkort, plaats,brin
|
||||
FROM tb_organisaties
|
||||
WHERE valtonder_id = {$orgid}
|
||||
AND id <> {$orgid}
|
||||
AND actief = 1
|
||||
ORDER BY naamkort";
|
||||
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
|
||||
function getorg($orgid){
|
||||
$this->sql="SELECT id, soort, naam, naamkort, plaats, valtonder_id , brin
|
||||
FROM tb_organisaties
|
||||
WHERE id = {$orgid}
|
||||
AND actief = 1";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
function getbgsonderswv($swvid){
|
||||
$this->sql="SELECT O1.id, O1.soort, O1.naam, O1.plaats, O1.actief
|
||||
FROM tb_organisaties O1
|
||||
JOIN tb_organisaties O2 ON O2.id = O1.valtonder_id
|
||||
JOIN tb_organisaties O3 ON O3.id = O2.valtonder_id
|
||||
WHERE O3.id = {$swvid}
|
||||
AND O1.id <> O3.valtonder_id
|
||||
AND O2.id <> O2.valtonder_id
|
||||
AND O1.actief = 1
|
||||
ORDER BY O1.naam ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
|
||||
function getorgsdetails($soort, $valtonder){
|
||||
$this->sql="SELECT id, soort, brin, naamkort, naam,
|
||||
plaats,valtonder_id, actief, monbas, mondiv,
|
||||
bijlagefile
|
||||
FROM tb_organisaties
|
||||
WHERE soort = {$soort}
|
||||
AND actief = 1";
|
||||
if ($valtonder) {
|
||||
$this->sql .=" AND valtonder_id = {$valtonder} ";
|
||||
};
|
||||
return $this->get_query_result();
|
||||
}
|
||||
function getorgdetails($id){
|
||||
$this->sql="SELECT id, soort, brin, naamkort, naam, plaats,valtonder_id, actief,monbas, mondiv
|
||||
FROM tb_organisaties
|
||||
WHERE id= {$id}";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
function hasdependent($orgid){
|
||||
$this->sql="SELECT count(id) AS aantal
|
||||
FROM tb_organisaties
|
||||
WHERE valtonder_id = {$orgid}
|
||||
AND id <> valtonder_id";
|
||||
$res = $this->get_query_row();
|
||||
if ($res && $res->aantal > 0) {return true;}
|
||||
else {return false;};
|
||||
}
|
||||
function zoekorgs($zoekstring){
|
||||
$this->sql = "SELECT brin, naamkort, plaats , soort, id
|
||||
FROM tb_organisaties
|
||||
WHERE (UPPER(naam) LIKE concat('%', UPPER('{$zoekstring}'),'%') ) OR
|
||||
(UPPER(naamkort) LIKE concat('%', UPPER('{$zoekstring}'),'%') )
|
||||
AND actief = 1
|
||||
ORDER BY naamkort";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
function getuserorgOUD($userid){
|
||||
// deze functie is vervallen omdat nu een gebruiker lid kan zijn van meerdere organisaties
|
||||
$this->sql="SELECT O.id, naam,soort,valtonder_id
|
||||
FROM tb_organisaties O
|
||||
JOIN tb_orgusers OU ON OU.organisatie_id = O.id
|
||||
WHERE OU.user_id = {$userid}";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
|
||||
function getsoortvanorginalorg($userid){
|
||||
$this->sql = "SELECT O.soort
|
||||
FROM tb_orgusers OU
|
||||
JOIN tb_organisaties O ON O.id=OU.organisatie_id
|
||||
WHERE OU.user_id = {$userid}";
|
||||
|
||||
$org = $this->get_query_row();
|
||||
return $org->soort;
|
||||
}
|
||||
function getorgs2($orgid){
|
||||
$this->sql = "SELECT O.id as orgid, O.naamkort as fullname, O.brin
|
||||
FROM tb_organisaties O
|
||||
WHERE O.valtonder_id = $orgid
|
||||
AND O.id <> $orgid
|
||||
AND O.actief = 1
|
||||
ORDER BY O.naamkort";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
function getall(){
|
||||
$this->sql="Select * from tb_organisaties";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
function getkamer($orgid){
|
||||
$organisatie = $this->get_record_by_id($orgid);
|
||||
if ($organisatie->soort == 1) {return null;};
|
||||
if ($organisatie->soort == 2) {return $orgid; };
|
||||
if ($organisatie->soort == 3) {return $organisatie->valtonder_id;};
|
||||
if ($organisatie->soort == 4) {
|
||||
$organisatie=$this->get_record_by_id($organisatie->valtonder_id);
|
||||
return $organisatie->valtonder_id;
|
||||
};
|
||||
}
|
||||
function getorgsonder($orgid){
|
||||
$this->sql = "SELECT id, soort, valtonder_id, actief
|
||||
FROM tb_organisaties
|
||||
WHERE valtonder_id ={$orgid}
|
||||
AND id != valtonder_id
|
||||
AND actief = 1;";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
function getscholenondertarget($orgid){
|
||||
if (!isset($idlijst)) {$idlijst = array();};
|
||||
|
||||
$orgs= $this->getorgsonder($orgid);
|
||||
|
||||
if ($orgs){
|
||||
foreach($orgs as $org) {
|
||||
if ($org->soort ==4 ) {$idlijst[] = $org->id;}
|
||||
}
|
||||
|
||||
foreach($orgs as $org){
|
||||
if ($org->soort < 4) { $idlijst=array_merge($idlijst, $this->getscholenondertarget($org->id));}
|
||||
}
|
||||
}
|
||||
|
||||
return $idlijst;
|
||||
}
|
||||
function getscholenondertarget2($orgid){
|
||||
$idlijst = array();
|
||||
$organisatie = $this->get_record_by_id($orgid);
|
||||
|
||||
if ($organisatie->soort == 1){
|
||||
|
||||
$kamers = $this->getorgsonder($organisatie->id);
|
||||
if ($kamers){
|
||||
foreach($kamers as $kamer){
|
||||
$bgs = $this->getorgsonder($kamer->id);
|
||||
if ($bgs){
|
||||
foreach($bgs as $bg){
|
||||
$scholen = $this->getorgsonder($bg->id);
|
||||
if ($scholen){
|
||||
foreach($scholen as $school){
|
||||
$idlijst[] = $school->id;
|
||||
}
|
||||
}; // if scholen
|
||||
}; // foreach
|
||||
}; // if bgs
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($organisatie->soort == 2){
|
||||
|
||||
$bgs = $this->getorgsonder($organisatie->id);
|
||||
|
||||
|
||||
if ($bgs){
|
||||
foreach($bgs as $bg){
|
||||
$scholen = $this->getorgsonder($bg->id);
|
||||
|
||||
if ($scholen){
|
||||
foreach($scholen as $school){
|
||||
$idlijst[] = $school->id;
|
||||
}
|
||||
}; // if scholen
|
||||
}; // foreach
|
||||
}; // if bgs
|
||||
}; //if orgsoort
|
||||
if ($organisatie->soort == 3){
|
||||
$scholen = $this->getorgsonder($organisatie->id);
|
||||
if ($scholen){
|
||||
foreach($scholen as $school){
|
||||
$idlijst[] = $school->id;
|
||||
}
|
||||
}; // if scholen
|
||||
}; //if orgsoort
|
||||
if ($organisatie->soort == 4){
|
||||
$idlijst[] = $organisatie->id;
|
||||
}
|
||||
return $idlijst;
|
||||
}
|
||||
function getorgstructuur($orgid, $actief=FALSE){
|
||||
$organisatie = $this->getorg($orgid);
|
||||
if ($organisatie->soort ==1){
|
||||
$swv = $organisatie;
|
||||
$swv->kamers = $this->getorgs(2, $swv->id, $actief);
|
||||
if ($swv->kamers){
|
||||
foreach($swv->kamers as $kamer){
|
||||
$kamer->bgs = $this->getorgs(3, $kamer->id, $actief);
|
||||
if ($kamer->bgs){
|
||||
foreach ($kamer->bgs as $bg){
|
||||
$bg->scholen = $this->getorgs(4, $bg->id, $actief);
|
||||
}; // foreach bg
|
||||
}; // if bgs
|
||||
}; // foreach $kamer
|
||||
}; // if kamers
|
||||
}; // if soort ==1;
|
||||
if ($organisatie->soort == 2){
|
||||
$swv = new stdClass;
|
||||
$swv->kamers = array();
|
||||
$swv->kamers[0] = $organisatie;
|
||||
foreach($swv->kamers as $kamer){
|
||||
$kamer->bgs = $this->getorgs(3, $kamer->id, $actief);
|
||||
if ($kamer->bgs){
|
||||
foreach($kamer->bgs as $bg){
|
||||
$bg->scholen = $this->getorgs(4, $bg->id, $actief);
|
||||
};// foreach bg
|
||||
}; // if bgs
|
||||
}; // foreach
|
||||
}; // if soort ==2
|
||||
if ($organisatie->soort==3){
|
||||
$swv = new stdClass;
|
||||
$swv->kamers = array();
|
||||
$swv->kamers[0]= new stdClass;
|
||||
$swv->kamers[0]->bgs = array();
|
||||
$swv->kamers[0]->bgs[0] = $organisatie;
|
||||
$swv->kamers[0]->bgs[0]->scholen = $this->getorgs(4, $organisatie->id, $actief);
|
||||
}
|
||||
if ($organisatie->soort==4){
|
||||
$swv = new stdClass;
|
||||
$swv->kamers = array();
|
||||
$swv->kamers[0]= new stdClass;
|
||||
$swv->kamers[0]->bgs = array();
|
||||
$swv->kamers[0]->bgs[0] = new stdClass;
|
||||
$swv->kamers[0]->bgs[0]->scholen = array();
|
||||
$swv->kamers[0]->bgs[0]->scholen[0]= $organisatie;
|
||||
}
|
||||
return $swv;
|
||||
}
|
||||
|
||||
function get_swvid ($orgid){
|
||||
$valtonder_id = $this->get(['id'=>$orgid], 'valtonder_id', true);
|
||||
if ($valtonder_id != $orgid){
|
||||
return $this->get_swvid($valtonder_id);
|
||||
}
|
||||
// else {
|
||||
return $orgid;
|
||||
// }
|
||||
}
|
||||
|
||||
function getlistrecursief($orgid,$lijst){
|
||||
$lijst = array_merge($lijst, array($orgid));
|
||||
$this->sql = " SELECT id
|
||||
FROM tb_organisaties
|
||||
WHERE valtonder_id = {$orgid}
|
||||
AND id <> {$orgid}
|
||||
AND actief = 1";
|
||||
$newlijst = $this->get_query_result();
|
||||
if ($newlijst){
|
||||
foreach($newlijst as $newid){
|
||||
$lijst= $this->getlistrecursief($newid->id, $lijst);
|
||||
}
|
||||
}
|
||||
|
||||
return $lijst;
|
||||
}
|
||||
|
||||
|
||||
function getKleurcodesOrg($clusterid = FALSE, $swvid){
|
||||
if (! $clusterid) $clusterid = 0;
|
||||
$sql = " SELECT *
|
||||
FROM tb_kleurcodes KC
|
||||
WHERE (organisatie_id = {$swvid} OR organisatie_id = 0)
|
||||
AND (cluster_id = {$clusterid})
|
||||
order by organisatie_id desc, cluster_id DESC
|
||||
limit 1";
|
||||
$query = $this->db->query($sql);
|
||||
$codes = $query->row();
|
||||
return $codes;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Orgusers_model januari 2015 */
|
||||
|
||||
class Orgusers_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_orgusers';
|
||||
|
||||
function getuserrole($userid, $orgid){
|
||||
$this->sql="SELECT AN.nivo
|
||||
FROM tb_orgusers OU
|
||||
JOIN tb_autorisaties A ON orguser_id = OU.id
|
||||
JOIN tb_autorisatienivos AN ON AN.id = A.nivo_id
|
||||
WHERE user_id={$userid}
|
||||
AND organisatie_id = {$orgid}";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
|
||||
function get_org_users($orgid, $level = FALSE){
|
||||
$this->sql=" SELECT ou.id,
|
||||
CONCAT_WS(' ', u.voornaam,u.tussenvoegsel,u.achternaam) as fullname
|
||||
FROM tb_orgusers ou, tb_users u
|
||||
WHERE ou.organisatie_id = {$orgid}
|
||||
AND u.id = ou.user_id
|
||||
AND u.actief = 1";
|
||||
if ($level) {
|
||||
$this->sql .= " AND u.gnaam IS NOT NULL ";
|
||||
}
|
||||
$this->sql .= " ORDER BY u.achternaam ";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
function get_user($userid, $orgid){
|
||||
$this->sql=" SELECT ou.id,
|
||||
CONCAT_WS(' ', u.voornaam,u.tussenvoegsel,u.achternaam) as fullname
|
||||
FROM tb_orgusers ou
|
||||
JOIN tb_users u ON u.id = ou.user_id
|
||||
WHERE ou.organisatie_id = {$orgid}
|
||||
AND ou.user_id = {$userid}";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
function get_org_user($userid){
|
||||
$this->sql="SELECT ou.id,
|
||||
CONCAT_WS(' ', u.voornaam,u.tussenvoegsel,u.achternaam) as fullname
|
||||
FROM tb_orgusers ou, tb_users u
|
||||
WHERE ou.id= {$userid}
|
||||
AND u.id = ou.user_id";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
function gethighestautorisatie($userid){
|
||||
$this->sql = "SELECT OU.id, OU.user_id,OU.organisatie_id ,AN.nivo
|
||||
FROM tb_orgusers OU
|
||||
JOIN tb_autorisaties A ON A.orguser_id = OU.id
|
||||
JOIN tb_autorisatienivos AN ON AN.id = A.nivo_id
|
||||
WHERE OU.user_id={$userid}
|
||||
AND AN.nivo <>0
|
||||
ORDER BY nivo";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**Schooljaren_model mei 2015 */
|
||||
|
||||
class Schooljaren_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = 'tb_schooljaren';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('');
|
||||
$this->load->model($models);
|
||||
}
|
||||
function getschooljaren(){
|
||||
$this->sql = "SELECT schooljaarnr, naam, start, eind
|
||||
FROM tb_schooljaren
|
||||
ORDER BY schooljaarnr DESC";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function getschooljaar($schooljaarnr){
|
||||
$this->sql = "SELECT id, schooljaarnr, naam, start, eind
|
||||
FROM tb_schooljaren
|
||||
WHERE schooljaarnr = {$schooljaarnr}";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/* Session_model januari 2015 */
|
||||
|
||||
|
||||
class Session_model extends CI_Model{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array();
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
function create_session(){
|
||||
|
||||
}
|
||||
|
||||
function set_userid($userid){
|
||||
$this->session->set_userdata('userid', $userid);
|
||||
}
|
||||
|
||||
function set_tmpuserid($userid){
|
||||
$this->session->set_userdata('tmpuserid', $userid);
|
||||
}
|
||||
|
||||
function unset_userid(){
|
||||
$this->session->unset_userdata('userid');
|
||||
}
|
||||
|
||||
function set_orgid($orgid){
|
||||
$this->session->set_userdata('orgid', $orgid);
|
||||
}
|
||||
|
||||
function unset_orgid(){
|
||||
$this->session->unset_userdata('orgid');
|
||||
}
|
||||
|
||||
function set_globorgid($orgid){
|
||||
$this->session->set_userdata('globorgid', $orgid);
|
||||
}
|
||||
|
||||
function unset_globorgid(){
|
||||
$this->session->unset_userdata('globorgid');
|
||||
}
|
||||
|
||||
function set_role($role){
|
||||
$this->session->set_userdata('role', $role);
|
||||
}
|
||||
|
||||
function unset_role(){
|
||||
$this->session->unset_userdata('role');
|
||||
}
|
||||
|
||||
function set_logged(){
|
||||
$this->session->set_userdata('logged', TRUE);
|
||||
}
|
||||
|
||||
function unset_logged(){
|
||||
$this->session->unset_userdata('logged');
|
||||
$this->session->sess_destroy();
|
||||
}
|
||||
|
||||
function set_module($module){
|
||||
$this->session->set_userdata("module", $module);
|
||||
$this->module =$module;
|
||||
}
|
||||
|
||||
function unset_module(){
|
||||
$this->session->unset_userdata('module');
|
||||
}
|
||||
function set_selectedschool($schoolid){
|
||||
$this->session->set_userdata("selectedschool", $schoolid);
|
||||
$this->selectedschool =$schoolid;
|
||||
}
|
||||
|
||||
function unset_selectedschool(){
|
||||
$this->session->unset_userdata('selectedschool');
|
||||
}
|
||||
function set_schooljaar($schooljaarnr){
|
||||
$this->session->set_userdata("schooljaar", $schooljaarnr);
|
||||
$this->schooljaar =$schooljaarnr;
|
||||
}
|
||||
|
||||
function unset_schooljaar(){
|
||||
$this->session->unset_userdata('schooljaar');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/** Users_model januari 2015 */
|
||||
|
||||
class Users_model extends MY_Model{
|
||||
|
||||
|
||||
protected $tablename = "tb_users";
|
||||
public $gID;
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array();
|
||||
$this->load->model($models);
|
||||
$this->userid = $this->session->userdata('userid');//gets userid from session
|
||||
if($this->userid){
|
||||
$this->get_fullname($this->userid);//set the full username if user is logged on
|
||||
$this->gID = $this->userid;
|
||||
}
|
||||
}
|
||||
function get_user_detail_by_id($userid){
|
||||
$this->sql = "SELECT id, gnaam as user_name, concat_ws(' ' , voornaam, tussenvoegsel, achternaam) as fullname
|
||||
FROM tb_users
|
||||
WHERE id={$userid}";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
function get_fullname($userid){
|
||||
$this->sql=" select concat_ws(' ', voornaam,tussenvoegsel,achternaam) as fullname
|
||||
from tb_users
|
||||
where id = {$userid}";
|
||||
$rij = $this->get_query_row();
|
||||
return $rij->fullname;
|
||||
}
|
||||
function getdetails ($userid){
|
||||
$this->sql = "SELECT voornaam , tussenvoegsel, achternaam, email, zout
|
||||
FROM tb_users
|
||||
WHERE id = $userid";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
|
||||
function getorggebruikers($orgid,$userid=false){
|
||||
$this->sql = "SELECT U.id as userid, voornaam, tussenvoegsel, achternaam, email,gnaam, U.actief,
|
||||
A.nivo_id, AN.naam as autorisatienaam, if (AN.nivo > 0, TRUE,FALSE) as OUactief
|
||||
FROM tb_users U
|
||||
JOIN tb_orgusers OU ON OU.user_id= U.id
|
||||
JOIN tb_autorisaties A ON A.orguser_id = OU.id
|
||||
JOIN tb_autorisatienivos AN ON AN.id = A.nivo_id
|
||||
WHERE OU.organisatie_id = $orgid";
|
||||
if ($userid) {
|
||||
$this->sql .=" AND U.id = {$userid} ";
|
||||
};
|
||||
|
||||
$this->sql .= " ORDER BY UPPER(U.achternaam)";
|
||||
if ($userid) {return $this->get_query_row() ;}
|
||||
else {return $this->get_query_result();}
|
||||
}
|
||||
function check_username($gnaam,$userid = false){
|
||||
$this->sql="SELECT count(id) as aantal
|
||||
FROM tb_users
|
||||
WHERE gnaam = '{$gnaam}'";
|
||||
if ($userid) {
|
||||
$this->sql .= " AND id <> $userid ";
|
||||
}
|
||||
$gevonden= $this->get_query_row();
|
||||
return $gevonden->aantal;
|
||||
}
|
||||
function getleerkracht($lkid){
|
||||
$this->sql = "SELECT U.id, OU.organisatie_id, U.aanhef,
|
||||
U.voornaam, U.tussenvoegsel, U.achternaam, U.email,
|
||||
A.nivo_id
|
||||
FROM tb_orgusers OU
|
||||
JOIN tb_autorisaties A ON A.orguser_id = OU.id
|
||||
JOIN tb_users U ON U.id = OU.user_id
|
||||
WHERE U.actief = 1
|
||||
AND U.id = {$lkid}";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
function getleerkrachten($orgid){
|
||||
$this->sql = "SELECT U.id, U.id as userid, OU.organisatie_id, U.aanhef,
|
||||
U.voornaam, U.tussenvoegsel, U.achternaam, U.email,
|
||||
concat_ws(' ',U.voornaam, U.tussenvoegsel, U.achternaam) AS fullname,
|
||||
A.nivo_id
|
||||
FROM tb_orgusers OU
|
||||
JOIN tb_autorisaties A ON A.orguser_id = OU.id
|
||||
JOIN tb_users U ON U.id = OU.user_id
|
||||
WHERE U.actief = 1
|
||||
AND OU.organisatie_id = {$orgid}
|
||||
AND A.nivo_id <> 100
|
||||
ORDER BY U.achternaam";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
function otherusers($orgid, $orgids){
|
||||
$this->sql="SELECT DISTINCT(U.id), concat_ws(' ',voornaam, tussenvoegsel, achternaam) AS fullname
|
||||
FROM tb_users U
|
||||
JOIN tb_orgusers OU ON OU.user_id= U.id
|
||||
WHERE (SELECT count(id) FROM tb_orgusers WHERE user_id = U.id AND organisatie_id = {$orgid}) = 0
|
||||
AND (OU.organisatie_id IN ({$orgids}) )
|
||||
ORDER BY achternaam";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
function get_users_by_organisatie($orgid){
|
||||
// uit partituur users
|
||||
$this->sql = "SELECT U.id, U.gnaam as user_name, concat_ws(' ', voornaam, tussenvoegsel, achternaam) as fullname
|
||||
FROM tb_users U
|
||||
JOIN tb_orgusers OU on OU.user_id = U.id
|
||||
WHERE OU.organisatie_id= {$orgid}
|
||||
ORDER BY U.achternaam";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user