本文整理汇总了PHP中Job::updateJob方法的典型用法代码示例。如果您正苦于以下问题:PHP Job::updateJob方法的具体用法?PHP Job::updateJob怎么用?PHP Job::updateJob使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Job
的用法示例。
在下文中一共展示了Job::updateJob方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: intval
//handle edit
if (isset($_POST['submit'])) {
//concat the closing date values
$year = intval($_POST['year_jb_closing_date']);
$month = intval($_POST['month_jb_closing_date']);
$month = $month < 10 ? '0' . $month : $month;
$day = intval($_POST['day_jb_closing_date']);
$day = $day < 10 ? '0' . $day : $day;
$hour = intval($_POST['hour_jb_closing_date']);
$hour = $hour < 10 ? '0' . $hour : $hour;
$min = intval($_POST['min_jb_closing_date']);
$min = $min < 10 ? '0' . $min : $min;
$jb_closing_date = $year . '-' . $month . '-' . $day . ' ' . $hour . ':' . $min . ':00';
//approval state.
$approval_state = $_config['jb_posting_approval'] == 1 ? AT_JB_POSTING_STATUS_UNCONFIRMED : AT_JB_POSTING_STATUS_CONFIRMED;
$job->updateJob($jid, $_POST['title'], $_POST['jb_description'], $_POST['jb_categories'], $_POST['jb_is_public'], $jb_closing_date, $approval_state);
$msg->addFeedback('JB_POST_UPDATED_SUCCESS');
header('Location: home.php');
exit;
}
//load visual editor base on personal preferences
if (!isset($_REQUEST['setvisual']) && !isset($_REQUEST['settext'])) {
if ($_SESSION['prefs']['PREF_CONTENT_EDITOR'] == 1) {
$_POST['formatting'] = 1;
$_REQUEST['settext'] = 0;
$_REQUEST['setvisual'] = 0;
} else {
if ($_SESSION['prefs']['PREF_CONTENT_EDITOR'] == 2) {
$_POST['formatting'] = 1;
$_POST['settext'] = 0;
$_POST['setvisual'] = 1;
示例2: updateJobField
public static function updateJobField($jobId, $jobFieldName, $jobFieldValue, $userId)
{
$job = array($jobFieldName => $jobFieldValue);
$res = Job::updateJob($jobId, $job, $userId);
return $res;
}
示例3: postEditJob
public function postEditJob()
{
$data = \Input::get('data');
$_hash = new Hash();
$_hash = $_hash->getHasher();
if (!($job = \Job::findJobById(trim(\Input::get('job'))))) {
return \Response::json(['type' => 'danger', 'message' => 'Job not found.']);
}
if (!($company = \Company::findCompanyById($_hash->decode($data['company'])))) {
return \Response::json(['type' => 'danger', 'message' => 'Company not found.']);
}
if (!($agency = \Agency::getAgency())) {
return \Response::json(['type' => 'danger', 'message' => 'Not an agency account.']);
}
if ($data['job_post_duration'] !== '0') {
if (!$agency->is_vip) {
$value = ['1' => -1, '2' => -3];
$checkValue = abs($value[$data['job_post_duration']]);
if ($agency->credit < $checkValue) {
return \Response::json(['type' => 'warning', 'message' => 'You have ' . $agency->credit . ' credit. You need at least ' . $checkValue . ' credit(s) to post this job.']);
}
}
}
$status = $company->agencies()->wherePivot('company_id', $company->id)->wherePivot('status', 'accept')->first();
if (!$status) {
return \Response::json(['type' => 'danger', 'message' => 'You do not have permission from this company to post a job']);
}
$data['agency_id'] = $agency->id;
$data['company_id'] = $company->id;
if ($data['job_apply_type'] === 'job_apply_by_email') {
if ($data['job_apply_application_email'] === '' && $data['job_apply_direct_email'] === '') {
return \Response::json(['type' => 'warning', 'message' => 'Job application by email is chosen, please input at least one email.']);
}
$data['job_apply_details'] = json_encode(['type' => 'email', 'application_email' => $data['job_apply_application_email'], 'direct_email' => $data['job_apply_direct_email']]);
} elseif ($data['job_apply_type'] === 'job_apply_by_url') {
if ($data['job_apply_url'] === '') {
return \Response::json(['type' => 'warning', 'message' => 'Job application by url is chosen, please input the application url.']);
}
$data['job_apply_details'] = json_encode(['type' => 'url', 'url' => $data['job_apply_url']]);
}
try {
$job = \Job::updateJob($job, $data);
if (!$agency->is_vip && $data['job_post_duration'] !== '0') {
\Agency::updateCredit($agency, $value[$data['job_post_duration']]);
}
return \Response::json(['type' => 'success', 'message' => 'Job updated successfully.']);
} catch (\Exception $e) {
return \Response::json(['type' => 'danger', 'message' => env('APP_DEBUG') ? $e->getMessage() : 'Error, please contact webmaster.']);
}
}
示例4: postEditJob
public function postEditJob()
{
$data = \Input::get('data');
$job = \Job::findJobById(trim(\Input::get('job')));
$company = \Company::getCompany();
if ($job->company_id !== $company->id) {
return \Response::json(['type' => 'danger', 'message' => 'You cannot edit the job that does not belong to you.']);
}
// if company not subscribed to 6 month contract, check the credit
// TODO: update this to retrieve from db
if ($data['job_post_duration'] !== '0') {
if (!$company->is_vip) {
$value = ['1' => -1, '2' => -3];
$checkValue = abs($value[$data['job_post_duration']]);
if ($company->credit < $checkValue) {
return \Response::json(['type' => 'warning', 'message' => 'You have ' . $company->credit . ' credit. You need at least ' . $checkValue . ' credit(s) to post this job.']);
}
}
}
$data['company_id'] = $company->id;
// WTF?
// TODO: move to model
if ($data['job_apply_type'] === 'job_apply_by_email') {
if ($data['job_apply_application_email'] === '' && $data['job_apply_direct_email'] === '') {
return \Response::json(['type' => 'warning', 'message' => 'Job application by email is chosen, please input at least one email.']);
}
$data['job_apply_details'] = json_encode(['type' => 'email', 'application_email' => $data['job_apply_application_email'], 'direct_email' => $data['job_apply_direct_email']]);
} elseif ($data['job_apply_type'] === 'job_apply_by_url') {
if ($data['job_apply_url'] === '') {
return \Response::json(['type' => 'warning', 'message' => 'Job application by url is chosen, please input the application url.']);
}
$data['job_apply_details'] = json_encode(['type' => 'url', 'url' => $data['job_apply_url']]);
}
try {
$job = \Job::updateJob($job, $data);
// if company not subscribed to 6 month contract, substract the credit
if (!$company->is_vip && $data['job_post_duration'] !== '0') {
\Company::updateCredit($company, $value[$data['job_post_duration']]);
}
return \Response::json(['type' => 'success', 'message' => 'Job updated successfully']);
} catch (\Exception $e) {
return \Response::json(['type' => 'danger', 'message' => env('APP_DEBUG') ? $e->getMessage() : 'Error, please contact webmaster.']);
}
}