本文整理汇总了PHP中Job::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Job::find方法的具体用法?PHP Job::find怎么用?PHP Job::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Job
的用法示例。
在下文中一共展示了Job::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: displayjobsItems
public function displayjobsItems($jobId)
{
if (Auth::check()) {
$data['job'] = Job::find($jobId);
$data['jobs'] = ApplyJobs::where('jobs_id', '=', $jobId)->get();
$data = DB::table('users')->join('jobs_applied', 'users.id', '=', 'jobs_applied.userid')->leftJoin('user_rating', 'users.id', '=', 'user_rating.rated_id')->leftJoin('shortlist', function ($join) {
$join->on('users.id', '=', 'shortlist.shorlisted_userid')->on('jobs_applied.jobs_id', '=', 'shortlist.shortlist_jobs_id');
})->select('*', DB::raw('ROUND(avg(user_rating.rating), 2) AS average'))->where('jobs_applied.jobs_id', $jobId)->where('jobs_applied.status', '!=', 'invited')->groupBy('users.id')->get();
// foreach ($data as $value) {
//
// $data['avg'] = DB::table('user_rating')
// ->select(DB::raw('avg(user_rating.rating) AS average'))
// ->where('user_rating.user_id', $value->id)
// ->get();
//
// }
// $data = DB::table('users')
// ->join('jobs_applied', 'users.id', '=', 'jobs_applied.userid')
// ->join('user_rating', 'users.id', '=', 'user_rating.user_id')
// ->select('*' , DB::raw('avg(user_rating.rating) AS average'))
// ->where('jobs_applied.jobs_id', $jobId)
// ->get();
return $data;
//return View::make('login/job-itms' , $data);
}
}
示例3: refreshCronJobs
/**
* Revive crashed crons
*/
private function refreshCronJobs()
{
$jobs = Job::find(['conditions' => ['nextRun' => ['$lte' => time() - 5 * 60], 'status' => 1]]);
foreach ($jobs as $job) {
$job->save();
}
}
示例4: 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;
}
示例5: getFirstQueue
/**
* Get first queued job from database.
*
*
* @return \Armxy\Queue\Models\Job
*/
function getFirstQueue()
{
$firstQueue = Queue::where('status', '=', Job::STATUS_OPEN)->orderBy('created_at')->first();
if (!is_null($firstQueue)) {
$job = Job::find($firstQueue->id);
return $job;
}
}
示例6: get
public function get()
{
$uid = (int) $_REQUEST['uid'];
if ($uid == 0) {
$uid = $this->user->id;
}
$where = array(array('uid', '=', $uid));
$userClass = new Job();
$results = $userClass->find($where);
if (sizeof($results) == 0) {
return false;
}
$data = $this->parse($results[0]);
return $data;
}
示例7: header
}
}
header('Content-type: text/xml');
$response = array('found_employers' => array('found_employer' => $found_employers), 'pagination' => array('total_pages' => $total_pages, 'current_page' => $_POST['page']), 'application' => $result);
echo $xml_dom->get_xml_from_array(array('applications' => $response));
exit;
}
if ($_POST['action'] == 'get_testimony') {
$criteria = array('columns' => "testimony", 'match' => "id = " . $_POST['id'], 'limit' => "1");
$referral = new Referral();
$result = $referral->find($criteria);
$testimony = htmlspecialchars_decode(str_replace("\n", '<br/>', $result[0]['testimony']));
echo $testimony;
exit;
}
if ($_POST['action'] == 'get_job_desc') {
$criteria = array('columns' => "description", 'match' => "id = " . $_POST['id'], 'limit' => "1");
$job = new Job();
$result = $job->find($criteria);
$job_desc = htmlspecialchars_decode(str_replace("\n", '<br/>', $result[0]['description']));
echo $job_desc;
exit;
}
if ($_POST['action'] == 'get_employer_remarks') {
$criteria = array('columns' => "employer_remarks", 'match' => "id = " . $_POST['id'], 'limit' => "1");
$referral = new Referral();
$result = $referral->find($criteria);
$remarks = str_replace("\n", '<br/>', stripslashes($result[0]['employer_remarks']));
echo $remarks;
exit;
}
示例8: top_search
protected function top_search($_page_title)
{
// get the employers
$criteria = array('columns' => 'employers.id, employers.name, COUNT(jobs.id) AS job_count', 'joins' => 'employers ON employers.id = jobs.employer', 'group' => 'employers.id', 'order' => 'employers.name ASC');
$job = new Job();
$employers = $job->find($criteria);
if ($employers === false) {
$employers = array();
}
// get the industries
$industries = Industry::getIndustriesFromJobs(true);
// get the countries
$criteria = array('columns' => "countries.country_code, countries.country, COUNT(jobs.id) AS job_count", 'joins' => "countries ON countries.country_code = jobs.country", 'group' => "countries.country_code", 'order' => "countries.country ASC");
$job = new Job();
$countries = $job->find($criteria);
$top = file_get_contents(dirname(__FILE__) . '/../../html/top_search.html');
$top = str_replace('%root%', $this->url_root, $top);
$employers_options = '';
foreach ($employers as $emp) {
$employers_options .= '<option value="' . $emp['id'] . '">' . desanitize($emp['name']);
if ($emp['job_count'] > 0) {
$employers_options .= ' (' . $emp['job_count'] . ')';
}
$employers_options .= '</option>' . "\n";
}
$top = str_replace('<!-- %employers_options% -->', $employers_options, $top);
$industries_options = '';
foreach ($industries as $industry) {
$industries_options .= '<option value="' . $industry['id'] . '">' . $industry['industry'];
if ($industry['job_count'] > 0) {
$industries_options .= ' (' . $industry['job_count'] . ')';
}
$industries_options .= '</option>' . "\n";
}
$top = str_replace('<!-- %industries_options% -->', $industries_options, $top);
$countries_options = '';
foreach ($countries as $a_country) {
$countries_options .= '<option value="' . $a_country['country_code'] . '">' . $a_country['country'];
if ($a_country['job_count'] > 0) {
$countries_options .= ' (' . $a_country['job_count'] . ')';
}
$countries_options .= '</option>' . "\n";
}
$top = str_replace('<!-- %countries_options% -->', $countries_options, $top);
echo $top;
}
示例9: dirname
<?php
require_once dirname(__FILE__) . "/../../private/lib/utilities.php";
header('Content-type: text/xml');
$xml_dom = new XMLDOM();
$response = array();
$result = array();
$result = Job::find(array('columns' => 'employers.id, employers.name', 'joins' => 'employers ON employers.id = jobs.employer', 'match' => 'employers.active = \'Y\' AND jobs.closed = \'N\' AND jobs.expire_on >= NOW()', 'group' => 'employers.id', 'order' => 'employers.name'));
$i = 0;
foreach ($result as $row) {
$response[$i]['id'] = $row['id'];
$response[$i]['name'] = $row['name'];
$i++;
}
$xml_array = array('employers' => array('employer' => $response));
echo $xml_dom->get_xml_from_array($xml_array);
示例10: function
//Get all aprameters
$r = Feedback::update_feedback($params);
$app->response->body(json_encode($r));
});
//Delete Feedback - OK
$app->delete("/feedback/delete/:id", function ($id) use($app) {
$f = Feedback::find($id);
$f->delete();
$app->response->body();
});
//Insert Feedback
$app->post("/feedback/set", function () use($app) {
$params = $app->request()->params();
//Get all aprameters
$set_feedback = JobOffers::set_bid();
$app->response->body(json_encode($set_feedback));
});
//OFFERS
$app->post("/job/offer", function () use($app) {
$params = $app->request()->params();
$new_bid = JobOffers::set_bid($params);
$app->response->body(json_encode($new_bid));
});
$app->post("/job/get_offers", function () use($app) {
$params = $app->request()->params();
$j = Job::find($params['id']);
$j->jobOffers;
$app->response->body($j->toJson());
});
//Run application
$app->run();
示例11: count
$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';
$data['currency'] = 'HKD';
$data['salary'] = '5562';
$data['salary_negotiable'] = 'Y';
$data['description'] = "wllwh kwhhwf wpejf[w wopj blahlelelll blah... some job descriptions goes here";
if ($job->update($data)) {
print_array($job->get());
} else {
echo "failed";
示例12: Employer
if ($_POST['action'] == 'get_jobs') {
$employer = new Employer($_POST['id']);
$result = $employer->getJobs($_POST['order']);
if (is_null($result) || empty($result)) {
echo '0';
exit;
}
if ($result === false) {
echo 'ko';
exit;
}
foreach ($result as $i => $row) {
$result[$i]['title'] = htmlspecialchars_decode(stripslashes($row['title']));
}
header('Content-type: text/xml');
echo $xml_dom->get_xml_from_array(array('jobs' => array('job' => $result)));
exit;
}
if ($_POST['action'] == 'get_job') {
$job = new Job($_POST['id']);
$result = $job->get();
$result[0]['title'] = htmlspecialchars_decode(stripslashes($result[0]['title']));
$result[0]['description'] = htmlspecialchars_decode(stripslashes($result[0]['description']));
$result[0]['description'] = str_replace('<br/>', "\n", $result[0]['description']);
$criteria = array('columns' => "job_index.state", 'joins' => "job_index ON job_index.job = jobs.id", 'match' => "jobs.id = " . $_POST['id'], 'limit' => "1");
$tmp = $job->find($criteria);
$result[0]['state'] = $tmp[0]['state'];
header('Content-type: text/xml');
echo $xml_dom->get_xml_from_array(array('job' => $result));
exit;
}
示例13: dirname
<?php
require_once dirname(__FILE__) . "/../../private/lib/utilities.php";
header('Content-type: text/xml');
$xml_dom = new XMLDOM();
$result = Job::find(array('columns' => 'SUM(potential_reward) AS sumReward, branches.country AS country_code, branches.currency', 'joins' => 'employers on employers.id = jobs.employer,
branches on branches.id = employers.branch', 'match' => 'jobs.closed = \'N\' AND jobs.expire_on >= NOW()', 'group' => 'branches.country', 'order' => 'sumReward'));
$response = array();
$i = 0;
foreach ($result as $row) {
if ($row['sumReward'] != '0') {
$response[$i] = $row;
$i++;
}
}
/*$response = Job::find(array(
'columns' => 'SUM(potential_reward) AS sumReward, jobs.currency, currencies.country_code',
'joins' => 'currencies ON currencies.symbol = jobs.currency',
'match' => 'jobs.closed = \'N\'',
'group' => 'jobs.currency',
'order' => 'sumReward'
)
);*/
// format the rewards
foreach ($response as $i => $row) {
$response[$i]['sumReward'] = number_format($row['sumReward'], 0, '.', ', ');
}
$xml_array = array('rewards' => array('potential' => $response));
echo $xml_dom->get_xml_from_array($xml_array);
示例14: get_job_info
private function get_job_info()
{
$criteria = array('columns' => 'jobs.*, industries.industry AS full_industry,
countries.country AS country_name, employers.name AS employer_name,
employers.website_url AS employer_website_url, branches.currency,
DATE_FORMAT(jobs.expire_on, \'%e %b, %Y\') AS formatted_expire_on,
DATEDIFF(NOW(), jobs.expire_on) AS expired', '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 = " . $this->job_id . " AND jobs.deleted = FALSE");
$job = new Job();
$result = $job->find($criteria);
$job = array();
if (count($result) <= 0 || is_null($result)) {
return NULL;
}
$job = $result[0];
$total_potential_reward = $job['potential_reward'];
$potential_token_reward = $total_potential_reward * 0.05;
$potential_reward = $total_potential_reward - $potential_token_reward;
$job['description'] = htmlspecialchars_decode($job['description']);
if (!is_null($job['alternate_employer']) && !empty($job['alternate_employer'])) {
$job['employer_name'] = $job['alternate_employer'];
}
$job['potential_reward'] = number_format($potential_reward, 0, '.', ', ');
$job['potential_token_reward'] = number_format($potential_token_reward, 0, '. ', ', ');
$job['salary'] = number_format($job['salary'], 0, '. ', ', ');
$job['salary_end'] = number_format($job['salary_end'], 0, '. ', ', ');
$job['state'] = ucwords($job['state']);
return $job;
}
示例15: job_offer
public static function job_offer($params)
{
$job = Job::find($params['id']);
$job->update($params);
if ($job->save()) {
return 1;
} else {
return 0;
}
}