/**
  * Serialize the form into the database.
  *
  */
 public function save($con = null)
 {
     if ($this->getObject()) {
         $j = $this->getObject();
     } else {
         $j = new Job();
     }
     $j->setPublicationId($this->getValue("publication_id"));
     $j->setStatusId($this->getValue("status_id"));
     $j->setEvent($this->getValue("event"));
     $j->setDate($this->getValue("date"));
     $j->setStartTime($this->getValue("start_time"));
     $j->setEndTime($this->getValue("end_time"));
     $j->setDueDate($this->getValue("due_date"));
     $j->setContactName($this->getValue("contact_name"));
     $j->setContactPhone($this->getValue("contact_phone"));
     $j->setContactEmail($this->getValue("contact_email"));
     $j->setAcctNum($this->getValue("acct_num"));
     $j->save();
     $logEntry = new Log();
     $logEntry->setWhen(time());
     $logEntry->setPropelClass("Job");
     $logEntry->setSfGuardUserProfileId(sfContext::getInstance()->getUser()->getUserId());
     $logEntry->setMessage("Basic info updated.");
     $logEntry->setLogMessageTypeId(sfConfig::get("app_log_type_update"));
     $logEntry->setPropelId($j->getId());
     $logEntry->save();
 }
 /**
  * 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(), $job->getId());
     $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;
 }
示例#3
0
 /**
  * Form builder
  *
  * @param FormBuilderInterface $builder
  * @param array $options
  *
  * @return null
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $this->company = $options['company'];
     $this->job = $options['job'];
     if (null == $this->company) {
         $builder->add('company', EntityType::class, array('label' => 'CompanyFrame.company.label', 'class' => 'AcfDataBundle:Company', 'query_builder' => function (CompanyRepository $br) {
             return $br->createQueryBuilder('c')->orderBy('c.corporateName', 'ASC');
         }, 'choice_label' => 'corporateName', 'multiple' => false, 'by_reference' => true, 'required' => true));
     } else {
         $companyId = $this->company->getId();
         $builder->add('company', EntityidType::class, array('label' => 'CompanyFrame.company.label', 'class' => 'AcfDataBundle:Company', 'query_builder' => function (CompanyRepository $br) use($companyId) {
             return $br->createQueryBuilder('c')->where('c.id = :id')->setParameter('id', $companyId)->orderBy('c.corporateName', 'ASC');
         }, 'choice_label' => 'id', 'multiple' => false, 'by_reference' => true, 'required' => true));
     }
     if (null == $this->job) {
         $builder->add('job', EntityType::class, array('label' => 'CompanyFrame.job.label', 'class' => 'AcfDataBundle:Job', 'query_builder' => function (JobRepository $br) {
             return $br->createQueryBuilder('j')->orderBy('j.label', 'ASC');
         }, 'choice_label' => 'label', 'multiple' => false, 'by_reference' => true, 'required' => true));
     } else {
         $jobId = $this->job->getId();
         $builder->add('job', EntityidType::class, array('label' => 'CompanyFrame.job.label', 'class' => 'AcfDataBundle:Job', 'query_builder' => function (JobRepository $br) use($jobId) {
             return $br->createQueryBuilder('j')->where('j.id = :id')->setParameter('id', $jobId)->orderBy('j.label', 'ASC');
         }, 'choice_label' => 'id', 'multiple' => false, 'by_reference' => true, 'required' => true));
     }
     $builder->add('sexe', ChoiceType::class, array('label' => 'CompanyFrame.sexe.label', 'choices_as_values' => true, 'choices' => CompanyFrame::choiceSexe(), 'attr' => array('choice_label_trans' => true)));
     $builder->add('firstName', TextType::class, array('label' => 'CompanyFrame.firstName.label'));
     $builder->add('lastName', TextType::class, array('label' => 'CompanyFrame.lastName.label'));
     $builder->add('cin', TextType::class, array('label' => 'CompanyFrame.cin.label', 'required' => false));
     $builder->add('passport', TextType::class, array('label' => 'CompanyFrame.passport.label', 'required' => false));
     $builder->add('email', EmailType::class, array('label' => 'CompanyFrame.email.label', 'required' => false));
     $builder->add('phone', TextType::class, array('label' => 'CompanyFrame.phone.label', 'required' => false));
     $builder->add('mobile', TextType::class, array('label' => 'CompanyFrame.mobile.label', 'required' => false));
     $builder->add('streetNum', IntegerType::class, array('label' => 'CompanyFrame.streetNum.label', 'scale' => 0, 'required' => false));
     $builder->add('address', TextareaType::class, array('label' => 'CompanyFrame.address.label', 'required' => false));
     $builder->add('address2', TextareaType::class, array('label' => 'CompanyFrame.address2.label', 'required' => false));
     $builder->add('town', TextType::class, array('label' => 'CompanyFrame.town.label', 'required' => false));
     $builder->add('zipCode', TextType::class, array('label' => 'CompanyFrame.zipCode.label', 'required' => false));
     $builder->add('country', CountryType::class, array('label' => 'CompanyFrame.country.label', 'required' => false, 'placeholder' => 'Options.choose', 'empty_data' => null));
     $builder->add('otherInfos', TextareaType::class, array('label' => 'CompanyFrame.otherInfos.label', 'required' => false));
 }
示例#4
0
 /**
  * Returns an array of jobs for the specified job identifiers, keyed by job identifier
  *
  * @param string[] $jids
  *
  * @return array|Job[]
  */
 public function multiget($jids)
 {
     if (empty($jids)) {
         return [];
     }
     $results = call_user_func_array([$this->client, 'multiget'], $jids);
     $jobs = json_decode($results, true);
     $ret = [];
     foreach ($jobs as $job_data) {
         $job = new Job($this->client, $job_data);
         $ret[$job->getId()] = $job;
     }
     return $ret;
 }
 /**
  * Serialize the form into the database.
  *
  */
 public function save($con = null)
 {
     if ($this->getObject()) {
         $j = $this->getObject();
     } else {
         $j = new Job();
     }
     $j->setEstimate($this->getValue("estimate"));
     $j->setProcessing($this->getValue("processing"));
     $j->save();
     $logEntry = new Log();
     $logEntry->setWhen(time());
     $logEntry->setPropelClass("Job");
     $logEntry->setSfGuardUserProfileId(sfContext::getInstance()->getUser()->getUserId());
     $logEntry->setMessage("Billing info updated.");
     $logEntry->setLogMessageTypeId(sfConfig::get("app_log_type_update"));
     $logEntry->setPropelId($j->getId());
     $logEntry->save();
 }
 /**
  * Serialize the form into the database.
  *
  */
 public function save($con = null)
 {
     if ($this->getObject()) {
         $j = $this->getObject();
     } else {
         $j = new Job();
     }
     $j->setState($this->getValue("state"));
     $j->setCity($this->getValue("city"));
     $j->setZip($this->getValue("zip"));
     $j->setStreet($this->getValue("street"));
     $j->save();
     $logEntry = new Log();
     $logEntry->setWhen(time());
     $logEntry->setPropelClass("Job");
     $logEntry->setSfGuardUserProfileId(sfContext::getInstance()->getUser()->getUserId());
     $logEntry->setMessage("Shoot info updated.");
     $logEntry->setLogMessageTypeId(sfConfig::get("app_log_type_update"));
     $logEntry->setPropelId($j->getId());
     $logEntry->save();
 }
 /**
  * Serialize the form into the database.
  *
  */
 public function save($con = null)
 {
     if ($this->getObject()) {
         $j = $this->getObject();
     } else {
         $j = new Job();
     }
     $j->setPhotoType(implode(", ", $this->getValue("photo_type")));
     $j->setQues1($this->getValue("ques1"));
     $j->setQues2($this->getValue("ques2"));
     $j->setQues3($this->getValue("ques3"));
     $j->setOther($this->getValue("other"));
     $j->save();
     $logEntry = new Log();
     $logEntry->setWhen(time());
     $logEntry->setPropelClass("Job");
     $logEntry->setSfGuardUserProfileId(sfContext::getInstance()->getUser()->getUserId());
     $logEntry->setMessage("Photography info updated.");
     $logEntry->setLogMessageTypeId(sfConfig::get("app_log_type_update"));
     $logEntry->setPropelId($j->getId());
     $logEntry->save();
 }
 /**
  * Declares an association between this object and a Job object.
  *
  * @param      Job $v
  * @return     JobPhotographer The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setJob(Job $v = null)
 {
     if ($v === null) {
         $this->setJobId(NULL);
     } else {
         $this->setJobId($v->getId());
     }
     $this->aJob = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Job object, it will not be re-added.
     if ($v !== null) {
         $v->addJobPhotographer($this);
     }
     return $this;
 }
 /**
  * Test related method
  */
 public function testGetId()
 {
     $this->assertNull($this->jobInstance->getId());
 }
示例#10
0
文件: job.php 项目: pamalite/yel
$job = new Job();
$date = date('Y-m-d H:i:s');
$expiry_date = sql_date_add($date, 30, 'day');
$data = array();
$data['employer'] = 'acme123';
$data['industry'] = '2';
$data['country'] = 'SG';
$data['currency'] = 'MYR';
$data['salary'] = '3200';
$data['salary_negotiable'] = 'N';
$data['created_on'] = $date;
$data['expire_on'] = $expiry_date;
$data['title'] = "Some lame job";
$data['description'] = "blahlelelll blah... some job descriptions goes here";
if ($job->create($data)) {
    echo "This job gets the ID of <b>" . $job->getId() . "</b><br><br>";
    print_array($job->get());
} else {
    echo "failed";
    exit;
}
?>
</p><p style="font-weight: bold;">Get all jobs... </p><p><?php 
$jobs = $job->find(array('columns' => 'id'));
echo "There are " . count($jobs) . " jobs in the database.<br><br>";
?>
</p><p style="font-weight: bold;">Update 1st job... </p><p><?php 
echo $first_job_id . '<br/>';
$job = new Job($first_job_id);
$data = array();
$data['country'] = 'HK';
示例#11
0
 /**
  * set the lastRun of $job to now
  *
  * @param Job $job
  */
 public function setLastRun($job)
 {
     $query = \OC_DB::prepare('UPDATE `*PREFIX*jobs` SET `last_run` = ? WHERE `id` = ?');
     $query->execute(array(time(), $job->getId()));
 }
示例#12
0
 /**
  * @see JobQueue::doAck()
  * @return Job|bool
  */
 protected function doAck(Job $job)
 {
     $dbw = $this->getMasterDB();
     $dbw->commit(__METHOD__, 'flush');
     // flush existing transaction
     $autoTrx = $dbw->getFlag(DBO_TRX);
     // automatic begin() enabled?
     $dbw->clearFlag(DBO_TRX);
     // make each query its own transaction
     try {
         // Delete a row with a single DELETE without holding row locks over RTTs...
         $dbw->delete('job', array('job_cmd' => $this->type, 'job_id' => $job->getId()));
     } catch (Exception $e) {
         $dbw->setFlag($autoTrx ? DBO_TRX : 0);
         // restore automatic begin()
         throw $e;
     }
     $dbw->setFlag($autoTrx ? DBO_TRX : 0);
     // restore automatic begin()
     return true;
 }
示例#13
0
require_once dirname(__FILE__) . '/private/lib/utilities.php';
session_start();
if (!isset($_POST['job_id'])) {
    redirect_to('welcome.php');
}
// 1. initialize the parameters
$candidate = array();
$candidate['email_addr'] = sanitize($_POST['apply_email']);
$candidate['phone_num'] = sanitize($_POST['apply_phone']);
$candidate['name'] = sanitize(stripslashes($_POST['apply_name']));
$candidate['current_position'] = sanitize(stripslashes($_POST['apply_current_pos']));
$candidate['current_employer'] = sanitize(stripslashes($_POST['apply_current_emp']));
$job_id = $_POST['job_id'];
$job = new Job($job_id);
// get employer info
$criteria = array('columns' => "jobs.employer, employers.name AS employer_name", 'joins' => "employers ON employers.id = jobs.employer", 'match' => "jobs.id = " . $job->getId(), 'limit' => "1");
$result = $job->find($criteria);
$employer_id = $result[0]['employer'];
$employer_name = $result[0]['employer_name'];
$today = now();
// 2. store the contacts
$country_code = strtolower($_SESSION['yel']['country_code']);
if (isset($_SESSION['yel']['member']['id']) && !empty($_SESSION['yel']['member']['id'])) {
    $member = new Member($_SESSION['yel']['member']['id']);
    $country_code = strtolower($member->getCountry());
    if (is_null($country_code) || empty($country_code) || $country_code === false) {
        $country_code = 'my';
    }
}
//$branch_email = 'team.'. $country_code. '@yellowelevator.com';
$branch_email = '*****@*****.**';
示例#14
0
$today = now();
// 2. store the contacts
$data = array();
$data['requested_on'] = $today;
$data['referrer_email'] = $referrer['email_addr'];
$data['referrer_phone'] = $referrer['phone_num'];
$data['referrer_name'] = $referrer['name'];
$data['is_reveal_name'] = $referrer['is_reveal_name'];
// loop through the number of candidates
$has_error = false;
$error_candidates = array();
foreach ($candidates as $i => $candidate) {
    $data['candidate_email'] = $candidate['email_addr'];
    $data['candidate_phone'] = $candidate['phone_num'];
    $data['candidate_name'] = $candidate['name'];
    $data['job'] = $job->getId();
    $data['via_social_connection'] = $candidate['social'];
    $data['current_position'] = $candidate['current_position'];
    $data['current_employer'] = $candidate['current_employer'];
    $data['referrer_remarks'] = 'NULL';
    $referral_buffer = new ReferralBuffer();
    $buffer_id = $referral_buffer->create($data);
    if ($buffer_id === false) {
        $has_error = true;
        $error_candidates[] = array('email_addr' => $candidate['email_addr'], 'name' => $candidate['name']);
        continue;
    }
    // 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) {
示例#15
0
 /**
  * @method boolean forceRegisterJob(Job $job) registers an Job to JobManager regardless of whether id of job is already registered.
  * @param Job $job The job to register.
  */
 public static function forceRegisterJob(Job $job)
 {
     self::$jobs[$job->getId()] = $job;
 }
 /**
  * @see JobQueue::doAck()
  * @param Job $job
  * @throws MWException
  * @return Job|bool
  */
 protected function doAck(Job $job)
 {
     if (!$job->getId()) {
         throw new MWException("Job of type '{$job->getType()}' has no ID.");
     }
     list($dbw, $scope) = $this->getMasterDB();
     $dbw->commit(__METHOD__, 'flush');
     // flush existing transaction
     $autoTrx = $dbw->getFlag(DBO_TRX);
     // get current setting
     $dbw->clearFlag(DBO_TRX);
     // make each query its own transaction
     $scopedReset = new ScopedCallback(function () use($dbw, $autoTrx) {
         $dbw->setFlag($autoTrx ? DBO_TRX : 0);
         // restore old setting
     });
     // Delete a row with a single DELETE without holding row locks over RTTs...
     $dbw->delete('job', array('job_cmd' => $this->type, 'job_id' => $job->getId()), __METHOD__);
     return true;
 }
示例#17
0
 /**
  * Exclude object from result
  *
  * @param   Job $job Object to remove from the list of results
  *
  * @return JobQuery The current query, for fluid interface
  */
 public function prune($job = null)
 {
     if ($job) {
         $this->addUsingAlias(JobPeer::ID, $job->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
示例#18
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> 
示例#19
0
文件: Worker.php 项目: blar/beanstalk
 /**
  * @param \Blar\Beanstalk\Job $job
  */
 public function completeJob(Job $job)
 {
     $this->getBeanstalk()->removeJob($job->getId());
 }
示例#20
0
文件: Queue.php 项目: e-ruiz/brick
 /**
  * Removes a finished job from the queue.
  *
  * @param Job $job The job to remove.
  *
  * @return boolean Whether the job has been sucessfully removed.
  */
 public function remove(Job $job)
 {
     $this->executeStatement($this->removeJobStatement, [$job->getId()]);
     return $this->removeJobStatement->rowCount() != 0;
 }
示例#21
0
 public function testGetId()
 {
     $this->assertNull($this->jobExecution->getId());
 }
示例#22
0
 $is_test_site = false;
 foreach ($tmp as $t) {
     if ($t == 'yel') {
         $is_test_site = true;
         break;
     }
 }
 // send an email to consultant about the job is being assigned
 $employee = new Employee($_POST['employee']);
 $employer = new Employer($_POST['employer']);
 $lines = file(dirname(__FILE__) . '/../private/mail/employee_job_assignment.txt');
 $message = '';
 foreach ($lines as $line) {
     $message .= $line;
 }
 $message = str_replace('%job_id%', $job->getId(), $message);
 $message = str_replace('%job%', $_POST['title'], $message);
 $message = str_replace('%employer%', $employer->getName(), $message);
 $message = str_replace('%country%', Country::getCountryFrom($_POST['country']), $message);
 $message = str_replace('%is_exec%', $_POST['is_executive'] == '1' ? 'Yes' : 'No', $message);
 $message = str_replace('%expiry%', $job->getExpiryDate(), $message);
 $subject = $_POST['title'] . ' position has been assigned to you';
 $headers = 'From: YellowElevator.com <*****@*****.**>' . "\n";
 mail($employee->getEmailAddress(), $subject, $body, $headers);
 // $handle = fopen('/tmp/email_to_'. $employee->getEmailAddress(). '.txt', 'w');
 // fwrite($handle, 'Subject: '. $subject. "\n\n");
 // fwrite($handle, $body);
 // fclose($handle);
 // Tweet about this job, if it is new
 if ($new_id > 0 && !$is_test_site) {
     $employer = htmlspecialchars_decode(stripslashes($employer->getName()));
示例#23
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      Job $obj A Job object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool($obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         JobPeer::$instances[$key] = $obj;
     }
 }
示例#24
0
文件: Job.php 项目: 0x20h/phloppy
 /**
  * Job Factory method.
  *
  * @param array $args
  * @return Job
  */
 public static function create(array $args)
 {
     $job = new Job($args['body']);
     if (isset($args['id'])) {
         $job->setId($args['id']);
         $job->setTtl(hexdec(substr($job->getId(), -4)));
     }
     if (isset($args['queue'])) {
         $job->setQueue($args['queue']);
     }
     if (isset($args['ttl'])) {
         $job->setTtl($args['ttl']);
     }
     if (isset($args['retry'])) {
         $job->setRetry($args['retry']);
     }
     return $job;
 }