tagging as ATutor 1.5.4-release
[atutor.git] / editor / add_forum.php
1 <?php
2 /****************************************************************************/
3 /* ATutor                                                                                                                                       */
4 /****************************************************************************/
5 /* Copyright (c) 2002-2007 by Greg Gay, Joel Kronenberg & Heidi Hazelton        */
6 /* Adaptive Technology Resource Centre / University of Toronto                          */
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 define('AT_INCLUDE_PATH', '../include/');
15 require (AT_INCLUDE_PATH.'vitals.inc.php');
16
17 authenticate(AT_PRIV_FORUMS);
18
19 if ($_POST['cancel']) {
20         $msg->addFeedback('CANCELLED');
21         header('Location: '.AT_BASE_HREF.'tools/forums/index.php');
22         exit;
23 }
24
25 if ($_POST['add_forum'] && (authenticate(AT_PRIV_FORUMS, AT_PRIV_RETURN))) {
26         if ($_POST['title'] == '') {
27                 $msg->addError(array('EMPTY_FIELDS', _AT('title')));
28         }
29
30         if (!$msg->containsErrors()) {
31                 require (AT_INCLUDE_PATH.'lib/forums.inc.php');
32                 add_forum($_POST);
33                 
34                 $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
35                 header('Location: '.AT_BASE_HREF.'tools/forums/index.php');
36                 exit;
37         }
38 }
39
40 $onload = 'document.form.title.focus();';
41
42 require(AT_INCLUDE_PATH.'header.inc.php');
43
44 ?>
45
46 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="form">
47 <input type="hidden" name="add_forum" value="true">
48
49 <div class="input-form">
50         <div class="row">
51                 <div class="required" title="<?php echo _AT('required_field'); ?>">*</div><label for="title"><?php echo _AT('title'); ?></label><br />
52                 <input type="text" name="title" size="40" id="title" />
53         </div>
54         <div class="row">
55                 <label for="body"><?php echo _AT('description'); ?></label><br />
56                 <textarea name="body" cols="45" rows="2" id="body" wrap="wrap"></textarea>
57         </div>
58         <div class="row">
59                 <label for="edit"><?php echo _AT('allow_editing'); ?></label><br />
60                 <input type="text" name="edit" size="3" id="edit" value="<?php echo intval($row['mins_to_edit']); ?>" /> <?php echo _AT('in_minutes'); ?>
61         </div>
62         <div class="row buttons">
63                 <input type="submit" name="submit" value="<?php echo _AT('save'); ?>" accesskey="s" /> 
64                 <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?>" />
65         </div>
66 </div>
67 </form>
68
69 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>