2 /****************************************************************************/
4 /****************************************************************************/
5 /* Copyright (c) 2002-2007 by Greg Gay, Joel Kronenberg & Heidi Hazelton */
6 /* Adaptive Technology Resource Centre / University of Toronto */
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 require (AT_INCLUDE_PATH.'vitals.inc.php');
18 authenticate(AT_PRIV_FORUMS);
20 require (AT_INCLUDE_PATH.'lib/forums.inc.php');
22 if (isset($_POST['cancel'])) {
23 $msg->addFeedback('CANCELLED');
24 header('Location: '.AT_BASE_HREF.'tools/forums/index.php');
26 } else if (isset($_POST['edit_forum'])) {
27 $_POST['fid'] = intval($_POST['fid']);
29 if ($_POST['title'] == '') {
30 $msg->addError(array('EMPTY_FIELDS', _AT('title')));
33 if (!$msg->containsErrors()) {
34 if (!is_shared_forum($_POST['fid'])) {
36 $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
38 $msg->addError('FORUM_NO_EDIT_SHARE');
41 header('Location: '.AT_BASE_HREF.'tools/forums/index.php');
46 $onload = 'document.form.title.focus();';
47 require(AT_INCLUDE_PATH.'header.inc.php');
49 $fid = intval($_REQUEST['fid']);
51 if (!isset($_POST['submit'])) {
52 $row = get_forum($fid, $_SESSION['course_id']);
53 if (!is_array($row)) {
54 $msg->addError('FORUM_NOT_FOUND');
56 require(AT_INCLUDE_PATH.'footer.inc.php');
60 $row['description'] = $_POST['body'];
61 $row['mins_to_edit'] = $_POST['edit'];
67 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="form">
68 <input type="hidden" name="edit_forum" value="true">
69 <input type="hidden" name="fid" value="<?php echo $fid; ?>">
71 <div class="input-form">
73 <div class="required" title="<?php echo _AT('required_field'); ?>">*</div><label for="title"><?php echo _AT('title'); ?></label><br />
74 <input type="text" name="title" size="50" id="title" value="<?php echo htmlspecialchars(stripslashes($row['title'])); ?>" />
78 <label for="body"><?php echo _AT('description'); ?></label><br />
79 <textarea name="body" cols="45" rows="2" id="body" wrap="wrap"><?php echo $row['description']; ?></textarea>
83 <label for="edit"><?php echo _AT('allow_editing'); ?></label><br />
84 <input type="text" name="edit" size="3" id="edit" value="<?php echo intval($row['mins_to_edit']); ?>" /> <?php echo _AT('in_minutes'); ?>
87 <div class="row buttons">
88 <input type="submit" name="submit" value="<?php echo _AT('save'); ?>" accesskey="s" />
89 <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?>" />
94 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>