changed git call from https to git readonly
[atutor.git] / mods / certificate / open_certificate.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 require(AT_INCLUDE_PATH.'lib/test_result_functions.inc.php');\r
18 require("common.inc.php");\r
19 \r
20 if ($_REQUEST["certificate_id"] == 0)\r
21 {\r
22         $msg->printErrors('NO_ITEM_SELECTED');\r
23         exit;\r
24 }\r
25 \r
26 if ($_REQUEST["result_id"] > 0) $tokens = initialize_tokens($_REQUEST['result_id']);\r
27 \r
28 $sql = "select * from ".TABLE_PREFIX."certificate_text where certificate_id=".$_REQUEST["certificate_id"];\r
29 $result = mysql_query($sql, $db) or die(mysql_error());\r
30 \r
31 $url=AT_BASE_HREF . "mods/certificate/default_certificate.pdf";\r
32 \r
33 $fdf = "%FDF-1.2\n%¡¦¡§&&Mac178;\n";\r
34 $fdf .= "1 0 obj \n<< /FDF << /Fields [\n";\r
35 \r
36 while ($row = mysql_fetch_assoc($result))\r
37 {\r
38   $key = $row["field_name"];\r
39   if ($_REQUEST["result_id"] > 0)\r
40         $value = replace_tokens($row["field_value"], $tokens);\r
41   else\r
42         $value = $row["field_value"];\r
43 \r
44   $fdf .= "<< /T ($key) /V ($value) >> \n";\r
45 }\r
46 \r
47 $fdf .= "]\n/F ($url) >>";\r
48 $fdf .= ">>\nendobj\ntrailer\n<<\n";\r
49 $fdf .= "/Root 1 0 R \n\n>>\n";\r
50 $fdf .= "%%EOF";\r
51 \r
52 header('Content-type: application/vnd.fdf');\r
53 echo $fdf;\r
54 \r
55 ?>