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 /****************************************************************************/
15 define('AT_INCLUDE_PATH', '../../../../include/');
16 require(AT_INCLUDE_PATH.'vitals.inc.php');
18 authenticate(AT_PRIV_POLLS);
20 if (isset($_POST['edit'], $_POST['poll'])) {
21 header('Location: edit.php?poll_id=' . $_POST['poll']);
23 } else if (isset($_POST['delete'], $_POST['poll'])) {
24 header('Location: delete.php?pid=' . $_POST['poll'] );
26 } else if (!empty($_POST)) {
27 $msg->addError('NO_ITEM_SELECTED');
30 require(AT_INCLUDE_PATH.'header.inc.php');
32 $orders = array('asc' => 'desc', 'desc' => 'asc');
33 $cols = array('question' => 1, 'created_date' => 1, 'total' => 1);
35 if (isset($_GET['asc'])) {
37 $col = isset($cols[$_GET['asc']]) ? $_GET['asc'] : 'created_date';
38 } else if (isset($_GET['desc'])) {
40 $col = isset($cols[$_GET['desc']]) ? $_GET['desc'] : 'created_date';
44 $col = 'created_date';
47 $sql = "SELECT poll_id, question, created_date, total FROM ".TABLE_PREFIX."polls WHERE course_id=$_SESSION[course_id] ORDER BY $col $order";
48 $result = mysql_query($sql, $db);
49 $savant->assign('col', $col);
50 $savant->assign('order', $order);
51 $savant->assign('orders', $orders);
52 $savant->assign('result', $result);
53 $savant->display('instructor/polls/index.tmpl.php');
54 require(AT_INCLUDE_PATH.'footer.inc.php'); ?>