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 /***********************************************************************/
15 define(AT_INCLUDE_PATH, '../../../include/');
16 include(AT_INCLUDE_PATH.'vitals.inc.php');
17 admin_authenticate(AT_ADMIN_PRIV_JOB_BOARD);
19 include(AT_JB_INCLUDE.'classes/Job.class.php');
20 require(AT_INCLUDE_PATH.'lib/tinymce.inc.php');
21 $_custom_css = $_base_path . AT_JB_BASENAME . 'module.css'; // use a custom stylesheet
23 <link rel="stylesheet" type="text/css" href="'.AT_BASE_HREF.'jscripts/infusion/framework/fss/css/fss-layout.css" />
24 <link rel="stylesheet" type="text/css" href="'.AT_BASE_HREF.'jscripts/infusion/framework/fss/css/fss-text.css" />
25 <script type="text/javascript" src="'.$_base_path.'mods/job_board/include/js/edit.js"></script>
29 * Add the submenu on this page so that user can go back to the listing.
30 * Reason why this is not included in module.php is because we don't want the
31 * 'edit_post' submenu to show on job_board/index.php
33 $_pages[AT_JB_BASENAME.'index_admin.php']['children'] = array(AT_JB_BASENAME.'admin/edit_post.php');
35 $jid = intval($_GET['jid']);
37 $job_post = $job->getJob($jid);
40 if ((!$_POST['setvisual'] && $_POST['settext']) || !$_GET['setvisual']){
41 $onload = 'document.form.title.focus();';
45 if(isset($_POST['submit'])){
46 //concat the closing date values
47 $year = intval($_POST['year_jb_closing_date']);
48 $month = intval($_POST['month_jb_closing_date']);
49 $month = ($month < 10)?'0'.$month:$month;
50 $day = intval($_POST['day_jb_closing_date']);
51 $day = ($day < 10)?'0'.$day:$day;
52 $hour = intval($_POST['hour_jb_closing_date']);
53 $hour = ($hour < 10)?'0'.$hour:$hour;
54 $min = intval($_POST['min_jb_closing_date']);
55 $min = ($min < 10)?'0'.$min:$min;
56 $jb_closing_date = $year.'-'.$month.'-'.$day.' '.$hour.':'.$min.':00';
58 $job->updateJob($jid, $_POST['title'], $_POST['jb_description'], $_POST['jb_categories'], $_POST['jb_is_public'], $jb_closing_date, $_POST['jb_approval_state']);
59 $msg->addFeedback('JB_POST_UPDATED_SUCCESS');
60 header('Location: ../index_admin.php');
64 //load visual editor base on personal preferences
65 if (!isset($_REQUEST['setvisual']) && !isset($_REQUEST['settext'])) {
66 if ($_SESSION['prefs']['PREF_CONTENT_EDITOR'] == 1) {
67 $_POST['formatting'] = 1;
68 $_REQUEST['settext'] = 0;
69 $_REQUEST['setvisual'] = 0;
71 } else if ($_SESSION['prefs']['PREF_CONTENT_EDITOR'] == 2) {
72 $_POST['formatting'] = 1;
73 $_POST['settext'] = 0;
74 $_POST['setvisual'] = 1;
76 } else { // else if == 0
77 $_POST['formatting'] = 0;
78 $_REQUEST['settext'] = 0;
79 $_REQUEST['setvisual'] = 0;
83 include(AT_INCLUDE_PATH.'header.inc.php');
84 $savant->assign('job', $job);
85 $savant->assign('categories', $job->getCategories());
86 $savant->assign('job_post', $job_post);
87 $savant->display('admin/jb_edit_post.tmpl.php');
88 include(AT_INCLUDE_PATH.'footer.inc.php');