Esempio n. 1
0
if ($_POST['action'] == 'extend_job') {
    $employer = new Employer($_POST['employer']);
    // check whether employer can use free job posting?
    if ($employer->hasFreeJobPostings() === false) {
        // check whether employer has paid job postings?
        if ($employer->hasPaidJobPostings() === false) {
            // check whether subscription has expired
            $result = $employer->getSubscriptionsDetails();
            if ($result[0]['expired'] < 0 || $result[0]['subscription_suspended'] != '0') {
                echo '-2';
                exit;
            }
        } else {
            $employer->usedPaidJobPosting();
        }
    } else {
        $employer->usedFreeJobPosting();
    }
    $job = new Job($_POST['id']);
    if ($job->extend() === false) {
        echo 'ko';
        exit;
    }
    echo 'ok';
    exit;
}
if ($_POST['action'] == 'preview_job_desc') {
    $_POST['desc'] = str_replace(array("\r\n", "\r", "\n"), '<br/>', $_POST['desc']);
    echo format_job_description($_POST['desc']);
    exit;
}
Esempio n. 2
0
 public function show($_from_search = false)
 {
     $this->begin();
     $this->top_search("Job Details");
     if (!is_null($this->member)) {
         $this->menu('member');
     }
     $this->howitworks();
     $job = $this->job;
     $career = $this->get_member_career();
     $error_message = '';
     if (count($job) <= 0 || is_null($job)) {
         $error_message = 'The job that you are looking for cannot be found.';
     } else {
         if ($job === false) {
             $error_message = 'An error occured while loading the job details.';
         } else {
             if ($job['expired'] >= 0 || $job['closed'] == 'Y') {
                 // $error_message = 'The job that you are looking for is no longer available.';
             }
         }
     }
     // format tags to HTML
     $job['description'] = format_job_description($job['description']);
     $page = file_get_contents(dirname(__FILE__) . '/../../../html/job_page.html');
     $page = str_replace('%root%', $this->url_root, $page);
     $page = str_replace('%job_id%', $this->job_id, $page);
     $toggle = '';
     if (is_null($this->member)) {
         $toggle = '<div class="howitworks_pulldown_bar">
             <div class="pulldown job_page">
                 <a class="no_link how_it_works" onClick="toggle_howitworks();">How Yellow Elevator Works? <img id="howitworks_arrow" src="../common/images/howitworks_down.gif" /></a>
             </div>
         </div>';
     }
     $page = str_replace('%howitworks_toggler%', $toggle, $page);
     if (!empty($error_message)) {
         $page = str_replace('%error_message%', $error_message, $page);
         $page = str_replace('%show_error%', 'block', $page);
         $page = str_replace('%show_job%', 'none', $page);
     } else {
         $page = str_replace('%show_error%', 'none', $page);
         $page = str_replace('%show_job%', 'block', $page);
         $this->add_view_count();
         $page = str_replace('%job_title%', $job['title'], $page);
         $employer_name = $job['employer_name'];
         if (!is_null($job['employer_website_url']) && !empty($job['employer_website_url'])) {
             $employer_name = '<a href="' . $job['employer_website_url'] . '" target="_new">' . $job['employer_name'] . '</a>';
         }
         $page = str_replace('%employer_name%', $employer_name, $page);
         $page = str_replace('%job_description%', $job['description'], $page);
         $employer_country = !is_null($job['state']) && !empty($job['state']) ? $job['state'] . ', ' : '';
         $employer_country .= $job['country_name'];
         $page = str_replace('%employer_country%', $employer_country, $page);
         $page = str_replace('%full_industry%', $job['full_industry'], $page);
         $page = str_replace('%currency%', $job['currency'], $page);
         $salary_range = $job['salary'];
         if ($job['salary_end'] > 0) {
             $salary_range .= ' to ' . $job['salary_end'];
         }
         $page = str_replace('%salary_range%', $salary_range, $page);
         if ($job['salary_negotiable'] == 'Y') {
             $page = str_replace('%negotiable%', '<br/><span class="negotiable">Negotiable</span>', $page);
         } else {
             $page = str_replace('%negotiable%', '', $page);
         }
         $page = str_replace('%expire_on%', $job['formatted_expire_on'], $page);
         $page = str_replace('%potential_reward%', $job['potential_reward'], $page);
         $page = str_replace('%potential_token_reward%', $job['potential_token_reward'], $page);
         if ($_from_search) {
             $page = str_replace('%from_search%', 'default', $page);
         } else {
             $page = str_replace('%from_search%', 'none', $page);
         }
         // popup windows
         // refer
         $refer_form = file_get_contents(dirname(__FILE__) . '/../../../html/job_page_refer_common_form.html');
         if (!is_null($this->member)) {
             $refer_form = file_get_contents(dirname(__FILE__) . '/../../../html/job_page_refer_logged_in_form.html');
             $refer_form = str_replace('%refer_member_id%', $this->member->getId(), $refer_form);
             $refer_form = str_replace('%refer_member_fullname%', $this->member->getFullname(), $refer_form);
             $refer_form = str_replace('%refer_member_phone%', $this->member->getPhone(), $refer_form);
         }
         $page = str_replace('<!-- %refer_form% -->', $refer_form, $page);
         // apply
         $apply_form = file_get_contents(dirname(__FILE__) . '/../../../html/job_page_apply_common_form.html');
         if (!is_null($this->member)) {
             $apply_form = file_get_contents(dirname(__FILE__) . '/../../../html/job_page_apply_logged_in_form.html');
             $apply_form = str_replace('%apply_member_id%', $this->member->getId(), $apply_form);
             $apply_form = str_replace('%apply_member_fullname%', $this->member->getFullname(), $apply_form);
             $apply_form = str_replace('%apply_member_phone%', $this->member->getPhone(), $apply_form);
             $apply_form = str_replace('%apply_current_pos%', $career['current_position'], $apply_form);
             $apply_form = str_replace('%apply_current_emp%', $career['current_employer'], $apply_form);
             $existing_resumes_select = '<select id="existing_resume" name="existing_resume" onChange="toggle_resume_upload();">' . "\n";
             $existing_resumes_select .= '<option value="0" selected>Choose from one of your pre-uploads</option>' . "\n";
             $existing_resumes_select .= '<option value="0" disabled>&nbsp;</option>' . "\n";
             if ($this->member->hasResume()) {
                 $criteria = array('columns' => 'id, file_name', 'match' => "member = '" . $this->member->getId() . "' AND \n                                    is_yel_uploaded = FALSE");
                 $resume = new Resume();
                 $result = $resume->find($criteria);
                 foreach ($result as $row) {
                     $existing_resumes_select .= '<option value="' . $row['id'] . '">' . $row['file_name'] . '</option>' . "\n";
                 }
                 $existing_resumes_select .= '</select> or<br/>' . "\n";
             }
             $apply_form = str_replace('<!-- %existing_resumes_select% -->', $existing_resumes_select, $apply_form);
         }
         $page = str_replace('<!-- %apply_form% -->', $apply_form, $page);
     }
     echo $page;
 }