2 /****************************************************************************/
\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
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
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(AT_INCLUDE_PATH.'header.inc.php');
\r
20 $include_javascript=true;
\r
21 require("common.inc.php");
\r
23 $sql = "SELECT T.*, R.*, C.certificate_id, C.enable_download
\r
24 FROM ".TABLE_PREFIX."tests T, ".TABLE_PREFIX."tests_results R, ".TABLE_PREFIX."certificate C
\r
25 WHERE R.final_score > 0
\r
26 AND R.member_id=$_SESSION[member_id]
\r
27 AND R.test_id=T.test_id
\r
28 AND T.course_id=$_SESSION[course_id]
\r
29 AND T.test_id = C.test_id
\r
30 AND C.enable_download=1
\r
31 ORDER BY R.date_taken DESC";
\r
33 $result = mysql_query($sql, $db) or die(mysql_error());
\r
35 while ($row = mysql_fetch_assoc($result))
\r
37 // if pass score is defined in table certificate, set passscore, passpercent
\r
38 if (!is_pass_score_defined_in_base_table())
\r
40 $sql = "select passscore, passpercent from ".TABLE_PREFIX."certificate where test_id=".$row["test_id"];
\r
41 $result_certificate = mysql_query($sql, $db) or die(mysql_error());
\r
42 $row_certificate = mysql_fetch_assoc($result_certificate);
\r
44 $row["passscore"] = $row_certificate["passscore"];
\r
45 $row["passpercent"] = $row_certificate["passpercent"];
\r
48 // if pass score/percentage is not defined for issuing certificate, don't show rows for this test on the page
\r
49 if (($row["passscore"]==0 || $row["passscore"]=="") & ($row["passpercent"]==0 || $row["passpercent"]==""))
\r
52 // if final score or out of is empty, don't show this row on the page
\r
53 if ($row['out_of'] == 0 || $row['final_score'] == '' || $row['result_release']==AT_RELEASE_NEVER)
\r
58 $out_of = get_random_outof($row['test_id'], $row['result_id']);
\r
60 $out_of = $row['out_of'];
\r
65 if ($row["passpercent"] <> 0 & ($row["final_score"]/$out_of*100) >= $row["passpercent"])
\r
66 $pass_score = ($row["final_score"]/$out_of*100) . '%';
\r
67 if ($row["passscore"] <> 0 & $row["final_score"] >= $row["passscore"])
\r
68 $pass_score = $row["final_score"] . " / " . $out_of;
\r
70 if ($pass_score <> 0)
\r
72 $rows[] = array("result_id"=>$row["result_id"],
\r
73 "certificate_id"=>$row["certificate_id"],
\r
74 "title"=>$row["title"],
\r
75 "mark"=>$pass_score,
\r
76 "date_taken"=>$row["date_taken"]);
\r
81 · <?php echo _AT("require_acrobat", "download"); ?><br><br>
\r
83 <form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
\r
84 <table summary="" class="data" rules="cols" align="center" style="width: 70%;">
\r
88 <th scope="col"> </th>
\r
89 <th scope="col"><?php echo _AT('title'); ?></th>
\r
90 <th scope="col"><?php echo _AT('mark'); ?></th>
\r
91 <th scope="col"><?php echo _AT('date_taken'); ?></th>
\r
97 <div class="row buttons">
\r
98 <input type="button" name="download" value="<?php echo _AT('download'); ?>" onClick="open_certificate_win('<?php echo dirname($_SERVER["PHP_SELF"])?>/open_certificate.php?result_id={radio_value}&certificate_id={hidden_value}', 'result_id', 'certificate_id')" />
\r
105 if (!is_array($rows))
\r
109 <td colspan="4"><?php echo _AT('none_found'); ?></td>
\r
115 foreach ($rows as $row)
\r
118 <tr onmousedown="document.form['m<?php echo $row['result_id']; ?>'].checked = true; rowselect(this);" id="r_<?php echo $row['result_id']; ?>">
\r
119 <td width="10"><input type="radio" name="result_id" value="<?php echo $row['result_id']; ?>" id="m<?php echo $row['result_id']; ?>" <?php if ($row['result_id']==$_POST['result_id']) echo 'checked'; ?> /></td>
\r
120 <td><label for="m<?php echo $row['certificate_id']; ?>"><?php echo $row['title']; ?></label></td>
\r
121 <td><?php echo $row['mark']; ?></td>
\r
122 <td><?php echo $row['date_taken']; ?></td>
\r
123 <input type="hidden" name="certificate_id" value="<?php echo $row['certificate_id']; ?>">
\r
135 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>