7d3b11666832277189d992fda3cfc97658726363
[atutor.git] / docs / mods / _standard / basiclti / index_admin.php
1 <?php
2 define('AT_INCLUDE_PATH', '../../../include/');
3 require (AT_INCLUDE_PATH.'vitals.inc.php');
4 admin_authenticate(AT_ADMIN_PRIV_BASICLTI);
5
6 if (isset($_GET['view'], $_GET['id'])) {
7     header('Location: tool/admin_view.php?id='.$_GET['id']);
8     exit;
9 } else if (isset($_GET['edit'], $_GET['id'])) {
10     header('Location: tool/admin_edit.php?id='.$_GET['id']);
11     exit;
12 } else if (isset($_GET['delete'], $_GET['id'])) {
13     header('Location: tool/admin_delete.php?id='.$_GET['id']);
14     exit;
15 } else if ($_GET['delete'] ||$_GET['edit'] || $_GET['view'] && !isset($_GET['id'])){
16         $msg->addError("NO_ITEM_SELECTED");
17
18 }
19
20 require (AT_INCLUDE_PATH.'header.inc.php');
21
22 $sql = "SELECT t.id AS id,t.title AS title,t.toolid AS toolid,
23                t.description AS description, COUNT(c.id) AS cnt 
24         FROM ".TABLE_PREFIX."basiclti_tools AS t 
25         LEFT OUTER JOIN ".TABLE_PREFIX."basiclti_content as c
26         ON t.toolid = c.toolid
27         WHERE t.course_id = 0 GROUP BY t.toolid ORDER BY t.title";
28 $result = mysql_query($sql, $db) or die(mysql_error());
29 ?>
30 <form name="form" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
31 <table class="data static" summary="" rules="all">
32         <thead>
33                 <th>&nbsp;</th>
34                 <th><?php echo _AT('bl_title'); ?></th>
35                 <th><?php echo _AT('bl_toolid_header'); ?></th>
36                 <th><?php echo _AT('bl_description'); ?></th>
37                 <th><?php echo _AT('bl_count'); ?></th>
38         </thead>
39         <tfoot>
40                 <tr>
41                 <td colspan="5"><input type="submit" name="view" value="<?php echo _AT('view'); ?>" />
42                     <input type="submit" name="edit" value="<?php echo _AT('edit'); ?>" />
43                     <input type="submit" name="delete" value="<?php echo _AT('delete'); ?>" /></td>
44                 </tr>
45         </tfoot>
46         <tbody>
47                 <?php while($row = mysql_fetch_array($result)) { ?><tr>
48                 <td><input type="radio" name="id" value="<?php echo $row['id']; ?>" id="m<?php echo $row['id']; ?>" /></td>
49                 <td><label for="m<?php echo $row['id']; ?>"><?php echo $row['title']; ?></a></td>
50                 <td><?php echo $row['toolid']; ?></td>
51                 <td><?php echo $row['description']; ?></td>
52                 <td><?php echo $row['cnt']; ?></td>
53                 </tr> <?php } ?>
54         </tbody>
55 </table>
56 </form>
57 <?php
58 include(AT_INCLUDE_PATH.'footer.inc.php');
59 ?>