forked from derbear/bellbook
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcourse.php
More file actions
73 lines (72 loc) · 2.7 KB
/
course.php
File metadata and controls
73 lines (72 loc) · 2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<? require("util/header.php");
connect(false);
$cId=$_GET['id'];
$cname="";
$cteachers="";
$query="SELECT * FROM Courses WHERE courseId=$cId";
$resource=mysql_query($query);
if($resource) {
while($row=mysql_fetch_array($resource)) {
$cname=$row['courseName'];
$cteachers=$row['teachers'];
}
} else {
header("Location: course.php?message=Invalid course: $cId");
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="style.css" />
<title>Course: <?php echo $cname; ?></title>
</head>
<body>
<? print_header(); ?>
<div id="content-title"><h2> <?php echo $cname; ?> information </h2></div>
<hr class="title-line"/>
<div> <? /*<p> The following course information applies to these teachers:
<? echo $cteachers ?> </p>*/?>
<p><b>Required books:</b></p>
<? require("util/listing.php");
$query="SELECT * FROM CMap WHERE courseId='$cId' AND required='1'";
$resource=mysql_query($query);
if($resource) {
$i=0;
while($row=mysql_fetch_array($resource)) {
$addClass = "";
$i++; if ($i%2==0) $addClass = " color2"; //alternate colors in display
$isbn=$row['ISBN'];
$offerbutton = "<p class='offers'><a href=offers.php?isbn=$isbn>See offers</a></p>";
$newcode = "<div class='item$addClass'>" . generateListing_B($isbn, mappedTitle($row['ISBN']),
mappedClasses($row['ISBN'])) . $offerbutton . '</div>';
echo $newcode;
}
}?>
<br />
<p><b>Optional books:</b></p>
<?
$query="SELECT * FROM CMap WHERE courseId='$cId' AND required='0'";
$resource=mysql_query($query);
if($resource) {
$i=0;
while($row=mysql_fetch_array($resource)) {
$addClass = "";
$i++; if ($i%2==0) $addClass = " color2"; //alternate colors in display
$isbn=$row['ISBN'];
$offerbutton = "<p class='offers'><a href=offers.php?isbn=$isbn>See offers</a></p>";
$newcode = "<div class='item$addClass'>" . generateListing_B($isbn, mappedTitle($row['ISBN']),
mappedClasses($row['ISBN'])) . $offerbutton . '</div>';
echo $newcode;
}
}
?>
</div>
<? require("util/footer.php"); ?>
</body>
</html>
<!--
Authors: Derek Leung, Ben Chan
Project BellBook - 1.0
Bellarmine College Preparatory, 2011
-->