Beispiel #1
0
 public function action_delete($id = null)
 {
     if ($job = \Model\Job::find($id)) {
         $job->delete();
         \Session::set_flash('success', 'Deleted job #' . $id);
     } else {
         \Session::set_flash('error', 'Could not delete job #' . $id);
     }
     \Response::redirect('admin/job');
 }
Beispiel #2
0
 public function action_view($id = null)
 {
     is_null($id) and Response::redirect('job');
     $data['job'] = \Model\Job::find($id);
     $data['actions'] = ['back' => ['label' => 'Back', 'url' => '/']];
     if (\Auth::check()) {
         list(, $userid) = \Auth::get_user_id();
         // check if the job has been saved by the current user
         $data['favorite'] = \Model\Favorite::find('all', array('where' => array(array('user_id', $userid), array('job_id', $id))));
     }
     $this->template->title = "Jobs";
     $this->template->content = View::forge('job/_details.twig', $data);
 }
Beispiel #3
0
 public function action_add($id = null)
 {
     if ($id) {
         $job = \Model\Job::find($id);
         list(, $userid) = \Auth::get_user_id();
         if ($job and $userid) {
             $favorite = \Model\Favorite::find('first', array('where' => array(array('user_id', $userid), array('job_id', $id))));
             if ($favorite) {
                 $favorite->delete();
                 unset($favorite);
                 \Session::set_flash('success', 'The job has been removed from your favorites.');
                 \Response::redirect('/job/view/' . $job->id . '');
             }
             $props = array('user_id' => $userid, 'job_id' => $id);
             $favorite = new \Model\Favorite($props);
             try {
                 $favorite->save();
             } catch (Exception $e) {
                 \Session::set_flash('error', 'Job already saved');
                 \Response::redirect('/job/view/' . $job->id . '');
             }
             \Session::set_flash('success', 'Job #' . $job->id . ' has been added to your favorites.');
             \Response::redirect('/job/view/' . $job->id . '');
         } else {
             if ($job == null) {
                 \Session::set_flash('error', 'This job doesn\'t exist.');
                 \Response::redirect('/');
             } else {
                 if ($userid == null) {
                     \Session::set_flash('error', 'You must be logged in in order to add a job to your favorite');
                     \Response::redirect('/');
                 }
             }
         }
     } else {
         \Response::redirect('/');
     }
 }
Beispiel #4
0
 public function __construct()
 {
     parent::__construct();
     $this->model = \Model\Job::getInstance();
     $this->contentType = 'application/json';
 }
Beispiel #5
0
 public function action_index()
 {
     $data['jobs'] = \Model\Job::query()->get();
     $this->template->title = "Jobs listing";
     $this->template->content = View::forge('index.twig', $data);
 }
Beispiel #6
0
<?php

require_once '../bootstrap.php';
$js_files = array('jquery.validate.js', 'employee.list.js');
$jobsObj = \Model\Job::getInstance();
$pageNo = !empty($_REQUEST['page']) ? $_REQUEST['page'] : 0;
$jobs = $jobsObj->selectPage(array('company_id' => array('op' => '=', 'val' => $_REQUEST['company_id'])), 'id', $pageNo);
$breadcrumbs = unserialize($_SESSION['breadcrumbs']);
$breadcrumbs->add($_REQUEST['name'] . '\'s Postings', $_SERVER['REQUEST_URI']);
?>
<!DOCTYPE html>
<html lang="en">
	<head>
		<?php 
include_once '../common/header_content.php';
?>
		<?php 
include_once '../common/admin_styles.php';
?>
	</head>
	<body>
		<div class="container-fluid">
			<div class="row">
				<div class="col-md-12">
					<?php 
include_once '../common/admin_head.php';
?>
					<?php 
include_once '../common/admin_nav.php';
?>
					<div class="row">