本文整理汇总了PHP中Job类的典型用法代码示例。如果您正苦于以下问题:PHP Job类的具体用法?PHP Job怎么用?PHP Job使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Job类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param Controller $controller
* @param Job $job (optional)
*/
public function __construct($controller, $job = null)
{
if ($job) {
$fields = $job->getFields();
$required = $job->getValidator();
} else {
$fields = singleton('Job')->getFields();
$required = singleton('Job')->getValidator();
}
$fields->merge(new FieldList(new LiteralField('Conditions', $controller->TermsAndConditionsText), new HiddenField('BackURL', '', $controller->Link('thanks')), new HiddenField('EmailFrom', '', $controller->getJobEmailFromAddress()), new HiddenField('EmailSubject', '', $controller->getJobEmailSubject()), $jobId = new HiddenField('JobID')));
if ($job) {
$jobId->setValue($job->ID);
$actions = new FieldList(new FormAction('doEditJob', _t('Jobboard.EDITLISTING', 'Edit Listing')));
} else {
$actions = new FieldList(new FormAction('doAddJob', _t('JobBoard.CONFIRM', 'Confirm')));
}
parent::__construct($controller, 'AddJobForm', $fields, $actions, $required);
$this->setFormAction('JobBoardFormProcessor/doJobForm');
$this->setFormMethod('POST');
if ($job) {
$this->loadDataFrom($job);
} else {
$this->enableSpamProtection();
}
}
示例2: perform
/**
* args:
* jobid Job ID
* action Action (started, finished, failed).
*/
public function perform()
{
$token = Config::get('ircbridgetoken');
$job = new Job($this->args['jobid']);
$jobdata = $job->getJobData();
$msg = sprintf('[%%02%s%%0f] (%s) - %s - ', $jobdata['jail'], $jobdata['creator'], $jobdata['port']);
switch ($this->args['action']) {
case 'started':
$msg .= 'started';
break;
case 'finished':
$msg .= 'finished (' . $jobdata['buildreason'] . ')';
break;
case 'failed':
$msg .= 'failed';
break;
default:
$msg .= 'unknown';
break;
}
if (file_get_contents('https://redportsircbot-bluelife.rhcloud.com/?token=' . $token . '&msg=' . urlencode($msg)) === false) {
return false;
}
return true;
}
示例3: checkJobs
private function checkJobs()
{
$job = new Job();
// $sql = "SELECT * FROM jobs WHERE type!='time' and datetime<'".date("Y-m-d H:i:s")."'";
$this->todolist = $job->findAll("type!='time' and datetime<:datetime", array('datetime' => date("Y-m-d H:i:s")));
return count($this->todolist);
}
示例4: Display
public function Display()
{
global $db;
$rss_writer_object = new rss_writer_class();
$rss_writer_object->specification = '1.0';
$rss_writer_object->about = BASE_URL . 'rss.xml';
$rss_writer_object->rssnamespaces['dc'] = 'http://purl.org/dc/elements/1.1/';
$properties = array();
if ($this->mCategoryId == 'all') {
$properties['description'] = 'Latest jobs';
} else {
$properties['description'] = 'Latest jobs for ' . ucwords($this->mCategoryName);
}
$properties['link'] = BASE_URL;
$properties['title'] = SITE_NAME;
$properties['dc:date'] = date('d-m-Y');
$rss_writer_object->addchannel($properties);
$count = 0;
$jobb = new Job();
if ($this->mCategoryId == 'all') {
$jobs = $jobb->GetJobs(0, 0, 0, 0, 0, true);
} else {
$jobs = $jobb->GetJobs(0, $this->mCategoryId, 0, 0, 0, true);
}
foreach ($jobs as $job) {
$count++;
if ($count > 10) {
break;
}
$properties = array();
$properties['description'] = '<strong>Location:</strong> ' . $job['location'] . '<br />';
if ($job['url'] != '' && $job['url'] != 'http://') {
$properties['description'] .= '<strong>URL:</strong> <a href="' . $job['url'] . '">' . $job['url'] . '</a><br /><br />';
}
$properties['description'] .= '<strong>Description:</strong><br />' . $job['description'] . '<br /><br />';
$properties['description'] .= '<a href="' . BASE_URL . URL_JOB . '/' . $job['id'] . '/' . $job['url_title'] . '/' . '">Apply to this job</a><br />';
$properties['link'] = BASE_URL . URL_JOB . '/' . $job['id'] . '/' . $job['url_title'] . '/';
$type = '[' . $job['type_name'] . ']';
$properties['title'] = $type . ' ' . $job['title'] . ' at ' . $job['company'];
$properties['dc:date'] = $job['mysql_date'];
$rss_writer_object->additem($properties);
}
if (empty($jobs)) {
$properties = array();
$properties['description'] = ' ';
$properties['description'] .= ' ';
$properties['link'] = ' ';
$properties['title'] = ' ';
$properties['dc:date'] = ' ';
$rss_writer_object->additem($properties);
}
if ($rss_writer_object->writerss($output)) {
header('Content-Type: text/xml; charset="utf-8"');
header('Content-Length: ' . strval(strlen($output)));
echo $output;
} else {
//header('Content-Type: text/plain');
//echo ('Error: '.$rss_writer_object->error);
}
}
示例5: get_employers
private function get_employers()
{
$branch = $this->employee->getBranch();
$criteria = array('columns' => "DISTINCT employers.name AS employer, employers.id", 'joins' => "employers ON employers.id = jobs.employer, \n employees ON employees.id = employers.registered_by", 'match' => "employees.branch = " . $branch[0]['id'], 'order' => "employers.name");
$job = new Job();
return $job->find($criteria);
}
示例6: get_countries
private function get_countries()
{
$criteria = array('columns' => "countries.country_code, countries.country, COUNT(jobs.id) AS job_count", 'joins' => "countries ON countries.country_code = jobs.country", 'match' => "jobs.deleted = FALSE AND jobs.expire_on >= CURDATE() AND jobs.closed = 'N'", 'group' => "countries.country_code", 'order' => "countries.country ASC");
$job = new Job();
$countries = $job->find($criteria);
return $countries === false ? array() : $countries;
}
示例7: testHandleFailedJob
/**
* @param array $stats
* @param string $expectedMethod
* @param array $expectedParams
* @dataProvider failedJobDataProvider
*/
public function testHandleFailedJob(array $stats, $expectedMethod, array $expectedParams)
{
$this->job->expects($this->once())->method('stats')->willReturn($stats);
$invocationMocker = $this->job->expects($this->once())->method($expectedMethod);
call_user_func_array([$invocationMocker, 'with'], $expectedParams);
$this->strategy->handleFailedJob($this->job);
}
示例8: getById
function getById($jobid)
{
// do Bacula ACLs
Zend_Loader::loadClass('Job');
$table = new Job();
if (!$table->isJobIdExists($jobid)) {
return FALSE;
}
$select = new Zend_Db_Select($this->db);
switch ($this->db_adapter) {
case 'PDO_SQLITE':
// bug http://framework.zend.com/issues/browse/ZF-884
$select->distinct();
$select->from(array('l' => 'Log'), array('logid' => 'LogId', 'jobid' => 'JobId', 'LogTime' => 'Time', 'logtext' => 'LogText'));
$select->where("JobId = ?", $jobid);
$select->order(array('LogId', 'LogTime'));
break;
default:
// mysql, postgresql
$select->distinct();
$select->from(array('l' => 'Log'), array('LogId', 'JobId', 'LogTime' => 'Time', 'LogText'));
$select->where("JobId = ?", $jobid);
$select->order(array('LogId', 'LogTime'));
}
//$sql = $select->__toString(); echo "<pre>$sql</pre>"; exit; // for !!!debug!!!
$stmt = $select->query();
return $stmt->fetchAll();
}
示例9: getInitData
public function getInitData($req)
{
$data = array();
$employees = new Employee();
$data['numberOfEmployees'] = $employees->Count("1 = 1");
$company = new CompanyStructure();
$data['numberOfCompanyStuctures'] = $company->Count("1 = 1");
$user = new User();
$data['numberOfUsers'] = $user->Count("1 = 1");
$project = new Project();
$data['numberOfProjects'] = $project->Count("status = 'Active'");
$attendance = new Attendance();
$data['numberOfAttendanceLastWeek'] = $attendance->Count("in_time > '" . date("Y-m-d H:i:s", strtotime("-1 week")) . "'");
if (empty($data['numberOfAttendanceLastWeek'])) {
$data['numberOfAttendanceLastWeek'] = 0;
}
$empLeave = new EmployeeLeave();
$data['numberOfLeaves'] = $empLeave->Count("date_start > '" . date("Y-m-d") . "'");
$timeEntry = new EmployeeTimeEntry();
$data['numberOfAttendanceLastWeek'] = $timeEntry->Count("in_time > '" . date("Y-m-d H:i:s", strtotime("-1 week")) . "'");
$candidate = new Candidate();
$data['numberOfCandidates'] = $candidate->Count("1 = 1");
$job = new Job();
$data['numberOfJobs'] = $job->Count("status = 'Active'");
$course = new Course();
$data['numberOfCourses'] = $course->Count("1 = 1");
return new IceResponse(IceResponse::SUCCESS, $data);
}
示例10: apply
public function apply()
{
$id = (int) $_POST['id'];
//find the offer
$market = new JobMarket();
$offer = $market->get($id);
if (empty($offer)) {
throw new Exception('offer not found');
}
//check if matches the requirements
$skill = new Skill();
$skill = $skill->get($this->user->id);
if ($skill->economic < $offer->skill) {
throw new Exception("you don't meet the requirements");
}
//give him the job
$data = array('uid' => $this->user->id, 'company' => $offer->company, 'salary' => $offer->salary);
$job = new Job($data);
$saved = $job->save();
// update the offer
if (!empty($saved)) {
$offer->quantity--;
if ($offer->quantity == 0) {
$offer->delete();
} else {
$offer->save();
}
return true;
} else {
return false;
}
}
示例11: pushSync
public function pushSync($name, array $args = array())
{
$job = new Job($this->config, $name, $args);
$job->isSynchronous();
$this->engine->push($job);
$this->listening[$job->id] = $job;
return $job;
}
示例12: newFromJob
/**
* 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;
}
示例13: installJobs
function installJobs()
{
global $jobsData, $jobs;
foreach ($jobsData as $jobTitle) {
$job = new Job();
$job->setName($jobTitle);
$jobs[$jobTitle] = $job;
}
}
示例14: perform
public function perform()
{
$job = new Job($this->args['jobid']);
$jobdata = $job->getJobData();
$to = '';
$subject = 'Build ' . $this->args['action'];
$content = 'Build ' . $this->args['action'];
return mail($to, $subject, $content, implode("\r\n", $this->_headers));
}
示例15: queueLinksJobs
/**
* Add an array of refreshLinks jobs to the queue
* @param array $titles Array of title objects.
* @static
*/
function queueLinksJobs($titles)
{
$fname = 'Job::queueLinksJobs';
wfProfileIn($fname);
foreach ($titles as $title) {
$job = new Job('refreshLinks', $title);
$job->insert();
}
wfProfileOut($fname);
}