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 define('AT_INCLUDE_PATH', '../../../include/');
15 require(AT_INCLUDE_PATH.'vitals.inc.php');
16 include(AT_JB_INCLUDE.'classes/Job.class.php');
17 $_custom_css = $_base_path . AT_JB_BASENAME . 'module.css'; // use a custom stylesheet
19 admin_authenticate(AT_ADMIN_PRIV_JOB_BOARD);
23 $categories = $job->getCategories();
26 if (isset($_REQUEST['submit'])){
27 if($_POST['submit']=='ajax' && $_POST['action']=='edit'){
29 $cid = intval($_POST['cid']); //category id
30 $name = $_POST['category_name']; //category name
31 $job->updateCategory($cid, $name);
33 } elseif($_POST['action']=='add'){
35 $name = $_POST['category_name']; //category name
36 $job->addCategory($name);
37 $categories = $job->getCategories(); //refresh the list.
38 } elseif ($_GET['action']=='delete'){
40 $cid = intval($_GET['cid']); //category id
41 $hidden_vars['cid'] = $cid;
42 $this_category_name = $job->getCategoryNameById($cid);
43 $msg->addConfirm(array('DELETE', $this_category_name), $hidden_vars);
47 //handle delete confirmation
48 if (isset($_POST['submit_no'])) {
49 $msg->addFeedback('CANCELLED');
50 header('Location: categories.php');
52 } else if (isset($_POST['submit_yes'])) {
53 $cid = intval($_POST['cid']);
54 $job->removeCategory($cid);
55 $msg->addFeedback('JB_CATEGORY_DELETED');
56 header('Location: categories.php');
60 include(AT_INCLUDE_PATH.'header.inc.php');
62 $savant->assign('categories', $categories);
63 $savant->display('admin/jb_categories.tmpl.php');
64 include(AT_INCLUDE_PATH.'footer.inc.php');