2 /************************************************************************/
\r
4 /************************************************************************/
\r
5 /* Copyright (c) 2002-2010 */
\r
6 /* Inclusive Design Institute */
\r
7 /* http://atutor.ca */
\r
9 /* This program is free software. You can redistribute it and/or */
\r
10 /* modify it under the terms of the GNU General Public License */
\r
11 /* as published by the Free Software Foundation. */
\r
12 /************************************************************************/
\r
15 define('AT_INCLUDE_PATH', '../../../include/');
\r
16 require(AT_INCLUDE_PATH.'vitals.inc.php');
\r
17 authenticate(AT_PRIV_GROUPS);
\r
19 if (isset($_POST['cancel'])) {
\r
20 $msg->addFeedback('CANCELLED');
\r
21 header('Location: index.php');
\r
23 } else if (isset($_POST['submit'])) {
\r
24 $_POST['title'] = trim($_POST['title']);
\r
26 if (!$_POST['title']) {
\r
27 $msg->addError(array('EMPTY_FIELDS', _AT('title')));
\r
30 if (!$msg->containsErrors()) {
\r
31 $_POST['title'] = $addslashes($_POST['title']);
\r
33 $type_id = intval($_POST['type_id']);
\r
35 $sql = "UPDATE ".TABLE_PREFIX."groups_types SET title='$_POST[title]' WHERE course_id=$_SESSION[course_id] AND type_id=$type_id";
\r
36 $result = mysql_query($sql, $db);
\r
38 $msg->addFeedback('GROUP_TYPE_EDITED_SUCCESSFULLY');
\r
40 header('Location: index.php');
\r
43 $_GET['id'] = abs($_POST['type_id']);
\r
46 require(AT_INCLUDE_PATH.'header.inc.php');
\r
48 $_GET['id'] = intval($_GET['id']);
\r
50 $sql = "SELECT * FROM ".TABLE_PREFIX."groups_types WHERE type_id=$_GET[id] AND course_id=$_SESSION[course_id]";
\r
51 $result = mysql_query($sql,$db);
\r
52 if (!($row = mysql_fetch_assoc($result))) {
\r
53 $msg->printErrors('GROUP_TYPE_NOT_FOUND');
\r
54 require (AT_INCLUDE_PATH.'footer.inc.php');
\r
59 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="form">
\r
60 <input type="hidden" name="type_id" value="<?php echo $row['type_id']; ?>" />
\r
61 <div class="input-form">
\r
62 <fieldset class="group_form"><legend class="group_form"><?php echo _AT('edit'); ?></legend>
\r
64 <span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="title"><?php echo _AT('title'); ?></label><br />
\r
65 <input type="text" name="title" id="title" value="<?php echo $row['title']; ?>" size="30" maxlength="40" />
\r
68 <div class="row buttons">
\r
69 <input type="submit" name="submit" value="<?php echo _AT('save'); ?>" accesskey="s" />
\r
70 <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?>" />
\r
76 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>