EVOLUTION-NINJA
Edit File: Model.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Model extends CI_Model { function __construct() { parent:: __construct(); } public function get_all_data($table) { $this->db->select('*'); $this->db->from($table); $query=$this->db->get(); return $query->result(); } public function get_all_data_new($table) { $this->db->select('*'); $this->db->from($table); $this->db->order_by("document_no","asc"); $query=$this->db->get(); return $query->result(); } public function products() { $this->db->distinct(); $this->db->select('product_name,category'); $this->db->from('manuals'); $query=$this->db->get(); return $query->result(); } public function get_all_row($table) { $this->db->select('*'); $this->db->from($table); $query=$this->db->get(); return $query->row(); } public function get_where_row($table,$where) { $this->db->select('*'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->row(); } public function get_row($table,$where) { $this->db->select('*'); $this->db->where($where); $query=$this->db->get($table); return $query->row(); } public function get_where_row1($table) { $this->db->select('id'); $this->db->from($table); $this->db->order_by("id","desc"); $this->db->limit('1'); $query=$this->db->get(); return $query->row(); } public function get_where_data($table,$where,$id) { $this->db->select('*'); $this->db->from($table); $this->db->where($where,$id); $query=$this->db->get(); return $query->result(); } public function fetch_where_data($table,$where) { $this->db->select('*'); $this->db->from($table); $this->db->where($where); $this->db->order_by('id',"DESC"); $query=$this->db->get(); return $query->result(); } public function fetch_where_data_case_stories($table,$where) { $this->db->select('*'); $this->db->from($table); $this->db->where($where); $this->db->order_by('case_id',"DESC"); $query=$this->db->get(); return $query->result(); } public function fetch_where_data_new($table,$where) { $this->db->select('*'); $this->db->from($table); $this->db->where($where); $this->db->order_by('po_id',"DESC"); $query=$this->db->get(); return $query->result(); } public function fetch_where_data_asc($table,$where) { $this->db->select('*'); $this->db->from($table); $this->db->where($where); $this->db->order_by('id',"ASC"); $query=$this->db->get(); return $query->result(); } public function fetch_where_data_case($table,$where) { $this->db->select('*'); $this->db->from($table); $this->db->where($where); $this->db->order_by('case_id',"DESC"); $query=$this->db->get(); return $query->result(); } public function fetch_where_data_stock($table,$where) { $this->db->select('*'); $this->db->from($table); $this->db->where($where); $this->db->order_by('stock_id',"DESC"); $query=$this->db->get(); return $query->result(); } public function get_intend($table,$limit,$page,$where) { $this->db->where($where); $this->db->select('*'); $this->db->from($table); $this->db->limit($limit,$page); $query=$this->db->get(); return $query->result(); } public function insert($table,$data) { $this->db->insert($table,$data); return $this->db->insert_id(); } public function delete($table,$where) { $this->db->where($where); $this->db->delete($table); } public function update_new($where,$table,$data) { $this->db->where($where); $this->db->update($table,$data); } public function update($where,$table,$data) { $this->db->where($where); $this->db->update($table,$data); $afftectedRows = $this->db->affected_rows(); return $afftectedRows; } public function insertCSV($data) { $this->db->insert('stock_info', $data); return TRUE; } public function insertexl($data) { $this->db->insert('fin_outstanding', $data); return TRUE; } public function insertexl2($data) { $this->db->insert('fin_overdue', $data); return TRUE; } public function insertexl3($data) { $this->db->insert('fin_cforms', $data); return TRUE; } public function view_data(){ $query=$this->db->query("SELECT im.* FROM stock_info im "); return $query->result_array(); } public function region_get($id) { $this->db->select('*'); $this->db->from(' fin_overdue fin'); $this->db->join('profile pro','fin.partner_code=pro.uid'); $this->db->where('pro.region',$id,'fin.status',0); $query=$this->db->get(); return $query->result(); } public function region_get_stock($id) { $this->db->select('*'); $this->db->from('stock_info stc'); $this->db->join('profile pro','stc.partner_code=pro.uid'); $this->db->where('pro.region',$id,'stc.status',0); $query=$this->db->get(); return $query->result(); } public function region_get_po($id) { $this->db->select('*'); $this->db->from('po_info po'); $this->db->join('profile pro','po.partner_code=pro.uid'); $this->db->where('pro.region',$id); $this->db->where('po.status',0); $query=$this->db->get(); return $query->result(); } /* public function region_get_outed($id) { $this->db->select('*'); $this->db->from('fin_outstanding po'); $this->db->join('profile pro','po.partner_code=pro.uid'); $this->db->where('pro.region',$id); $this->db->where('po.status',0); $query=$this->db->get(); return $query->result(); }*/ public function region_get_outed($id) { $this->db->select('*'); $this->db->from('fin_outstanding po'); // $this->db->join('profile pro','po.partner_code=pro.uid'); //$this->db->where('pro.region',$id); $this->db->where('po.region',$id); $this->db->where('po.status',0); $query=$this->db->get(); return $query->result(); } public function get_cform($id) { $this->db->select('*'); $this->db->from('fin_cforms c'); $this->db->join('profile pro','c.partner_code=pro.uid'); $this->db->where('pro.region',$id); $this->db->where('c.status',0); $query=$this->db->get(); return $query->result(); } public function get_drive($id) { $this->db->select('*'); $this->db->from('manuals m'); $this->db->join('profile pro','m.partner_code=pro.uid'); $this->db->where('pro.region',$id); $this->db->where('m.status',0); $query=$this->db->get(); return $query->result(); } public function get_case($id) { $this->db->select('*'); $this->db->from('case_stories ca'); $this->db->join('profile pro','ca.partner_code=pro.uid'); $this->db->where('pro.region',$id); $this->db->where('ca.status',0); $query=$this->db->get(); return $query->result(); } public function partner_code($table,$id) { $this->db->select('*'); $this->db->from($table); $this->db->where('partner_code',$id); $query=$this->db->get(); return $query->result(); } public function table_truncate($table) { $this->db->from($table); $this->db->truncate(); } public function Get($keyword) { $this->db->distinct(); $this->db->select('product'); $this->db->order_by('product', 'DESC'); $this->db->like("product", $keyword); $this->db->from('product_list'); $query= $this->db->get(); return $query->result(); } public function GetRowlog($keyword) { $this->db->distinct(); $this->db->select('category'); $this->db->order_by('category', 'DESC'); $this->db->like("category", $keyword); $this->db->from('category'); $query= $this->db->get(); return $query->result(); } public function get_reg_news($reg) { $this->db->select('*'); $this->db->from('news ca'); $this->db->join('profile pro','ca.partner_code=pro.uid'); $this->db->where('pro.region',$reg,'ca.status',0); $query=$this->db->get(); return $query->result(); } public function outstanding_email() { $this->db->distinct(); $this->db->select('p.email'); $this->db->from('profile p'); $this->db->from('fin_outstanding f','f.partner_code=p.uid'); $query= $this->db->get(); return $query->result(); } public function overdue_email() { $this->db->distinct(); $this->db->select('p.email'); $this->db->from('profile p'); $this->db->from('fin_overdue f','f.partner_code=p.uid'); $query= $this->db->get(); return $query->result(); } public function cform_email() { $this->db->distinct(); $this->db->select('p.email'); $this->db->from('profile p'); $this->db->from('fin_cforms f','f.partner_code=p.uid'); $query= $this->db->get(); return $query->result(); } public function get_time($t) { $this->db->select('*'); $this->db->from($t); $this->db->order_by('createdate','desc'); $this->db->limit(1); $query=$this->db->get(); return $query->row(); } public function getdata($start,$limit,$sidx,$sord,$where,$table) { $this->db->select('*'); $this->db->limit($limit); $this->db->where($where); if($where != NULL) $this->db->where($where,NULL,FALSE); $this->db->order_by($sidx,$sord); $query = $this->db->get($table,$limit,$start); return $query->result(); } public function getdata_case_stories($start,$limit,$sidx,$sord,$where,$table) { $this->db->select('*'); $this->db->limit($limit); $this->db->where($where); $this->db->where($where); $this->db->order_by('case_id','DESC'); $query = $this->db->get($table); return $query->result(); } public function getdata2($start,$limit,$sidx,$sord,$where,$table,$id) { $this->db->select('*'); $this->db->limit($limit); $this->db->where($where); $this->db->where('partner_code',$id); if($where != NULL) $this->db->where($where,NULL,FALSE); $this->db->order_by($sidx,$sord); $query = $this->db->get($table,$limit,$start); return $query->result(); } public function partner_code1($table,$where,$id) { $this->db->select('*'); $this->db->from($table); $this->db->where('partner_code',$id); $this->db->where($where); $query=$this->db->get(); return $query->result(); } //version -2 public function get_wish_list_dataa($ids) { $this->db->select('*'); $this->db->from('product_details'); // $this->db->join('indent_add_indent', 'indent_add_indent.product_id = indent_product.id'); $this->db->where('product_details.id', $ids); $query = $this->db->get(); return $query->row(); } public function select_purchase_no($table) { $this->db->select('po_no'); $this->db->from($table); //$this->db->where('status',1); $this->db->order_by("id","desc"); //$this->db->limit('1'); $query = $this->db->get(); return $query->row(); } public function max_select_purchase_no($table) { $this->db->select('po_no,id,po_type'); $this->db->from($table); //$this->db->where('status',1); $this->db->order_by("id","desc"); $this->db->limit('1'); $query = $this->db->get(); return $query->row(); } public function fetch_normal_po($where) { $this->db->select('A.*,B.po_path as p_path,B.po_no,B.po_type'); $this->db->from('po_link A'); $this->db->join('product_po B','B.po_no = A.po_no'); $this->db->group_by('A.po_no'); $this->db->where('A.status','0'); $this->db->where('B.po_type','normal'); $this->db->where('B.user_id',$where); $where = '(A.approve_status = "DISAPPROVED" or A.approve_status = "UNAPPROVED")'; $this->db->where($where); $this->db->order_by("A.id","desc"); $query=$this->db->get(); return $query->result(); } public function fetch_special_po($where) { $this->db->select('A.*'); $this->db->from('signed_po A'); $this->db->where('A.status','0'); $this->db->where('A.user_id',$where); $this->db->where('A.po_type','special'); $where = '(A.approve_status = "DISAPPROVED" or A.approve_status = "UNAPPROVED")'; $this->db->where($where); $this->db->order_by("A.id","desc"); $query=$this->db->get(); return $query->result(); } public function fetch_normal_po_reg($region) { $this->db->select('A.*,B.po_path as p_path,B.po_no,B.po_type,B.region,B.po_date'); $this->db->from('po_link A'); $this->db->join('product_po B','B.po_no = A.po_no'); $this->db->group_by('A.po_no'); $this->db->where('A.status','0'); $this->db->where('B.region',$region); $this->db->where('B.po_type','normal'); $where = '(A.approve_status = "DISAPPROVED" or A.approve_status = "UNAPPROVED")'; $this->db->where($where); $this->db->order_by("A.id","desc"); $query=$this->db->get(); return $query->result(); } public function fetch_normal_approved_po($table,$where,$id) { $this->db->select('A.*,B.po_path as p_path,B.po_no,B.po_type'); $this->db->from('po_link A'); $this->db->join('product_po B','B.po_no = A.po_no'); $this->db->group_by('A.po_no'); $this->db->where('A.status','0'); $this->db->where('B.po_type','normal'); $this->db->where('B.user_id',$id); $this->db->where('A.approve_status','APPROVED'); $this->db->order_by("A.id","desc"); $query=$this->db->get(); return $query->result(); } public function fetch_normal_approved_po_reg($region) { $this->db->select('A.*,B.po_path as p_path,B.po_no,B.po_type,B.po_date'); $this->db->from('po_link A'); $this->db->join('product_po B','B.po_no = A.po_no'); $this->db->group_by('A.po_no'); $this->db->where('A.status','0'); $this->db->where('B.po_type','normal'); $this->db->where('B.region',$region); $this->db->where('A.approve_status','APPROVED'); $this->db->order_by("A.id","desc"); $query=$this->db->get(); return $query->result(); } public function fetch_special_approved_po($table,$where) { $this->db->select('A.*'); $this->db->from('signed_po A'); //$this->db->join('product_po B','B.po_no = A.po_no'); //$this->db->group_by('A.po_no'); $this->db->where('A.status','0'); $this->db->where('A.po_type','special'); $this->db->where('A.approve_status','APPROVED'); $this->db->order_by("A.id","desc"); $query=$this->db->get(); return $query->result(); } public function fetch_special_po_reg($region) { $this->db->select('A.*'); $this->db->from('signed_po A'); //$this->db->join('supervisor B','B.region = A.region'); $this->db->where('A.status','0'); $this->db->where('A.region',$region); $this->db->where('A.po_type','special'); $where = '(A.approve_status = "DISAPPROVED" or A.approve_status = "UNAPPROVED")'; $this->db->where($where); $this->db->order_by("A.id","desc"); $query=$this->db->get(); return $query->result(); } public function fetch_signed_po_reg($region) { $this->db->select('A.*'); $this->db->from('signed_po A'); $this->db->where('A.status','0'); $this->db->where('A.user_id',$region); $where = '(A.approve_status = "DISAPPROVED" or A.approve_status = "UNAPPROVED")'; $this->db->where($where); $this->db->order_by("A.id","desc"); $query=$this->db->get(); return $query->result(); } public function fetch_signed_po($id) { $this->db->select('A.*'); $this->db->from('signed_po A'); $this->db->where('A.status','0'); $this->db->where('A.user_id',$id); $where = '(A.approve_status = "SIGNED")'; $this->db->where($where); $this->db->order_by("A.id","desc"); $query=$this->db->get(); return $query->result(); } /* public function fetch_transferred_cancelled_po($id) { $this->db->select('A.*,B.po_path as p_path,B.po_no,B.transfer_status,B.po_type,B.user_id'); $this->db->from('po_link A'); $this->db->join('product_po B','B.po_no = A.po_no'); $this->db->group_by('A.po_no'); $this->db->where('A.status','0'); $this->db->where('B.user_id',$id); $where = '(B.transfer_status = "PENDING")'; $this->db->where($where); $this->db->order_by("A.id","desc"); $query=$this->db->get(); return $query->result(); }*/ public function fetch_pending_po($ids) { $this->db->select('A.*,B.po_no'); $this->db->from('po_link A'); $this->db->join('product_po B','B.po_no = A.po_no'); $where = '(B.transfer_status = "PENDING")'; $this->db->where($where); $this->db->where('A.po_no',$ids); $query=$this->db->get(); return $query->row(); } public function get_pending_po($id) { $this->db->select('A.po_no,A.po_path,B.po_no,B.po_type,B.transfer_status'); $this->db->from('po_link A'); $this->db->join('product_po B','B.po_no = A.po_no'); $this->db->where('B.user_id',$id); $this->db->where('B.transfer_status','PENDING'); $this->db->group_by('B.po_no'); $this->db->order_by('A.id','desc'); $query=$this->db->get(); return $query->result(); } public function get_all_disctinct_data($table) { $this->db->distinct(); $this->db->select('*'); $this->db->from($table); $this->db->group_by('category'); $query=$this->db->get(); return $query->result(); } public function fetch_special_approved_po_reg($region) { $this->db->select('A.*'); $this->db->from('signed_po A'); //$this->db->join('supervisor B','B.region = A.region'); $this->db->where('A.status','0'); $this->db->where('A.region',$region); $this->db->where('A.po_type','special'); $where = '(A.approve_status = "APPROVED")'; $this->db->where($where); $this->db->order_by("A.id","desc"); $query=$this->db->get(); return $query->result(); } public function fetch_pending_po_reg($region) { $this->db->select('A.po_no,A.po_path,A.created_at,B.id,B.po_no,B.po_type,B.transfer_status,B.region'); $this->db->from('po_link A'); $this->db->join('product_po B','B.po_no = A.po_no'); $this->db->where('B.transfer_status','PENDING'); $this->db->where('B.region',$region); $this->db->group_by('B.po_no'); $this->db->order_by('B.id','desc'); $query=$this->db->get(); return $query->result(); } public function fetch_transferred_po_reg($region) { $this->db->select('A.po_no,A.po_path,A.created_at,B.po_no,B.po_type,B.transfer_status,B.region'); $this->db->from('po_link A'); $this->db->join('product_po B','B.po_no = A.po_no'); $this->db->where('B.region',$region); $this->db->where('B.transfer_status','TRANSFERRED'); $this->db->group_by('B.po_no'); $this->db->order_by('B.id','desc'); $query=$this->db->get(); return $query->result(); } /* public function fetch_pending_po_reg($region) { $this->db->select('A.*'); $this->db->from('product_po A'); //$this->db->join('supervisor B','B.region = A.region'); $this->db->where('A.status','0'); $this->db->where('A.region',$region); //$this->db->where('A.po_type','special'); $where = '(A.transfer_status = "PENDING")'; $this->db->where($where); $this->db->order_by("A.id","desc"); $query=$this->db->get(); return $query->result(); } */ public function get_transferred_po($id) { $this->db->select('A.po_no,A.po_path,B.po_no,B.po_type,B.transfer_status'); $this->db->from('po_link A'); $this->db->join('product_po B','B.po_no = A.po_no'); $this->db->where('B.user_id',$id); $this->db->where('B.transfer_status','TRANSFERRED'); $this->db->group_by('B.po_no'); $this->db->order_by('B.id','desc'); $query=$this->db->get(); return $query->result(); } public function view_pending_po_reg($region) { $this->db->select('A.po_no,A.po_path,A.created_at,B.po_no,B.po_type,B.transfer_status,B.region'); $this->db->from('po_link A'); $this->db->join('product_po B','B.po_no = A.po_no'); $this->db->where('B.transfer_status','PENDING'); $this->db->where('B.region',$region); $this->db->group_by('B.po_no'); $query=$this->db->get(); return $query->row(); } public function get_all_normal_approved_po_data() { $this->db->select('A.po_no,A.po_path,A.created_at,B.id,B.po_no,B.po_type,B.transfer_status,B.region,B.approve_status'); $this->db->from('po_link A'); $this->db->join('product_po B','B.po_no = A.po_no'); $this->db->where('B.po_type','normal'); $this->db->where('B.approve_status','APPROVED'); $this->db->group_by('B.po_no'); $this->db->order_by('B.id','desc'); $query=$this->db->get(); return $query->result(); } public function get_all_special_po_data() { $this->db->select('A.*'); $this->db->from('signed_po A'); $this->db->where('A.status','0'); $this->db->where('A.po_type','special'); $this->db->where('A.approve_status !=','APPROVED'); $this->db->group_by('A.po_no'); $this->db->order_by('A.id','desc'); $query=$this->db->get(); return $query->result(); } public function get_all_special_approved_po_data() { $this->db->select('A.*'); $this->db->from('signed_po A'); $this->db->where('A.status','0'); $this->db->where('A.po_type','special'); $this->db->where('A.approve_status','APPROVED'); $this->db->group_by('A.po_no'); $this->db->order_by('A.id','desc'); $query=$this->db->get(); return $query->result(); } public function get_all_pending_po_data() { $this->db->select('A.po_no,A.po_path,A.created_at,B.po_no,B.po_type,B.transfer_status,B.region'); $this->db->from('po_link A'); $this->db->join('product_po B','B.po_no = A.po_no'); $this->db->where('B.transfer_status','PENDING'); $this->db->group_by('B.po_no'); $this->db->order_by('A.id','desc'); $query=$this->db->get(); return $query->result(); } public function view_pending_po($ids) { $this->db->select('A.*,B.po_no'); $this->db->from('po_link A'); $this->db->join('product_po B','B.po_no = A.po_no'); $where = '(B.transfer_status = "PENDING")'; $this->db->where($where); $this->db->where('A.po_no',$ids); $query=$this->db->get(); return $query->row(); } public function get_all_transferred_po() { $this->db->select('A.*,B.po_no,B.po_type,B.transfer_status,'); $this->db->from('po_link A'); $this->db->join('product_po B','B.po_no = A.po_no'); $where = '(B.transfer_status = "TRANSFERRED")'; $this->db->where($where); $this->db->group_by('B.po_no'); $this->db->order_by('A.id','desc'); $query=$this->db->get(); return $query->result(); } public function get_signed_po() { $this->db->select('*'); $this->db->from('signed_po A'); $this->db->where('A.po_type =','signed'); $this->db->group_by('A.po_no'); $this->db->order_by('A.id','desc'); $query=$this->db->get(); return $query->result(); } public function view_signed_po($ids) { $this->db->select('A.*'); $this->db->from('signed_po A'); $this->db->where('A.id',$ids); $this->db->where('A.po_type =','signed'); $query=$this->db->get(); return $query->row(); } /* public function get_all_normal_po_data() { $this->db->select('A.po_no,A.po_path,A.created_at,B.id,B.po_no,B.po_type,B.transfer_status,B.region,B.approve_status'); $this->db->from('po_link A'); $this->db->join('product_po B','B.po_no = A.po_no'); $this->db->where('B.po_type','normal'); $this->db->where('B.approve_status !=','APPROVED'); $this->db->group_by('B.po_no'); $this->db->order_by('B.id','desc'); $query=$this->db->get(); return $query->result(); } */ public function get_all_normal_po_data() { $this->db->select('*'); $this->db->from('po_link A'); //$this->db->join('product_po B','B.po_no = A.po_no'); //$this->db->where('B.po_type','normal'); $this->db->where('A.approve_status !=','APPROVED'); //$this->db->group_by('B.po_no'); $this->db->order_by('A.id','desc'); $query=$this->db->get(); return $query->result(); } public function news_year() { $this->db->distinct(); $this->db->select('YEAR(createdate) year'); $this->db->from('news'); $query=$this->db->get(); return $query->result(); } public function get_opinions() { $this->db->select('*'); $this->db->from('feedback A'); $this->db->where('A.delete_status','ACTIVE'); $this->db->limit('1'); $this->db->order_by('A.id','DESC'); $query = $this->db->get(); $result = $query->result(); return $result; } public function get_feedback_count() { $this->db->select('*'); $this->db->from('feedback A'); $this->db->where('A.delete_status','ACTIVE'); $this->db->limit('1'); $this->db->order_by('A.id','DESC'); $query = $this->db->get(); $result = $query->result(); $array = array(); foreach($result as $res) { $options = json_decode($res->options); $id = $res->id; foreach($options as $key=>$opt) { $keys = $key+1; $this->db->select('*'); $this->db->from('feedback_count A'); $this->db->where('A.feedback_id',$id); $this->db->where('A.delete_status','ACTIVE'); $this->db->where('A.selected_option',$keys); $querys = $this->db->get(); $results = $querys->row(); if(!empty($results)) { $data['count'] = ($results->count)*10; } else { $data['count'] = 0; } array_push($array,$data); } } return $array; } public function drive_manual($table,$where) { //$this->db->distinct(); $this->db->select('*'); $this->db->from($table); $this->db->where($where); // $this->db->group_by('product_name'); $this->db->order_by('priority asc,createdate asc'); $query=$this->db->get(); return $query->result(); } public function get_accessed_softwares() { $id=$this->session->userdata('id'); $this->db->select('*'); $this->db->from('profile A'); $this->db->where('status','0'); $this->db->where('id',$id); $query = $this->db->get(); $result = $query->row(); if(!empty($result)) { $decoded_id = json_decode($result->software_access_status); $this->db->select('*'); $this->db->from('softwares B'); if(!empty($decoded_id)) { $this->db->where_in('id',$decoded_id); $query = $this->db->get(); $result1 = $query->result(); } $array = array(); if(!empty($result1)) { foreach($result1 as $res1) { $data['software'] = $res1->software; $data['description'] = $res1->description; $data['version'] = $res1->version; $data['document'] = $res1->document; $data['createdate'] = $res1->createdate; array_push($array,$data); } } } return $array; } public function get_where_selected_access_row($id) { $this->db->select('*'); $this->db->from('profile'); $this->db->where('id',$id); $query = $this->db->get(); $result = $query->row(); $array1 = array(); if(!empty($result)) { $data['access_status'] = $result->access_status; $data['downloads_access_status'] = $result->downloads_access_status; $data['technical_manuals_access'] = $result->technical_manuals_access; $data['case_notes_access'] = $result->case_notes_access; $data['appreciation_letters_access'] = $result->appreciation_letters_access; $data['application_notes_access'] = $result->application_notes_access; $data['technical_notes_access'] = $result->technical_notes_access; $data['training_presentations_access'] = $result->training_presentations_access; $data['projects_access'] = $result->projects_access; $data['others_access'] = $result->others_access; $data['in_projects_access'] = $result->in_projects_access; $data['in_others_access'] = $result->in_others_access; $data['information_access_status'] = $result->information_access_status; $data['financials_access_status'] = $result->financials_access_status; $data['po_generate_access_status'] = $result->po_generate_access_status; $data['software_access_status'] = $result->software_access_status; $decoded_id = json_decode($result->software_access_status); $this->db->select('*'); $this->db->from('softwares B'); if(!empty($decoded_id)) { $this->db->where_in('id',$decoded_id); } $query = $this->db->get(); $result1 = $query->result(); foreach($result1 as $res1) { $data1['sid'] = $res1->id; $data1['software'] = $res1->software; $data1['description'] = $res1->description; $data1['version'] = $res1->version; $data1['document'] = $res1->document; $data1['createdate'] = $res1->createdate; array_push($array1,$data1); } $decoded_pro_id = json_decode($result->in_projects_access); $this->db->select('*'); $this->db->from('projects B'); if(!empty($decoded_pro_id)) { $this->db->where_in('id',$decoded_pro_id); } $query = $this->db->get(); $result1 = $query->result(); foreach($result1 as $res1) { $data1['pid'] = $res1->id; $data1['product'] = $res1->product; $data1['description'] = $res1->description; $data1['customer'] = $res1->customer; $data1['application'] = $res1->application; $data1['segment'] = $res1->segment; $data1['document'] = $res1->document; $data1['createdate'] = $res1->createdate; array_push($array1,$data1); } $decoded_other_id = json_decode($result->in_others_access); $this->db->select('*'); $this->db->from('others B'); if(!empty($decoded_other_id)) { $this->db->where_in('id',$decoded_other_id); } $query = $this->db->get(); $result1 = $query->result(); foreach($result1 as $res1) { $data1['oid'] = $res1->id; $data1['document_name'] = $res1->document_name; $data1['document'] = $res1->document; $data1['createdate'] = $res1->createdate; array_push($array1,$data1); } $data['about_software'] = $array1; } return $data; } public function get_accessed_projects() { $id=$this->session->userdata('id'); $this->db->select('*'); $this->db->from('profile A'); $this->db->where('status','0'); $this->db->where('id',$id); $query = $this->db->get(); $result = $query->row(); if(!empty($result) && $result->projects_access == 'YES') { $decoded_id = json_decode($result->in_projects_access); $this->db->select('*'); $this->db->from('projects B'); //if(!empty($decoded_id)) // { // $this->db->where_in('id',$decoded_id); $query = $this->db->get(); $result1 = $query->result(); // } $array = array(); if(!empty($result1)) { foreach($result1 as $res1) { $data['customer'] = $res1->customer; $data['description'] = $res1->description; $data['product'] = $res1->product; $data['application'] = $res1->application; $data['segment'] = $res1->segment; $data['createdate'] = $res1->createdate; $data['document'] = $res1->document; $data['report'] = $res1->report; array_push($array,$data); } } } return $array; } public function get_accessed_others() { $id=$this->session->userdata('id'); $this->db->select('*'); $this->db->from('profile A'); $this->db->where('status','0'); $this->db->where('id',$id); $query = $this->db->get(); $result = $query->row(); if(!empty($result)) { $decoded_id = json_decode($result->in_others_access); $this->db->select('*'); $this->db->from('others B'); if(!empty($decoded_id)) { $this->db->where_in('id',$decoded_id); $query = $this->db->get(); $result1 = $query->result(); } $array = array(); if(!empty($result1)) { foreach($result1 as $res1) { $data['document_name'] = $res1->document_name; $data['document'] = $res1->document; $data['createdate'] = $res1->createdate; array_push($array,$data); } } } return $array; } }