Exemple #1
0
 public function notify_ye_consultants($_buffer_id, $_country = 'my')
 {
     if (empty($_buffer_id) || $_buffer_id <= 0 || $_buffer_id === false) {
         $this->error = 'notify_ye_consultants : the buffer_id is invalid.';
         return false;
     }
     if (!array_key_exists(strtoupper($_country), $this->available_ye_branches)) {
         $_country = 'MY';
     }
     $buffer = new ReferralBuffer($_buffer_id);
     $result = $buffer->get();
     $job = new Job($result[0]['job']);
     $has_resume = 'YES';
     if (is_null($result[0]['existing_resume_id']) && is_null($result[0]['resume_file_hash'])) {
         $has_resume = 'NO';
     }
     $branch_email = 'team.' . strtolower($_country) . '@yellowelevator.com';
     $this->log_api_usage('notify_ye_consultants : ' . $_buffer_id . ' send to ' . $branch_email);
     $mail_lines = file(dirname(__FILE__) . '/../../mail/new_referral.txt');
     $message = '';
     foreach ($mail_lines as $line) {
         $message .= $line;
     }
     $message = str_replace('%referrer%', htmlspecialchars_decode(stripslashes($result[0]['referrer_name'])), $message);
     $message = str_replace('%candidate%', htmlspecialchars_decode(stripslashes($result[0]['candidate_name'])), $message);
     $message = str_replace('%referrer_email%', $result[0]['referrer_email'], $message);
     $message = str_replace('%candidate_email%', $result[0]['candidate_email'], $message);
     $message = str_replace('%request_on%', $result[0]['requested_on'], $message);
     $message = str_replace('%job_title%', $job->getTitle(), $message);
     $message = str_replace('%has_resume%', $has_resume, $message);
     $subject = "[Facebook] New Referral for " . $job->getTitle() . " position";
     $headers = 'From: YellowElevator.com <*****@*****.**>' . "\n";
     mail($branch_email, $subject, $message, $headers);
     // $handle = fopen('/tmp/email_to_'. $branch_email. '.txt', 'w');
     // fwrite($handle, 'Subject: '. $subject. "\n\n");
     // fwrite($handle, $message);
     // fclose($handle);
     return true;
 }
Exemple #2
0
<?php

require_once dirname(__FILE__) . '/private/lib/utilities.php';
if (!isset($_GET['id'])) {
    redirect_to('welcome.php');
}
$referral_buffer = new ReferralBuffer($_GET['id']);
// check whether the buffer has been updated before
// does the buffer exists?
$result = $referral_buffer->get();
if ($result === false || is_null($result) || empty($result)) {
    // no
    redirect_to($GLOBALS['protocol'] . '://' . $GLOBALS['root'] . '/index.php');
    exit;
}
// already responded?
if (!is_null($result[0]['candidate_response']) && !is_null($result[0]['candidate_responded_on'])) {
    // yes
    redirect_to($GLOBALS['protocol'] . '://' . $GLOBALS['root'] . '/index.php');
    exit;
}
// proceed
$data['candidate_response'] = 'no';
$data['candidate_responded_on'] = now();
$referral_buffer->update($data);
redirect_to($GLOBALS['protocol'] . '://' . $GLOBALS['root'] . '/index.php');
exit;
Exemple #3
0
    }
    $message = str_replace('%member_name%', $member->getFullName(), $message);
    $message = str_replace('%referee_name%', $candidate->getFullName(), $message);
    $message = str_replace('%employer%', $employer->getName(), $message);
    $message = str_replace('%job_title%', $job['title'], $message);
    $message = str_replace('%protocol%', $GLOBALS['protocol'], $message);
    $message = str_replace('%root%', $GLOBALS['root'], $message);
    $subject = desanitize($candidate->getFullName()) . " was successfully employed!";
    $headers = 'From: YellowElevator.com <*****@*****.**>' . "\n";
    mail($member->getId(), $subject, $message, $headers);
    echo 'ok';
    exit;
}
if ($_POST['action'] == 'get_referrer_remarks') {
    $referral_buffer = new ReferralBuffer($_POST['id']);
    $record = $referral_buffer->get();
    $remark = trim(htmlspecialchars_decode(stripslashes($record[0]['referrer_remarks'])));
    $remark = str_replace('<br/>', "\n", $remark);
    echo strip_tags($remark);
    exit;
}
if ($_POST['action'] == 'save_referrer_remarks') {
    $data = array();
    $data['referrer_remarks'] = $_POST['remarks'];
    $data['referrer_remarks'] .= "\n\n--- " . date('Y-m-d H:i') . " ---\n\n";
    $referral_buffer = new ReferralBuffer($_POST['id']);
    if ($referral_buffer->update($data) === false) {
        echo 'ko';
        exit;
    }
    echo 'ok';