2 /****************************************************************/
\r
4 /****************************************************************/
\r
5 /* Copyright (c) 2002-2007 by Greg Gay & Joel Kronenberg */
\r
6 /* Adaptive Technology Resource Centre / University of Toronto */
\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
16 define('AT_INCLUDE_PATH', '../../include/');
\r
17 require(AT_INCLUDE_PATH.'vitals.inc.php');
\r
18 authenticate(AT_PRIV_ANNOUNCEMENTS);
\r
20 if (isset($_GET['edit'], $_GET['id'])) {
\r
21 header('Location: '.AT_BASE_HREF.'editor/edit_news.php?aid='.intval($_GET['id']));
\r
23 } else if (isset($_GET['delete'], $_GET['id'])) {
\r
24 header('Location: '.AT_BASE_HREF.'editor/delete_news.php?aid='.intval($_GET['id']));
\r
26 } else if ((isset($_GET['edit']) || isset($_GET['delete']))) {
\r
27 $msg->addError('NO_ITEM_SELECTED');
\r
30 require(AT_INCLUDE_PATH.'header.inc.php');
\r
32 $orders = array('asc' => 'desc', 'desc' => 'asc');
\r
33 $cols = array('title' => 1, 'date' => 1);
\r
35 if (isset($_GET['asc'])) {
\r
37 $col = isset($cols[$_GET['asc']]) ? $_GET['asc'] : 'date';
\r
38 } else if (isset($_GET['desc'])) {
\r
40 $col = isset($cols[$_GET['desc']]) ? $_GET['desc'] : 'date';
\r
47 $sql = "SELECT news_id, title, date FROM ".TABLE_PREFIX."news WHERE course_id=$_SESSION[course_id] $and ORDER BY $col $order";
\r
48 $result = mysql_query($sql, $db);
\r
51 <form name="form" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
\r
52 <table class="data" summary="" rules="cols">
\r
54 <?php if ($col == 'title'): ?>
\r
56 <col class="sort" />
\r
58 <?php elseif($col == 'date'): ?>
\r
60 <col class="sort" />
\r
65 <th scope="col"> </th>
\r
66 <th scope="col"><a href="tools/news/index.php?<?php echo $orders[$order]; ?>=title"><?php echo _AT('title'); ?></a></th>
\r
67 <th scope="col"><a href="tools/news/index.php?<?php echo $orders[$order]; ?>=date"><?php echo _AT('date'); ?></a></th>
\r
72 <td colspan="3"><input type="submit" name="edit" value="<?php echo _AT('edit'); ?>" /> <input type="submit" name="delete" value="<?php echo _AT('delete'); ?>" /></td>
\r
76 <?php if ($row = mysql_fetch_assoc($result)): ?>
\r
78 <tr onmousedown="document.form['n<?php echo $row['news_id']; ?>'].checked = true; rowselect(this);" id="r_<?php echo $row['news_id']; ?>">
\r
79 <td><input type="radio" name="id" value="<?php echo $row['news_id']; ?>" id="n<?php echo $row['news_id']; ?>" /></td>
\r
80 <td><label for="n<?php echo $row['news_id']; ?>"><?php echo AT_print($row['title'], 'news.title'); ?></label></td>
\r
81 <td><?php echo AT_date(_AT('announcement_date_format'), $row['date'], AT_DATE_MYSQL_DATETIME); ?></td>
\r
83 <?php } while ($row = mysql_fetch_assoc($result)); ?>
\r
86 <td colspan="3"><?php echo _AT('none_found'); ?></td>
\r
93 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>