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
13 // $Id: index.php 7981 2008-10-01 19:34:17Z cindy $
\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['aid'])) {
\r
21 header('Location: '.AT_BASE_HREF.'mods/_standard/announcements/edit_news.php?aid='.intval($_GET['aid']));
\r
23 } else if (isset($_GET['delete'], $_GET['aid'])) {
\r
24 header('Location: '.AT_BASE_HREF.'mods/_standard/announcements/delete_news.php?aid='.intval($_GET['aid']));
\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] 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="mods/_standard/announcements/index.php?<?php echo $orders[$order]; ?>=title"><?php echo _AT('title'); ?></a></th>
\r
67 <th scope="col"><a href="mods/_standard/announcements/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'); ?>" class="button"/> <input type="submit" name="delete" value="<?php echo _AT('delete'); ?>" class="button"/></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
80 <td><input type="radio" name="aid" value="<?php echo $row['news_id']; ?>" id="n<?php echo $row['news_id']; ?>" /></td>
\r
82 <td><label for="n<?php echo $row['news_id']; ?>"><?php echo AT_print(htmlentities_utf8($row['title']), 'news.title'); ?></label></td>
\r
83 <td><?php echo AT_date(_AT('announcement_date_format'), $row['date'], AT_DATE_MYSQL_DATETIME); ?></td>
\r
85 <?php } while ($row = mysql_fetch_assoc($result)); ?>
\r
88 <td colspan="3"><?php echo _AT('none_found'); ?></td>
\r
95 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>