logger->info('Dash extends Users_Controller contructor');
if (!isset($_SESSION['username']) or $_SESSION['username'] == '') {
redirect(home);
}
}
public function help(){
$data = $this->getSessionArray();
$data['page_title'] ="Help";
$this->renderSecurePage('users/view_help', $data);
}
public function index() {
$data['username'] = $_SESSION['username']; // = $this->input->post('username');
$data['name'] = $_SESSION['name']; // = $this->input->post('username');
$data['firstname'] = $_SESSION['firstname']; // = $ret->firstname;
$data['lastname'] = $_SESSION['lastname']; // = $ret->lastname;
$data['email'] = $_SESSION['email']; // = $ret->email;
$data['member_id'] = $_SESSION['member_id']; // = $ret->email;
// print_r($_SESSION);
//Array ( [__ci_last_regenerate] => 1474689025 [username] => ses66181+1@gmail.com [name] => ses66181+1@gmail.com [firstname] => Olusesan [lastname] => Amey [email] => ses66181+1@gmail.com )
if (!isset($_SESSION['username']) or $_SESSION['username'] == '') {
redirect(home);
} else {
// load the Dash model now
$this->load->model('coupon_model');
$activeCouponResult = $this->coupon_model->loadMemberActiveCoupons($_SESSION['member_id'] ,$fliters=[]);
$_SESSION['coupon'] = $activeCouponResult->num_rows();
// print_r($_SESSION);
$this->load->model('dash_model');
$out = $this->dash_model->getDashData($data);
$data = $this->getSessionArray();
// print_r($out[0]);
$data['active_task'] = $out['active_task'];
$data['active_pass_due'] = $out['active_pass_due'];
$data['current_balance'] = $out['current_balance'];
$data['new_message'] = $out['new_message'];
$data['total_jobs'] = $out['total_jobs'];
$data['offer_dash'] = '';
// Review to another location
$mysql = "SELECT to_char(mi.added, 'YYYY-MM-DD HH24:MI') AS added,jo.offer_code,mjs.title,"
. "m.firstname||' '||m.lastname AS Client "
. "FROM members_offer_interest mi "
. "LEFT JOIN members m ON m.id = mi.member_id "
. "LEFT JOIN members_jobs_offer jo ON jo.id=mi.offer_id "
. "LEFT JOIN members_jobs mjs ON mjs.id=jo.job_id "
. "WHERE jo.member_id =" . $_SESSION['member_id'] . " "
. "AND mi.status=1 AND jo.expire> now() + '-3 days' ORDER BY mi.added ASC";
$query = $this->db->query($mysql);
$data["offer_interest_count"] = $query->num_rows();
$_SESSION['offer_interest_count'] = $data["offer_interest_count"];
$mysql = "SELECT 'Project ID:'||mc.contract||'
Title:'||mc.title AS Project,m.firstname||' '||m.lastname AS Client,"
. " 'Timeline: '||mc.timeline_days||' day(s)
Price:'||mc.price*0.01 ,mc.description, "
. " (CASE WHEN mc.status = 1 AND mc.delivery_date > now() THEN 'Active' WHEN mc.status = 1 AND mc.delivery_date db->query($mysql);
$data["past_duejobs_count"] = $query->num_rows();
$_SESSION['past_duejobs_count'] = $data["past_duejobs_count"];
//======================= move it
/* Table Slider Data */
/* $jbx = "''/proj/thisjob''";
$mysql = "SELECT 'ID:'||mc.contract||'
Timeline:'||mc.timeline_days||' day(s)
Price:'||mc.price*0.01 AS Project,"
. " 'Title: '||mc.title||'
Description: '||mc.description AS description,"
. " (CASE WHEN mc.status=4 THEN '' "
. " WHEN mc.status = 1 AND mc.delivery_date > now() THEN '' "
. " WHEN mc.status = 1 AND mc.delivery_date PastDue' "
. " ELSE '' END) AS manage "
. " FROM members_jobs_contract mc LEFT JOIN members m ON m.id=mc.client_id "
. " WHERE mc.member_id = " . $_SESSION['member_id'] . " AND mc.status IN (1,2,4) AND mc.delivery_date > now() "
. " OR mc.client_id =" . $_SESSION['member_id'] . " AND mc.status IN (1,2,4) AND mc.delivery_date > now() LIMIT 4";
$query = $this->db->query($mysql);
$this->load->library('table');
$this->table->set_template($this->template);
$this->table->set_heading(array('data' => 'Job', 'style' => 'width:180px'), 'Title/Description', array('data' => '', 'style' => 'width:100px; cellpadding:0px;'));
$data['job_table'] = $this->table->generate($query);
$data['job_table_result'] = $query->result(); // used in new impl.
*/
$x = $this->dashTaskMessage();
$data['job_message_table'] = $x['job_message_table'];
$data['job_message_table_result'] = $x['job_message_table_result'];
$data['message_found'] = $x['message_found'];
/// End table data ===========================
$acp = array();
$acp = $this->activeProjects();
$data['job_table'] = $acp['job_table'];
$data['job_table_result'] = $acp['job_table_result'];
$ya = array();
$ya = $this->dash_title( 4 );
$data["dash_title"] = $ya["dash_title"];
$data["offer_dash"] = $ya["offer_dash"];
$data["offer_dash_result"] = $ya["offer_dash_result"];
$data["offer_found"] = $ya["offer_found"];
$_SESSION['secure_data'] = $data; // all data needed for secure page
//var_dump( $_SESSION);
//exit;
$data['page_title'] ="Dashboard";
$this->renderSecurePage('users/view_dash', $data);
}
}
private function dashTaskMessage() {
$data = array();
$jbx = "''/proj/thisjob''";
$mysql = " SELECT s.created::date ||'
'||j.contract AS date_contract,j.title AS title,substring(s.message,0,90) as title_message,'\/proj\/thisjob' AS qpath,j.id AS offer_code,"
. " '' "
. " FROM members_jobs_contract j "
. " RIGHT JOIN jobs_contract_message s ON s.contract=j.contract "
. " WHERE j.member_id=" . $_SESSION['member_id'] . " AND j.delivery_date IS NOT NULL AND j.delivery_date > now() OR j.client_id = " . $_SESSION['member_id'] . " AND j.status IN (1,4) AND j.delivery_date IS NOT NULL AND j.delivery_date > now() LIMIT 5";
$query = $this->db->query($mysql);
$this->load->library('table');
$this->table->set_template($this->template);
$this->table->set_heading(array('data' => 'Date', 'style' => 'width:180px'), 'Title/Message', array('data' => '', 'style' => 'width:100px; cellpadding:0px;'));
$data['job_message_table'] = $this->table->generate($query);
$data['job_message_table_result'] = $query->result(); // used in new impl.
$data['message_found'] = true;
return $data;
}
private function dash_title($listLimit) {
$offer_found = false;
$data = array();
$data['offer_dash'] = $data['offer_dash_result'] ='';
$this->load->library('table');
$this->table->set_template($this->template);
$jbx = "''/jobs/viewjob''";
$mysql = "SELECT jo.added::date AS pdate, jo.added::date AS start_job_date , jo.expire::date AS end_job_date, j.title,(CASE WHEN jo.public_view > 0 THEN '-Public View' ELSE jo.email END) AS tRec,'\/jobs\/viewjob' AS qpath,"
. 'CASE WHEN jo.status = 1 AND jo.public_view =0 THEN \'Pending\' WHEN jo.status = 1 AND jo.public_view >0 THEN \'Active\' ELSE \'Other\' END AS status,'
. "'' AS View ,jo.offer_code AS offer_code "
. "FROM members_jobs_offer jo LEFT JOIN members_jobs j ON j.id = jo.job_id "
. "WHERE jo.expire > now() AND jo.status = 1 "
. "AND jo.client_id = " . $_SESSION['member_id'] . " LIMIT $listLimit";
$query = $this->db->query($mysql);
$num = $query->num_rows();
$data["dash_title"] = "Pending Offer(s)";
if ($num > 0) {
// array('data' => 'Added', 'style' => 'width:80px')
$this->table->set_heading(array('data' => 'Added', 'style' => 'width:80px'), 'Title', array('data' => '', 'style' => 'width:80px'));
$data['offer_dash'] = $this->table->generate($query);
$data['offer_dash_result'] = $query->result();
$offer_found = true;
} else {
$data["offer_dash"] = "";
}
if ($offer_found == false) {
$data["dash_title"] = "Active Offer(s)";
$jbx = "''/jobs/viewmyjob''";
$mysql = "SELECT jo.added::date||'
'||jo.expire::date AS pdate, jo.added::date AS start_job_date , jo.expire::date AS end_job_date, j.title, (CASE WHEN jo.public_view > 0 THEN '-Public View' ELSE jo.email END) AS tRec,'\/jobs\/viewmyjob' AS qpath,"
. 'CASE WHEN jo.status = 1 AND jo.public_view =0 THEN \'Pending\' WHEN jo.status = 1 AND jo.public_view >0 THEN \'Active\' ELSE \'Other\' END AS status,'
. "'' AS View,jo.offer_code AS offer_code "
. "FROM members_jobs_offer jo LEFT JOIN members_jobs j ON j.id = jo.job_id "
. "WHERE jo.expire > now() AND jo.status = 1 "
. "AND jo.member_id = " . $_SESSION['member_id'] . " ORDER BY jo.id DESC LIMIT $listLimit";
$query = $this->db->query($mysql);
$num = $query->num_rows();
if ($num > 0) {
// array('data' => 'Status', 'style' => 'width:150px')
//array('data' => 'Added', 'style' => 'width:150px')
//array('data' => 'Added', 'style' => 'width:150px')
$this->table->set_heading(array('data' => 'Added/Expire', 'style' => 'width:120px'), 'Title/Recipient', array('data' => 'Status', 'style' => 'width:100px'), array('data' => '', 'style' => 'width:100px'));
$data['offer_dash'] = $this->table->generate($query);
$data['offer_dash_result'] = $query->result();
$offer_found = true;
}
}
$data["offer_found"] = $offer_found;
return $data;
}
public function howitworks() {
$data = $this->getSessionArray();
$data['page_key'] = 'WRB_MAIN_HOWIT_WORK';
$data['txt_detail'] = $this->readFixedText($data['page_key']);
$data['txt_detail'] = str_replace("[how-it-worked-image-1]", "
", $data['txt_detail']);
$data['txt_detail'] = str_replace("[how-it-worked-image-2]", "
", $data['txt_detail']);
$data['page_title'] = "How it Works";
$this->load->view('users/view_header_user', $data);
$this->load->view('users/view_howitworks', $data);
$this->load->view('users/view_footer_user', $data);
//echo "here-here";
}
public function howfindwork() {
$data = $this->getSessionArray();
$data['page_key'] = 'WRB_MAIN_HOWIT_WORK';
$data['txt_detail'] = $this->readFixedText($data['page_key']);
$data['txt_detail'] = str_replace("[how-it-worked-image-1]", "
", $data['txt_detail']);
$data['txt_detail'] = str_replace("[how-it-worked-image-2]", "
", $data['txt_detail']);
$data['page_title'] = "How to find Job";
$this->load->view('users/view_header_user', $data);
$this->load->view('users/view_howfindjob', $data);
$this->load->view('users/view_footer_user', $data);
//echo "here-here";
}
public function howpostjob() {
$data = $this->getSessionArray();
$data['page_key'] = 'WRB_MAIN_HOWIT_WORK';
$data['txt_detail'] = $this->readFixedText($data['page_key']);
$data['txt_detail'] = str_replace("[how-it-worked-image-1]", "
", $data['txt_detail']);
$data['txt_detail'] = str_replace("[how-it-worked-image-2]", "
", $data['txt_detail']);
$data['page_title'] = "How to Post Job";
$this->load->view('users/view_header_user', $data);
$this->load->view('users/view_howpostjob', $data);
$this->load->view('users/view_footer_user', $data);
//echo "here-here";
}
}