initial commit
This commit is contained in:
@@ -0,0 +1,110 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Description of Orgusers_model
|
||||
*
|
||||
* @author Theo Weijmer
|
||||
* @date april 26, 2013 12:00 PM
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
class Orgusers_model extends MY_Model{
|
||||
|
||||
protected $tablename = 'tb_orgusers';
|
||||
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('shared/Organisaties_model',
|
||||
'shared/Autorisaties_model');
|
||||
$this->load->model($models);
|
||||
}
|
||||
|
||||
|
||||
function get_details($where){
|
||||
$records = $this->get_records_where($where);
|
||||
|
||||
if($records){
|
||||
foreach($records as $record){
|
||||
$details[] = $this->get_orguser_details($record);
|
||||
}
|
||||
}
|
||||
if ($details )
|
||||
{ return $details;}
|
||||
else {return false;};
|
||||
}
|
||||
|
||||
function get_orguser_details($record){
|
||||
$details = new stdClass;
|
||||
|
||||
$details->id = $record->id;
|
||||
$details->level = $record->orguser_level;
|
||||
|
||||
$details->orgid = $record->orguser_organisatie_id;
|
||||
$details->orgnaam = $this->Organisaties_model->get_record_by_id($record->orguser_organisatie_id, 'organisatie_naamkort');
|
||||
|
||||
$details->userid = $record->orguser_user_id;
|
||||
|
||||
$details->autorisaties = $this->Autorisaties_model->get_autorisaties($record->orguser_level);
|
||||
|
||||
return $details;
|
||||
}
|
||||
|
||||
function table_def(){
|
||||
$this->sql = "
|
||||
|
||||
";
|
||||
|
||||
}
|
||||
function get_org_users($orgid){
|
||||
$this->sql="
|
||||
SELECT ou.id,
|
||||
CONCAT_WS(' ', u.voornaam,u.tussenvoegsel,u.achternaam) as fullname
|
||||
FROM tb_orgusers ou, tb_users u
|
||||
WHERE ou.orguser_organisatie_id = {$orgid}
|
||||
AND u.id = ou.orguser_user_id";
|
||||
// AND orguser_level != 0 ";
|
||||
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.orguser_user_id";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
function get_orguser_from_user($userid, $orgid){
|
||||
$this->sql = "SELECT *
|
||||
FROM tb_orgusers
|
||||
WHERE orguser_user_id={$userid}
|
||||
AND orguser_organisatie_id ={$orgid}";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
function get_full_users($orgid, $admin=false){
|
||||
$this->sql= " SELECT ou.id,
|
||||
CONCAT_WS(' ', u.voornaam,u.tussenvoegsel,u.achternaam) as fullname,
|
||||
u.user_email, ";
|
||||
if ($admin){
|
||||
$this->sql.="gnaam as user_name ,";
|
||||
}else{
|
||||
$this->sql.="'*' as user_name ,";
|
||||
}
|
||||
$this->sql.=" ou.orguser_level as level
|
||||
FROM tb_orgusers ou, tb_users u
|
||||
WHERE ou.organisatie_id = {$orgid}
|
||||
AND u.id = ou.user_id";
|
||||
return $this->get_query_result();
|
||||
}
|
||||
|
||||
function get_single_orguser($userid){
|
||||
$this->sql = " SELECT id, orguser_organisatie_id as organisatie_id
|
||||
FROM tb_orgusers
|
||||
WHERE orguser_user_id = $userid
|
||||
LIMIT 1";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user