changed git call from https to git readonly
[atutor.git] / mods / job_board / employer / home.php
1 <?php
2 /***********************************************************************/
3 /* ATutor                                                                                                                          */
4 /***********************************************************************/
5 /* Copyright (c) 2002-2009                                                                                         */
6 /* Adaptive Technology Resource Centre / Inclusive Design Institute        */
7 /* http://atutor.ca                                                                                                        */
8 /*                                                                                                                                         */
9 /* This program is free software. You can redistribute it and/or           */
10 /* modify it under the terms of the GNU General Public License             */
11 /* as published by the Free Software Foundation.                                           */
12 /***********************************************************************/
13 // $Id$
14 $_user_location='public';
15 define(AT_INCLUDE_PATH, '../../../include/');
16 include(AT_INCLUDE_PATH.'vitals.inc.php');
17 include(AT_JB_INCLUDE.'classes/Job.class.php');
18 include(AT_JB_INCLUDE.'classes/Employer.class.php');
19 $_custom_css = $_base_path . AT_JB_BASENAME . 'module.css'; // use a custom stylesheet
20
21 //TODO: If not authenticated with user login, quit.
22 if (!Employer::authenticate()){
23         $msg->addError('ACCESS_DENIED');
24         header('Location: ../index.php');
25         exit;
26 }
27
28 //init
29 $job = new Job();
30 $page = intval($_GET['p']);
31 $page = ($page==0)?1:$page;
32 $all_job_posts = $job->getMyJobs($_GET['col'], $_GET['order']);
33
34 //handle pages
35 if ($page > 0){
36         $offset = ($page - 1) * AT_JB_ROWS_PER_PAGE;
37 } else {
38         $offset = 0;
39 }
40 if (sizeof($all_job_posts) > 0){
41         $current_job_posts = array_slice($all_job_posts, $offset, AT_JB_ROWS_PER_PAGE);
42 }
43
44 //handle order
45 if ($_GET['order']==''){
46         $order = 'DESC';
47 } else {
48         //flip the ordre
49         $order = ($_GET['order']=='ASC')?'DESC':'ASC';
50         $page_string = 'col='.$_GET['col'].SEP.'order='.$_GET['order'];
51 }
52
53 include(AT_INCLUDE_PATH.'header.inc.php');
54 echo '<div class="pageinator_box">';
55 $savant->display('employer/jb_employer_header.tmpl.php');
56 print_paginator($page, sizeof($all_job_posts), $page_string, AT_JB_ROWS_PER_PAGE);
57 echo '</div>';
58 $savant->assign('job_obj', $job);
59 $savant->assign('job_posts', $current_job_posts);
60 $savant->display('employer/jb_home.tmpl.php');
61 print_paginator($page, sizeof($all_job_posts), $page_string, AT_JB_ROWS_PER_PAGE);
62 include(AT_INCLUDE_PATH.'footer.inc.php'); 
63 ?>