remove old readme
[atutor.git] / mods / _core / users / admins / index.php
1 <?php
2 /****************************************************************************/
3 /* ATutor                                                                                                                                       */
4 /****************************************************************************/
5 /* Copyright (c) 2002-2010                                                  */
6 /* Inclusive Design Institute                                               */
7 /* http://atutor.ca                                                                                                                     */
8 /*                                                                                                                                                      */
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$
14
15 define('AT_INCLUDE_PATH', '../../../../include/');
16 require(AT_INCLUDE_PATH.'vitals.inc.php');
17 admin_authenticate(AT_ADMIN_PRIV_ADMIN);
18
19 if (isset($_GET['delete'], $_GET['login'])) {
20         header('Location: delete.php?login='.$_GET['login']);
21         exit;
22 } else if (isset($_GET['view_log'], $_GET['login'])) {
23         header('Location: log.php?login='.$_GET['login']);
24         exit;
25 } else if (isset($_GET['password'], $_GET['login'])) {
26         header('Location: password.php?login='.$_GET['login']);
27         exit;
28 } else if (isset($_GET['edit'], $_GET['login'])) {
29         header('Location: edit.php?login='.$_GET['login']);
30         exit;
31 } else if ((isset($_GET['edit']) || isset($_GET['delete']) || isset($_GET['view_log']))) {
32         $msg->addError('NO_ITEM_SELECTED');
33 }
34
35 $id = $_GET['id'];
36 $L = $_GET['L'];
37 require(AT_INCLUDE_PATH.'header.inc.php'); 
38
39
40 $orders = array('asc' => 'desc', 'desc' => 'asc');
41 $cols   = array('login' => 1, 'real_name' => 1, 'email' => 1, 'last_login' => 1);
42
43 if (isset($_GET['asc'])) {
44         $order = 'asc';
45         $col   = isset($cols[$_GET['asc']]) ? $_GET['asc'] : 'login';
46 } else if (isset($_GET['desc'])) {
47         $order = 'desc';
48         $col   = isset($cols[$_GET['desc']]) ? $_GET['desc'] : 'login';
49 } else {
50         // no order set
51         $order = 'asc';
52         $col   = 'login';
53 }
54
55
56         $offset = ($page-1)*$results_per_page;
57
58         $sql    = "SELECT * FROM ".TABLE_PREFIX."admins ORDER BY $col $order";
59         $result = mysql_query($sql, $db);
60
61 $savant->assign('result', $result);
62 $savant->display('admin/users/index.tmpl.php');
63 require(AT_INCLUDE_PATH.'footer.inc.php'); ?>