2 /****************************************************************************/
4 /****************************************************************************/
5 /* Copyright (c) 2002-2010 */
6 /* 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 /****************************************************************************/
13 // $Id: edit_forum.php 7482 2008-05-06 17:44:49Z greg $
15 define('AT_INCLUDE_PATH', '../../../include/');
16 require (AT_INCLUDE_PATH.'vitals.inc.php');
18 authenticate(AT_PRIV_FORUMS);
20 require (AT_INCLUDE_PATH.'../mods/_standard/forums/lib/forums.inc.php');
22 if (isset($_POST['cancel'])) {
23 $msg->addFeedback('CANCELLED');
24 header('Location: '.AT_BASE_HREF.'mods/_standard/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')));
32 $_POST['title'] = validate_length($_POST['title'], 60);
35 if (!$msg->containsErrors()) {
36 if (!is_shared_forum($_POST['fid'])) {
38 $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
40 $msg->addError('FORUM_NO_EDIT_SHARE');
43 header('Location: '.AT_BASE_HREF.'mods/_standard/forums/index.php');
48 $onload = 'document.form.title.focus();';
49 require(AT_INCLUDE_PATH.'header.inc.php');
51 $fid = intval($_REQUEST['fid']);
53 if (!isset($_POST['submit'])) {
54 $row = get_forum($fid, $_SESSION['course_id']);
55 if (!is_array($row)) {
56 $msg->addError('FORUM_NOT_FOUND');
58 require(AT_INCLUDE_PATH.'footer.inc.php');
62 $row['description'] = $_POST['body'];
63 $row['mins_to_edit'] = $_POST['edit'];
69 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="form">
70 <input type="hidden" name="edit_forum" value="true">
71 <input type="hidden" name="fid" value="<?php echo $fid; ?>">
73 <div class="input-form">
74 <fieldset class="group_form"><legend class="group_form"><?php echo _AT('edit_forum'); ?></legend>
76 <span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="title"><?php echo _AT('title'); ?></label><br />
77 <input type="text" name="title" size="50" id="title" value="<?php echo htmlspecialchars(stripslashes($row['title'])); ?>" />
81 <label for="body"><?php echo _AT('description'); ?></label><br />
82 <textarea name="body" cols="45" rows="2" id="body" wrap="wrap"><?php echo htmlentities_utf8($row['description']); ?></textarea>
86 <label for="edit"><?php echo _AT('allow_editing'); ?></label><br />
87 <input type="text" name="edit" size="3" id="edit" value="<?php echo intval($row['mins_to_edit']); ?>" /> <?php echo _AT('in_minutes'); ?>
90 <div class="row buttons">
91 <input type="submit" name="submit" value="<?php echo _AT('save'); ?>" accesskey="s" />
92 <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?>" />
98 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>