本文整理汇总了PHP中Jobs::getSlugTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP Jobs::getSlugTitle方法的具体用法?PHP Jobs::getSlugTitle怎么用?PHP Jobs::getSlugTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jobs
的用法示例。
在下文中一共展示了Jobs::getSlugTitle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Notifications
$title = $j->getSlugTitle();
$notif = new Notifications();
$notif->sendEmailsToSubscribersMail($id);
$app->flash('success', "Job {$id} has been activated successfully.");
$app->redirect(ADMIN_URL . "jobs/{$job->id}/{$title}");
} else {
$app->flash('danger', "Job {$id} could not be activated.");
$app->redirect(ADMIN_URL . "jobs/{$id}");
}
});
// deactivate job
$app->get('/:id/deactivate/:token', 'validateUser', function ($id, $token) use($app) {
$j = new Jobs($id);
if ($j->deactivateJob($token)) {
$job = $j->showJobDetails();
$title = $j->getSlugTitle();
$app->flash('success', "Job {$id} has been deactivated successfully.");
$app->redirect(ADMIN_URL . "jobs/{$job->id}/{$title}");
} else {
$app->flash('danger', "Job {$id} could not be deactivated.");
$app->redirect(ADMIN_URL . "jobs/{$id}");
}
});
// show job information
$app->get('/:id(/:title)', 'validateUser', function ($id, $title = null) use($app) {
$j = new Jobs($id);
$job = $j->showJobDetails();
$city = $j->getJobCity($job->city);
$category = $j->getJobCategory($job->category);
$applications = $j->countJobApplications();
if (isset($job) && $job->id) {
示例2: sendEmailsToSubscribersMail
public function sendEmailsToSubscribersMail($job_id)
{
global $categories, $cities;
$message = '';
$content = '';
// get job information
$j = new Jobs($job_id);
$job = $j->showJobDetails();
$title = $j->getSlugTitle();
$category_name = $categories[$job->category]['name'];
$city_name = $cities[$job->city]['name'];
$job_link = BASE_URL . "jobs/{$job->id}/{$title}";
$description = Parsedown::instance()->parse($job->description);
$content .= "<p>Job Details</p>";
$content .= "<p>-----------</p>";
$content .= "<p><a href={$job_link}>{$job_link}</a></p>";
$content .= "<p>Title: <strong>{$job->title}</strong></p>";
$content .= "<p>Description: {$description}</p>";
if ($job->perks != '') {
$content .= "<p>Perks: {$job->perks}</p>";
}
$content .= "<p>How to apply: {$job->how_to_apply}</p>";
$content .= "<p>-----------</p>";
// get all users subscribed to the job
$users = R::findAll('subscriptions', " is_confirmed=1 AND (category_id=:category_id OR city_id=:city_id) ", array(':category_id' => $job->category, ':city_id' => $job->city));
foreach ($users as $user) {
$link = BASE_URL . "subscribe/{$user->id}/delete/{$user->token}";
$name = $user->category_id > 0 ? $category_name : $city_name;
$subject = "A new {$name} job was posted at {$this->app_name}";
$message .= "<p>You subcribed to receive {$name} jobs on {$this->app_name}.</p>";
$message .= $content;
$message .= "<p>To unsubscribe, click this link to stop receiving alerts.</p>";
$message .= "<p><a href={$link}>{$link}</a></p>";
if ($this->sendNotification($subject, $message, $user->email)) {
$update = R::load('subscriptions', $user->id);
$update->last_sent = R::isoDateTime();
R::store($update);
}
}
}