db->query($mysql);
return $query->result_array();
}
/*
* Supply active list of jobs for this id
*/
public function selectMarketJob($jobId){
$mysql = 'SELECT jo.offer_code,mj.title,mj.description,mj.timeline_days,mj.price,jo.job_description,jo.expire::date FROM members_jobs_offer jo '
. ' LEFT JOIN members_jobs mj ON mj.id=jo.job_id '
. ' WHERE mj.status=1 AND jo.status=1 '
. ' AND jo.expire> now() AND mj.id ='.$jobId;
$query = $this->db->query($mysql);
return $query->result();
}
public function deleteMemberGroup($group_id) {
$this->actionMessage = '';
$x['member_id'] = $_SESSION['member_id'];
$x['group_id'] = $group_id;
$x['action'] = WRENCHBOARD_JOB_DELETE_GROUP;
$this->load->model('backend_model');
$out = array();
$res = $this->backend_model->wrenchboard_api($x, $out);
if ($res == PHP_CREATED_OK) {
$this->actionMessage = "Group Deleted";
} else {
$this->actionMessage = 'Unable to delete group...';
}
return $this->actionMessage;
}
public function deleteMemberGroupMember($group_id, $group_member_id) {
$this->actionMessage = '';
$x['member_id'] = $_SESSION['member_id'];
$x['group_id'] = $group_id;
$x['group_member_id'] = $group_member_id;
$x['action'] = WRENCHBOARD_JOB_DELETE_GROUPMEMBER;
$this->load->model('backend_model');
$out = array();
$res = $this->backend_model->wrenchboard_api($x, $out);
if ($res == PHP_CREATED_OK) {
$this->actionMessage = "Group Deleted";
} else {
$this->actionMessage = 'Unable to delete group...';
}
return $this->actionMessage;
}
public function addMemberGroupMember($group_id, $firstname, $lastname, $email) {
$this->actionMessage = '';
//$group_id = $group_id + 0; // just making sure it is number
$x['member_id'] = $_SESSION['member_id'];
$x['group_id'] = $group_id;
$x['firstname'] = $firstname;
$x['lastname'] = $lastname;
$x['email'] = $email;
$x['action'] = WRENCHBOARD_JOB_GROUP_MEMBER;
$this->load->model('backend_model');
$out = array();
$res = $this->backend_model->wrenchboard_api($x, $out);
if ($res == PHP_CREATED_OK) {
$this->actionMessage = 'Group Created';
} else {
$this->actionMessage = 'Unable to create job group...';
}
return $this->actionMessage;
}
var $tableJobMember = '';
public function getJobGroupMembers($group_id) {
$this->tableJobMember = '';
$this->load->library('table');
$this->table->set_template($this->template);
$mysql = "SELECT firstname,lastname,email,'' FROM members_job_groupmember WHERE member_id = " . $_SESSION['member_id'] . " AND group_id = " . $group_id . " AND status = 1";
$query = $this->db->query($mysql);
$this->table->set_heading('Firstname', 'Lastname', 'Email', '');
$this->tableJobMember = $this->table->generate($query);
return $this->tableJobMember;
}
var $tableStr = '';
public function getMembersJobGroup($sel) {
$this->tableStr = '';
$groups = array();
$mysql = "SELECT id,group_name FROM members_job_group WHERE member_id = " . $_SESSION['member_id'] . " AND status = 1 ORDER BY group_name ASC";
$query = $this->db->query($mysql);
$this->tableStr = '
';
return array($this->tableStr,$groups);
}
public function addGroupMemberForm($group_id) {
$str = "
";
return $str;
}
public function loadJobOffer($member_id, $offer_code) {
$out = array();
$out['result'] = 0;
$mysql = "SELECT jo.added::date AS added_date,j.title,j.description, j.timeline_days, j.price*0.01 AS price,jo.offer_code,jo.job_description,jo.expire "
. "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 = " . $member_id . " AND jo.offer_code='" . $offer_code . "' ";
$q = $this->db->query($mysql);
if ($q->num_rows() > 0) {
$out['added_date'] = $q->row()->added_date;
$out['title'] = $q->row()->title;
$out['description'] = $q->row()->description;
$out['timeline_days'] = $q->row()->timeline_days;
$out['price'] = $q->row()->price;
$out['offer_code'] = $q->row()->offer_code;
$out['job_description'] = $q->row()->job_description;
$out['expire'] = $q->row()->expire;
$out['result'] = 1;
} else {
}
return $out;
}
public function getComboJobListOrdered($member_id, $list_limit){
/*
*SELECT uid,title FROM members_jobs WHERE status = 1 AND member_id = 1 ORDER BY title ASC LIMIT 100;
uid | title
--------------------------------------+----------------------------------------------------------------------------------
f13c2850-d1a4-4c87-be03-5fcd18a0643a | Another 2 days job
01d9da51-8290-46aa-902c-279203b9b85f | ChiefSoftWorks
00ce0c85-17c2-49f8-86e0-4c8ce70540a0 | Control Selected GPIO Pin on a Raspberry Pi Raspberry Pi 3
0c17f4f0-a2c2-449e-8b5c-61b1ac3eeeea | Different Screen,15 and 5 different Email Subject Capture
*/
$mysql = "SELECT uid,title FROM members_jobs WHERE status = 1 AND member_id = " . $member_id . " ORDER BY title ASC LIMIT ".$list_limit;
$query = $this->db->query($mysql);
return $query->result_array();
}
public function readMyloadJobOffer($member_id, $offer_code) {
$out = array();
$out['result'] = 0;
$mysql = "SELECT jo.added::date AS added_date,j.title,j.description, j.timeline_days, j.price*0.01 AS price,public_view,"
." jo.offer_code,jo.job_description,jo.expire,(CASE WHEN jo.public_view > 0 THEN 'Public View' ELSE jo.email END ) AS job_sent_to "
. "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 = " . $member_id . " AND jo.offer_code='" . $offer_code . "' ";
$q = $this->db->query($mysql);
if ($q->num_rows() > 0) {
$out['job_sent_to'] = $q->row()->job_sent_to;
$out['added_date'] = $q->row()->added_date;
$out['title'] = $q->row()->title;
$out['description'] = $q->row()->description;
$out['timeline_days'] = $q->row()->timeline_days;
$out['price'] = $q->row()->price;
$out['offer_code'] = $q->row()->offer_code;
$out['job_description'] = $q->row()->job_description;
$out['expire'] = $q->row()->expire;
$out['public_view'] = $q->row()->public_view;
$out['result'] = 1;
} else {
}
return $out;
}
public function verifyJobInputs($data) {
/*
$in['title'] = $title;
$in['description'] = $description;
$in['timeline_days'] = $timeline;
$in['job_detail'] = $job_detail;
$in['price'] = $price;
$in['member_id'] = $_SESSION['member_id'];
*/
$ret = false;
if (trim($data['title']) != ''
&& trim($data['description']) != ''
&& trim($data['timeline_days']) != ''
&& $data['timeline_days'] > 0
&& trim($data['price']) != ''
&& $data['price']*100 > 0
&& trim($data['member_id']) > 0) {
$ret = true;
}
return $ret;
}
public function getJob($job_id) {
$q = $this
->db
->where('id', $job_id)
->limit(1)
->get('members_jobs');
if ($q->num_rows() > 0) {
return $q->row();
} else {
return false;
}
}
}