Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if($this->session->userdata('role') == "Admin")
- {
- $role_wise = "";
- }elseif($this->session->userdata('role') == "CompanyAdmin"){
- $role_wise = "AND company_id = ".$this->session->userdata('company_id');
- }else{
- $role_wise = "AND company_id = ".$this->session->userdata('company_id')." AND created_by = ".$this->session->userdata('created_by')." OR created_by = ".$this->session->userdata('id');
- }
- $sQuery = "SELECT SQL_CALC_FOUND_ROWS " . str_replace(" , ", " ", implode(", ", $aColumns)) . "
- FROM tbl_users
- $sWhere ".$role_wise."
- $sOrder
- $sLimit
- ";
- $aColumns = array(
- '(SELECT IFNULL((SELECT name FROM tbl_company WHERE id=company_id),"not found")) AS company_by_name',
- );
- '(SELECT IFNULL((SELECT CONCAT_WS(" ", first_name, last_name) FROM tbl_users WHERE id=tbl_tasks.created_by),"not found")) AS created_by_name',
- $whereColumns = array(
- '(SELECT IFNULL((SELECT name FROM tbl_company WHERE id=company_id),"not found"))',
- '(SELECT IFNULL((SELECT CONCAT_WS(" ", first_name, last_name) FROM tbl_users WHERE id=tbl_tasks.created_by),"not found"))',
- );
Add Comment
Please, Sign In to add comment