1144 lines
50 KiB
PHP
1144 lines
50 KiB
PHP
<?php
|
|
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class Member extends Users_Controller {
|
|
|
|
|
|
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;
|
|
// 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 {
|
|
|
|
// $this->load->view('users/view_header_user', $data);
|
|
// $this->load->view('users/view_dash', $data);
|
|
// $this->load->view('users/view_footer_user', $data);
|
|
redirect(dash);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function addreccipient() {
|
|
|
|
$data = $this->getSessionArray();
|
|
$data['firstname'] = $data['lastname'] = $data['account_no'] = $data['account_no_repeat'] = '';
|
|
$data['state'] = $data['city'] = '';
|
|
$data['add_error'] = '';
|
|
|
|
|
|
// $this->load->model('country_model');
|
|
$data["status"] = 1;
|
|
// $out = $this->country_model->loadCountry($data);
|
|
// print_r($out);
|
|
|
|
|
|
|
|
$data['country'] = $this->input->post('country');
|
|
$data['banks'] = $this->input->post('banks');
|
|
$data['account_type'] = $this->input->post('account_type');
|
|
|
|
|
|
$this->load->model('combo_model');
|
|
$data['country_combo'] = $this->combo_model->getCountryCombo('country', $data['country']);
|
|
$data['bank_combo'] = $this->combo_model->getBankCombo('banks', $data['banks']);
|
|
$data['account_type_combo'] = $this->combo_model->getAccountTypeCombo('account_type', $data['account_type']);
|
|
|
|
|
|
if ($_POST) {
|
|
|
|
$data['firstname'] = $this->input->post('firstname');
|
|
$data['lastname'] = $this->input->post('lastname');
|
|
$data['account_no'] = $this->input->post('account_no');
|
|
$data['account_no_repeat'] = $this->input->post('account_no_repeat');
|
|
$data['state'] = $this->input->post('state');
|
|
$data['city'] = $this->input->post('city');
|
|
|
|
// now let us verify the data
|
|
$this->load->model('recipient_model');
|
|
$out = $this->recipient_model->verifyNewRecipientInfo($data, $_SESSION['member_id']);
|
|
|
|
if ($out['error_state'] == true) {
|
|
$data['add_error'] = "<div class=\"text-left\"><div class=\"alert alert-danger no-border\">" . $out['error'] . "</div></div>";
|
|
} else {
|
|
$in = array();
|
|
$outx = array();
|
|
// $this->load->model('backend_model');
|
|
$in['action'] = WRENCHBOARD_SMONEY_ADDRECIPIENT;
|
|
|
|
$in['member_id'] = $_SESSION['member_id'];
|
|
$in['bank_code'] = $data['banks'];
|
|
$in['firstname'] = $data['firstname'];
|
|
$in['lastname'] = $data['lastname'];
|
|
$in['account_no'] = $data['account_no'];
|
|
$in['account_type'] = $data['account_type'];
|
|
$in['country'] = $data['country'];
|
|
$in['city'] = $data['city'];
|
|
$in['state'] = $data['state'];
|
|
|
|
$outx['error'] = '';
|
|
$recipient_id = $this->wrenchboard_api($in, $outx);
|
|
if ($recipient_id > 0) {
|
|
redirect('/member/recipient');
|
|
} else {
|
|
$data['job_message'] = 'Unable to create recipient...';
|
|
$data['add_error'] = "<div class=\"text-left\"><div class=\"alert alert-danger no-border\">" . $outx['error'] . "</div></div>";
|
|
}
|
|
}
|
|
// print_r($out);
|
|
}
|
|
|
|
|
|
//getBankCombo
|
|
/*
|
|
*
|
|
*
|
|
* wrenchboard=> \d sendmoney_recipient
|
|
Table "public.sendmoney_recipient"
|
|
Column | Type | Modifiers
|
|
--------------+-----------------------------+------------------------------------------------------------------
|
|
id | integer | not null default nextval('sendmoney_recipient_id_seq'::regclass)
|
|
member_id | integer |
|
|
bank_code | character varying(3) |
|
|
firstname | character varying(50) | not null
|
|
lastname | character varying(50) | not null
|
|
account_no | character varying(20) | not null
|
|
added | timestamp without time zone | default now()
|
|
updated | timestamp without time zone | default now()
|
|
status | integer | default 1
|
|
account_type | integer | default 20
|
|
Indexes:
|
|
"sendmoney_recipient_id_key" UNIQUE CONSTRAINT, btree (id)
|
|
Foreign-key constraints:
|
|
"sendmoney_recipient_member_id_fkey" FOREIGN KEY (member_id) REFERENCES members(id)
|
|
Referenced by:
|
|
TABLE "money_transfer" CONSTRAINT "money_transfer_recipientid_fkey" FOREIGN KEY (recipientid) REFERENCES sendmoney_recipient(id)
|
|
|
|
wrenchboard=>
|
|
|
|
* $options = array(
|
|
'small' => 'Small Shirt',
|
|
'med' => 'Medium Shirt',
|
|
'large' => 'Large Shirt',
|
|
'xlarge' => 'Extra Large Shirt',
|
|
);
|
|
|
|
$shirts_on_sale = array('small', 'large');
|
|
echo form_dropdown('shirts', $options, 'large');
|
|
|
|
*/
|
|
|
|
//print_r($out);
|
|
//stdClass Object ( [id] => 146 [code] => NG [country] => Nigeria [phone_code] => 234 [allow] => 2017-01-08 10:30:42.259079-05 [status] => 1 [created] => 2017-01-08 10:30:15.087696 [updated] => 2017-01-08 10:30:15.087696 )
|
|
|
|
|
|
$this->load->view('users/view_header_user', $data);
|
|
$this->load->view('users/view_addrecipient', $data);
|
|
$this->load->view('users/view_footer_user', $data);
|
|
}
|
|
|
|
public function paypal()
|
|
{
|
|
|
|
|
|
global $wrenchboard;
|
|
|
|
|
|
$amount = 20;
|
|
|
|
$this->load->model('backend_model');
|
|
$is_live = $this->backend_model->cfgReadChar("system.live");
|
|
|
|
|
|
$business = $this->backend_model->cfgReadChar("Paypal.business");
|
|
$no_shipping = $this->backend_model->cfgReadChar("Paypal.no_shipping");
|
|
$returnv = $this->backend_model->cfgReadChar("Paypal.return");
|
|
$cancel_return = $this->backend_model->cfgReadChar("Paypal.cancel_return");
|
|
$no_note = $this->backend_model->cfgReadChar("Paypal.no_note");
|
|
$currency_code = $this->backend_model->cfgReadChar("Paypal.currency_code");
|
|
$lc = $this->backend_model->cfgReadChar("Paypal.lc");
|
|
$bn = $this->backend_model->cfgReadChar("Paypal.bn");
|
|
$url = $this->backend_model->cfgReadChar("Paypal.url");
|
|
|
|
|
|
|
|
|
|
$item_number = rand(1000,9999)."ADDDD";
|
|
|
|
$amount= $data['amount'] = trim($this->input->post('D1'));
|
|
|
|
|
|
if ($_POST) {
|
|
|
|
$ITEM_SERVICE = "Reload my Account";
|
|
$item_name = $ITEM_SERVICE . sprintf("%.2f", $amount);
|
|
//$url = "https://www.paypal.com/cgi-bin/webscr";
|
|
//$url = "https://www.sandbox.paypal.com/cgi-bin/webscr";
|
|
$url.= "?cmd=_xclick";
|
|
$url.= "&business=" . $business;
|
|
$url.= "&item_name=" . $item_name;
|
|
$url.= "&item_number=" . $item_number;
|
|
$url.= "&amount=" . sprintf("%.2f", $amount);
|
|
$url.= "&no_shipping=" . $no_shipping;
|
|
//$url.= "&return=https://".$_SERVER["SERVER_NAME"]."/".$returnv."?item_id=".$item_number;
|
|
$url.= "&cancel_return=https://" . $_SERVER["SERVER_NAME"] . "" . $cancel_return . "?item_id=" . $item_number;
|
|
$url.= "&no_note=" . $no_note;
|
|
$url.= "¤cy_code=" . $currency_code;
|
|
$url.= "&lc=" . $lc;
|
|
$url.= "&bn=" . $bn;
|
|
$url.= "&HDRIMG=" . urlencode("https://" . $_SERVER["SERVER_NAME"] . "/images/peezy_paypal.gif");
|
|
header("Location: " . $url);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function profile() {
|
|
|
|
$data = $this->getSessionArray();
|
|
$this->load->model('country_model');
|
|
$data['state'] = $_SESSION['state'];
|
|
$data['city'] = $_SESSION['city'];
|
|
$data['country'] = $_SESSION['country'];
|
|
|
|
|
|
$data['save_message'] = '';
|
|
$data["status"] = 1;
|
|
|
|
if ($_POST) {
|
|
$data['firstname'] = trim($this->input->post('firstname'));
|
|
$data['lastname'] = trim($this->input->post('lastname'));
|
|
$data['country'] = trim($this->input->post('country'));
|
|
$data['email'] = trim($this->input->post('email'));
|
|
$data['state'] = trim($this->input->post('state'));
|
|
$data['city'] = trim($this->input->post('city'));
|
|
|
|
if ($data['firstname'] != '' && $data['lastname'] != '' && $data['country'] != '' && $data['email'] != '' && $data['state'] != '' && $data['city'] != '') {
|
|
|
|
$outx = array();
|
|
$this->load->model('backend_model');
|
|
$data['action'] = WRENCHBOARD_UPDATE_PROFILE;
|
|
$outx['error'] = '';
|
|
if ($this->wrenchboard_api($data, $outx) == PHP_API_OK) {
|
|
|
|
$data['save_message'] = "<div class=\"text-left\"><div class=\"alert alert-info no-border\">Profile Updated</div></div>";
|
|
} else {
|
|
$data['save_message'] = "<div class=\"text-left\"><div class=\"alert alert-danger no-border\">Unable to update profile</div></div>";
|
|
}
|
|
} else {
|
|
$data['save_message'] = "<div class=\"text-left\"><div class=\"alert alert-danger no-border\">All fields required</div></div>";
|
|
}
|
|
|
|
//print_r($data);
|
|
}
|
|
|
|
|
|
$this->load->model('combo_model');
|
|
$data['country_combo'] = $this->combo_model->getCountryCombo('country', $data['country']);
|
|
|
|
//$out = $this->country_model->loadCountry($data);
|
|
//print_r($out);
|
|
//stdClass Object ( [id] => 146 [code] => NG [country] => Nigeria [phone_code] => 234 [allow] => 2017-01-08 10:30:42.259079-05 [status] => 1 [created] => 2017-01-08 10:30:15.087696 [updated] => 2017-01-08 10:30:15.087696 )
|
|
|
|
|
|
$this->load->view('users/view_header_user', $data);
|
|
$this->load->view('users/view_profile', $data);
|
|
$this->load->view('users/view_footer_user', $data);
|
|
}
|
|
|
|
public function picture() {
|
|
global $wrenchboard;
|
|
|
|
$data = $this->getSessionArray();
|
|
$data["upload_message"] = "";
|
|
|
|
$this->load->model('backend_model');
|
|
$is_live = $this->backend_model->cfgReadChar("system.live");
|
|
$x_limit = $this->backend_model->cfgReadChar("system.profile_picture_width"); //650;
|
|
$y_limit = $this->backend_model->cfgReadChar("system.profile_picture_height"); //650;
|
|
$size_limit = $this->backend_model->cfgReadChar("system.profile_picture_size");
|
|
$target_dir = $this->backend_model->cfgReadChar("system.profile_picture");
|
|
$data["size_limit"] = $size_limit;
|
|
$uploadOk = 1;
|
|
// Check if image file is a actual image or fake image
|
|
if ($_SERVER["REQUEST_METHOD"] == 'POST') {
|
|
$target_file = $target_dir . '/' . $_SESSION["member_id"] . '.' . pathinfo(basename($_FILES["fileToUpload"]["name"]), PATHINFO_EXTENSION);
|
|
$imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION));
|
|
$check = @getimagesize($_FILES["fileToUpload"]["tmp_name"]);
|
|
if ($check !== false) {
|
|
$data["upload_message"] = ""; //"File is an image - " . $check["mime"] . ".";
|
|
if ($check[0] <= $x_limit && $check[1] <= $y_limit && $_FILES["fileToUpload"]["size"] <= $size_limit) {
|
|
$uploadOk = 1;
|
|
} else if ($_FILES["fileToUpload"]["size"] > $size_limit) {
|
|
$data["upload_message"] = "Image size is too large, your picture should be under " . sprintf("%0.01f", $size_limit / 1024.0) . "kB";
|
|
$uploadOk = 0;
|
|
} else {
|
|
$data["upload_message"] = "Image should be ${x_limit}x${y_limit} pixels or less, when your image is " . $check[0] . "x" . $check[1];
|
|
$uploadOk = 0;
|
|
}
|
|
if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") {
|
|
$data["upload_message"] = "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
|
|
$uploadOk = 0;
|
|
}
|
|
} else {
|
|
$data["upload_message"] = "File is not an image or upload failed.";
|
|
$uploadOk = 0;
|
|
}
|
|
if ($uploadOk) {
|
|
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
|
|
$q = "UPDATE members SET profile_pic='" . str_replace("'", "\\'", stripslashes(basename($target_file))) . "' WHERE id='" . $_SESSION["member_id"] . "'";
|
|
$query = $this->db->query($q);
|
|
$data["upload_message"] = "Image uploaded!";
|
|
$_SESSION["profile_picture"] = "../smedia/" . ($is_live ? "LIVE" : "TEST") . "/profile/" . basename($target_file);
|
|
}
|
|
}
|
|
}
|
|
$this->load->view('users/view_header_user', $data);
|
|
$this->load->view('users/view_picture', $data);
|
|
$this->load->view('users/view_footer_user', $data);
|
|
}
|
|
|
|
// <editor-fold defaultstate="collapsed" desc="your bank account">
|
|
|
|
/*
|
|
* List user bank accounts for payments
|
|
*/
|
|
|
|
public function recipient() {
|
|
|
|
$this->load->library('table');
|
|
$this->table->set_template($this->template);
|
|
$data = $this->getSessionArray();
|
|
|
|
$mysql = "select '<b>Bank: </b>'||b.name||'<br> <b>Account No: </b>'||r.account_no||'<br> <b>Name: </b>'||r.firstname||' '||r.lastname,r.added::date,"
|
|
. "'<div id=\"selected_acc'||r.id||'\"><input type=submit id=\"dacc'||r.id||'\" onclick=\"return delAccount('||id||')\" name=\"manage\" class=\"btn btn-warning btn-xs\" value=\"Del\"></div>' AS manage "
|
|
. "FROM sendmoney_recipient r LEFT JOIN bank_entity_codes b ON b.code=r.bank_code WHERE r.status = 1 AND r.member_id = " . $_SESSION['member_id'] . " ORDER BY b.name ASC";
|
|
|
|
$query = $this->db->query($mysql);
|
|
$this->table->set_heading('Account', array('data' => 'Added', 'style' => 'width:120px'), array('data' => 'Action', 'style' => 'width:100px'));
|
|
$data['recipient_table'] = $this->table->generate($query);
|
|
|
|
$this->load->view('users/view_header_user', $data);
|
|
$this->load->view('users/view_recipient', $data);
|
|
$this->load->view('users/view_footer_user', $data);
|
|
}
|
|
|
|
/*
|
|
* Delete account from back end by maeking status =0
|
|
* Email may be sent based on user preferences
|
|
* Pay attention to pening transactions when del is called
|
|
*/
|
|
|
|
public function recipprocess() {
|
|
$data = $this->getSessionArray();
|
|
$data['recipient_id'] = $this->input->get('recipient_id');
|
|
if ($this->input->get() && $data['recipient_id'] > 0) {
|
|
$data['member_id'] = $_SESSION['member_id'];
|
|
$data['action'] = WRENCHBOARD_DELETE_RECACC;
|
|
$outx['error'] = '';
|
|
$ret = $this->wrenchboard_api($data, $outx);
|
|
if ($ret == PHP_API_OK) {
|
|
echo 'Deleted';
|
|
} else {
|
|
echo 'Err';
|
|
}
|
|
}
|
|
}
|
|
|
|
// </editor-fold>
|
|
|
|
|
|
// <editor-fold defaultstate="collapsed" desc="yourpagecodes">
|
|
public function addgallery() {
|
|
$data = $this->getSessionArray();
|
|
$data['gallery'] = trim($this->input->get('gallery'));
|
|
$this->load->model('backend_model');
|
|
|
|
echo 'Ameye ... ';
|
|
|
|
if ($data['gallery'] != '') {
|
|
$in['action'] = WRENCHBOARD_SAVE_GALLERY;
|
|
$in['member_id'] = $_SESSION['member_id'];
|
|
$in['gallery'] = $data['gallery'];
|
|
$in['gallery_type'] = 1;
|
|
$out = array();
|
|
$res = $this->backend_model->wrenchboard_api($in, $out);
|
|
if ($res >= 0) {
|
|
//echo $out['status'];
|
|
echo $out['result'];
|
|
} else {
|
|
echo 'Error';
|
|
}
|
|
} else {
|
|
echo "Invalid URL ";
|
|
}
|
|
}
|
|
|
|
public function yourpage() {
|
|
$data = $this->getSessionArray();
|
|
//$data['description'] = "";
|
|
// if ($this->input->post)
|
|
$data['description'] = '';
|
|
$mysql = "SELECT description FROM members_detail WHERE member_id = " . $_SESSION['member_id'];
|
|
$query = $this->db->query($mysql);
|
|
$data['update_message'] = '';
|
|
$row = $query->row();
|
|
|
|
if (isset($row)) {
|
|
$data['description'] = $row->description;
|
|
}
|
|
|
|
// $data['description'] =
|
|
|
|
if ($_POST and isset($_POST['your_description']) ) {
|
|
|
|
$data['description'] = trim($this->input->post('description'));
|
|
$outx = array();
|
|
$this->load->model('backend_model');
|
|
$data['action'] = WRENCHBOARD_ACCOUNT_MDESCRIPTION;
|
|
$outx['error'] = '';
|
|
if ($this->backend_model->wrenchboard_api($data, $outx) == PHP_API_OK) {
|
|
$data['update_message'] = 'Your description was updated';
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$data['skill_combo'] = $this->getSkillGeneralCombo();
|
|
$data['skill_types'] = $this->getUserNewSkills($_SESSION['member_id']);
|
|
$data['saved_skills'] = $this->getUserSavedSkills($_SESSION['member_id']);
|
|
|
|
$skill_types = array();
|
|
$q = "SELECT id,category FROM skill_category ORDER BY lorder DESC";
|
|
$query = $this->db->query($q);
|
|
if ($query->num_rows() > 0 ) {
|
|
foreach ($query->result_array() as $row) {
|
|
$skill_types[$row["id"]] = array();
|
|
}
|
|
}
|
|
$q = "SELECT category_id,id,skill FROM skill_types ORDER BY category_id,lorder DESC";
|
|
$query = $this->db->query($q);
|
|
if ($query->num_rows() > 0 ) {
|
|
foreach ($query->result_array() as $row) {
|
|
$skill_types[$row["category_id"]][$row["id"]] = $row["skill"];
|
|
}
|
|
}
|
|
$data['skill_types_data'] = $skill_types;
|
|
$data['member_skills'] = $this->buildUserSkillList(); // $member_skills;
|
|
$data['page_title'] = "My Page";
|
|
|
|
$data['galery_list'] = $this->getGaleryList($_SESSION['member_id']);
|
|
|
|
$this->load->view('users/view_header_user', $data);
|
|
$this->load->view('users/view_yourpage', $data);
|
|
$this->load->view('users/view_footer_user', $data);
|
|
}
|
|
|
|
|
|
/*
|
|
$member_skills = "<table style=\"width: 100%;\" style=\"cellpadding:1px;\" class='table table-sm table-hover table-bordered table-condensed'>\n";
|
|
$member_skills_data = $this->getUserSavedSkills($_SESSION["member_id"]);
|
|
foreach ($member_skills_data as $id=>$skill) {
|
|
$val = $skill["category"]."-".$skill["skill"];
|
|
$member_skills.= "<tr>\n<td>${val}</td><td style=\"width: 20px;\"><div id=\"deldiv${id}\"><button id=\"del_acc${id}\" class=\"btn btn-danger btn-xs\" onclick=\"return delAccountSkill(".$id.")\">X</button></div></td>\n</tr>\n";
|
|
}
|
|
$member_skills .= "</table>\n";
|
|
*/
|
|
|
|
private function getGaleryList($member_id) {
|
|
|
|
|
|
$gal_str = "";
|
|
$mysql = " SELECT g.*,t.gal_type FROM members_site_gallery g LEFT JOIN gallery_types t ON t.id = g.gallery_type WHERE g.member_id =". $member_id ;
|
|
|
|
$query = $this->db->query($mysql);
|
|
if ($query->num_rows() > 0) {
|
|
foreach ($query->result_array() as $row) {
|
|
$gal_str .= $row["gallery"]."<br>";
|
|
}
|
|
}
|
|
return $gal_str;
|
|
}
|
|
|
|
private function getSkillGeneralCombo() {
|
|
$this->load->model('combo_model');
|
|
return $this->combo_model->getGeneralSkillCombo('skill_combo', $this->input->post('skill_combo'));
|
|
}
|
|
|
|
private function buildUserSkillList()
|
|
{
|
|
$member_skills = "<table style=\"width: 100%;\" style=\"cellpadding:1px;\" class='table table-sm table-hover table-bordered table-condensed'>\n";
|
|
$member_skills_data = $this->getUserSavedSkills($_SESSION["member_id"]);
|
|
foreach ($member_skills_data as $id=>$skill) {
|
|
$val = $skill["category"]."-".$skill["skill"];
|
|
$member_skills.= "<tr>\n<td>${val}</td><td style=\"width: 20px;\"><div id=\"deldiv${id}\"><button id=\"del_acc${id}\" class=\"btn btn-danger btn-xs\" onclick=\"return delAccountSkill(".$id.")\">X</button></div></td>\n</tr>\n";
|
|
}
|
|
$member_skills .= "</table>\n";
|
|
|
|
|
|
$member_skills = "";
|
|
|
|
foreach ($member_skills_data as $id=>$skill) {
|
|
$val = $skill["category"]."-".$skill["skill"];
|
|
$member_skills.= "<table style='width: auto !important; padding:0px;' class='table table-xs table-hover'><tr><td>${val}</td><td style=\"width: 10px;\"><div id=\"deldiv${id}\"><a href=\"#\" id=\"del_acc${id}\" class=\"btn btn-outline-warning btn-xs\" onclick=\"return delAccountSkill(".$id.")\">Del.</a></div></td>\n</tr></table>";
|
|
}
|
|
|
|
|
|
|
|
return $member_skills;
|
|
}
|
|
|
|
private function getUserNewSkills($member_id) {
|
|
$this->load->model('combo_model');
|
|
$skill_combo_selection = $this->input->post('skill_combo'); // this changes with combo selected for skill category
|
|
$skill_combo_selection = 1;
|
|
return $this->combo_model->getUserNewSkillCombo('skill_type_combo', $this->input->post('skill_type_combo'), $skill_combo_selection, $member_id);
|
|
}
|
|
|
|
private function getUserSavedSkills($member_id) {
|
|
$skills = array();
|
|
$mysql =" SELECT mk.*,sc.category,st.skill "
|
|
. "FROM members_skills mk "
|
|
. "LEFT JOIN skill_types st ON st.id = mk.skill_id "
|
|
. "LEFT JOIN skill_category sc ON sc.id = mk.category_id "
|
|
. "WHERE mk.member_id = $member_id AND mk.status=1";
|
|
|
|
$query = $this->db->query($mysql);
|
|
if ($query->num_rows() > 0 ) {
|
|
foreach ($query->result_array() as $row) {
|
|
$skills[$row["id"]] = array("category"=>$row["category"],"skill"=>$row["skill"]);
|
|
}
|
|
}
|
|
return $skills;
|
|
}
|
|
|
|
public function saveuserskill() {
|
|
$skill_combo_selection = $this->input->get('skill_combo');
|
|
$skill_type_combo_slection = $this->input->get('skill_type_combo');
|
|
$member_id = $_SESSION['member_id'];
|
|
|
|
if ($skill_combo_selection>0 && $skill_type_combo_slection>0) {
|
|
|
|
$data['category_id'] =$skill_combo_selection ;
|
|
$data['skill_id'] = $skill_type_combo_slection ;
|
|
$data['member_id'] = $member_id;
|
|
|
|
$outx = array();
|
|
$this->load->model('backend_model');
|
|
$data['action'] = WRENCHBOARD_ACCOUNT_SAVESKILL;
|
|
$outx['error'] = '';
|
|
if ($this->backend_model->wrenchboard_api($data, $outx) == PHP_API_OK) {
|
|
//print_r($outx);
|
|
echo "Skill added";
|
|
} else {
|
|
echo "Failed to add skill";
|
|
}
|
|
} else {
|
|
echo "Invalid skill or skill type selection";
|
|
}
|
|
echo "<table style=\"width: 100%;\" class='table table-sm table-hover table-bordered table-condensed'>\n";
|
|
$data = $this->getUserSavedSkills($_SESSION["member_id"]);
|
|
foreach ($data as $id=>$data) {
|
|
// $val = $data["skill"];
|
|
$val = $data["category"]."-".$data["skill"];
|
|
echo "<tr>\n<td>${val}</td><td style=\"width: 20px;\"><div id=\"deldiv${id}\"><button id=\"del_acc${id}\" class=\"btn btn-danger btn-xs\" onclick=\"return delAccountSkill(".$id.")\">X</button></div></td>\n</tr>\n";
|
|
}
|
|
echo "</table>\n";
|
|
}
|
|
|
|
public function deleteskill() {
|
|
$savedskill_id = $this->input->get('savedskill_id');
|
|
$member_id = $_SESSION['member_id'];
|
|
|
|
if ($member_id > 0 && $savedskill_id > 0) {
|
|
|
|
$data['savedskill_id'] = $savedskill_id;
|
|
$data['member_id'] = $member_id;
|
|
$outx = array();
|
|
$this->load->model('backend_model');
|
|
$data['action'] = WRENCHBOARD_ACCOUNT_DELSKILL;
|
|
|
|
$outx['error'] = '';
|
|
if ($this->backend_model->wrenchboard_api($data, $outx) == PHP_API_OK) {
|
|
//print_r($outx);
|
|
echo "Del";
|
|
} else {
|
|
echo "Failed";
|
|
}
|
|
}
|
|
|
|
//echo "";
|
|
}
|
|
|
|
// </editor-fold>
|
|
|
|
public function addfund() {
|
|
$data = $this->getSessionArray();
|
|
$data['page_key'] = 'WRB_FUND_ACCOUNT';
|
|
$data['txt_detail'] = $this->readFixedText($data['page_key']);
|
|
$data['txt_detail'] = str_replace("[how-it-worked-image-1]", "<img src='/assets/images/howitworks/howitworks-1.jpg' alt=''>", $data['txt_detail']);
|
|
$data['txt_detail'] = str_replace("[how-it-worked-image-2]", "<img src='/assets/images/howitworks/howitworks-2.jpg' alt=''>", $data['txt_detail']);
|
|
$this->RenderUserPage('users/view_addfund', $data);
|
|
}
|
|
|
|
|
|
public function faq() {
|
|
$data = $this->getSessionArray();
|
|
$data['faq_table'] = '';
|
|
$query = $this->db->query('SELECT * FROM faq');
|
|
|
|
foreach ($query->result() as $row) {
|
|
|
|
$data['faq_table'] .= "<div class=\"panel panel-white\"> "
|
|
. "<div class=\"panel-heading\"> "
|
|
. " <h6 class=\"panel-title\">"
|
|
. " <a data-toggle=\"collapse\" data-parent=\"#accordion-control\" href=\"#accordion-control-group" . $row->id . "\">" . $row->title . "</a> "
|
|
. " </h6> "
|
|
. " </div> "
|
|
. " <div id=\"accordion-control-group" . $row->id . "\" class=\"panel-collapse collapse out\"> "
|
|
. " <div class=\"panel-body\">" .htmlspecialchars_decode( $row->msg ) . " "
|
|
. " </div>"
|
|
. " </div> "
|
|
. " </div>";
|
|
}
|
|
|
|
$data['page_title'] = "Frequently Asked Questions";
|
|
|
|
$this->RenderUserPage('users/view_faq', $data);
|
|
}
|
|
|
|
public function balance() {
|
|
|
|
$data = $this->getSessionArray();
|
|
|
|
|
|
|
|
|
|
$data['add_error'] = '';
|
|
$data['amount'] = 0;
|
|
$this->load->model('combo_model');
|
|
$data['recipient_account'] = $this->input->post('recipient_account');
|
|
$data['recipient_account_combo'] = $this->combo_model->getUserRecipientCombo('recipient_account', $_SESSION['member_id'], $data['recipient_account']);
|
|
$data['fee'] = $data['total'] =0;
|
|
$data['comment'] = '';
|
|
// $data['fee'] = 0;
|
|
//$data['escrow_balance'] = 0;
|
|
|
|
if ($_POST) {
|
|
$data['comment'] = $this->input->post('comment');
|
|
$data['amount'] = $this->input->post('amount') + 0; // must be number [still in full will be cents to go to backend latter]
|
|
|
|
if ($data['amount'] == 0 || $data['amount'] < 0 || $data['amount'] == '' || $data['recipient_account'] == '') {
|
|
$out['error'] = 'Amount & Recipient Account Required';
|
|
$data['add_error'] = "<div class=\"text-left\"><div class=\"alert alert-danger no-border\">" . $out['error'] . "</div></div>";
|
|
if ($data['amount'] > 0) {
|
|
$outx = $this->transactionFee($data['amount'], $_SESSION['member_id']);
|
|
$data['total'] = $outx['total_amount'];
|
|
$data['fee'] = $outx['processing_fee'];
|
|
}
|
|
} else {
|
|
|
|
$outx = $this->transactionFee($data['amount'], $_SESSION['member_id']);
|
|
$data['total'] = $outx['total_amount'];
|
|
$data['fee'] = $outx['processing_fee'];
|
|
|
|
$TotalAmount = $data['total'];
|
|
|
|
// now let us do initial check if you have enough money
|
|
if ($_SESSION['current_balance'] < $TotalAmount) {
|
|
$out['error'] = 'You do not have enough balance for this transfer';
|
|
$data['add_error'] = "<div class=\"text-left\"><div class=\"alert alert-danger no-border\">" . $out['error'] . "</div></div>";
|
|
} else {
|
|
$this->session->set_flashdata('pending_sendmoney', $data);
|
|
redirect('member/confirmwithdraw');
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->load->library('table');
|
|
$this->table->set_template($this->template);
|
|
$mysql = "SELECT m.added::date AS date,m.terminatingamount*0.01 AS amount,m.fee*0.01 as fee, "
|
|
. "r.firstname||' '||r.lastname||'<br><b>Acc:</b>'||r.account_no||'-'||b.name AS Recitient,mp.confirmation,"
|
|
. "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 m.member_id =" . $_SESSION['member_id'] . " AND mp.confirmation IS NOT NULL ORDER BY m.id DESC LIMIT 4";
|
|
|
|
$query = $this->db->query($mysql);
|
|
$this->table->set_heading('Date', 'Amount','Fee','Recipient','Confirmation', 'Status');
|
|
$data['sendmoney_table'] = $this->table->generate($query);
|
|
|
|
$this->RenderUserPage('users/view_balance', $data);
|
|
}
|
|
|
|
public function fee() {
|
|
$amount = $this->input->get('amount') + 0;
|
|
$res = $this->transactionFee($amount, $_SESSION['member_id']);
|
|
echo is_numeric($res["processing_fee"]) ? sprintf("%0.02f", 0.01 * $res["processing_fee"]) : 0;
|
|
}
|
|
|
|
private function transactionFee($amount, $member_id) {
|
|
|
|
$in = array();
|
|
$in['amount'] = $amount * 100;
|
|
$in['member_id'] = $member_id;
|
|
|
|
$outx = array();
|
|
$this->load->model('backend_model');
|
|
$in['action'] = WRENCHBOARD_SMONEY_PROCFEE;
|
|
$outx['error'] = '';
|
|
$this->backend_model->wrenchboard_api($in, $outx);
|
|
return $outx;
|
|
}
|
|
|
|
public function confirmwithdraw() {
|
|
$final_page = false;
|
|
$data = $this->getSessionArray();
|
|
|
|
//$data = $this->getSessionArray();
|
|
if ($_POST) {
|
|
|
|
//$data = array();
|
|
$data['member_id'] = $_SESSION['member_id'];
|
|
$data['action'] = WRENCHBOARD_SMONEY_MEMBER;
|
|
$data["senderid"] = $_SESSION['member_id'];
|
|
$data["InitiatingEntityCode"] = "MBA";
|
|
|
|
$data['InitiatingAmount'] = $this->input->post('amount') * 100;
|
|
$data['Fee'] = $this->input->post('fee') * 100;
|
|
|
|
$data["InitiatingChannel"] = 7;
|
|
$data["InitiatingPaymentMethodCode"] = "CA";
|
|
$data["InitiatingCurrencyCode"] = '566'; // 566 - NRN - Naira
|
|
//$data["recipientid"] = $this->input->post('recipient_account');
|
|
$data['recipientid'] = $this->input->post('recipientid');
|
|
$data["transaction_id"] = "T" . rand(120000, 999999);
|
|
$data["TerminatingPaymentMethodCode"] = "AC";
|
|
$data["TerminatingAmount"] = $data["InitiatingAmount"];
|
|
$data["TerminatingCurrencyCode"] = '566'; // 566 - NRN - Naira
|
|
$data["TerminatingCountryCode"] = 'NG'; // NG - Nigeria
|
|
$final_page = true;
|
|
if ($data['recipientid'] != '' && $data['recipientid'] > 0 && $data['InitiatingAmount'] > 0 && $data['Fee'] >= 0) {
|
|
$this->load->model('backend_model');
|
|
$out = array();
|
|
$res = $this->backend_model->wrenchboard_api($data, $out);
|
|
// print_r($out);
|
|
$data = $this->getSessionArray(); // you will need this for new balace
|
|
$data["fee"] = $out["Fee"];
|
|
$data["amount"] = $out["InitiatingAmount"];
|
|
$data["total"] = $data["fee"] + $data["amount"];
|
|
$data["recipient_account_detail"] = "Recipient Account Here";
|
|
$data["comment"] = "Coment Here";
|
|
|
|
$data["rec_firstname"] = $out["firstname"];
|
|
$data["rec_lastname"] = $out["lastname"];
|
|
$data["account_no"] = $out["account_no"];
|
|
$data["bank_name"] = $out["bank_name"];
|
|
$data["confirmation"] = $out["confirmation"];
|
|
$sendmoney_message = '<b>Estimated delivery time is 2 to 4 Hours.</b>';
|
|
$data['sendmoney_message'] = $sendmoney_message;
|
|
}
|
|
|
|
//print_r($data);
|
|
//
|
|
//
|
|
// you are about to send money for real now -
|
|
// calling the vack end takes place here now
|
|
/*
|
|
*
|
|
//isset($_POST["InitiatingEntityCode"])?$_POST["InitiatingEntityCode"]:"";
|
|
//
|
|
$data["senderid"] = "1"; // isset($_POST["customerid"])?((int)$_POST["customerid"]):0;
|
|
$data["InitiatingAmount"] = 120000 + rand(999, 99999);
|
|
$data["Fee"] = 120;
|
|
$data["TerminatingAccountNumber"] = "";
|
|
// $data["TerminatingAccountType"] = isset($_POST["TerminatingAccountType"])?$_POST["TerminatingAccountType"]:"";
|
|
$data["TerminatingEntityCode"] = "";
|
|
|
|
*
|
|
*/
|
|
} else {
|
|
$pending_sendmoney = $this->session->flashdata('pending_sendmoney');
|
|
$data['amount'] = 0;
|
|
$data['amount'] = $pending_sendmoney['amount'];
|
|
$data['total'] = $pending_sendmoney['total'];
|
|
$data['fee'] = $pending_sendmoney['fee'];
|
|
$data['recipient_account'] = $pending_sendmoney['recipient_account'];
|
|
$data['comment'] = $pending_sendmoney['comment'];
|
|
}
|
|
|
|
if ($final_page == false) {
|
|
$this->load->model('combo_model');
|
|
$this->combo_model->setReadOnly(true);
|
|
$data['recipient_account_combo'] = $this->combo_model->getUserRecipientCombo('recipient_account', $_SESSION['member_id'], $data['recipient_account']);
|
|
|
|
// $this->load->view('users/view_header_user', $data);
|
|
$this->RenderUserPage('users/view_confirmwithdraw', $data);
|
|
// $this->load->view('users/view_footer_user', $data);
|
|
} else {
|
|
|
|
//$this->load->view('users/view_header_user', $data);
|
|
$this->RenderUserPage('users/view_finalwithdraw', $data);
|
|
// $this->load->view('users/view_footer_user', $data);
|
|
}
|
|
}
|
|
|
|
public function completewithdraw() {
|
|
|
|
echo 'Not attached - backend implemented already';
|
|
|
|
$data = $this->getSessionArray();
|
|
}
|
|
|
|
public function message() {
|
|
date_default_timezone_set('UTC');
|
|
$data = $this->getSessionArray();
|
|
$this->load->library('table');
|
|
$this->table->set_template($this->template);
|
|
$mysql = "SELECT added::date AS msg_date,msg,id AS msg_id FROM members_messages WHERE member_id = " . $_SESSION['member_id'] . " AND reply IS NULL ORDER BY id DESC LIMIT 20";
|
|
$query = $this->db->query($mysql);
|
|
|
|
$myTable = "<table class='table table-striped table-hover table-bordered table-condensed'>";
|
|
|
|
foreach ($query->result_array() as $row) {
|
|
$myTable .= $this->mesageTableRow($row);
|
|
}
|
|
|
|
$myTable .="</table>";
|
|
|
|
|
|
//$this->table->set_heading(array('data' => 'Date', 'style' => 'width:110px'), 'Message');
|
|
$data['message_table'] = $myTable; //$this->table->generate($query);
|
|
$this->RenderUserPage('users/view_message', $data);
|
|
}
|
|
|
|
private function mesageTableRow($row) {
|
|
return "<tr><td style='width:120px;'><b>" . $row['msg_date'] . "</b></td><td>" . substr($row['msg'], 0, 85) . "...<a href='#' onclick=\"return EDetail('" . $row['msg_id'] . "');\">view</a></td></tr>"
|
|
. "<tr><td colspan = '2'><div id='" . $row['msg_id'] . "'></div></td></tr>";
|
|
}
|
|
|
|
public function messagedetail() {
|
|
|
|
// echo 'Ameye';
|
|
$message_id = $this->input->get('message_id');
|
|
|
|
/*
|
|
* wrenchboard=> SELECT * FROM members_messages WHERE id = 8;
|
|
id | member_id | added | msg | status | senders_id | msg_type | memo
|
|
----+-----------+----------------------------+--------------------------------------------------------------------------+--------+------------+----------+------------
|
|
8 | 27 | 2017-08-12 19:08:24.779765 | I am interested in this Job but would like to understand. Please clarify | 1 | 26 | JOB | 3R4836964W
|
|
(1 row)
|
|
|
|
*/
|
|
|
|
|
|
$mysql = "SELECT * FROM members_messages WHERE id = " . $message_id . " AND member_id = " . $_SESSION['member_id'];
|
|
|
|
|
|
|
|
$query = $this->db->query($mysql);
|
|
$num = $query->num_rows();
|
|
|
|
if ($num > 0) {
|
|
$row = $query->row_array();
|
|
$myTable = "<table class='table table-sm table-hover table-bordered table-condensed' style=' background-color: #f1fdd5;'>";
|
|
$myTable .= $this->makeMesageDetailTableRow($row);
|
|
$myTable .="</table>";
|
|
}
|
|
|
|
echo $myTable;
|
|
}
|
|
|
|
private function makeMesageDetailTableRow($row) {
|
|
return "<tr><td style='width:100px;'><b>Memo</b></td><td><b>" . $row['memo'] . "</b></td></tr>"
|
|
. "<tr><td><b>Message</b></td><td>" . $row['msg'] . "</td></tr>"
|
|
. "<tr><td colspan='2'>"
|
|
. "<div id='msg_result_" . $row['id'] . "'><form name=\"job_message\"><table class='table table-striped table-hover table-bordered table-condensed'>"
|
|
. "<tr><td><textarea name='yourmessage' cols=\"5\" rows=\"3\" class=\"textarea form-control\" class=\"btn btn-success btn-xs\" placeholder=\"Enter reply here ...\"></textarea></td></tr>"
|
|
. "<tr><td style='text-align:right;'><button id='submit_yourmessage_" . $row['id'] . "' onclick=\"return OMessage('" . $row['memo'] . "'," . $row['id'] . ");\" class=\"btn btn-info btn-xs\">Reply</button></td></tr></table></form></div>"
|
|
. "</td></tr>"
|
|
. " ";
|
|
}
|
|
|
|
public function replymessage() {
|
|
$data = $this->getSessionArray();
|
|
//url: "/member/replymessage?proc=REPLYMSG&message_code=" + message_code + "&message_id="+message_id+"&yourmessage=" + document.job_message.yourmessage.value
|
|
$data["message_id"] = $this->input->get('message_id');
|
|
$data["memo"] = trim($this->input->get('message_code'));
|
|
$data["yourmessage"] = trim($this->input->get('yourmessage'));
|
|
|
|
if ($data["message_id"] > 0 && $data["memo"] != '' && $data["yourmessage"] != '') {
|
|
$data['action'] = WRENCHBOARD_JOB_REPLY_QUESTION;
|
|
$this->load->model('backend_model');
|
|
$out = array();
|
|
$res = $this->wrenchboard_api($data, $out);
|
|
if ($res == PHP_API_OK) {
|
|
echo 'Replied...';
|
|
}
|
|
}
|
|
}
|
|
|
|
public function payments() {
|
|
$data = $this->getSessionArray();
|
|
|
|
$this->load->library('pagination');
|
|
$config = array();
|
|
|
|
|
|
$this->load->library('table');
|
|
$this->table->set_template($this->template);
|
|
$mysql = "SELECT added::date,(CASE WHEN code = 'OFDPS' THEN 'Job Offer Deposit' "
|
|
. "WHEN code ='OFRFD' THEN 'Job Offer Refund' WHEN code='MDEPT' THEN 'Account Depoist' "
|
|
. "WHEN code ='SMPAY' THEN 'Account Withdraw' "
|
|
. "WHEN code ='COCNL' THEN 'Cancellation Refund' "
|
|
. "WHEN code ='COPAY' THEN 'Completed Task Payment' ELSE '' END) AS Description,amount*0.01 AS amount,fee*0.01 as fee,confirmation "
|
|
. "FROM members_payments "
|
|
. "WHERE member_id = " . $_SESSION['member_id'] . " AND status = 1 ORDER BY id DESC";
|
|
$query = $this->db->query($mysql);
|
|
|
|
|
|
$config["total_rows"] = $query->num_rows();
|
|
$config["base_url"] = base_url() . "/member/payments";
|
|
$config["per_page"] = 10;
|
|
$config["uri_segment"] = 3;
|
|
$config["num_links"] = 5;
|
|
|
|
$config['full_tag_open'] = "<ul class='pagination'>";
|
|
$config['full_tag_close'] = "</ul>";
|
|
$config['num_tag_open'] = '<li>';
|
|
$config['num_tag_close'] = '</li>';
|
|
$config['cur_tag_open'] = "<li class='disabled'><li class='active'><a href='#'>";
|
|
$config['cur_tag_close'] = "<span class='sr-only'></span></a></li>";
|
|
$config['next_tag_open'] = "<li>";
|
|
$config['next_tagl_close'] = "</li>";
|
|
$config['prev_tag_open'] = "<li>";
|
|
$config['prev_tagl_close'] = "</li>";
|
|
$config['first_tag_open'] = "<li>";
|
|
$config['first_tagl_close'] = "</li>";
|
|
$config['last_tag_open'] = "<li>";
|
|
$config['last_tagl_close'] = "</li>";
|
|
|
|
|
|
$this->pagination->initialize($config);
|
|
$page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
|
|
$page = is_numeric($page) ? $page : 0;
|
|
|
|
$mysql = "SELECT added::date,(CASE WHEN code = 'OFDPS' THEN 'Job Offer Deposit' "
|
|
. "WHEN code ='OFRFD' THEN 'Job Offer Refund' WHEN code='MDEPT' THEN 'Account Depoist' "
|
|
. "WHEN code ='SMPAY' THEN 'Account Withdraw' "
|
|
. "WHEN code ='COCNL' THEN 'Cancellation Refund' "
|
|
. "WHEN code ='COPAY' THEN 'Completed Task Payment' ELSE '' END) AS Description,amount*0.01 AS amount,fee*0.01 as fee,confirmation "
|
|
. "FROM members_payments "
|
|
. "WHERE member_id = " . $_SESSION['member_id'] . " AND status = 1 ORDER BY id DESC LIMIT " . $config["per_page"] . " OFFSET " . $page;
|
|
|
|
$query = $this->db->query($mysql);
|
|
|
|
$this->table->set_heading(array('data' => 'Date', 'style' => 'width:110px'), 'Description', array('data' => 'Amount', 'style' => 'width:100px'), array('data' => 'Fee', 'style' => 'width:70px'), array('data' => 'Confirmation', 'style' => 'width:100px'));
|
|
$data['payment_result'] = $this->table->generate($query);
|
|
$data["links"] = $this->pagination->create_links();
|
|
|
|
// $this->load->view('users/view_header_user', $data);
|
|
$this->RenderUserPage('users/view_payment', $data);
|
|
// $this->load->view('users/view_footer_user', $data);
|
|
}
|
|
|
|
public function support() {
|
|
|
|
$data = $this->getSessionArray();
|
|
$message = $email = $firstname = $lastname = $your_message = '';
|
|
|
|
$data['message'] = ""; // $message;
|
|
$data['email'] = $_SESSION['email'];
|
|
// $data['firstname'] = $firstname;
|
|
// $data['lastname'] = $lastname;
|
|
$data['msg'] = $your_message;
|
|
|
|
|
|
if ($_POST) {
|
|
|
|
//$email = $this->input->post('email');
|
|
// $firstname = $this->input->post('firstname');
|
|
// $lastname = $this->input->post('lastname');
|
|
$your_message = $this->input->post('msg');
|
|
$data['firstname'] = $_SESSION['firstname']; // $firstname;
|
|
$data['lastname'] = $_SESSION['lastname']; // $lastname;
|
|
// if ($firstname == '' || $lastname == '') {
|
|
// $message = 'Both first and last name are required';
|
|
// }
|
|
|
|
if ($your_message == '' || strlen($your_message) > 500) {
|
|
$message = 'Message is required. Your message can be up to 500 characters long';
|
|
}
|
|
|
|
// if ($email=='' || !filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
|
// $message = 'Invalid e-mail';
|
|
// }
|
|
|
|
if ($message == '') {
|
|
$data['email'] = $_SESSION['email']; // $email;
|
|
|
|
$data['your_message'] = $your_message;
|
|
$data['loc'] = $_SERVER['REMOTE_ADDR']; //'38.101.241.200';
|
|
$data['action'] = WRENCHBOARD_SEND_CONTACTUS;
|
|
$this->load->model('backend_model');
|
|
$out = array();
|
|
$res = $this->backend_model->wrenchboard_api($data, $out);
|
|
$message = "Your message was sent";
|
|
$email = $firstname = $lastname = $your_message = "";
|
|
} else {
|
|
//$message = 'Invalid input';
|
|
$your_message = substr($your_message, 0, 500);
|
|
}
|
|
$data['message'] = "<div class=\"text-left\"><div class=\"alert alert-info no-border\">" . $message . "</div></div>";
|
|
}
|
|
|
|
$data['page_title'] = "Support";
|
|
|
|
|
|
|
|
// $this->load->view('users/view_header_user', $data);
|
|
$this->RenderUserPage('users/view_support', $data);
|
|
// $this->load->view('users/view_footer_user', $data);
|
|
}
|
|
|
|
public function schedule() {
|
|
|
|
$data = $this->getSessionArray();
|
|
|
|
$data['current_month'] = '2017-07-12';
|
|
|
|
$ic = 0;
|
|
$calendar_data = '';
|
|
$mysql = " SELECT member_id,client_id,id,contract,delivery_date::date,created::date FROM members_jobs_contract WHERE client_id=" . $_SESSION['member_id'];
|
|
$query = $this->db->query($mysql);
|
|
foreach ($query->result() as $row) {
|
|
if ($ic > 0) {
|
|
$calendar_data .= ",";
|
|
}
|
|
$calendar_data .= "{
|
|
title: '" . $row->contract . "',
|
|
start: '" . $row->created . "',
|
|
end: '" . $row->delivery_date . "',
|
|
color: '#26A69A'
|
|
}";
|
|
$ic++;
|
|
}
|
|
// DONT reset $ic to zero
|
|
$mysql = " SELECT member_id,client_id,id,contract,delivery_date::date,created::date FROM members_jobs_contract WHERE member_id=" . $_SESSION['member_id'];
|
|
$query = $this->db->query($mysql);
|
|
foreach ($query->result() as $row) {
|
|
if ($ic > 0) {
|
|
$calendar_data .= ",";
|
|
}
|
|
$calendar_data .= "{
|
|
title: '" . $row->contract . "',
|
|
start: '" . $row->created . "',
|
|
end: '" . $row->delivery_date . "',
|
|
color: '#546E7A'
|
|
}";
|
|
$ic++;
|
|
}
|
|
|
|
|
|
|
|
$data["calendar_data"] = $calendar_data;
|
|
|
|
$this->load->view('users/view_header_user', $data);
|
|
$this->load->view('users/view_schedule', $data);
|
|
$this->load->view('users/view_footer_user', $data);
|
|
}
|
|
|
|
public function userlog() {
|
|
|
|
$data = $this->getSessionArray();
|
|
|
|
$mysql = "SELECT mlog,loc, status, created FROM members_log WHERE member_id = " . $_SESSION['member_id'] . " ORDER BY created DESC LIMIT 40";
|
|
$query = $this->db->query($mysql);
|
|
$data['log_result'] = $query->result();
|
|
|
|
// print_r($query->result());
|
|
$data['now_date'] = date('l\, F jS\, Y ');
|
|
|
|
|
|
$this->load->view('users/view_header_user', $data);
|
|
$this->load->view('users/view_userlog', $data);
|
|
$this->load->view('users/view_footer_user', $data);
|
|
}
|
|
|
|
public function settings() {
|
|
|
|
$data = $this->getSessionArray();
|
|
$this->load->view('users/view_header_user', $data);
|
|
$this->load->view('users/view_settings', $data);
|
|
$this->load->view('users/view_footer_user', $data);
|
|
}
|
|
|
|
private function AgetSessionArray() {
|
|
$data = $_SESSION['secure_data'];
|
|
$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'];
|
|
|
|
$this->load->model('dash_model');
|
|
$out = $this->dash_model->getDashData($data);
|
|
$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['escrow_balance'] = $out['escrow_balance'];
|
|
$data['description'] = $out["description"];
|
|
|
|
$data['member_id'] = $_SESSION['member_id']; // = $ret->email;
|
|
|
|
$this->refreshAccountDetail($_SESSION['member_id']);
|
|
return $data;
|
|
}
|
|
|
|
private function ADELETErefreshAccountDetail($member_id) {
|
|
$this->load->model('account_model');
|
|
$qr = $this->account_model->loadAccountData($member_id);
|
|
// print_r($qr);
|
|
$_SESSION['current_balance'] = $qr[0]['balance'];
|
|
$_SESSION['state'] = $qr[0]['state'];
|
|
$_SESSION['city'] = $qr[0]['city'];
|
|
$_SESSION['country'] = $qr[0]['country'];
|
|
}
|
|
|
|
private function ArefreshAccountDetail($member_id) {
|
|
$this->load->model('account_model');
|
|
$qr = $this->account_model->loadAccountData($member_id);
|
|
// print_r($qr);
|
|
$_SESSION['current_balance'] = $qr[0]['balance'];
|
|
$_SESSION['active_task'] = $this->account_model->loadActiveTaskCount($member_id);
|
|
$_SESSION['state'] = $qr[0]['state'];
|
|
$_SESSION['city'] = $qr[0]['city'];
|
|
$_SESSION['country'] = $qr[0]['country'];
|
|
|
|
$in = array();
|
|
$in['action'] = WRENCHBOARD_SESSION_VERIFY;
|
|
$in['sessionid'] = $_SESSION['session_id'];
|
|
$in['member_id'] = $_SESSION['member_id'];
|
|
$this->load->model('backend_model');
|
|
$out = array();
|
|
$res = $this->backend_model->wrenchboard_api($in, $out);
|
|
if ($res != PHP_API_OK) {
|
|
redirect(home);
|
|
}
|
|
}
|
|
|
|
}
|