"", 'thead_open' => '', 'thead_close' => '', 'heading_row_start' => '', 'heading_row_end' => '', 'heading_cell_start' => '', 'tbody_open' => '', 'tbody_close' => '', 'row_start' => '', 'row_end' => '', 'cell_start' => '', 'row_alt_start' => '', 'row_alt_end' => '', 'cell_alt_start' => '', 'table_close' => '
', 'heading_cell_end' => '
', 'cell_end' => '
', 'cell_alt_end' => '
' ); public $data = array(); function __construct() { parent::__construct(); if (!isset($_SESSION['bko_selected_id']) or $_SESSION['bko_selected_id'] == '' or $_SESSION['bko_selected_id'] <= 0 ) { redirect('/bkouser/locate'); } } // protected protected function bkoUserDashData($member_id) { $this->load->model('backend_model'); $is_live = $this->backend_model->cfgReadChar("system.live"); $data = array(); $this->load->library('table'); $this->table->set_template($this->template); $short_limit = 10; // MY JOBS $mysql = "SELECT created,title FROM members_jobs WHERE member_id = $member_id ORDER BY id DESC limit $short_limit"; $query = $this->db->query($mysql); $this->table->set_heading(array('data' => 'Date', 'style' => 'width:110px'), 'Title'); $data['member_job_table'] = $this->table->generate($query); // MY CONTRACTS $mysql = "SELECT created,title,status,client_id FROM members_jobs_contract WHERE member_id = $member_id ORDER BY id DESC LIMIT $short_limit"; $query = $this->db->query($mysql); $this->table->set_heading(array('data' => 'Date', 'style' => 'width:110px'), 'Title', array('data' => 'ST', 'style' => 'width:40px'), 'client'); $data['member_contract_table'] = $this->table->generate($query); // Jobs Messages $sqlMsg = " SELECT j.created, (CASE WHEN j.msg_type='FILE' THEN ''||j.message||'' " . " ELSE '['||m.firstname||'-'||m.username||']->'||j.created||'
'||j.message END) as msg " . " FROM jobs_contract_message j LEFT JOIN members m ON m.id=j.member_id " . " WHERE j.member_id = $member_id ORDER BY j.id DESC LIMIT $short_limit"; $query_message = $this->db->query($sqlMsg); //$this->table->set_heading(''); $this->table->set_heading(array('data' => 'Added', 'style' => 'width:110px'), 'Activity Message'); $data['message_dash_table'] = $this->table->generate($query_message); // Active Jobs $mysql = "SELECT ''||mj.contract||'
'||mo.title AS thejob,'Owner: '||m1.firstname||' '||m1.lastname||'
'|| m1.email||'
Client: '||m2.firstname||' '||m2.lastname||'
'|| m2.email AS Team1 " . "FROM members_jobs_contract mj " . "LEFT JOIN members_jobs mo ON mo.id=mj.job_id " . "LEFT JOIN members m1 ON m1.id=mj.member_id " . "LEFT JOIN members m2 ON m2.id=mj.client_id " . "WHERE mj.status IN (1,2) AND mj.delivery_date > now() AND mj.member_id = $member_id ORDER by mj.id DESC LIMIT $short_limit "; $query = $this->db->query($mysql); $this->table->set_heading('Task', array('data' => 'Members', 'style' => 'width:150px')); $data['job_active_dash_table'] = $this->table->generate($query); // PAST DUE JOBS $mysql = "SELECT ''||mj.contract||'
'||mo.title AS thejob,'Owner: '||m1.firstname||' '||m1.lastname||'
'|| m1.email||'
Client: '||m2.firstname||' '||m2.lastname||'
'|| m2.email AS Team1 " . "FROM members_jobs_contract mj " . "LEFT JOIN members_jobs mo ON mo.id=mj.job_id " . "LEFT JOIN members m1 ON m1.id=mj.member_id " . "LEFT JOIN members m2 ON m2.id=mj.client_id " . "WHERE mj.status IN (1,2) AND mj.delivery_date < now() AND mj.member_id = $member_id ORDER by mj.id DESC LIMIT $short_limit "; $query = $this->db->query($mysql); $this->table->set_heading('Task', array('data' => 'Members', 'style' => 'width:150px')); $data['job_pastdue_dash_table'] = $this->table->generate($query); $jbx = ""; $mysql = "SELECT 'ADDED:'||added::date||'
EXPIRE:'||expire::date As Dates,username||'
Name:'||firstname||' '||lastname AS signup," . " (CASE WHEN status=1 THEN '
' ELSE ' ' END) AS action ," . " (CASE WHEN status=1 THEN '
' ELSE ' ' END) AS Del " . " FROM members_pending WHERE expire> now() AND status = 1" . " ORDER BY id desc limit 5"; $query = $this->db->query($mysql); // $this->table->set_heading('Dates', 'Username', 'Name', 'Action'); $this->table->set_heading(array('data' => 'Date', 'style' => 'width:180px'), 'Email/Name', array('data' => 'RES', 'style' => 'width:40px; cellpadding:0px;'), array('data' => 'Del', 'style' => 'width:40px; cellpadding:0px;')); $data['pending_dash_table'] = $this->table->generate($query); $this->table->set_template($this->template); $mysql = "SElECT added::date||'
'||loc AS dates,email||'
'||firstname||' '||lastname AS Name FROM members ORDER BY id DESC LIMIT 7"; $query = $this->db->query($mysql); // $this->table->set_heading('Account', 'Created', 'Action'); $this->table->set_heading(array('data' => 'Date/LOC', 'style' => 'width:140px'), 'Email/Name'); $data['signup_dash_table'] = $this->table->generate($query); $mysql = "SELECT 'Added: '||m.added::date ||'
Amount: '||m.terminatingamount*0.01||'
Fee: '|| m.fee*0.01 as trans, " . "r.firstname||' '||r.lastname||'
Acc:'||r.account_no||'-'||b.name||'
Confirm: '||mp.confirmation AS Recitient," . "CASE WHEN m.status=1 THEN 'Pending' WHEN m.status=3 THEN 'Cancelled' WHEN m.status=5 THEN 'Completed' ELSE '' END AS Status " . "FROM money_transfer m " . "LEFT JOIN sendmoney_recipient r ON r.id = m.recipientid " . "LEFT JOIN bank_entity_codes b ON b.code = r.bank_code " . "LEFT JOIN members_payments mp ON mp.what_sendmoney = m.id " . "WHERE mp.confirmation IS NOT NULL ORDER BY m.id DESC LIMIT 4"; $query = $this->db->query($mysql); $this->table->set_heading('Trans', 'Target', 'Status'); $data['sendmoney_dash_table'] = $this->table->generate($query); $mysql = "SELECT created,'From: '||email||'
'|| ( CASE WHEN status=1 THEn '' ELSE '' END )||'
'||your_message AS your_message " . " FROM contacts order by id desc lIMIT 6"; $query = $this->db->query($mysql); $this->table->set_heading(array('data' => 'Added', 'style' => 'width:110px'), 'Message'); $data['contact_dash_table'] = $this->table->generate($query); $data['members_dash_online'] = 0; $data['total_members'] = 0; $data['total_balance'] = 0; $data['total_active_jobs'] = 0; $mysql = "SELECT count(id) AS total_members FROM members WHERE status =1"; $query = $this->db->query($mysql); $row = $query->row_array(); $data['total_members'] = $row['total_members']; $mysql = "SELECT sum(balance)AS total_balance FROM members WHERE status =1"; $query = $this->db->query($mysql); $row = $query->row_array(); $data['total_balance'] = $row['total_balance']; $mysql = "SELECT count(id) AS total_active_jobs FROM members_jobs_contract WHERE status IN (1,2)"; $query = $this->db->query($mysql); $row = $query->row_array(); $data['total_active_jobs'] = $row['total_active_jobs']; return $data; } }