本文整理汇总了PHP中Job类的典型用法代码示例。如果您正苦于以下问题:PHP Job类的具体用法?PHP Job怎么用?PHP Job使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Job类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
}
开发者ID:helpfulrobot,项目名称:fullscreeninteractive-silverstripe-jobboard,代码行数:29,代码来源:JobBoardForm.php
示例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;
}
开发者ID:linearregression,项目名称:redports,代码行数:30,代码来源:TaskNotifyIRC.php
示例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);
}
开发者ID:snipesn,项目名称:UkrYama-2,代码行数:7,代码来源:Cron.php
示例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);
}
}
开发者ID:bklein01,项目名称:jobberbase,代码行数:60,代码来源:class.Feed.php
示例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);
}
开发者ID:pamalite,项目名称:yel,代码行数:7,代码来源:employee_members_page.php
示例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;
}
开发者ID:pamalite,项目名称:yel,代码行数:7,代码来源:welcome_page.php
示例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);
}
开发者ID:zwilias,项目名称:qman,代码行数:13,代码来源:GenericJobFailureStrategyTest.php
示例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();
}
开发者ID:neverstoplwy,项目名称:contrib-webacula,代码行数:28,代码来源:Log.php
示例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);
}
开发者ID:riazuddinahmed1,项目名称:icehrm,代码行数:28,代码来源:DashboardActionManager.php
示例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;
}
}
开发者ID:AugustoAngeletti,项目名称:erepublik,代码行数:32,代码来源:jobmarket.php
示例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;
}
开发者ID:crodas,项目名称:worker,代码行数:8,代码来源:Client.php
示例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;
}
开发者ID:Tarendai,项目名称:spring-website,代码行数:15,代码来源:DuplicateJob.php
示例13: installJobs
function installJobs()
{
global $jobsData, $jobs;
foreach ($jobsData as $jobTitle) {
$job = new Job();
$job->setName($jobTitle);
$jobs[$jobTitle] = $job;
}
}
开发者ID:sailor744,项目名称:emp-directory,代码行数:9,代码来源:install.php
示例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));
}
开发者ID:linearregression,项目名称:redports,代码行数:9,代码来源:TaskNotifyEmail.php
示例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);
}
开发者ID:BackupTheBerlios,项目名称:blahtex,代码行数:15,代码来源:JobQueue.php
示例16: enqueue
public function enqueue(Job $job, $trackStatus = false)
{
if ($job instanceof ContainerAwareJob) {
$job->setKernelOptions($this->kernelOptions);
}
$result = \Resque::enqueue($job->queue, \get_class($job), $job->args, $trackStatus);
if ($trackStatus) {
return new \Resque_Job_Status($result);
}
return null;
}
开发者ID:rosstuck,项目名称:BCCResqueBundle,代码行数:11,代码来源:Resque.php
示例17: runJob
/**
* Executes the job
*
* @param Job $job
* @return boolean Returns false if the job failed
*/
public function runJob(Job $job)
{
try {
$command = $this->instantiateCommand($job->getClassName());
$result = call_user_func_array([$command, 'handle'], $job->getArguments());
} catch (\Exception $e) {
error_log($e);
$result = false;
}
return $result;
}
开发者ID:burriko,项目名称:job-queue,代码行数:17,代码来源:JobRunner.php
示例18: do_post_testcancelphp_continuation_v1
function do_post_testcancelphp_continuation_v1($job, $resp)
{
// we have do_post with a continuation of do_finish. The do_finish
// is only called via on-completion handler for do_run
$run = $this->job_manager()->job("do_run_testcancelphp_continuation_v1");
$finish = new Job($job);
$finish->name("do_finish_testcancelphp_continuation_v1");
$run->on(Job::EVENT_COMPLETED, $finish);
$this->afterwards($run);
return Worker::WORKER_CONTINUE;
}
开发者ID:wqx081,项目名称:gearbox,代码行数:11,代码来源:workerTestCancel.php
示例19: delete
function delete($id)
{
$o = new Job($id);
if ($o->delete()) {
flash_message('success', 'Level đã được xóa thành công');
redirect($this->admin_url . 'jobs/listAll');
} else {
flash_message('error', 'Có lỗi. Vui lòng kiểm tra lại');
redirect($this->admin_url . 'jobs/listAll');
}
}
开发者ID:lxthien,项目名称:batdongsan,代码行数:11,代码来源:jobs.php
示例20: executeAction
public function executeAction()
{
Assert::found($id = (int) $this->dispatcher->getParam('0', 'uint'));
Assert::found($task = Task::findFirst($id), "Task not found");
$job = Job::findFirst(['task_id = ?0 and executed_at is null', 'bind' => [$task->task_id]]);
if (!$job) {
$job = new Job();
$job->save(['task_id' => $task->task_id]);
Assert::noMessages($job);
}
return $this->response->redirect('/task/run/' . $job->job_id, true);
}
开发者ID:rj28,项目名称:executer,代码行数:12,代码来源:TaskController.php
注:本文中的Job类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论