本文整理汇总了PHP中Jobs::getJobs方法的典型用法代码示例。如果您正苦于以下问题:PHP Jobs::getJobs方法的具体用法?PHP Jobs::getJobs怎么用?PHP Jobs::getJobs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jobs
的用法示例。
在下文中一共展示了Jobs::getJobs方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getJobs
/**
* Get job tuples
* @return mixed[int] The jobs
*/
private function getJobs()
{
$jobs = new Jobs();
$jobList = $jobs->getJobs();
Tools::usort($jobList);
$smartyJobs = array();
$jobsWithoutSupport = array();
foreach ($jobList as $job) {
$smartyJobs[$job->getId()] = array("name" => $job->getName(), "type" => $job->getType(), "typeName" => Job::$typeNames[$job->getType()], "color" => $job->getColor());
if (Jobs::JOB_SUPPORT != $job->getId() && Jobs::JOB_NA != $job->getId()) {
$jobsWithoutSupport[] = $job->getId();
$smartyJobs[$job->getId()]["deletedJob"] = true;
}
}
$formattedJobs = implode(", ", $jobsWithoutSupport);
// if job already used for TimeTracking, delete forbidden
$query2 = "SELECT jobid, COUNT(jobid) as count " . "FROM `codev_timetracking_table` " . "WHERE jobid IN ({$formattedJobs}) GROUP BY jobid;";
$result2 = SqlWrapper::getInstance()->sql_query($query2);
if (!$result2) {
return NULL;
}
while ($row = SqlWrapper::getInstance()->sql_fetch_object($result2)) {
$smartyJobs[$row->jobid]["deletedJob"] = 0 == $row->count;
}
return $smartyJobs;
}
示例2: function
* Homepage
* Front page controller
*/
$app->get('/(:page)', function ($page = null) use($app) {
global $categories;
if (isset($page) && $page != '') {
$content = R::findOne('pages', ' url=:url ', array(':url' => $page));
if ($content && $content->id) {
// show page information
$seo_title = $content->name . ' | ' . APP_NAME;
$seo_desc = excerpt($content->description);
$seo_url = BASE_URL . $page;
$app->render(THEME_PATH . 'page.php', array('seo_url' => $seo_url, 'seo_title' => $seo_title, 'seo_desc' => $seo_desc, 'content' => $content));
} else {
$app->flash('danger', 'The page you are looking for could not be found.');
$app->redirect(BASE_URL, 404);
}
} else {
// show list of job
$seo_title = APP_NAME;
$seo_desc = APP_DESC;
$seo_url = BASE_URL;
$j = new Jobs();
foreach ($categories as $cat) {
$jobs[$cat->id] = $j->getJobs(ACTIVE, $cat->id, 0, HOME_LIMIT);
}
$app->render(THEME_PATH . 'home.php', array('seo_url' => $seo_url, 'seo_title' => $seo_title, 'seo_desc' => $seo_desc, 'jobs' => $jobs));
}
});
// Run app
$app->run();
示例3: unset
unset($_SESSION['email']);
unset($_SESSION['is_admin']);
$app->flash('success', 'Logout successful. Please login again.');
$app->redirect('login');
});
/*
* Manage group
* Manage inactive jobs, categories list, cities list
*/
$app->group('/manage', function () use($app) {
// manage inactive jobs
$app->get('/', 'validateUser', function () use($app) {
global $categories;
$j = new Jobs();
foreach ($categories as $cat) {
$jobs[$cat->id] = $j->getJobs(INACTIVE, $cat->id);
}
$app->render(ADMIN_THEME . 'home.php', array('jobs' => $jobs));
});
/*
* Manage categories group
*/
$app->group('/categories', function () use($app) {
$app->post('/', 'isValidReferrer', 'validateUser', function () use($app) {
$data = $app->request->post();
$c = new Categories($data['id']);
$c->addCategory($data);
if ($data && $data['id'] != '') {
$message = 'Category was successfully updated.';
} else {
$message = 'New category has been added.';