Esempio n. 1
0
 /**
  * Get a duplicate no-op version of a job
  *
  * @param Job $job
  * @return Job
  */
 public static function newFromJob(Job $job)
 {
     $djob = new self($job->getTitle(), $job->getParams());
     $djob->command = $job->getType();
     $djob->params = is_array($djob->params) ? $djob->params : array();
     $djob->params = array('isDuplicate' => true) + $djob->params;
     $djob->metadata = $job->metadata;
     return $djob;
 }
Esempio n. 2
0
 /**
  * @param $job Job
  * @return array
  */
 protected function insertFields(Job $job)
 {
     list($dbw, $scope) = $this->getMasterDB();
     return array('job_cmd' => $job->getType(), 'job_namespace' => $job->getTitle()->getNamespace(), 'job_title' => $job->getTitle()->getDBkey(), 'job_params' => self::makeBlob($job->getParams()), 'job_id' => $dbw->nextSequenceValue('job_job_id_seq'), 'job_timestamp' => $dbw->timestamp(), 'job_sha1' => wfBaseConvert(sha1(serialize($job->getDeduplicationInfo())), 16, 36, 31), 'job_random' => mt_rand(0, self::MAX_JOB_RANDOM));
 }
Esempio n. 3
0
 /**
  * @param $job Job
  * @return array
  */
 protected function getNewJobFields(Job $job)
 {
     return array('type' => $job->getType(), 'namespace' => $job->getTitle()->getNamespace(), 'title' => $job->getTitle()->getDBkey(), 'params' => $job->getParams(), 'rtimestamp' => $job->getReleaseTimestamp() ?: 0, 'uuid' => UIDGenerator::newRawUUIDv4(UIDGenerator::QUICK_RAND), 'sha1' => $job->ignoreDuplicates() ? wfBaseConvert(sha1(serialize($job->getDeduplicationInfo())), 16, 36, 31) : '', 'timestamp' => time());
 }
Esempio n. 4
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;
 }
Esempio n. 5
0
	/**
	 * @param $job Job
	 * @return array
	 */
	protected function getNewJobFields( Job $job ) {
		return array(
			// Fields that describe the nature of the job
			'type'       => $job->getType(),
			'namespace'  => $job->getTitle()->getNamespace(),
			'title'      => $job->getTitle()->getDBkey(),
			'params'     => $job->getParams(),
			// Some jobs cannot run until a "release timestamp"
			'rtimestamp' => $job->getReleaseTimestamp() ?: 0,
			// Additional job metadata
			'uuid'       => UIDGenerator::newRawUUIDv4( UIDGenerator::QUICK_RAND ),
			'sha1'       => $job->ignoreDuplicates()
				? wfBaseConvert( sha1( serialize( $job->getDeduplicationInfo() ) ), 16, 36, 31 )
				: '',
			'timestamp'  => time() // UNIX timestamp
		);
	}
Esempio n. 6
0
<?php

require_once __DIR__ . "/../vendor/autoload.php";
require_once __DIR__ . "/../src/Job.php";
require_once __DIR__ . "/../src/Contact.php";
$app = new Silex\Application();
$app->get("/", function () {
    return "\n            <!DOCTYPE html>\n            <html>\n                <head>\n                    <link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css' integrity='sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7' crossorigin='anonymous'>\n                    <title>Post a Job Opening</title>\n                </head>\n                <body>\n                    <div class='container'>\n                        <h1>Post a Job Opening</h1>\n                        <form action='/view_jobs'>\n                            <div class='form-group'>\n                                <label for='title'>Enter Job Title:</label>\n                                <input id='title' name='title' class='form-control' type='text'>\n                            </div>\n                            <div class='form-group'>\n                                <label for='description'>Enter Job Description:</label>\n                                <input id='description' name='description' class='form-control' type='text'>\n                            </div>\n                            <div class='form-group'>\n                                <label for='salary'>Enter Job Salary:</label>\n                                <input id='salary' name='salary' class='form-control' type='text'>\n                            </div>\n                            <div class='form-group'>\n                                <label for='name'>Enter Contact Name:</label>\n                                <input id='name' name='name' class='form-control' type='text'>\n                            </div>\n                            <div class='form-group'>\n                                <label for='email'>Enter Contact Email:</label>\n                                <input id='email' name='email' class='form-control' type='text'>\n                            </div>\n                            <div class='form-group'>\n                                <label for='number'>Enter Contact Phone #:</label>\n                                <input id='number' name='number' class='form-control' type='text'>\n                            </div>\n\n                            <button type='submit' class='btn-success'>Submit</button>\n                        </form>\n                    </div>\n                </body>\n            </html>\n            ";
});
$app->get("/view_jobs", function () {
    $new_contact = new Contact($_GET['name'], $_GET['email'], $_GET['number']);
    $my_job = new Job($_GET['title'], $_GET['description'], $_GET['salary'], $new_contact);
    $current_contact = $my_job->getContact();
    //the line below would over ride any inputted name with Bob
    // $current_contact->setName("Bob");
    $contact_name = $current_contact->getName();
    $contact_email = $current_contact->getEmail();
    $contact_number = $current_contact->getNumber();
    $output = "<div class='row'>\n                <div class='col-md-6'>\n                    <p>Job Title: " . $my_job->getTitle() . "</p>\n                    <p>Job Description: " . $my_job->getDescription() . "</p>\n                    <p>Salary: " . $my_job->getSalary() . "</p>\n                    <p>Contact Name: " . $contact_name . "</p>\n                    <p>Contact Email: " . $contact_email . "</p>\n                    <p>Contact Phone #: " . $contact_number . "</p>\n                </div>\n                ";
    return $output;
});
return $app;
Esempio n. 7
0
	/**
	 * @param $job Job
	 * @return array
	 */
	protected function insertFields( Job $job ) {
		$dbw = $this->getMasterDB();
		return array(
			// Fields that describe the nature of the job
			'job_cmd'       => $job->getType(),
			'job_namespace' => $job->getTitle()->getNamespace(),
			'job_title'     => $job->getTitle()->getDBkey(),
			'job_params'    => self::makeBlob( $job->getParams() ),
			// Additional job metadata
			'job_id'        => $dbw->nextSequenceValue( 'job_job_id_seq' ),
			'job_timestamp' => $dbw->timestamp(),
			'job_sha1'      => wfBaseConvert(
				sha1( serialize( $job->getDeduplicationInfo() ) ),
				16, 36, 31
			),
			'job_random'    => mt_rand( 0, self::MAX_JOB_RANDOM )
		);
	}
Esempio n. 8
0
		<?php 
include 'sidebar.php';
?>
		</div>
		<div id="content" style="float:right;width:85%;">
			<table>
				<tr><td style="width:200px;">Job</td>
					<td style="width:200px;">Title</td>
					<td style="width:200px;">Vehicle</td>
					<td style="width:200px;">Driver</td>
					<td style="width:200px;">Action</td>
				</tr>
				<?php 
for ($i = 0; $i < sizeof($mJobList); $i++) {
    $mJob = new Job($mJobList[$i]);
    $mVehicle = new Vehicle($mJob->getVehicle());
    $mDriver = new Driver($mJob->getDriver());
    echo "<tr>";
    echo "<td><a href='detail.php?id=" . $mJob->getId() . "'>" . $mJob->getCode() . "</a></td>";
    echo "<td>" . $mJob->getTitle() . "</td>";
    echo "<td><a href='../vehicle/detail.php?id=" . $mVehicle->getId() . "'>" . $mVehicle->getVehicleNumber() . "</a></td>";
    echo "<td><a href='../driver/detail.php?id=" . $mDriver->getId() . "'>" . $mDriver->getName() . "</a></td>";
    echo "<td><input type='submit' value='Assign'><input type='submit' value='Track'></td>";
    echo "</tr>";
}
?>
			</table>
		<div>
	</div>
	
</body> 
Esempio n. 9
0
 /**
  * @param $job Job
  * @return array
  */
 protected function insertFields(Job $job)
 {
     // Rows that describe the nature of the job
     $descFields = array('job_cmd' => $job->getType(), 'job_namespace' => $job->getTitle()->getNamespace(), 'job_title' => $job->getTitle()->getDBkey(), 'job_params' => self::makeBlob($job->getParams()));
     // Additional job metadata
     if ($this->order === 'timestamp') {
         // oldest first
         $random = time() - 1325376000;
         // seconds since "January 1, 2012"
     } else {
         // random first
         $random = mt_rand(0, self::MAX_JOB_RANDOM);
     }
     $dbw = $this->getMasterDB();
     $metaFields = array('job_id' => $dbw->nextSequenceValue('job_job_id_seq'), 'job_timestamp' => $dbw->timestamp(), 'job_sha1' => wfBaseConvert(sha1(serialize($descFields)), 16, 36, 32), 'job_random' => $random);
     return $descFields + $metaFields;
 }
Esempio n. 10
0
}
$candidate_current_position = '(None provided)';
if (!empty($candidate['current_position'])) {
    $candidate_current_position = htmlspecialchars_decode(stripslashes($candidate['current_position']));
}
if (!empty($_POST['current_employer'])) {
    $candidate_current_position .= '(' . htmlspecialchars_decode(stripslashes($candidate['current_employer'])) . ')';
}
$message = str_replace('%employer_id%', $employer_id, $message);
$message = str_replace('%employer%', $candidate['current_employer'], $message);
$message = str_replace('%candidate%', htmlspecialchars_decode(stripslashes($candidate['name'])), $message);
$message = str_replace('%candidate_phone%', $candidate['phone_num'], $message);
$message = str_replace('%candidate_email%', $candidate['email_addr'], $message);
$message = str_replace('%candidate_current_position%', $candidate_current_position, $message);
$message = str_replace('%request_on%', $today, $message);
$message = str_replace('%job_title%', $job->getTitle(), $message);
$message = str_replace('%has_resume%', $has_resume, $message);
$subject = "New Application for " . $job->getTitle() . " position";
$headers = 'From: YellowElevator.com <*****@*****.**>' . "\n";
$body = '';
if (!empty($file_type)) {
    $headers .= 'MIME-Version: 1.0' . "\n";
    $headers .= 'Content-Type: multipart/mixed; boundary="yel_mail_sep_' . $filename . '";' . "\n\n";
    $body = '--yel_mail_sep_' . $filename . "\n";
    $body .= 'Content-Type: multipart/alternative; boundary="yel_mail_sep_alt_' . $filename . '"' . "\n";
    $body .= '--yel_mail_sep_alt_' . $filename . "\n";
    $body .= 'Content-Type: text/plain; charset="iso-8859-1"' . "\n";
    $body .= 'Content-Transfer-Encoding: 7bit"' . "\n";
}
$body .= $message . "\n";
if (!empty($file_type)) {
Esempio n. 11
0
 }
 // Send a yes/no email to each candidate. reveal the name of the referrer if is_reveal_name is set to 1
 $mail_lines = file(dirname(__FILE__) . '/private/mail/new_referral_confirm.txt');
 $message = '';
 foreach ($mail_lines as $line) {
     $message .= $line;
 }
 $criteria = array('columns' => 'jobs.*, industries.industry AS full_industry, 
                   employers.name AS employer_name, branches.currency', 'joins' => 'industries ON industries.id = jobs.industry, 
                 countries ON countries.country_code = jobs.country, 
                 employers ON employers.id = jobs.employer, 
                 employees ON employees.id = employers.registered_by, 
                 branches ON branches.id = employees.branch', 'match' => "jobs.id = " . $job->getId(), 'limit' => "1");
 $job_result = $job->find($criteria);
 $message = str_replace('%requested_on%', date('M j, Y'), $message);
 $message = str_replace('%job_title%', $job->getTitle(), $message);
 $message = str_replace('%job_id%', $job->getId(), $message);
 $message = str_replace('%employer%', $job_result[0]['employer_name'], $message);
 $message = str_replace('%buffer_id%', $buffer_id, $message);
 $message = str_replace('%candidate_name%', htmlspecialchars_decode(stripslashes($candidate['name'])), $message);
 $message = str_replace('%industry%', $job_result[0]['full_industry'], $message);
 $currency = $job_result[0]['currency'];
 $salary_range = $currency . ' $' . number_format($job_result[0]['salary']);
 if (!is_null($job_result[0]['salary_end']) && $job_result[0]['salary_end'] > 0) {
     $salary_range .= ' - ' . number_format($job_result[0]['salary_end']);
 }
 $message = str_replace('%salary_range%', $salary_range, $message);
 $message = str_replace('%reward%', $currency . ' $' . number_format($job_result[0]['potential_reward']), $message);
 $total_potential_reward = $job_result[0]['potential_reward'];
 $potential_token_reward = $total_potential_reward * 0.05;
 $potential_reward = $total_potential_reward - $potential_token_reward;