initial commit
This commit is contained in:
@@ -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 ;};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user