-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathprogramdetails.php
148 lines (139 loc) · 4.34 KB
/
programdetails.php
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<?php
$prgindx=12348;
$logedIn = 0;
include_once("includes/config.php");
$stdid=$loginfo->getUserId();
if(!$loginfo->isLoggedIn())
{
$logedIn = 1;
}
function mysql_2_php_date($str)
{
$str=trim($str);
//'2012-05-14 10:19:30';
list($day,$time)=explode(" ", $str);
list($hour,$minute,$second)=explode(":", $time);
list($year,$month,$day)=explode("-", $day);
return mktime($hour,$minute,$second,$month,$day,$year);
}
function isallowed($progid,$studid)
{
$sql="select prog_start_date, prog_expire_date from es_prog where prog_id=$progid";
$res=mysql_query($sql);
$prog_start_date=0;
$prog_exp_date=0;
if($row=mysql_fetch_array($res))
{
$prog_start_date=mysql_2_php_date($row[0]);
$prog_exp_date=mysql_2_php_date($row[1]);
if($prog_start_date > time() || $prog_exp_date < time())
{
return false;
}
}
else{
return false;
}
$sql="select max(sp_test_start_time) from es_std_prog where sp_std_id=$studid and sp_prog_id=$progid";// and sp_status='over'";
$res=mysql_query($sql);
if($row=mysql_fetch_array($res))
{
if($row[0]==NULL || $row[0]==""){
return true;
}
$lasttime=mysql_2_php_date($row[0]);
if($prog_start_date > $lasttime)
{
return true;
}
return false;
}
return true;
}
$registered=Array();
if($loginfo->isLoggedIn())
{
$query = "select sp_prog_id from es_std_prog where sp_std_id = '".$loginfo->getUserId()."'";
$result = mysql_query($query);
if($result) {
while( $row = mysql_fetch_row($result)){
$registered[$row[0]] = $row[0];
}
}
}
$error="";
if(isset($_SESSION['prgerror']))
{
$error=$_SESSION['prgerror'];
unset($_SESSION['prgerror']);
}
?>
<?php include('includes/upper.php'); ?>
<!-- js or css here -->
<script>
$(function() {
/*$( "#accordion" ).accordion({
autoHeight: false,
navigation: true
});*/
$("a.taketest").css("cursor","pointer")
.css("text-decoration","underline")
.click(function(){window.open("question.php?prgid="+$(this).attr("prgid"),"_self")})
$("a.register").css("cursor","pointer")
.css("text-decoration","underline")
.click(function(){
<?php if( $logedIn ){ ?>
$( "#login-form" ).dialog( "open" );
$(".redirectto").val("model/model_registerprogram.php?prgid="+$(this).attr("prgid"))
//alert("Please login to register in program");
<?php }
else{ ?>
window.open("model/model_registerprogram.php?prgid="+$(this).attr("prgid"),"_self");
<?php } ?>
})
});
</script>
<?php include('includes/middle.php'); ?>
<?php //include('includes/content_program.php'); ?>
<div class="demo">
<div class="prgpad ui-widget-header"> Program Details</div>
<?php if($error!="") echo'<div style="padding: 0pt 0.7em;" class="ui-state-error ui-corner-all">'.$error.'</div>'; ?>
<div id="accordion" class="insidecontent">
<?php
//echo $stdid;
$sql="select * from es_prog where prog_id = ".($_GET['progid'] - $prgindx);
$res = mysql_query($sql);
while ($row = mysql_fetch_array($res)) {
?>
<div align="center"><h2 style="font-size:22px"><?php echo $row['prog_name']; ?></h2></div>
<div>
<div><div style="font-size:18px;">Program Description: </div><?php echo htmlentities ( $row['prog_short_desc']) ?></div><br>
<div><div style="font-size:18px;">Registration Open Date:</div> <span style="color:blue"><?php echo date("l, jS \of F Y h:i A",strtotime($row[10]));?></span></div><br/>
<div><div style="font-size:18px;">Registration Closing Date:</div><span style="color:blue"><?php echo date("l, jS \of F Y h:i A",strtotime($row[9]));?></span></div><br/>
<div><div style="font-size:18px;">Mentor & Trainer Brief Profile:</div><?php echo htmlentities ($row[6]);?></div><br/>
<div><div style="font-size:18px;">Course Prerequisite:</div><?php echo htmlentities ($row[7]);?></div><br/>
<div><div style="font-size:18px;">Entrance Test Required:</div><?php if($row[8]) echo "Yes"; else echo "No";?></div>
<div></div>
<br>
<div>
<?php if(!isset($registered[$row[0]])) { ?>
<a class="register" prgid="<?php echo ($prgindx+$row[0]);?>">Register</a>
<!--<?php if( isallowed($row[0],$loginfo->getUserId())) { ?>
<a class="taketest" prgid="<?php echo ($prgindx+$row[0]);?>">Take Test</a>
<?php } ?>-->
<?php
} else {
?>
<span style="text-decoration:underline; color:#ffaa99">Registered</span>
<?php
}
?>
</div>
</div>
<?php
}
mysql_free_result($res);
?>
</div>
</div>
<?php include('includes/lower.php'); ?>