2 /***********************************************************************/
4 /***********************************************************************/
5 /* Copyright (c) 2002-2009 */
6 /* Adaptive Technology Resource Centre / Inclusive Design Institute */
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 /***********************************************************************/
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 require(AT_INCLUDE_PATH.'lib/tinymce.inc.php');
20 $_custom_css = $_base_path . AT_JB_BASENAME . 'module.css'; // use a custom stylesheet
22 <link rel="stylesheet" type="text/css" href="'.AT_BASE_HREF.'jscripts/infusion/framework/fss/css/fss-layout.css" />
23 <link rel="stylesheet" type="text/css" href="'.AT_BASE_HREF.'jscripts/infusion/framework/fss/css/fss-text.css" />
24 <script type="text/javascript" src="'.$_base_path.'mods/job_board/include/js/edit.js"></script>
27 if (!Employer::authenticate()){
28 $msg->addError('ACCESS_DENIED');
29 header('Location: ../index.php');
34 * Add the submenu on this page so that user can go back to the listing.
35 * Reason why this is not included in module.php is because we don't want the
36 * 'edit_post' submenu to show on job_board/index.php
38 $_pages[AT_JB_BASENAME.'index_admin.php']['children'] = array(AT_JB_BASENAME.'admin/edit_post.php');
40 $jid = intval($_GET['jid']);
42 $job_post = $job->getJob($jid);
45 if ((!$_POST['setvisual'] && $_POST['settext']) || !$_GET['setvisual']){
46 $onload = 'document.form.title.focus();';
50 if(isset($_POST['submit'])){
51 //concat the closing date values
52 $year = intval($_POST['year_jb_closing_date']);
53 $month = intval($_POST['month_jb_closing_date']);
54 $month = ($month < 10)?'0'.$month:$month;
55 $day = intval($_POST['day_jb_closing_date']);
56 $day = ($day < 10)?'0'.$day:$day;
57 $hour = intval($_POST['hour_jb_closing_date']);
58 $hour = ($hour < 10)?'0'.$hour:$hour;
59 $min = intval($_POST['min_jb_closing_date']);
60 $min = ($min < 10)?'0'.$min:$min;
61 $jb_closing_date = $year.'-'.$month.'-'.$day.' '.$hour.':'.$min.':00';
64 $approval_state = ($_config['jb_posting_approval']==1)?AT_JB_POSTING_STATUS_UNCONFIRMED:AT_JB_POSTING_STATUS_CONFIRMED;
66 $job->updateJob($jid, $_POST['title'], $_POST['jb_description'], $_POST['jb_categories'], $_POST['jb_is_public'], $jb_closing_date, $approval_state);
67 $msg->addFeedback('JB_POST_UPDATED_SUCCESS');
68 header('Location: home.php');
72 //load visual editor base on personal preferences
73 if (!isset($_REQUEST['setvisual']) && !isset($_REQUEST['settext'])) {
74 if ($_SESSION['prefs']['PREF_CONTENT_EDITOR'] == 1) {
75 $_POST['formatting'] = 1;
76 $_REQUEST['settext'] = 0;
77 $_REQUEST['setvisual'] = 0;
79 } else if ($_SESSION['prefs']['PREF_CONTENT_EDITOR'] == 2) {
80 $_POST['formatting'] = 1;
81 $_POST['settext'] = 0;
82 $_POST['setvisual'] = 1;
84 } else { // else if == 0
85 $_POST['formatting'] = 0;
86 $_REQUEST['settext'] = 0;
87 $_REQUEST['setvisual'] = 0;
91 include(AT_INCLUDE_PATH.'header.inc.php');
92 $savant->display('employer/jb_employer_header.tmpl.php');
93 $savant->assign('job', $job);
94 $savant->assign('categories', $job->getCategories());
95 $savant->assign('job_post', $job_post);
96 $savant->display('employer/jb_edit_post.tmpl.php');
97 include(AT_INCLUDE_PATH.'footer.inc.php');