changed git call from https to git readonly
[atutor.git] / mods / certificate / index_instructor.php
1 <?php\r
2 /****************************************************************************/\r
3 /* ATutor                                                                                                                                       */\r
4 /****************************************************************************/\r
5 /* Copyright (c) 2002-2008 by Greg Gay, Joel Kronenberg & Heidi Hazelton        */\r
6 /* Adaptive Technology Resource Centre / University of Toronto                          */\r
7 /* http://atutor.ca                                                                                                                     */\r
8 /*                                                                                                                                                      */\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_instructor.php 7208 2008-02-20 16:07:24Z cindy $\r
14 \r
15 define('AT_INCLUDE_PATH', '../../include/');\r
16 require (AT_INCLUDE_PATH.'vitals.inc.php');\r
17 authenticate(AT_PRIV_CERTIFICATE);\r
18 require(AT_INCLUDE_PATH.'lib/themes.inc.php');\r
19 \r
20 if (isset($_POST['remove'], $_POST['certificate_id'])) \r
21 {\r
22         header('Location: certificate_delete.php?certificate_id='.$_POST['certificate_id']);\r
23         exit;\r
24\r
25 else if (isset($_POST['edit'], $_POST['certificate_id'])) \r
26 {\r
27         header('Location: certificate_edit.php?certificate_id='.$_POST['certificate_id']);\r
28         exit;\r
29\r
30 else if (!empty($_POST) && !isset($_POST['certificate_id'])) {\r
31         $msg->addError('NO_ITEM_SELECTED');\r
32 }\r
33 \r
34 require(AT_INCLUDE_PATH.'header.inc.php'); \r
35 \r
36 ?>\r
37 &middot; <?php echo _AT("require_acrobat", "preview"); ?><br><br>\r
38 <form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">\r
39 <table summary="" class="data" rules="cols" align="center" style="width: 70%;">\r
40 \r
41 <thead>\r
42 <tr>\r
43         <th scope="col">&nbsp;</th>\r
44         <!--<th scope="col"><?php echo _AT('certificate_id'); ?></th>-->\r
45         <th scope="col"><?php echo _AT('test_title'); ?></th>\r
46         <th scope="col"><?php echo _AT('pass_score'); ?></th>\r
47         <th scope="col"><?php echo _AT('created_date'); ?></th>\r
48 </tr>\r
49 </thead>\r
50 <tfoot>\r
51 <tr>\r
52         <td colspan="5">\r
53                 <div class="row buttons">\r
54                 <input type="button" name="preview" value="<?php echo _AT('preview'); ?>" onClick="open_certificate_win('<?php echo dirname($_SERVER["PHP_SELF"])?>/open_certificate.php?test_id={hidden_value}&certificate_id={radio_value}', 'certificate_id', 'test_id')" />\r
55                 <input type="submit" name="edit" value="<?php echo _AT('edit'); ?>" /> \r
56                 <input type="submit" name="remove" value="<?php echo _AT('remove'); ?>" /> \r
57                 </div>\r
58         </td>\r
59 </tr>\r
60 <tr>\r
61         <td colspan="5"></td>\r
62 </tr>\r
63 </tfoot>\r
64 <tbody>\r
65 <?php\r
66 $include_javascript = true;\r
67 \r
68 require("common.inc.php");\r
69 \r
70 if (is_pass_score_defined_in_base_table())\r
71         $sql = "SELECT c.*, t.title, t.passscore, t.passpercent from ".TABLE_PREFIX."tests t, ".TABLE_PREFIX."certificate c WHERE t.test_id = c.test_id";\r
72 else\r
73         $sql = "SELECT c.*, t.title from ".TABLE_PREFIX."tests t, ".TABLE_PREFIX."certificate c WHERE t.test_id = c.test_id";\r
74 \r
75 $result = mysql_query($sql, $db) or die(mysql_error());\r
76 \r
77 if (mysql_num_rows($result) == 0)\r
78 {\r
79 ?>\r
80         <tr>\r
81                 <td colspan="5"><?php echo _AT('none_found'); ?></td>\r
82         </tr>\r
83 <?php \r
84 }\r
85 else\r
86 {\r
87         while ($row = mysql_fetch_assoc($result))\r
88         {\r
89         ?>\r
90                 <tr onmousedown="document.form['m<?php echo $row['certificate_id']; ?>'].checked = true; rowselect(this);" id="r_<?php echo $row['certificate_id']; ?>">\r
91                         <td width="10"><input type="radio" name="certificate_id" value="<?php echo $row['certificate_id']; ?>" id="m<?php echo $row['certificate_id']; ?>" <?php if ($row['certificate_id']==$_POST['certificate_id']) echo 'checked'; ?> /></td>\r
92                         <!--<td><label for="m<?php echo $row['certificate_id']; ?>"><?php echo $row['certificate_id']; ?></label></td>-->\r
93                         <td><label for="m<?php echo $row['certificate_id']; ?>"><?php echo $row['title']; ?></label></td>\r
94                         <td>\r
95 <?php \r
96 if ($row['passscore'] <> 0) \r
97         echo $row['passscore']; \r
98 elseif ($row['passpercent'] <> 0) \r
99         echo $row['passpercent'] . "%"; \r
100 else echo _AT("na"); \r
101 ?></td>\r
102                         <td><?php echo $row['created_date']; ?></td>\r
103                         <input type="hidden" name="test_id" value="<?php echo $row['test_id']; ?>">\r
104                 </tr>\r
105 <?php \r
106         }\r
107 }\r
108 ?>\r
109 \r
110 </tbody>\r
111 </table>\r
112 \r
113 </form>\r
114 \r
115 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>\r