dbd5196dbbce05e1e110607ec8701d727558f2dd
[atutor.git] / mods / job_board / employer / view_post.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 if (!Employer::authenticate()){
22         $msg->addError('ACCESS_DENIED');
23         header('Location: ../index.php');
24         exit;
25 }
26
27 /* 
28  * Add the submenu on this page so that user can go back to the listing.
29  * Reason why this is not included in module.php is because we don't want the 
30  * 'view_post' submenu to show on job_board/index.php
31  */
32 $_pages[AT_JB_BASENAME.'employer/home.php']['children'] = array(AT_JB_BASENAME.'employer/view_post.php');
33
34 $jid = intval($_REQUEST['jid']);
35 $job = new Job();
36 $job_post = $job->getJob($jid);
37
38 if($_GET['action']=='delete'){
39         $hidden_vars['jid'] = $jid;
40         $job_post = $job->getJob($jid);
41         $msg->addConfirm(array('DELETE', $job_post['title']), $hidden_vars);
42 }
43 //handle delete 
44 if (isset($_POST['submit_no'])) {
45         $msg->addFeedback('CANCELLED');
46         header('Location: home.php');
47         exit;
48 } else if (isset($_POST['submit_yes'])) {
49         $job->removeJob($jid);
50         $msg->addFeedback('JB_POST_DELETED');
51         header('Location: home.php');
52         exit;
53 }
54
55 include(AT_INCLUDE_PATH.'header.inc.php');
56 $msg->printConfirm();
57 echo '<div class="pageinator_box">';
58 $savant->display('employer/jb_employer_header.tmpl.php');
59 echo '</div>';
60 $savant->assign('job_obj', $job);
61 $savant->assign('job_post', $job_post);
62 $savant->display('jb_view_post.tmpl.php');
63 include(AT_INCLUDE_PATH.'footer.inc.php'); 
64 ?>