changed git call from https to git readonly
[atutor.git] / mods / job_board / index_admin.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
15 define('AT_INCLUDE_PATH', '../../include/');
16 require (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
20 admin_authenticate(AT_ADMIN_PRIV_JOB_BOARD); 
21
22 //init
23 $job = new Job();
24 $page = intval($_GET['p']);
25 $page = ($page==0)?1:$page;
26 $all_job_posts = $job->getAllJobs($_GET['col'], $_GET['order'], true);
27
28 //handle pages
29 if ($page > 0){
30         $offset = ($page - 1) * AT_JB_ROWS_PER_PAGE;
31 } else {
32         $offset = 0;
33 }
34 $current_job_posts = array_slice($all_job_posts, $offset, AT_JB_ROWS_PER_PAGE);
35
36 //handle order
37 if ($_GET['order']==''){
38         $order = 'DESC';
39 } else {
40         //flip the ordre
41         $order = ($_GET['order']=='ASC')?'DESC':'ASC';
42         $page_string = 'col='.$_GET['col'].SEP.'order='.$_GET['order'];
43 }
44
45 include(AT_INCLUDE_PATH.'header.inc.php');
46 echo '<div class="pageinator_box">';
47 print_paginator($page, sizeof($all_job_posts), $page_string, AT_JB_ROWS_PER_PAGE);
48 echo '</div>';
49 $savant->assign('job_obj', $job);
50 $savant->assign('job_posts', $current_job_posts);
51 $savant->display('admin/jb_index.tmpl.php');
52 print_paginator($page, sizeof($all_job_posts), $page_string, AT_JB_ROWS_PER_PAGE);
53 include(AT_INCLUDE_PATH.'footer.inc.php'); 
54 ?>