Beispiel #1
0
 function prepareItem($item)
 {
     $item = new JS_User($item);
     $model = SnapJobs::getModel('jobs');
     $snapped_jobs = $model->get_snapped_jobs($item->user->ID, false, array('fields' => 'snap_date', 'orderby' => 'snap_date', 'order' => 'desc'));
     $item->user->last_snapped = mysql2date('d . m . Y', $snapped_jobs[0]);
     $this->items[] = $item->user;
     return $item;
 }
Beispiel #2
0
 function display($tmpl = null, $separator = false)
 {
     $user_name = JS_Helper::get_input('snap_user');
     if ($user_name) {
         $model = SnapJobs::getModel('reviews');
         $this->user = $model->load($user_name);
         $this->items = $model->getData();
         $this->assignRef('total_count', $model->total_count);
     }
     parent::display($tmpl, $separator);
 }
Beispiel #3
0
 function reply_message()
 {
     $message_reply_text = $_POST['message_reply_text'];
     $receiver = $_POST['receiver'];
     $reply_to = $_POST['reply_to'];
     $model = SnapJobs::getModel('message');
     if ($message_reply_text && $reply_to != null) {
         $replied_message = $model->sendMessage($message_reply_text, $receiver, $reply_to);
     }
     wp_redirect($model->getMessage($reply_to)->link);
     exit;
 }
Beispiel #4
0
 function getData($filter = null)
 {
     $model = SnapJobs::getModel('jobsshopper');
     switch ($filter) {
         case 'saved':
             $saved_jobsshopper = (array) get_user_meta(get_current_user_id(), 'snap_saved_jobsshopper', true);
             $saved_jobsshopper = array_filter($saved_jobsshopper);
             $this->total_count = count($saved_jobsshopper);
             $args = array('include' => !empty($saved_jobsshopper) ? $saved_jobsshopper : array(-1));
             break;
         default:
             $args = array();
             break;
     }
     $this->items = $model->getData($args);
 }
Beispiel #5
0
 public static function getInstance($type, $prefix = '', $config = array())
 {
     $type = preg_replace('/[^A-Z0-9_\\.-]/i', '', $type);
     $modelClass = $prefix . ucfirst($type);
     if (!class_exists($modelClass)) {
         $path = SnapJobs::get_setting('plugin_path') . 'models' . DIRECTORY_SEPARATOR . $type . '.php';
         if ($path) {
             require_once $path;
             if (!class_exists($modelClass)) {
                 return false;
             }
         } else {
             return false;
         }
     }
     return new $modelClass($config);
 }
Beispiel #6
0
 function display($tmpl = null, $separator = false)
 {
     $controller = SnapJobs::getController('message');
     $model = $controller->getModel();
     switch ($this->snap_task) {
         case 'reply_message':
             $controller->execute($this->snap_task);
             break;
         case 'message':
             $tmpl = 'inbox.message';
             $id = JS_Helper::get_input('id');
             $this->assignRef('model', $model);
             $this->item = $model->viewMessage($id);
             break;
         default:
         case 'inbox':
             $this->items = $model->getData();
             break;
     }
     parent::display($tmpl, $separator);
 }
Beispiel #7
0
 function get_plugin_url($path = '')
 {
     $plugin_url = get_template_directory_uri() . SnapJobs::get_setting('plugin_uri');
     return $plugin_url . $path;
 }
Beispiel #8
0
<?php

global $_js_helper;
$model = SnapJobs::getModel('jobsshopper');
$model->setLimit(4);
$this->items = $model->getData();
?>
<div class="list-items-content user-list">
    <div class="row">
        <!-- start .list-item -->
        <?php 
foreach ($this->items as $key => $item) {
    $this->item = $item;
    $this->get_template_part('jobsshopper.item', true);
}
?>
    </div>
</div>
Beispiel #9
0
 function reject_applicant($jobsshopper_id)
 {
     if (!$jobsshopper_id || !intval($jobsshopper_id)) {
         throw new Exception('Invalid jobs id.');
     }
     $jobid = $_POST['job_id'];
     $get_jobs_relationships = $this->get_snapped_jobs($jobsshopper_id, $jobid);
     $jobs = get_post($jobid);
     $data = array();
     if ($get_jobs_relationships) {
         $jobsshopper = $get_jobs_relationships[0];
         foreach ($jobsshopper as $key => $value) {
             $tmp_data[$key] = $value;
         }
         if (isset($tmp_data) && $tmp_data) {
             $tmp_data['snap_status'] = 'rejected';
         } else {
             return false;
         }
         if ($this->table->store($tmp_data) !== false) {
             $message_model = SnapJobs::getModel('message');
             $message = $message_model->createMessage(array('post_title' => 'Rejected of ' . $jobs->post_title, 'post_content' => sprintf("%s has just rejected your job.", wp_get_current_user()->name)));
             $message_model->sendMessage($message, $jobsshopper_id);
             return true;
         }
     } else {
         return false;
     }
 }
Beispiel #10
0
<?php

global $_js_helper;
if ($_js_helper->is_jobsboss()) {
    $model = SnapJobs::getModel('jobs');
    $this->items = $model->get_snapped_jobs(get_current_user_id(), false);
    $template = 'jobsshopper.item-history';
} elseif ($_js_helper->is_jobsshopper()) {
    $this->getData('snapped');
    $template = 'jobs.item';
}
?>
<div id="main-content" class="site-content">
    <!-- banner search form -->
    <div class="banner-search" style="background-image: url(<?php 
echo get_template_directory_uri();
?>
/images/header-bg-2.jpg);">
        <div class="container">
            <?php 
if ($_js_helper->is_jobsshopper()) {
    ?>
                <?php 
    $current_user = JS_Helper::get_current_js_user();
    ?>
                <h1><?php 
    echo $current_user->completed_hours;
    ?>
</h1>
                <p><?php 
    _e('Completed snap hours');
Beispiel #11
0
 /**
  * API Save Applicant
  *
  * @param aid: ID of applicant
  * @param token
  * @return int | null
  */
 function removeSavedApplicant()
 {
     $this->checkTokenValidation();
     global $_js_helper;
     // check and return error if current user is not jobsboss
     if (!$_js_helper->is_jobsboss($this->user->ID)) {
         $this->setError('E403', 'You are not jobsboss');
         return null;
     }
     if (!isset($_GET['aid']) && !$_GET['aid']) {
         $this->setError('E404');
         return null;
     }
     $applicant_id = $_GET['aid'];
     if (!$_js_helper->is_jobsshopper($applicant_id)) {
         $this->setError('E403', 'This user is not jobsshopper user.');
         return null;
     }
     $model = SnapJobs::getModel('jobsshopper');
     $_POST['id'] = $applicant_id;
     if ($model->unsaveProfile()) {
         $this->setSuccess('You have unsaved this profile successful.');
         return $applicant_id;
     }
     $this->setError('E403', 'We cannot unsave this profile right now or you haven\'t saved this profile before, please try again later.');
     return null;
 }
Beispiel #12
0
 function prepareItem($item)
 {
     $model = SnapJobs::getModel('jobs');
     return $model->prepareItem($item);
 }
Beispiel #13
0
 function display($tmpl = null)
 {
     $this->results = array();
     $this->authors = array();
     $search_area = JS_Helper::get_input('snap_search_area');
     if ($this->snap_task == 'search_jobs' && $search_area == 'jobsshopper') {
         $model = SnapJobs::getModel($search_area);
         $args_filter = array('s' => $_GET['keyword'], 'meta_query' => array());
         if ($snap_education = JS_Helper::get_input('education')) {
             $args_filter['meta_query'][] = array('key' => 'education_qualifications', 'value' => $snap_education);
         }
         if ($snap_locate = JS_Helper::get_input('location')) {
             $args_filter['meta_query'][] = array('key' => 'location', 'value' => $snap_locate, 'compare' => 'LIKE');
         }
         if ($snap_skills = JS_Helper::get_input('skills')) {
             $args_filter['meta_query'][] = array('key' => 'skills', 'value' => $snap_skills, 'compare' => 'LIKE');
         }
         if ($snap_strengths = JS_Helper::get_input('strengths')) {
             $args_filter['meta_query'][] = array('key' => 'strengths', 'value' => $snap_strengths, 'compare' => 'LIKE');
         }
         if ($snap_year_experience = JS_Helper::get_input('year_experience')) {
             $args_filter['meta_query'][] = array('key' => 'year_of_experiences_year', 'value' => $snap_year_experience, 'compare' => '<=');
         }
         $datas['date'] = JS_Helper::get_input('snap_date');
         $datas['time_from'] = JS_Helper::get_input('time_from');
         $datas['time_to'] = JS_Helper::get_input('time_to');
         $datas['currency'] = JS_Helper::get_input('currency');
         $datas['min_rate'] = JS_Helper::get_input('min_rate');
         $datas['max_rate'] = JS_Helper::get_input('max_rate');
         $this->authors = $this->getAuthorbyTime($datas);
         $args_filter['include'] = $this->authors;
         $this->results = $model->getData($args_filter);
         $this->total_count = $model->total_count;
     } elseif ($this->snap_task == 'search_jobs' && $search_area == 'jobs') {
         $model = SnapJobs::getModel($search_area);
         $args_filter = array('s' => $_GET['keyword'], 'post_type' => 'jobssnap', 'meta_query' => array(array('key' => 'snap_job_status', 'value' => 'closed', 'compare' => '!=')));
         if ($snap_education = JS_Helper::get_input('snap_date')) {
             $args_filter['meta_query'][] = array('key' => 'date', 'value' => date('n/j/Y', strtotime($datas['date'])), 'compare' => 'LIKE');
         }
         if ($snap_education = JS_Helper::get_input('education')) {
             $args_filter['meta_query'][] = array('key' => 'education_qualifications', 'value' => $snap_education);
         }
         if ($snap_locate = JS_Helper::get_input('location')) {
             $args_filter['meta_query'][] = array('key' => 'location', 'value' => $snap_locate, 'compare' => 'LIKE');
         }
         if ($snap_locate = JS_Helper::get_input('time_from')) {
             $args_filter['meta_query'][] = array('key' => 'time_from', 'value' => $snap_locate, 'compare' => '<=');
         }
         if ($snap_locate = JS_Helper::get_input('time_to')) {
             $args_filter['meta_query'][] = array('key' => 'time_to', 'value' => $snap_locate, 'compare' => '>=');
         }
         if ($snap_locate = JS_Helper::get_input('currency')) {
             $args_filter['meta_query'][] = array('key' => 'currency', 'value' => $snap_locate, 'compare' => 'LIKE');
         }
         if ($snap_locate = JS_Helper::get_input('min_rate')) {
             $args_filter['meta_query'][] = array('key' => 'min_rate', 'value' => $snap_locate, 'compare' => '<=');
         }
         if (count($args_filter['meta_query']) > 1) {
             $args_filter['meta_query']['relation'] = 'AND';
         }
         $this->results = $model->getDataSearch($args_filter);
         $this->total_count = $model->total_count;
     }
     parent::display($tmpl, false);
 }
Beispiel #14
0
 function ajax_delete_message()
 {
     $model = SnapJobs::getModel('message');
     $result = $model->deleteMessage();
     echo json_encode($result);
     exit;
 }