class asp code:
Timetable
<%
Function min_class_date(timetable)
min_class_date=cdate("1-january-2015")
for i=0 to ubound(timetable,2)-1
'response.Write("
curr date inside array=" & cdate(timetable(1,i)))
curr_class_date=cdate(timetable(1,i))
if cdate(curr_class_date) < cdate(min_class_date) then
min_class_date=cdate(curr_class_date)
end if
next
End Function
%>
<%
Function max_class_date(timetable)
max_class_date=cdate("2000-January-22")
for i=0 to ubound(timetable,2)-1
curr_class_date=timetable(1,i)
if cdate(curr_class_date) > cdate(max_class_date) then
max_class_date=curr_class_date
end if
next
End Function
%>
<%
Function is_class_date(timetable,curdate)
is_class_date="no"
for k=0 to ubound(timetable,2)-1
'response.Write("
cdate input:" & cdate(timetable(1,k)))
'response.Write("
cur:" & cdate(curdate))
if cdate(timetable(1,k)) = cdate(curdate) then
is_class_date="yes"
response.Write(timetable(3,k)& "
")
response.Write("@" & timetable(2,k) & "
")
end if
next
End Function
%>
<%
If Request("course_code")="" Then
Response.Redirect("../YOUR FOLDER NAME HERE/YOUR ASP FILE NAME HERE.asp?msg=Records Not available
or Not authorised for your View")
ElseIf Request("study_centre_id") ="" Then
Response.Redirect("../YOUR FOLDER NAME HERE/YOUR ASP FILE NAME HERE.asp?msg=Study Centre NOT selected or
Records Not authorised for your View")
End If
sql="YOUR SQL STATEMENT FOR THE SCHEDULE HERE"
Set ObjRsSch=Myconn.Execute(sqlSch)
If ObjRsSch.EOF then
Response.Redirect("../YOUR FOLDER NAME HERE/YOUR ASP FILE NAME HERE.asp?msg=Error. Schedule is missing.
Inform administrator")
Else
schedule_code=ObjRsSch("schedule_code")
study_centre_display_name=ObjRsSch("city")
course_display_name=ObjRsSch("course_display_name")
course_session=ObjRsSch("course_session")
student_group_no=Request("i_group_no")
sqlTT="YOUR TIMETABLE RECORDS SQL STATEMENT HERE"
Set ObjRsTT=Myconn.Execute(sqlTT)
If ObjRsTT.EOf then
Response.Redirect(BACK_FILE_NAME &"?msg=Error. Timetable is not ready. Inform administrator")
End If
End If
'start_date=objRsSch("default_start_date")
'end_date=objRsSch("default_end_date")
schedule_code=objRsSch("schedule_code")
%>
<%
y=0
dim timetable()
redim timetable(3,y)
while Not ObjRsTT.EOF
timetable(0,y)=ObjRsTT("schedule_code")
' old line timetable(1,y)=yyyymmmdd_from_database(ObjRsTT("class_date"))
timetable(1,y)=ddmmyy_from_database(ObjRsTT("class_date"))
timetable(3,y)=ObjRsTT("module_code")
start_time=cint(ObjRsTT("start_time_hour"))* 100 + cint(ObjRsTT("start_time_minute"))
if start_time < 1000 then
start_time="0" & cstr(start_time)
end if
end_time=cint(ObjRsTT("end_time_hour"))* 100 + cint(ObjRsTT("end_time_minute"))
if end_time < 1000 then
end_time="0" & cstr(end_time)
end if
timetable(2,y)=start_time & "-" & end_time
redim preserve timetable(3,y+1)
'response.write("
...." & timetable(0,y) & ".." & timetable(1,y))
ObjRsTT.Movenext
y=y+1
Wend
%>
<%
start_date=cdate(min_class_date(timetable))
end_date=cdate(max_class_date(timetable))
%>
Timetable for
Batch No. <%=student_group_no%>
Of <%=course_display_name%> (<%=course_session %> Semester)
Learning Centre <%=study_centre_display_name%>
<%
days=cdate(end_date) - cdate(start_date)+1
wdstart_date=weekday(start_date)
empty_boxes=wdstart_date -1
wdend_date=weekday(end_date)
suffix_empty_boxes=7-wdend_date
total_boxes=empty_boxes + days
first_date=start_date - empty_boxes
'response.Redirect("../mY_main_module/error.asp?line_number=" & first_date)
response.write(total_boxes)
%>
Sunday
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
<%
for i=1 to total_boxes
record_exists_color="#ff0000"
wday=weekday(first_date)
if wday=7 and day(first_date)>=8 and day(first_date)<=14 then
second_saturday="yes"
else
second_saturday="no"
end if
if wday=1 then
disabled="disabled"
else
disabled=""
end if
%>
<%=ddmmyy_from_database(first_date) %>
<%
record_exists_color="#ffcccc"
%>
<%
if i <= empty_boxes or i >total_boxes then
Response.write(" ")
first_date=first_date +1
Elseif second_saturday="yes" then
%>
<%
is_class_date timetable,first_date
first_date=first_date +1
'========================
Response.write("
2nd Sat")
'=====================
%>
<%
Else
%>
<%
is_class_date timetable,first_date
first_date=first_date +1
%>
<%
End if
%>
<%
if i mod 7=0 then
%>
<%
end if
%>
<%
next
%>