update,
This commit is contained in:
23
_resources/it114105/itp4511/Assignment/.gitignore
vendored
Normal file
23
_resources/it114105/itp4511/Assignment/.gitignore
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
# Compiled class file
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
45
_resources/it114105/itp4511/Assignment/README.md.original
Normal file
45
_resources/it114105/itp4511/Assignment/README.md.original
Normal file
@@ -0,0 +1,45 @@
|
||||
# ITP4511 Enterprise Systems Development
|
||||
|
||||
Basically, the system involved teacher, student and IT administrator.
|
||||
- [x] Teacher: can mark attendance, modify the attendance record, and generate report.
|
||||
- [x] Student: can view his or her attendance record only.
|
||||
- [x] IT administrator: can fully access the system, included account management.
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
|
||||
|
||||
Function Requirement
|
||||
##### Class Management Functions
|
||||
• Setup class data
|
||||
• Schedule school day
|
||||
|
||||
##### Attendance Functions
|
||||
• Show class schedule
|
||||
• Record attendance for students per class
|
||||
• Edit/view attendance history
|
||||
• Generate attendance sheet for each class
|
||||
|
||||
##### Analytic/Report
|
||||
• Calculate attendance rate for each student by class
|
||||
• Generate report for attendance rate less than 60%
|
||||
• Generate report for class schedule
|
||||
|
||||
##### Account Management
|
||||
• Create different account/user
|
||||
• Register student according to class
|
||||
• Modify account information
|
||||
• Manage the user role
|
||||
|
||||
##### Extra Feature
|
||||
You are encouraged to add extra feature to score bonus mark, for example,
|
||||
• Show statistic in graphical formats
|
||||
• Show top search keywords
|
||||
• Export the attendance report to Excel file
|
||||
• Design your own database for the web-based system
|
71
_resources/it114105/itp4511/Assignment/build.xml
Normal file
71
_resources/it114105/itp4511/Assignment/build.xml
Normal file
@@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- You may freely edit this file. See commented blocks below for -->
|
||||
<!-- some examples of how to customize the build. -->
|
||||
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||
<!-- By default, only the Clean and Build commands use this build script. -->
|
||||
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
||||
<!-- the Compile on Save feature is turned off for the project. -->
|
||||
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
||||
<!-- in the project's Project Properties dialog box.-->
|
||||
<project name="ITP4511Assignemnt" default="default" basedir=".">
|
||||
<description>Builds, tests, and runs the project ITP4511Assignemnt.</description>
|
||||
<import file="nbproject/build-impl.xml"/>
|
||||
<!--
|
||||
|
||||
There exist several targets which are by default empty and which can be
|
||||
used for execution of your tasks. These targets are usually executed
|
||||
before and after some main targets. They are:
|
||||
|
||||
-pre-init: called before initialization of project properties
|
||||
-post-init: called after initialization of project properties
|
||||
-pre-compile: called before javac compilation
|
||||
-post-compile: called after javac compilation
|
||||
-pre-compile-single: called before javac compilation of single file
|
||||
-post-compile-single: called after javac compilation of single file
|
||||
-pre-compile-test: called before javac compilation of JUnit tests
|
||||
-post-compile-test: called after javac compilation of JUnit tests
|
||||
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||
-pre-dist: called before archive building
|
||||
-post-dist: called after archive building
|
||||
-post-clean: called after cleaning build products
|
||||
-pre-run-deploy: called before deploying
|
||||
-post-run-deploy: called after deploying
|
||||
|
||||
Example of pluging an obfuscator after the compilation could look like
|
||||
|
||||
<target name="-post-compile">
|
||||
<obfuscate>
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
</obfuscate>
|
||||
</target>
|
||||
|
||||
For list of available properties check the imported
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
|
||||
Other way how to customize the build is by overriding existing main targets.
|
||||
The target of interest are:
|
||||
|
||||
init-macrodef-javac: defines macro for javac compilation
|
||||
init-macrodef-junit: defines macro for junit execution
|
||||
init-macrodef-debug: defines macro for class debugging
|
||||
do-dist: archive building
|
||||
run: execution of project
|
||||
javadoc-build: javadoc generation
|
||||
|
||||
Example of overriding the target for project execution could look like
|
||||
|
||||
<target name="run" depends="<PROJNAME>-impl.jar">
|
||||
<exec dir="bin" executable="launcher.exe">
|
||||
<arg file="${dist.jar}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
Notice that overridden target depends on jar target and not only on
|
||||
compile target as regular run target does. Again, for list of available
|
||||
properties which you can use check the target you are overriding in
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
-->
|
||||
</project>
|
150
_resources/it114105/itp4511/Assignment/nbproject/ant-deploy.xml
Normal file
150
_resources/it114105/itp4511/Assignment/nbproject/ant-deploy.xml
Normal file
@@ -0,0 +1,150 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
||||
|
||||
Copyright (c) 2008, 2016 Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
Oracle and Java are registered trademarks of Oracle and/or its affiliates.
|
||||
Other names may be trademarks of their respective owners.
|
||||
|
||||
The contents of this file are subject to the terms of either the GNU
|
||||
General Public License Version 2 only ("GPL") or the Common
|
||||
Development and Distribution License("CDDL") (collectively, the
|
||||
"License"). You may not use this file except in compliance with the
|
||||
License. You can obtain a copy of the License at
|
||||
http://www.netbeans.org/cddl-gplv2.html
|
||||
or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
|
||||
specific language governing permissions and limitations under the
|
||||
License. When distributing the software, include this License Header
|
||||
Notice in each file and include the License file at
|
||||
nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
|
||||
particular file as subject to the "Classpath" exception as provided
|
||||
by Oracle in the GPL Version 2 section of the License file that
|
||||
accompanied this code. If applicable, add the following below the
|
||||
License Header, with the fields enclosed by brackets [] replaced by
|
||||
your own identifying information:
|
||||
"Portions Copyrighted [year] [name of copyright owner]"
|
||||
|
||||
If you wish your version of this file to be governed by only the CDDL
|
||||
or only the GPL Version 2, indicate your decision by adding
|
||||
"[Contributor] elects to include this software in this distribution
|
||||
under the [CDDL or GPL Version 2] license." If you do not indicate a
|
||||
single choice of license, a recipient has the option to distribute
|
||||
your version of this file under either the CDDL, the GPL Version 2 or
|
||||
to extend the choice of license to its licensees as provided above.
|
||||
However, if you add GPL Version 2 code and therefore, elected the GPL
|
||||
Version 2 license, then the option applies only if the new code is
|
||||
made subject to such option by the copyright holder.
|
||||
|
||||
Contributor(s):
|
||||
-->
|
||||
<project default="-deploy-ant" basedir=".">
|
||||
<target name="-init-cl-deployment-env" if="deploy.ant.enabled">
|
||||
<property file="${deploy.ant.properties.file}" />
|
||||
<available file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" property="sun.web.present"/>
|
||||
<available file="${deploy.ant.docbase.dir}/WEB-INF/glassfish-web.xml" property="glassfish.web.present"/>
|
||||
<available file="${deploy.ant.resource.dir}" property="has.setup"/>
|
||||
<tempfile prefix="gfv3" property="gfv3.password.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
|
||||
<echo message="AS_ADMIN_PASSWORD=${gfv3.password}" file="${gfv3.password.file}"/>
|
||||
</target>
|
||||
|
||||
<target name="-parse-sun-web" depends="-init-cl-deployment-env" if="sun.web.present">
|
||||
<tempfile prefix="gfv3" property="temp.sun.web" destdir="${java.io.tmpdir}"/>
|
||||
<copy file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" tofile="${temp.sun.web}"/>
|
||||
<!-- The doctype triggers resolution which can fail -->
|
||||
<replace file="${temp.sun.web}">
|
||||
<replacetoken><![CDATA[<!DOCTYPE]]></replacetoken>
|
||||
<replacevalue><![CDATA[<!-- <!DOCTYPE]]></replacevalue>
|
||||
</replace>
|
||||
<replace file="${temp.sun.web}">
|
||||
<replacetoken><![CDATA[<sun-web-app]]></replacetoken>
|
||||
<replacevalue><![CDATA[--> <sun-web-app]]></replacevalue>
|
||||
</replace>
|
||||
<xmlproperty file="${temp.sun.web}" validate="false">
|
||||
</xmlproperty>
|
||||
<delete file="${temp.sun.web}"/>
|
||||
<condition property="deploy.ant.client.url" value="${gfv3.url}${sun-web-app.context-root}" else="${gfv3.url}/${ant.project.name}">
|
||||
<isset property="sun-web-app.context-root"/>
|
||||
</condition>
|
||||
<condition property="deploy.context.root.argument" value="&contextroot=${sun-web-app.context-root}" else="/${ant.project.name}">
|
||||
<isset property="sun-web-app.context-root"/>
|
||||
</condition>
|
||||
</target>
|
||||
<target name="-parse-glassfish-web" depends="-init-cl-deployment-env" if="glassfish.web.present">
|
||||
<tempfile prefix="gfv3" property="temp.gf.web" destdir="${java.io.tmpdir}"/>
|
||||
<copy file="${deploy.ant.docbase.dir}/WEB-INF/glassfish-web.xml" tofile="${temp.gf.web}"/>
|
||||
<!-- The doctype triggers resolution which can fail -->
|
||||
<replace file="${temp.gf.web}">
|
||||
<replacetoken><![CDATA[<!DOCTYPE]]></replacetoken>
|
||||
<replacevalue><![CDATA[<!-- <!DOCTYPE]]></replacevalue>
|
||||
</replace>
|
||||
<replace file="${temp.gf.web}">
|
||||
<replacetoken><![CDATA[<glassfish-web-app]]></replacetoken>
|
||||
<replacevalue><![CDATA[--> <glassfish-web-app]]></replacevalue>
|
||||
</replace>
|
||||
<xmlproperty file="${temp.gf.web}" validate="false">
|
||||
</xmlproperty>
|
||||
<delete file="${temp.gf.web}"/>
|
||||
<condition property="deploy.ant.client.url" value="${gfv3.url}${glassfish-web-app.context-root}" else="${gfv3.url}/${ant.project.name}">
|
||||
<isset property="glassfish-web-app.context-root"/>
|
||||
</condition>
|
||||
<condition property="deploy.context.root.argument" value="&contextroot=${glassfish-web-app.context-root}" else="/${ant.project.name}">
|
||||
<isset property="glassfish-web-app.context-root"/>
|
||||
</condition>
|
||||
</target>
|
||||
<target name="-no-parse-sun-web" depends="-init-cl-deployment-env" unless="sun.web.present">
|
||||
<property name="deploy.context.root.argument" value=""/>
|
||||
</target>
|
||||
<target name="-add-resources" depends="-init-cl-deployment-env" if="has.setup">
|
||||
<tempfile prefix="gfv3" property="gfv3.resources.dir" destdir="${java.io.tmpdir}"/>
|
||||
<mkdir dir="${gfv3.resources.dir}"/>
|
||||
<mkdir dir="${gfv3.resources.dir}/META-INF"/>
|
||||
<copy todir="${gfv3.resources.dir}/META-INF">
|
||||
<fileset dir="${deploy.ant.resource.dir}"/>
|
||||
</copy>
|
||||
<jar destfile="${deploy.ant.archive}" update="true">
|
||||
<fileset dir="${gfv3.resources.dir}"/>
|
||||
</jar>
|
||||
<delete dir="${gfv3.resources.dir}"/>
|
||||
</target>
|
||||
<target name="-deploy-ant" depends="-parse-glassfish-web, -parse-sun-web, -no-parse-sun-web,-add-resources" if="deploy.ant.enabled">
|
||||
<antcall target="-deploy-without-pw"/>
|
||||
<antcall target="-deploy-with-pw"/>
|
||||
</target>
|
||||
|
||||
<target name="-deploy-without-pw" unless="gfv3.password">
|
||||
<echo message="Deploying ${deploy.ant.archive}"/>
|
||||
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
|
||||
<property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/>
|
||||
<get src="${gfv3.admin.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}&force=true&name=${ant.project.name}"
|
||||
dest="${gfv3.results.file}"/>
|
||||
<delete file="${gfv3.results.file}"/>
|
||||
</target>
|
||||
<target name="-deploy-with-pw" if="gfv3.password">
|
||||
<echo message="Deploying ${deploy.ant.archive}"/>
|
||||
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
|
||||
<property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/>
|
||||
<get username="${gfv3.username}" password="${gfv3.password}" src="${gfv3.admin.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}&force=true&name=${ant.project.name}"
|
||||
dest="${gfv3.results.file}"/>
|
||||
<delete file="${gfv3.results.file}"/>
|
||||
</target>
|
||||
<target name="-undeploy-ant" depends="-init-cl-deployment-env" if="deploy.ant.enabled">
|
||||
<antcall target="-undeploy-without-pw"/>
|
||||
<antcall target="-undeploy-with-pw"/>
|
||||
</target>
|
||||
|
||||
<target name="-undeploy-without-pw" unless="gfv3.password">
|
||||
<echo message="Undeploying ${deploy.ant.archive}"/>
|
||||
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
|
||||
<get src="${gfv3.admin.url}/__asadmin/undeploy?name=${ant.project.name}"
|
||||
dest="${gfv3.results.file}"/>
|
||||
<delete file="${gfv3.results.file}"/>
|
||||
</target>
|
||||
<target name="-undeploy-with-pw" if="gfv3.password">
|
||||
<echo message="Undeploying ${deploy.ant.archive}"/>
|
||||
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
|
||||
<get username="${gfv3.username}" password="${gfv3.password}" src="${gfv3.admin.url}/__asadmin/undeploy?name=${ant.project.name}"
|
||||
dest="${gfv3.results.file}"/>
|
||||
<delete file="${gfv3.results.file}"/>
|
||||
</target>
|
||||
</project>
|
1444
_resources/it114105/itp4511/Assignment/nbproject/build-impl.xml
Normal file
1444
_resources/it114105/itp4511/Assignment/nbproject/build-impl.xml
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,8 @@
|
||||
build.xml.data.CRC32=bc74c962
|
||||
build.xml.script.CRC32=aee59e2a
|
||||
build.xml.stylesheet.CRC32=651128d4@1.68.1.1
|
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||
nbproject/build-impl.xml.data.CRC32=bc74c962
|
||||
nbproject/build-impl.xml.script.CRC32=84172eac
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.68.1.1
|
@@ -0,0 +1,10 @@
|
||||
deploy.ant.properties.file=C:\\Users\\jerry\\AppData\\Roaming\\NetBeans\\8.2\\config\\GlassFishEE6\\Properties\\gfv3240127067.properties
|
||||
j2ee.platform.is.jsr109=true
|
||||
j2ee.server.domain=C:/Users/jerry/AppData/Roaming/NetBeans/8.2/config/GF_4.1.1/domain1
|
||||
j2ee.server.home=C:/Program Files/glassfish-4.1.1/glassfish
|
||||
j2ee.server.instance=[C:\\Program Files\\glassfish-4.1.1\\glassfish;C:\\Program Files\\glassfish-4.1.1\\glassfish\\domains\\domain1]deployer:gfv3ee6wc:localhost:4848
|
||||
j2ee.server.middleware=C:/Program Files/glassfish-4.1.1
|
||||
javac.debug=true
|
||||
javadoc.preview=true
|
||||
selected.browser=default
|
||||
user.properties.file=C:\\Users\\jerry\\AppData\\Roaming\\NetBeans\\8.2\\build.properties
|
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
||||
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
||||
<group>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/web/teacher/report.jsp</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/src/java/system/servlet/ErrorHandler.java</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/src/java/system/bean/SchedulerBean.java</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/web/teacher/attendance.jsp</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/web/admin/attendance.jsp</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/web/admin/schedule.jsp</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/src/java/system/servlet/TeacherReportController.java</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/web/admin/class.jsp</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/web/teacher/attendanceStudent.jsp</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/web/teacher/reportClass.jsp</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/src/java/system/bean/SearchBean.java</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/web/admin/lectureEdit.jsp</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/web/admin/reportStudent.jsp</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/web/teacher/reportStudent.jsp</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/src/java/system/bean/StudentBean.java</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/web/admin/scheduleClass.jsp</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/src/java/system/bean/LectureDayBean.java</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/src/java/system/servlet/AdminClassController.java</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/web/admin/user.jsp</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/src/java/system/bean/TeacherBean.java</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/src/java/system/servlet/AdminUserController.java</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/web/teacher/dashboard.jsp</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/src/java/system/servlet/ErrorController.java</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/web/student/dashboard.jsp</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/web/teacher/isError.jsp</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/web/admin/lecture.jsp</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/src/java/system/bean/LectureTimeBean.java</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/web/student/attendanceStudent.jsp</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/web/admin/dashboard.jsp</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/src/java/system/bean/LoginBean.java</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/web/admin/scheduleSchoolDay.jsp</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/src/java/system/bean/AdminBean.java</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/web/WEB-INF/tlds/nav-taglib.tld</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/src/java/system/bean/AttendBean.java</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/src/java/system/servlet/AdminAttendController.java</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/src/java/system/bean/LectureBean.java</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/web/404error.jsp</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/src/java/system/bean/SemesterBean.java</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/src/java/system/servlet/LoginController.java</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/web/admin/reportClass.jsp</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/src/java/system/servlet/AdminScheduleController.java</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/src/java/system/servlet/TeacherDashbaordController.java</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/src/java/system/bean/ClassBean.java</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/web/WEB-INF/web.xml</file>
|
||||
<file>file:/C:/Users/jerry/Documents/NetBeansProjects/ITP4511Assignemnt/src/java/system/bean/ClassYearBean.java</file>
|
||||
</group>
|
||||
</open-files>
|
||||
</project-private>
|
@@ -0,0 +1,90 @@
|
||||
annotation.processing.enabled=true
|
||||
annotation.processing.enabled.in.editor=true
|
||||
annotation.processing.processors.list=
|
||||
annotation.processing.run.all.processors=true
|
||||
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||
auxiliary.org-netbeans-modules-projectapi.jsf_2e_language=Facelets
|
||||
build.classes.dir=${build.web.dir}/WEB-INF/classes
|
||||
build.classes.excludes=**/*.java,**/*.form
|
||||
build.dir=build
|
||||
build.generated.dir=${build.dir}/generated
|
||||
build.generated.sources.dir=${build.dir}/generated-sources
|
||||
build.test.classes.dir=${build.dir}/test/classes
|
||||
build.test.results.dir=${build.dir}/test/results
|
||||
build.web.dir=${build.dir}/web
|
||||
build.web.excludes=${build.classes.excludes}
|
||||
client.urlPart=
|
||||
compile.jsps=false
|
||||
conf.dir=${source.root}/conf
|
||||
debug.classpath=${build.classes.dir}:${javac.classpath}
|
||||
debug.test.classpath=\
|
||||
${run.test.classpath}
|
||||
display.browser=true
|
||||
# Files to be excluded from distribution war
|
||||
dist.archive.excludes=
|
||||
dist.dir=dist
|
||||
dist.ear.war=${dist.dir}/${war.ear.name}
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
dist.war=${dist.dir}/${war.name}
|
||||
endorsed.classpath=\
|
||||
${libs.javaee-endorsed-api-6.0.classpath}
|
||||
excludes=
|
||||
includes=**
|
||||
j2ee.compile.on.save=true
|
||||
j2ee.copy.static.files.on.save=true
|
||||
j2ee.deploy.on.save=true
|
||||
j2ee.platform=1.7-web
|
||||
j2ee.platform.classpath=${j2ee.server.home}/modules/endorsed/javax.annotation-api.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/bean-validator.jar:${j2ee.server.home}/modules/cdi-api.jar:${j2ee.server.home}/modules/javax.batch-api.jar:${j2ee.server.home}/modules/javax.ejb-api.jar:${j2ee.server.home}/modules/javax.el.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent.jar:${j2ee.server.home}/modules/javax.enterprise.deploy-api.jar:${j2ee.server.home}/modules/javax.faces.jar:${j2ee.server.home}/modules/javax.inject.jar:${j2ee.server.home}/modules/javax.interceptor-api.jar:${j2ee.server.home}/modules/javax.jms-api.jar:${j2ee.server.home}/modules/javax.json.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/javax.management.j2ee-api.jar:${j2ee.server.home}/modules/javax.persistence.jar:${j2ee.server.home}/modules/javax.resource-api.jar:${j2ee.server.home}/modules/javax.security.auth.message-api.jar:${j2ee.server.home}/modules/javax.security.jacc-api.jar:${j2ee.server.home}/modules/javax.servlet-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/javax.transaction-api.jar:${j2ee.server.home}/modules/javax.websocket-api.jar:${j2ee.server.home}/modules/javax.ws.rs-api.jar:${j2ee.server.home}/modules/javax.xml.registry-api.jar:${j2ee.server.home}/modules/javax.xml.rpc-api.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/weld-osgi-bundle.jar:${j2ee.server.middleware}/mq/lib/jaxm-api.jar
|
||||
j2ee.platform.embeddableejb.classpath=${j2ee.server.home}/lib/embedded/glassfish-embedded-static-shell.jar
|
||||
j2ee.platform.wscompile.classpath=${j2ee.server.home}/modules/webservices-osgi.jar
|
||||
j2ee.platform.wsgen.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar
|
||||
j2ee.platform.wsimport.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar
|
||||
j2ee.platform.wsit.classpath=
|
||||
j2ee.server.type=gfv3ee6
|
||||
jar.compress=false
|
||||
javac.classpath=\
|
||||
${libs.MySQLDriver.classpath}
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.debug=true
|
||||
javac.deprecation=false
|
||||
javac.processorpath=\
|
||||
${javac.classpath}
|
||||
javac.source=1.8
|
||||
javac.target=1.8
|
||||
javac.test.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
javac.test.processorpath=\
|
||||
${javac.test.classpath}
|
||||
javadoc.additionalparam=
|
||||
javadoc.author=false
|
||||
javadoc.encoding=${source.encoding}
|
||||
javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
javadoc.preview=true
|
||||
javadoc.private=false
|
||||
javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
javadoc.windowtitle=
|
||||
lib.dir=${web.docbase.dir}/WEB-INF/lib
|
||||
persistence.xml.dir=${conf.dir}
|
||||
platform.active=default_platform
|
||||
resource.dir=setup
|
||||
run.test.classpath=\
|
||||
${javac.test.classpath}:\
|
||||
${build.test.classes.dir}
|
||||
# Space-separated list of JVM arguments used when running a class with a main method or a unit test
|
||||
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value):
|
||||
runmain.jvmargs=
|
||||
source.encoding=UTF-8
|
||||
source.root=src
|
||||
src.dir=${source.root}/java
|
||||
test.src.dir=test
|
||||
war.content.additional=
|
||||
war.ear.name=${war.name}
|
||||
war.name=ITP4511Assignemnt.war
|
||||
web.docbase.dir=web
|
||||
webinf.dir=web/WEB-INF
|
23
_resources/it114105/itp4511/Assignment/nbproject/project.xml
Normal file
23
_resources/it114105/itp4511/Assignment/nbproject/project.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.web.project</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/web-project/3">
|
||||
<name>ITP4511Assignemnt</name>
|
||||
<minimum-ant-version>1.6.5</minimum-ant-version>
|
||||
<web-module-libraries>
|
||||
<library dirs="200">
|
||||
<file>${libs.MySQLDriver.classpath}</file>
|
||||
<path-in-war>WEB-INF/lib</path-in-war>
|
||||
</library>
|
||||
</web-module-libraries>
|
||||
<web-module-additional-libraries/>
|
||||
<source-roots>
|
||||
<root id="src.dir"/>
|
||||
</source-roots>
|
||||
<test-roots>
|
||||
<root id="test.src.dir"/>
|
||||
</test-roots>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
BIN
_resources/it114105/itp4511/Assignment/sample-image/sample-image1.png
(Stored with Git LFS)
Normal file
BIN
_resources/it114105/itp4511/Assignment/sample-image/sample-image1.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
_resources/it114105/itp4511/Assignment/sample-image/sample-image2.png
(Stored with Git LFS)
Normal file
BIN
_resources/it114105/itp4511/Assignment/sample-image/sample-image2.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
_resources/it114105/itp4511/Assignment/sample-image/sample-image3.png
(Stored with Git LFS)
Normal file
BIN
_resources/it114105/itp4511/Assignment/sample-image/sample-image3.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
_resources/it114105/itp4511/Assignment/sample-image/sample-image4.png
(Stored with Git LFS)
Normal file
BIN
_resources/it114105/itp4511/Assignment/sample-image/sample-image4.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
_resources/it114105/itp4511/Assignment/sample-image/sample-image5.png
(Stored with Git LFS)
Normal file
BIN
_resources/it114105/itp4511/Assignment/sample-image/sample-image5.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
_resources/it114105/itp4511/Assignment/sample-image/sample-image6.png
(Stored with Git LFS)
Normal file
BIN
_resources/it114105/itp4511/Assignment/sample-image/sample-image6.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
_resources/it114105/itp4511/Assignment/sample-image/sample-image7.png
(Stored with Git LFS)
Normal file
BIN
_resources/it114105/itp4511/Assignment/sample-image/sample-image7.png
(Stored with Git LFS)
Normal file
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
Manifest-Version: 1.0
|
||||
|
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.bean;
|
||||
import java.io.Serializable;
|
||||
/**
|
||||
*
|
||||
* @author JerryKwok
|
||||
*/
|
||||
public class AdminBean implements Serializable {
|
||||
|
||||
private String id;
|
||||
private String fname;
|
||||
private String lname;
|
||||
private String gender;
|
||||
private String email;
|
||||
private String birthday;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getFname() {
|
||||
return fname;
|
||||
}
|
||||
|
||||
public void setFname(String fname) {
|
||||
this.fname = fname;
|
||||
}
|
||||
|
||||
public String getLname() {
|
||||
return lname;
|
||||
}
|
||||
|
||||
public void setLname(String lname) {
|
||||
this.lname = lname;
|
||||
}
|
||||
|
||||
public String getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getBirthday() {
|
||||
return birthday;
|
||||
}
|
||||
|
||||
public String getName(){
|
||||
return fname + " " + lname;
|
||||
}
|
||||
|
||||
public void setBirthday(String birthday) {
|
||||
this.birthday = birthday;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JerryKwok
|
||||
*/
|
||||
public class AttendBean implements Serializable {
|
||||
private String id;
|
||||
private boolean attend;
|
||||
private String date;
|
||||
private StudentBean stBean;
|
||||
|
||||
public AttendBean() {
|
||||
stBean = new StudentBean();
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public boolean isAttend() {
|
||||
return attend;
|
||||
}
|
||||
|
||||
public void setAttend(boolean attend) {
|
||||
this.attend = attend;
|
||||
}
|
||||
|
||||
public String getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(String date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public StudentBean getStBean() {
|
||||
return stBean;
|
||||
}
|
||||
|
||||
public void setStBean(StudentBean stBean) {
|
||||
this.stBean = stBean;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JerryKwok
|
||||
*/
|
||||
public class ClassBean implements Serializable{
|
||||
|
||||
private String id;
|
||||
private String className;
|
||||
private String year;
|
||||
private double attendanceTargetId;
|
||||
private TeacherBean teacherBean;
|
||||
|
||||
public ClassBean() {
|
||||
teacherBean = new TeacherBean();
|
||||
}
|
||||
|
||||
public TeacherBean getTeacherBean() {
|
||||
return teacherBean;
|
||||
}
|
||||
|
||||
public String getYear() {
|
||||
return year;
|
||||
}
|
||||
|
||||
public void setYear(String year) {
|
||||
this.year = year;
|
||||
}
|
||||
|
||||
public double getAttendanceTargetId() {
|
||||
return attendanceTargetId;
|
||||
}
|
||||
|
||||
public void setAttendanceTargetId(double attendanceTargetId) {
|
||||
this.attendanceTargetId = attendanceTargetId;
|
||||
}
|
||||
|
||||
|
||||
public void setTeacherBean(TeacherBean teacherBean) {
|
||||
this.teacherBean = teacherBean;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getClassName() {
|
||||
return className;
|
||||
}
|
||||
|
||||
public void setClassName(String className) {
|
||||
this.className = className;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JerryKwok
|
||||
*/
|
||||
public class ClassYearBean implements Serializable{
|
||||
private String id;
|
||||
private String year;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getYear() {
|
||||
return year;
|
||||
}
|
||||
|
||||
public void setYear(String year) {
|
||||
this.year = year;
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JerryKwok
|
||||
*/
|
||||
public class LectureBean implements Serializable{
|
||||
|
||||
private String id;
|
||||
private String lecture;
|
||||
private String description;
|
||||
private String className;
|
||||
private LectureTimeBean time;
|
||||
private LectureDayBean day;
|
||||
private String room;
|
||||
private String teacherId;
|
||||
|
||||
public LectureBean() {
|
||||
time = new LectureTimeBean();
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLecture() {
|
||||
return lecture;
|
||||
}
|
||||
|
||||
public void setLecture(String lecture) {
|
||||
this.lecture = lecture;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getClassName() {
|
||||
return className;
|
||||
}
|
||||
|
||||
public void setClassName(String className) {
|
||||
this.className = className;
|
||||
}
|
||||
|
||||
public LectureTimeBean getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(LectureTimeBean time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public LectureDayBean getDay() {
|
||||
return day;
|
||||
}
|
||||
|
||||
public void setDay(LectureDayBean day) {
|
||||
this.day = day;
|
||||
}
|
||||
|
||||
|
||||
public String getRoom() {
|
||||
return room;
|
||||
}
|
||||
|
||||
public void setRoom(String room) {
|
||||
this.room = room;
|
||||
}
|
||||
|
||||
public String getTeacherId() {
|
||||
return teacherId;
|
||||
}
|
||||
|
||||
public void setTeacherId(String teacherId) {
|
||||
this.teacherId = teacherId;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JerryKwok
|
||||
*/
|
||||
public class LectureDayBean implements Serializable{
|
||||
private String id;
|
||||
private String day;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getDay() {
|
||||
return day;
|
||||
}
|
||||
|
||||
public void setDay(String day) {
|
||||
this.day = day;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JerryKwok
|
||||
*/
|
||||
public class LectureTimeBean implements Serializable{
|
||||
private String id;
|
||||
private String startTime;
|
||||
private String endTime;
|
||||
private boolean fullweek;
|
||||
|
||||
public boolean isFullweek() {
|
||||
return fullweek;
|
||||
}
|
||||
|
||||
public void setFullweek(boolean fullweek) {
|
||||
this.fullweek = fullweek;
|
||||
}
|
||||
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(String startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public String getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(String endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jerrykwok
|
||||
*/
|
||||
public class LoginBean implements Serializable{
|
||||
|
||||
private String fname;
|
||||
private String lname;
|
||||
private String username;
|
||||
private String password;
|
||||
private String role;
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public String getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public void setRole(String role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public String getFname() {
|
||||
return fname;
|
||||
}
|
||||
|
||||
public void setFname(String fname) {
|
||||
this.fname = fname;
|
||||
}
|
||||
|
||||
public String getLname() {
|
||||
return lname;
|
||||
}
|
||||
|
||||
public void setLname(String lname) {
|
||||
this.lname = lname;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return fname + " " + lname;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JerryKwok
|
||||
*/
|
||||
public class SchedulerBean implements Serializable{
|
||||
|
||||
private String id;
|
||||
private String title;
|
||||
private String description;
|
||||
private String start_date;
|
||||
private String end_date;
|
||||
private boolean holiday;
|
||||
private boolean schoolDay;
|
||||
private int start_day_week;
|
||||
private int end_date_week;
|
||||
private int countDate;
|
||||
private int countBusineseDay;
|
||||
|
||||
public int getCountBusineseDay() {
|
||||
return countBusineseDay;
|
||||
}
|
||||
|
||||
public void setCountBusineseDay(int countBusineseDay) {
|
||||
this.countBusineseDay = countBusineseDay;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getStart_date() {
|
||||
return start_date;
|
||||
}
|
||||
|
||||
public void setStart_date(String start_date) {
|
||||
this.start_date = start_date;
|
||||
}
|
||||
|
||||
public String getEnd_date() {
|
||||
return end_date;
|
||||
}
|
||||
|
||||
public void setEnd_date(String end_date) {
|
||||
this.end_date = end_date;
|
||||
}
|
||||
|
||||
public int getStart_date_Day() {
|
||||
return Integer.parseInt(start_date.substring(8));
|
||||
}
|
||||
|
||||
public int getEnd_date_Day() {
|
||||
return Integer.parseInt(end_date.substring(8));
|
||||
}
|
||||
|
||||
public boolean isHoliday() {
|
||||
return holiday;
|
||||
}
|
||||
|
||||
public void setHoliday(boolean holiday) {
|
||||
this.holiday = holiday;
|
||||
}
|
||||
|
||||
public boolean isSchoolDay() {
|
||||
return schoolDay;
|
||||
}
|
||||
|
||||
public void setSchoolDay(boolean schoolDay) {
|
||||
this.schoolDay = schoolDay;
|
||||
}
|
||||
|
||||
public int getStart_day_week() {
|
||||
return start_day_week;
|
||||
}
|
||||
|
||||
public void setStart_day_week(int start_day_week) {
|
||||
this.start_day_week = start_day_week;
|
||||
}
|
||||
|
||||
public int getEnd_date_week() {
|
||||
return end_date_week;
|
||||
}
|
||||
|
||||
public void setEnd_date_week(int end_date_week) {
|
||||
this.end_date_week = end_date_week;
|
||||
}
|
||||
|
||||
public int getCountDate() {
|
||||
return countDate;
|
||||
}
|
||||
|
||||
public void setCountDate(int countDate) {
|
||||
this.countDate = countDate;
|
||||
}
|
||||
|
||||
public String getStart_day_Date() {
|
||||
String[] start_dateArray = start_date.split("-");
|
||||
return start_dateArray[2];
|
||||
}
|
||||
|
||||
public String getStart_day_Month() {
|
||||
String[] start_dateArray = start_date.split("-");
|
||||
return start_dateArray[1];
|
||||
}
|
||||
|
||||
public String getStart_day_Year() {
|
||||
String[] start_dateArray = start_date.split("-");
|
||||
return start_dateArray[0];
|
||||
}
|
||||
|
||||
public String getEnd_day_Date() {
|
||||
String[] end_dateArray = end_date.split("-");
|
||||
return end_dateArray[2];
|
||||
}
|
||||
|
||||
public String getEnd_day_Month() {
|
||||
String[] end_dateArray = end_date.split("-");
|
||||
return end_dateArray[1];
|
||||
}
|
||||
|
||||
public String getEnd_day_Year() {
|
||||
String[] end_dateArray = end_date.split("-");
|
||||
return end_dateArray[0];
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JerryKwok
|
||||
*/
|
||||
public class SearchBean implements Serializable{
|
||||
private String id;
|
||||
private String keyword;
|
||||
private int searchPage;
|
||||
private String staffId;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getKeyword() {
|
||||
return keyword;
|
||||
}
|
||||
|
||||
public void setKeyword(String keyword) {
|
||||
this.keyword = keyword;
|
||||
}
|
||||
|
||||
public int getSearchPage() {
|
||||
return searchPage;
|
||||
}
|
||||
|
||||
public void setSearchPage(int searchPage) {
|
||||
this.searchPage = searchPage;
|
||||
}
|
||||
|
||||
public String getStaffId() {
|
||||
return staffId;
|
||||
}
|
||||
|
||||
public void setStaffId(String staffId) {
|
||||
this.staffId = staffId;
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JerryKwok
|
||||
*/
|
||||
public class SemesterBean implements Serializable{
|
||||
private String year;
|
||||
private int term;
|
||||
private String start_date;
|
||||
private String end_date;
|
||||
private int countBusineseDate;
|
||||
|
||||
public int getCountBusineseDate() {
|
||||
return countBusineseDate;
|
||||
}
|
||||
|
||||
public void setCountBusineseDate(int countBusineseDate) {
|
||||
this.countBusineseDate = countBusineseDate;
|
||||
}
|
||||
|
||||
public String getYear() {
|
||||
return year;
|
||||
}
|
||||
|
||||
public void setYear(String year) {
|
||||
this.year = year;
|
||||
}
|
||||
|
||||
public int getTerm() {
|
||||
return term;
|
||||
}
|
||||
|
||||
public void setTerm(int term) {
|
||||
this.term = term;
|
||||
}
|
||||
|
||||
public String getStart_date() {
|
||||
return start_date;
|
||||
}
|
||||
|
||||
public void setStart_date(String start_date) {
|
||||
this.start_date = start_date;
|
||||
}
|
||||
|
||||
public String getEnd_date() {
|
||||
return end_date;
|
||||
}
|
||||
|
||||
public void setEnd_date(String end_date) {
|
||||
this.end_date = end_date;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JerryKwok
|
||||
*/
|
||||
public class StudentBean implements Serializable{
|
||||
private String id;
|
||||
private String fname;
|
||||
private String lname;
|
||||
private String gender;
|
||||
private String email;
|
||||
private String birthday;
|
||||
private int attendDay;
|
||||
private double attendRate;
|
||||
private String studentClassid;
|
||||
private ClassBean className;
|
||||
private ArrayList<AttendBean> attendList;
|
||||
|
||||
|
||||
public int getAttendDay() {
|
||||
return attendDay;
|
||||
}
|
||||
|
||||
public ClassBean getClassName() {
|
||||
return className;
|
||||
}
|
||||
|
||||
public String getStudentClassid() {
|
||||
return studentClassid;
|
||||
}
|
||||
|
||||
public void setStudentClassid(String studentClassid) {
|
||||
this.studentClassid = studentClassid;
|
||||
}
|
||||
|
||||
|
||||
public void setClassName(ClassBean className) {
|
||||
this.className = className;
|
||||
}
|
||||
|
||||
public void setAttendDay(int attendDay) {
|
||||
this.attendDay = attendDay;
|
||||
}
|
||||
|
||||
public double getAttendRate() {
|
||||
return attendRate;
|
||||
}
|
||||
|
||||
public void setAttendRate(double attendRate) {
|
||||
this.attendRate = attendRate;
|
||||
}
|
||||
|
||||
public String getBirthday() {
|
||||
return birthday;
|
||||
}
|
||||
|
||||
public void setBirthday(String birthday) {
|
||||
this.birthday = birthday;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getFname() {
|
||||
return fname;
|
||||
}
|
||||
|
||||
public void setFname(String fname) {
|
||||
this.fname = fname;
|
||||
}
|
||||
|
||||
public String getLname() {
|
||||
return lname;
|
||||
}
|
||||
|
||||
public void setLname(String lname) {
|
||||
this.lname = lname;
|
||||
}
|
||||
|
||||
public String getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return fname + " " + lname;
|
||||
}
|
||||
|
||||
public ArrayList<AttendBean> getAttendList() {
|
||||
return attendList;
|
||||
}
|
||||
|
||||
public void setAttendList(ArrayList<AttendBean> attendList) {
|
||||
this.attendList = attendList;
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JerryKwok
|
||||
*/
|
||||
public class TeacherBean implements Serializable{
|
||||
private String id;
|
||||
private String fname;
|
||||
private String lname;
|
||||
private String gender;
|
||||
private String email;
|
||||
private String birthday;
|
||||
private String title;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getFname() {
|
||||
return fname;
|
||||
}
|
||||
|
||||
public void setFname(String fname) {
|
||||
this.fname = fname;
|
||||
}
|
||||
|
||||
public String getLname() {
|
||||
return lname;
|
||||
}
|
||||
|
||||
public void setLname(String lname) {
|
||||
this.lname = lname;
|
||||
}
|
||||
|
||||
public String getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public String getTeacherFormalName() {
|
||||
if (gender.equals("M")) {
|
||||
return "Mr " + getName();
|
||||
} else {
|
||||
return "Miss " + getName();
|
||||
}
|
||||
}
|
||||
|
||||
public String getName(){
|
||||
return fname + " " + lname;
|
||||
}
|
||||
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getBirthday() {
|
||||
return birthday;
|
||||
}
|
||||
|
||||
public void setBirthday(String birthday) {
|
||||
this.birthday = birthday;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.db;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.*;
|
||||
import system.bean.LoginBean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jerrykwok
|
||||
*/
|
||||
public class LoginValid {
|
||||
|
||||
private String url;
|
||||
private String username;
|
||||
private String password;
|
||||
|
||||
public LoginValid(String url, String username, String password) {
|
||||
this.url = url;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public Connection getConnection() throws SQLException, IOException {
|
||||
try {
|
||||
Class.forName("com.mysql.jdbc.Driver");
|
||||
} catch (ClassNotFoundException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return DriverManager.getConnection(url, username, password);
|
||||
}
|
||||
|
||||
public boolean validateStaffLogin(LoginBean loginBean, int title) {
|
||||
boolean isSuccess = false;
|
||||
Connection cnnct = null;
|
||||
PreparedStatement pStmnt = null;
|
||||
try {
|
||||
cnnct = getConnection();
|
||||
String preQueryStatement = "SELECT * FROM Teacher WHERE id=? and password=? AND title=?";
|
||||
pStmnt = cnnct.prepareStatement(preQueryStatement);
|
||||
pStmnt.setString(1, loginBean.getUsername());
|
||||
pStmnt.setString(2, loginBean.getPassword());
|
||||
pStmnt.setInt(3, title);
|
||||
ResultSet rs = pStmnt.executeQuery();
|
||||
if (rs.next()) {
|
||||
isSuccess = true;
|
||||
}
|
||||
pStmnt.close();
|
||||
cnnct.close();
|
||||
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return isSuccess;
|
||||
}
|
||||
|
||||
public boolean validateStudentLogin(LoginBean loginBean) {
|
||||
boolean isSuccess = false;
|
||||
Connection cnnct = null;
|
||||
PreparedStatement pStmnt = null;
|
||||
try {
|
||||
cnnct = getConnection();
|
||||
String preQueryStatement = "SELECT * FROM Student WHERE id=? and password=?";
|
||||
pStmnt = cnnct.prepareStatement(preQueryStatement);
|
||||
pStmnt.setString(1, loginBean.getUsername());
|
||||
pStmnt.setString(2, loginBean.getPassword());
|
||||
ResultSet rs = pStmnt.executeQuery();
|
||||
if (rs.next()) {
|
||||
isSuccess = true;
|
||||
}
|
||||
pStmnt.close();
|
||||
cnnct.close();
|
||||
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return isSuccess;
|
||||
}
|
||||
}
|
@@ -0,0 +1,628 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.db;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import system.bean.AttendBean;
|
||||
import system.bean.ClassBean;
|
||||
import system.bean.LectureBean;
|
||||
import system.bean.LectureDayBean;
|
||||
import system.bean.LectureTimeBean;
|
||||
import system.bean.SchedulerBean;
|
||||
import system.bean.SemesterBean;
|
||||
import system.bean.StudentBean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jerrykwok
|
||||
*/
|
||||
public class StudentDB {
|
||||
|
||||
private String url;
|
||||
private String username;
|
||||
private String password;
|
||||
private String studentId;
|
||||
|
||||
public StudentDB(String url, String username, String password) {
|
||||
this.url = url;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public void setStudentId(String teacherId) {
|
||||
this.studentId = studentId;
|
||||
}
|
||||
|
||||
public Connection getConnection() throws SQLException, IOException {
|
||||
try {
|
||||
Class.forName("com.mysql.jdbc.Driver");
|
||||
} catch (ClassNotFoundException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return DriverManager.getConnection(url, username, password);
|
||||
}
|
||||
|
||||
public int getCountClass() {
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String preQuery = "SELECT COUNT(*) FROM lecture WHERE studentId = ?";
|
||||
PreparedStatement pStmnt = connt.prepareStatement(preQuery);
|
||||
pStmnt.setString(1, studentId);
|
||||
ResultSet result = pStmnt.executeQuery();
|
||||
while (result.next()) {
|
||||
return result.getInt(1);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getCountStudent() {
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String preQuery = "SELECT COUNT(DISTINCT studentId) FROM studentClass, class, lecture WHERE studentclass.classId = class.id AND class.id = lecture.classId AND lecture.teacherId = ?";
|
||||
PreparedStatement pStmnt = connt.prepareStatement(preQuery);
|
||||
pStmnt.setString(1, studentId);
|
||||
ResultSet result = pStmnt.executeQuery();
|
||||
while (result.next()) {
|
||||
return result.getInt(1);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public ArrayList<ClassBean> getAllClass() {
|
||||
ArrayList<ClassBean> classList = new ArrayList<ClassBean>();
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String sql = "SELECT class.*, teacher.fname, teacher.lname, teacher.email, teacher.gender FROM class, teacher WHERE class.teacherId = teacher.id";
|
||||
Statement stmnt = connt.createStatement();
|
||||
ResultSet result = stmnt.executeQuery(sql);
|
||||
while (result.next()) {
|
||||
ClassBean bean = new ClassBean();
|
||||
bean.getTeacherBean().setId(result.getString("id"));
|
||||
bean.setClassName(result.getString("class"));
|
||||
bean.getTeacherBean().setEmail(result.getString("email"));
|
||||
bean.getTeacherBean().setFname(result.getString("fname"));
|
||||
bean.getTeacherBean().setLname(result.getString("lname"));
|
||||
bean.getTeacherBean().setGender(result.getString("gender"));
|
||||
classList.add(bean);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return classList;
|
||||
}
|
||||
|
||||
public ArrayList<AttendBean> getAttendClass(String className, String date) {
|
||||
ArrayList<AttendBean> AttendList = new ArrayList<AttendBean>();
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String preSearchQuery = "SELECT DISTINCT student.* FROM studentclass, class, student WHERE studentclass.classId = class.id AND studentclass.studentId = student.id AND class.class = ?";
|
||||
PreparedStatement ptment = connt.prepareStatement(preSearchQuery);
|
||||
ptment.setString(1, className);
|
||||
ResultSet result = ptment.executeQuery();
|
||||
while (result.next()) {
|
||||
StudentBean studentBean = new StudentBean();
|
||||
studentBean.setFname(result.getString("fname"));
|
||||
studentBean.setLname(result.getString("lname"));
|
||||
studentBean.setGender(result.getString("gender"));
|
||||
studentBean.setEmail(result.getString("email"));
|
||||
studentBean.setId(result.getString("id"));
|
||||
String preAttendQuery = "SELECT * FROM studentattend WHERE attendDate=? AND studentId=?";
|
||||
PreparedStatement ptmentAttend = connt.prepareStatement(preAttendQuery);
|
||||
ptmentAttend.setString(1, date);
|
||||
ptmentAttend.setString(2, studentBean.getId());
|
||||
ResultSet resultAttend = ptmentAttend.executeQuery();
|
||||
AttendBean attendBean = new AttendBean();
|
||||
if (resultAttend.next()) {
|
||||
attendBean.setId(resultAttend.getString("studentAttendanceId"));
|
||||
attendBean.setDate(date);
|
||||
attendBean.setAttend(resultAttend.getBoolean("attend"));
|
||||
} else {
|
||||
attendBean.setDate(date);
|
||||
attendBean.setAttend(false);
|
||||
}
|
||||
attendBean.setStBean(studentBean);
|
||||
AttendList.add(attendBean);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return AttendList;
|
||||
}
|
||||
|
||||
public ArrayList<StudentBean> getAllStudentClass(String className) {
|
||||
ArrayList<StudentBean> list = new ArrayList<StudentBean>();
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String preQuery = "SELECT * FROM studentattend, studentclass, student, class WHERE studentclass.classId = class.id AND studentclass.studentId = student.id AND class.class = ? AND studentattend.studentId = student.id AND attendDate = ?";
|
||||
//String preQuery = "SELECT student.* FROM studentclass, class, student WHERE studentclass.classid = class.id AND studentclass.studentid = student.id AND class.class = ? ORDER BY student.fname ASC";
|
||||
PreparedStatement pStmnt = connt.prepareStatement(preQuery);
|
||||
pStmnt.setString(1, className);
|
||||
// pStmnt.setString(2, date);
|
||||
ResultSet result = pStmnt.executeQuery();
|
||||
while (result.next()) {
|
||||
StudentBean studentBean = new StudentBean();
|
||||
studentBean.setFname(result.getString("fname"));
|
||||
studentBean.setLname(result.getString("lname"));
|
||||
studentBean.setGender(result.getString("gender"));
|
||||
studentBean.setEmail(result.getString("email"));
|
||||
studentBean.setId(result.getString("id"));
|
||||
list.add(studentBean);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public void insertStudentAttendance(String studentId, String date, boolean attend) {
|
||||
try {
|
||||
int count = 0;
|
||||
Connection connt = getConnection();
|
||||
String preQuery = "SELECT studentAttend.studentId FROM studentattend, studentclass, student, class WHERE studentclass.classId = class.id AND studentclass.studentId = student.id AND studentattend.studentId = ? AND studentattend.studentId = student.id AND attendDate = ? ";
|
||||
PreparedStatement pStmnt = connt.prepareStatement(preQuery);
|
||||
pStmnt.setString(1, studentId);
|
||||
pStmnt.setString(2, date);
|
||||
ResultSet result = pStmnt.executeQuery();
|
||||
while (result.next()) {
|
||||
count = result.getInt(1);
|
||||
}
|
||||
if (count >= 1) {
|
||||
String preUpdateQuery = "UPDATE studentattend SET Attend = ? WHERE attendDate = ? AND studentId = ? ";
|
||||
PreparedStatement pUpdateStmnt = connt.prepareStatement(preUpdateQuery);
|
||||
pUpdateStmnt.setBoolean(1, attend);
|
||||
pUpdateStmnt.setString(2, date);
|
||||
pUpdateStmnt.setString(3, studentId);
|
||||
pUpdateStmnt.executeUpdate();
|
||||
} else {
|
||||
String preUpdateQuery = "INSERT INTO studentattend(studentId, attendDate, attend) VALUES (?, ?, ?)";
|
||||
PreparedStatement pUpdateStmnt = connt.prepareStatement(preUpdateQuery);
|
||||
pUpdateStmnt.setString(1, studentId);
|
||||
pUpdateStmnt.setString(2, date);
|
||||
pUpdateStmnt.setBoolean(3, attend);
|
||||
pUpdateStmnt.executeUpdate();
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<SemesterBean> getLatestReportYear() {
|
||||
ArrayList<SemesterBean> list = null;
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String sql = "SELECT DISTINCT year FROM semester ORDER BY year DESC LIMIT 3";
|
||||
Statement stmnt = connt.createStatement();
|
||||
ResultSet result = stmnt.executeQuery(sql);
|
||||
list = new ArrayList<SemesterBean>();
|
||||
while (result.next()) {
|
||||
SemesterBean bean = new SemesterBean();
|
||||
bean.setYear(result.getString("year"));
|
||||
list.add(bean);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public ArrayList<SemesterBean> getSemsterTerm(String year) {
|
||||
ArrayList<SemesterBean> list = null;
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String preQuery = "SELECT term FROM semester WHERE year = ? AND start_date<=CURRENT_DATE";
|
||||
PreparedStatement preStmnt = connt.prepareStatement(preQuery);
|
||||
preStmnt.setString(1, year);
|
||||
ResultSet result = preStmnt.executeQuery();
|
||||
list = new ArrayList<SemesterBean>();
|
||||
while (result.next()) {
|
||||
SemesterBean bean = new SemesterBean();
|
||||
bean.setTerm(result.getInt("term"));
|
||||
list.add(bean);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public SemesterBean getSemsterDate(String year, int term) {
|
||||
SemesterBean semBean = null;
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String perQuery = "SELECT start_date, end_date, 5 * ((DATEDIFF(end_date, start_date) ) DIV 7) + MID('0123455501234445012333450122234501101234000123450', 7 * WEEKDAY(start_date) + WEEKDAY(end_date) + 1, 1) AS countBusinDay FROM semester WHERE semester.start_date AND semester.year = ? AND semester.term = ?";
|
||||
PreparedStatement pStmnt = connt.prepareStatement(perQuery);
|
||||
pStmnt.setString(1, year);
|
||||
pStmnt.setInt(2, term);
|
||||
ResultSet result = pStmnt.executeQuery();
|
||||
if (result.next()) {
|
||||
semBean = new SemesterBean();
|
||||
semBean.setStart_date(result.getString("start_date"));
|
||||
semBean.setEnd_date(result.getString("end_date"));
|
||||
semBean.setTerm(term);
|
||||
semBean.setYear(year);
|
||||
semBean.setCountBusineseDate(result.getInt("countBusinDay"));
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return semBean;
|
||||
}
|
||||
|
||||
public ArrayList<SchedulerBean> getSchCalenderholiday() {
|
||||
ArrayList<SchedulerBean> list = null;
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String sql = "SELECT *, WEEKDAY(start_date) AS start_day_week, WEEKDAY(end_date) AS end_day_week, end_date - start_date AS countDate, 5 * ((DATEDIFF(end_date, start_date) ) DIV 7) + MID('0123455501234445012333450122234501101234000123450', 7 * WEEKDAY(start_date) + WEEKDAY(end_date) + 1, 1) AS countBusinDay FROM scheduler WHERE holiday = true";
|
||||
Statement stmnt = connt.createStatement();
|
||||
ResultSet result = stmnt.executeQuery(sql);
|
||||
list = new ArrayList<SchedulerBean>();
|
||||
while (result.next()) {
|
||||
SchedulerBean scheBean = new SchedulerBean();
|
||||
scheBean.setId(result.getString("id"));
|
||||
scheBean.setTitle(result.getString("title"));
|
||||
scheBean.setDescription(result.getString("description"));
|
||||
scheBean.setStart_date(result.getString("start_date"));
|
||||
scheBean.setEnd_date(result.getString("end_date"));
|
||||
scheBean.setHoliday(result.getBoolean("holiday"));
|
||||
scheBean.setSchoolDay(result.getBoolean("schoolDay"));
|
||||
scheBean.setStart_day_week(result.getInt("start_day_week"));
|
||||
scheBean.setEnd_date_week(result.getInt("end_day_week"));
|
||||
scheBean.setCountDate(result.getInt("countDate"));
|
||||
scheBean.setCountBusineseDay(result.getInt("countBusinDay"));
|
||||
list.add(scheBean);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public ArrayList<StudentBean> getStudentAttend(String startDate, String endDate, String className) {
|
||||
ArrayList<StudentBean> list = null;
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String perQuery = "SELECT COUNT(*) AS attendDay, student.* FROM studentattend, studentclass, student, class WHERE studentattend.attend=true AND studentclass.classId = class.id AND studentclass.studentId = student.id AND class.class = ? AND studentattend.studentId = student.id AND attendDate >= ? AND attendDate <= ? GROUP BY studentattend.studentId ORDER BY student.fname ASC";
|
||||
PreparedStatement pStmnt = connt.prepareStatement(perQuery);
|
||||
pStmnt.setString(1, className);
|
||||
pStmnt.setString(2, startDate);
|
||||
pStmnt.setString(3, endDate);
|
||||
ResultSet result = pStmnt.executeQuery();
|
||||
list = new ArrayList<StudentBean>();
|
||||
while (result.next()) {
|
||||
StudentBean studentBean = new StudentBean();
|
||||
studentBean.setFname(result.getString("fname"));
|
||||
studentBean.setLname(result.getString("lname"));
|
||||
studentBean.setGender(result.getString("gender"));
|
||||
studentBean.setEmail(result.getString("email"));
|
||||
studentBean.setBirthday(result.getString("birthday"));
|
||||
studentBean.setId(result.getString("id"));
|
||||
studentBean.setAttendDay(result.getInt("attendDay"));
|
||||
list.add(studentBean);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public double getAttendanceRateTarget(String className) {
|
||||
double target = 0;
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String preQuery = "SELECT attendanceTarget FROM class, attendanceTarget WHERE class.attendanceTargetId = attendanceTarget.id AND class.class = ?";
|
||||
PreparedStatement preStmnt = connt.prepareStatement(preQuery);
|
||||
preStmnt.setString(1, className);
|
||||
ResultSet result = preStmnt.executeQuery();
|
||||
if (result.next()) {
|
||||
target = result.getDouble("attendanceTarget");
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
public ArrayList<AttendBean> getStudentAttendDetail(String studentId, String year, int term) {
|
||||
ArrayList<AttendBean> list = null;
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String preQuery = "SELECT studentattend.* FROM studentattend, class, semester, studentclass WHERE studentattend.studentId = ? AND studentattend.attendDate >= semester.start_date AND studentattend.attendDate <= semester.end_date AND semester.year = ? AND semester.term = ? AND studentclass.studentId = studentattend.studentId AND studentclass.classId = class.id";
|
||||
PreparedStatement preStmnt = connt.prepareStatement(preQuery);
|
||||
preStmnt.setString(1, studentId);
|
||||
preStmnt.setString(2, year);
|
||||
preStmnt.setInt(3, term);
|
||||
ResultSet result = preStmnt.executeQuery();
|
||||
list = new ArrayList<AttendBean>();
|
||||
while (result.next()) {
|
||||
AttendBean bean = new AttendBean();
|
||||
bean.setId(result.getString("studentAttendanceId"));
|
||||
bean.setDate(result.getString("attendDate"));
|
||||
bean.setAttend(result.getBoolean("attend"));
|
||||
list.add(bean);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public ArrayList<StudentBean> getAllStudentAttendZero(String className) {
|
||||
ArrayList<StudentBean> list = new ArrayList<StudentBean>();
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String preQuery = "SELECT * FROM studentattend, studentclass, student, class WHERE studentclass.classId = class.id AND studentclass.studentId = student.id AND class.class = ? AND studentattend.studentId = student.id AND attendDate = ?";
|
||||
//String preQuery = "SELECT student.* FROM studentclass, class, student WHERE studentclass.classid = class.id AND studentclass.studentid = student.id AND class.class = ? ORDER BY student.fname ASC";
|
||||
PreparedStatement pStmnt = connt.prepareStatement(preQuery);
|
||||
pStmnt.setString(1, className);
|
||||
// pStmnt.setString(2, date);
|
||||
ResultSet result = pStmnt.executeQuery();
|
||||
while (result.next()) {
|
||||
StudentBean studentBean = new StudentBean();
|
||||
studentBean.setFname(result.getString("fname"));
|
||||
studentBean.setLname(result.getString("lname"));
|
||||
studentBean.setGender(result.getString("gender"));
|
||||
studentBean.setEmail(result.getString("email"));
|
||||
studentBean.setId(result.getString("id"));
|
||||
studentBean.setAttendRate(0);
|
||||
list.add(studentBean);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public ArrayList<LectureTimeBean> getAllTimeLecture() {
|
||||
ArrayList<LectureTimeBean> list = null;
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String sql = "SELECT * FROM timeTable ORDER BY timeTable.starttime ASC";
|
||||
Statement stmnt = connt.createStatement();
|
||||
ResultSet result = stmnt.executeQuery(sql);
|
||||
list = new ArrayList<LectureTimeBean>();
|
||||
while (result.next()) {
|
||||
LectureTimeBean bean = new LectureTimeBean();
|
||||
bean.setId(result.getString("timeId"));
|
||||
bean.setStartTime(result.getString("starttime"));
|
||||
bean.setEndTime(result.getString("endtime"));
|
||||
list.add(bean);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public ArrayList<LectureBean> getLecture(String studentId) {
|
||||
ArrayList<LectureBean> list = null;
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String preQuery = "SELECT * FROM lecture, timetable, daytable, class, studentclass WHERE class.id = studentclass.classId AND studentclass.studentId = ? AND lecture.classId = class.id AND lecture.timeId = timetable.timeId AND lecture.dayId = daytable.id";
|
||||
PreparedStatement preStmnt = connt.prepareStatement(preQuery);
|
||||
preStmnt.setString(1, studentId);
|
||||
System.out.println(studentId);
|
||||
ResultSet result = preStmnt.executeQuery();
|
||||
list = new ArrayList<LectureBean>();
|
||||
while (result.next()) {
|
||||
LectureBean lectureBean = new LectureBean();
|
||||
LectureTimeBean timeBean = new LectureTimeBean();
|
||||
LectureDayBean dayBean = new LectureDayBean();
|
||||
lectureBean.setLecture(result.getString("lecture"));
|
||||
lectureBean.setDescription(result.getString("description"));
|
||||
lectureBean.setClassName(result.getString("class"));
|
||||
timeBean.setStartTime(result.getString("starttime"));
|
||||
timeBean.setEndTime(result.getString("endtime"));
|
||||
timeBean.setFullweek(result.getBoolean("fullday"));
|
||||
lectureBean.setTime(timeBean);
|
||||
dayBean.setDay(result.getString("day"));
|
||||
lectureBean.setDay(dayBean);
|
||||
lectureBean.setRoom(result.getString("room"));
|
||||
list.add(lectureBean);
|
||||
}
|
||||
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public ArrayList<LectureBean> getAllLecture(String teacherId) {
|
||||
ArrayList<LectureBean> list = null;
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String preQuery = "SELECT * FROM lecture, class, timetable, daytable WHERE lecture.classId = class.id AND lecture.timeId = timetable.timeId AND lecture.teacherId = ? and lecture.dayId = daytable.id";
|
||||
PreparedStatement preStmnt = connt.prepareStatement(preQuery);
|
||||
preStmnt.setString(1, teacherId);
|
||||
ResultSet result = preStmnt.executeQuery();
|
||||
list = new ArrayList<LectureBean>();
|
||||
while (result.next()) {
|
||||
LectureBean lectureBean = new LectureBean();
|
||||
LectureTimeBean timeBean = new LectureTimeBean();
|
||||
LectureDayBean dayBean = new LectureDayBean();
|
||||
lectureBean.setLecture(result.getString("lecture"));
|
||||
lectureBean.setDescription(result.getString("description"));
|
||||
lectureBean.setClassName(result.getString("class"));
|
||||
timeBean.setStartTime(result.getString("starttime"));
|
||||
timeBean.setEndTime(result.getString("endtime"));
|
||||
timeBean.setFullweek(result.getBoolean("fullday"));
|
||||
lectureBean.setTime(timeBean);
|
||||
dayBean.setDay(result.getString("day"));
|
||||
lectureBean.setDay(dayBean);
|
||||
lectureBean.setRoom(result.getString("room"));
|
||||
list.add(lectureBean);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public ArrayList<LectureDayBean> getAllDayLecture() {
|
||||
ArrayList<LectureDayBean> list = null;
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String sql = "SELECT * FROM daytable ORDER BY day ASC";
|
||||
Statement stmnt = connt.createStatement();
|
||||
ResultSet result = stmnt.executeQuery(sql);
|
||||
list = new ArrayList<LectureDayBean>();
|
||||
while (result.next()) {
|
||||
LectureDayBean bean = new LectureDayBean();
|
||||
bean.setId(result.getString("id"));
|
||||
bean.setDay(result.getString("day"));
|
||||
list.add(bean);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public String getStudentClass(String studentId) {
|
||||
String className = "";
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String sql = "SELECT class.class FROM studentclass, class WHERE studentclass.classid = class.id AND studentclass.studentId = ?";
|
||||
PreparedStatement stmnt = connt.prepareStatement(sql);
|
||||
stmnt.setString(1, studentId);
|
||||
ResultSet result = stmnt.executeQuery();
|
||||
if (result.next()) {
|
||||
className = result.getString("class");
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return className;
|
||||
}
|
||||
|
||||
public String getMaxTerm() {
|
||||
String term = "";
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String sql = "SELECT term FROM semester WHERE start_date<=CURRENT_DATE AND end_date>=CURRENT_DATE";
|
||||
Statement stmnt = connt.createStatement();
|
||||
ResultSet result = stmnt.executeQuery(sql);
|
||||
if (result.next()) {
|
||||
term = result.getString("term");
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return term;
|
||||
}
|
||||
}
|
@@ -0,0 +1,549 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.db;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.*;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import system.bean.AttendBean;
|
||||
import system.bean.ClassBean;
|
||||
import system.bean.LectureBean;
|
||||
import system.bean.LectureDayBean;
|
||||
import system.bean.LectureTimeBean;
|
||||
import system.bean.SchedulerBean;
|
||||
import system.bean.SemesterBean;
|
||||
import system.bean.StudentBean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JerryKwok
|
||||
*/
|
||||
public class TeacherDB {
|
||||
|
||||
private String url;
|
||||
private String username;
|
||||
private String password;
|
||||
private String teacherId;
|
||||
|
||||
public TeacherDB(String url, String username, String password) {
|
||||
this.url = url;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public void setTeacherId(String teacherId) {
|
||||
this.teacherId = teacherId;
|
||||
}
|
||||
|
||||
public Connection getConnection() throws SQLException, IOException {
|
||||
try {
|
||||
Class.forName("com.mysql.jdbc.Driver");
|
||||
} catch (ClassNotFoundException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return DriverManager.getConnection(url, username, password);
|
||||
}
|
||||
|
||||
public int getCountClass() {
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String preQuery = "SELECT COUNT(*) FROM lecture WHERE teacherId = ?";
|
||||
PreparedStatement pStmnt = connt.prepareStatement(preQuery);
|
||||
pStmnt.setString(1, teacherId);
|
||||
ResultSet result = pStmnt.executeQuery();
|
||||
while (result.next()) {
|
||||
return result.getInt(1);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getCountStudent() {
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String preQuery = "SELECT COUNT(DISTINCT studentId) FROM studentClass, class, lecture WHERE studentclass.classId = class.id AND class.id = lecture.classId AND lecture.teacherId = ?";
|
||||
PreparedStatement pStmnt = connt.prepareStatement(preQuery);
|
||||
pStmnt.setString(1, teacherId);
|
||||
ResultSet result = pStmnt.executeQuery();
|
||||
while (result.next()) {
|
||||
return result.getInt(1);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public ArrayList<ClassBean> getAllClass() {
|
||||
ArrayList<ClassBean> classList = new ArrayList<ClassBean>();
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String sql = "SELECT class.*, teacher.fname, teacher.lname, teacher.email, teacher.gender FROM class, teacher WHERE class.teacherId = teacher.id";
|
||||
Statement stmnt = connt.createStatement();
|
||||
ResultSet result = stmnt.executeQuery(sql);
|
||||
while (result.next()) {
|
||||
ClassBean bean = new ClassBean();
|
||||
bean.getTeacherBean().setId(result.getString("id"));
|
||||
bean.setClassName(result.getString("class"));
|
||||
bean.getTeacherBean().setEmail(result.getString("email"));
|
||||
bean.getTeacherBean().setFname(result.getString("fname"));
|
||||
bean.getTeacherBean().setLname(result.getString("lname"));
|
||||
bean.getTeacherBean().setGender(result.getString("gender"));
|
||||
classList.add(bean);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return classList;
|
||||
}
|
||||
|
||||
public ArrayList<AttendBean> getAttendClass(String className, String date) {
|
||||
ArrayList<AttendBean> AttendList = new ArrayList<AttendBean>();
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String preSearchQuery = "SELECT DISTINCT student.* FROM studentclass, class, student WHERE studentclass.classId = class.id AND studentclass.studentId = student.id AND class.class = ?";
|
||||
PreparedStatement ptment = connt.prepareStatement(preSearchQuery);
|
||||
ptment.setString(1, className);
|
||||
ResultSet result = ptment.executeQuery();
|
||||
while (result.next()) {
|
||||
StudentBean studentBean = new StudentBean();
|
||||
studentBean.setFname(result.getString("fname"));
|
||||
studentBean.setLname(result.getString("lname"));
|
||||
studentBean.setGender(result.getString("gender"));
|
||||
studentBean.setEmail(result.getString("email"));
|
||||
studentBean.setId(result.getString("id"));
|
||||
String preAttendQuery = "SELECT * FROM studentattend WHERE attendDate=? AND studentId=?";
|
||||
PreparedStatement ptmentAttend = connt.prepareStatement(preAttendQuery);
|
||||
ptmentAttend.setString(1, date);
|
||||
ptmentAttend.setString(2, studentBean.getId());
|
||||
ResultSet resultAttend = ptmentAttend.executeQuery();
|
||||
AttendBean attendBean = new AttendBean();
|
||||
if (resultAttend.next()) {
|
||||
attendBean.setId(resultAttend.getString("studentAttendanceId"));
|
||||
attendBean.setDate(date);
|
||||
attendBean.setAttend(resultAttend.getBoolean("attend"));
|
||||
} else {
|
||||
attendBean.setDate(date);
|
||||
attendBean.setAttend(false);
|
||||
}
|
||||
attendBean.setStBean(studentBean);
|
||||
AttendList.add(attendBean);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return AttendList;
|
||||
}
|
||||
|
||||
public ArrayList<StudentBean> getAllStudentClass(String className) {
|
||||
ArrayList<StudentBean> list = new ArrayList<StudentBean>();
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
//String preQuery = "SELECT * FROM studentattend, studentclass, student, class WHERE studentclass.classId = class.id AND studentclass.studentId = student.id AND class.class = ? AND studentattend.studentId = student.id AND attendDate = ?";
|
||||
String preQuery = "SELECT student.* FROM studentclass, class, student WHERE studentclass.classid = class.id AND studentclass.studentid = student.id AND class.class = ? ORDER BY student.fname ASC";
|
||||
PreparedStatement pStmnt = connt.prepareStatement(preQuery);
|
||||
pStmnt.setString(1, className);
|
||||
// pStmnt.setString(2, date);
|
||||
ResultSet result = pStmnt.executeQuery();
|
||||
while (result.next()) {
|
||||
StudentBean studentBean = new StudentBean();
|
||||
studentBean.setFname(result.getString("fname"));
|
||||
studentBean.setLname(result.getString("lname"));
|
||||
studentBean.setGender(result.getString("gender"));
|
||||
studentBean.setEmail(result.getString("email"));
|
||||
studentBean.setId(result.getString("id"));
|
||||
list.add(studentBean);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public void insertStudentAttendance(String studentId, String date, boolean attend) {
|
||||
try {
|
||||
int count = 0;
|
||||
Connection connt = getConnection();
|
||||
String preQuery = "SELECT studentAttend.studentId FROM studentattend, studentclass, student, class WHERE studentclass.classId = class.id AND studentclass.studentId = student.id AND studentattend.studentId = ? AND studentattend.studentId = student.id AND attendDate = ? ";
|
||||
PreparedStatement pStmnt = connt.prepareStatement(preQuery);
|
||||
pStmnt.setString(1, studentId);
|
||||
pStmnt.setString(2, date);
|
||||
ResultSet result = pStmnt.executeQuery();
|
||||
while (result.next()) {
|
||||
count = result.getInt(1);
|
||||
}
|
||||
if (count >= 1) {
|
||||
String preUpdateQuery = "UPDATE studentattend SET Attend = ? WHERE attendDate = ? AND studentId = ? ";
|
||||
PreparedStatement pUpdateStmnt = connt.prepareStatement(preUpdateQuery);
|
||||
pUpdateStmnt.setBoolean(1, attend);
|
||||
pUpdateStmnt.setString(2, date);
|
||||
pUpdateStmnt.setString(3, studentId);
|
||||
pUpdateStmnt.executeUpdate();
|
||||
} else {
|
||||
String preUpdateQuery = "INSERT INTO studentattend(studentId, attendDate, attend) VALUES (?, ?, ?)";
|
||||
PreparedStatement pUpdateStmnt = connt.prepareStatement(preUpdateQuery);
|
||||
pUpdateStmnt.setString(1, studentId);
|
||||
pUpdateStmnt.setString(2, date);
|
||||
pUpdateStmnt.setBoolean(3, attend);
|
||||
pUpdateStmnt.executeUpdate();
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<SemesterBean> getLatestReportYear() {
|
||||
ArrayList<SemesterBean> list = null;
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String sql = "SELECT DISTINCT year FROM semester ORDER BY year DESC LIMIT 3";
|
||||
Statement stmnt = connt.createStatement();
|
||||
ResultSet result = stmnt.executeQuery(sql);
|
||||
list = new ArrayList<SemesterBean>();
|
||||
while (result.next()) {
|
||||
SemesterBean bean = new SemesterBean();
|
||||
bean.setYear(result.getString("year"));
|
||||
list.add(bean);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public ArrayList<SemesterBean> getSemsterTerm(String year) {
|
||||
ArrayList<SemesterBean> list = null;
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String preQuery = "SELECT term FROM semester WHERE year = ? AND start_date<=CURRENT_DATE";
|
||||
PreparedStatement preStmnt = connt.prepareStatement(preQuery);
|
||||
preStmnt.setString(1, year);
|
||||
ResultSet result = preStmnt.executeQuery();
|
||||
list = new ArrayList<SemesterBean>();
|
||||
while (result.next()) {
|
||||
SemesterBean bean = new SemesterBean();
|
||||
bean.setTerm(result.getInt("term"));
|
||||
list.add(bean);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public SemesterBean getSemsterDate(String year, int term) {
|
||||
SemesterBean semBean = null;
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String perQuery = "SELECT start_date, end_date, 5 * ((DATEDIFF(end_date, start_date) ) DIV 7) + MID('0123455501234445012333450122234501101234000123450', 7 * WEEKDAY(start_date) + WEEKDAY(end_date) + 1, 1) AS countBusinDay FROM semester WHERE semester.start_date AND semester.year = ? AND semester.term = ?";
|
||||
PreparedStatement pStmnt = connt.prepareStatement(perQuery);
|
||||
pStmnt.setString(1, year);
|
||||
pStmnt.setInt(2, term);
|
||||
ResultSet result = pStmnt.executeQuery();
|
||||
if (result.next()) {
|
||||
semBean = new SemesterBean();
|
||||
semBean.setStart_date(result.getString("start_date"));
|
||||
semBean.setEnd_date(result.getString("end_date"));
|
||||
semBean.setTerm(term);
|
||||
semBean.setYear(year);
|
||||
semBean.setCountBusineseDate(result.getInt("countBusinDay"));
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return semBean;
|
||||
}
|
||||
|
||||
public ArrayList<SchedulerBean> getSchCalenderholiday() {
|
||||
ArrayList<SchedulerBean> list = null;
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String sql = "SELECT *, WEEKDAY(start_date) AS start_day_week, WEEKDAY(end_date) AS end_day_week, end_date - start_date AS countDate, 5 * ((DATEDIFF(end_date, start_date) ) DIV 7) + MID('0123455501234445012333450122234501101234000123450', 7 * WEEKDAY(start_date) + WEEKDAY(end_date) + 1, 1) AS countBusinDay FROM scheduler WHERE holiday = true";
|
||||
Statement stmnt = connt.createStatement();
|
||||
ResultSet result = stmnt.executeQuery(sql);
|
||||
list = new ArrayList<SchedulerBean>();
|
||||
while (result.next()) {
|
||||
SchedulerBean scheBean = new SchedulerBean();
|
||||
scheBean.setId(result.getString("id"));
|
||||
scheBean.setTitle(result.getString("title"));
|
||||
scheBean.setStart_date(result.getString("start_date"));
|
||||
scheBean.setEnd_date(result.getString("end_date"));
|
||||
scheBean.setHoliday(result.getBoolean("holiday"));
|
||||
scheBean.setSchoolDay(result.getBoolean("schoolDay"));
|
||||
scheBean.setStart_day_week(result.getInt("start_day_week"));
|
||||
scheBean.setEnd_date_week(result.getInt("end_day_week"));
|
||||
scheBean.setCountDate(result.getInt("countDate"));
|
||||
scheBean.setCountBusineseDay(result.getInt("countBusinDay"));
|
||||
list.add(scheBean);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public ArrayList<StudentBean> getStudentAttend(String startDate, String endDate, String className) {
|
||||
ArrayList<StudentBean> list = null;
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String perQuery = "SELECT COUNT(*) AS attendDay, student.* FROM studentattend, studentclass, student, class WHERE studentattend.attend=true AND studentclass.classId = class.id AND studentclass.studentId = student.id AND class.class = ? AND studentattend.studentId = student.id AND attendDate >= ? AND attendDate <= ? GROUP BY studentattend.studentId ORDER BY student.fname ASC";
|
||||
PreparedStatement pStmnt = connt.prepareStatement(perQuery);
|
||||
pStmnt.setString(1, className);
|
||||
pStmnt.setString(2, startDate);
|
||||
pStmnt.setString(3, endDate);
|
||||
ResultSet result = pStmnt.executeQuery();
|
||||
list = new ArrayList<StudentBean>();
|
||||
while (result.next()) {
|
||||
StudentBean studentBean = new StudentBean();
|
||||
studentBean.setFname(result.getString("fname"));
|
||||
studentBean.setLname(result.getString("lname"));
|
||||
studentBean.setGender(result.getString("gender"));
|
||||
studentBean.setEmail(result.getString("email"));
|
||||
studentBean.setBirthday(result.getString("birthday"));
|
||||
studentBean.setId(result.getString("id"));
|
||||
studentBean.setAttendDay(result.getInt("attendDay"));
|
||||
list.add(studentBean);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public double getAttendanceRateTarget(String className) {
|
||||
double target = 0;
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String preQuery = "SELECT attendanceTarget FROM class, attendanceTarget WHERE class.attendanceTargetId = attendanceTarget.id AND class.class = ?";
|
||||
PreparedStatement preStmnt = connt.prepareStatement(preQuery);
|
||||
preStmnt.setString(1, className);
|
||||
ResultSet result = preStmnt.executeQuery();
|
||||
if (result.next()) {
|
||||
target = result.getDouble("attendanceTarget");
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
public ArrayList<AttendBean> getStudentAttendDetail(String studentId, String year, int term) {
|
||||
ArrayList<AttendBean> list = null;
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String preQuery = "SELECT studentattend.* FROM studentattend, class, semester, studentclass WHERE studentattend.studentId = ? AND studentattend.attendDate >= semester.start_date AND studentattend.attendDate <= semester.end_date AND semester.year = ? AND semester.term = ? AND studentclass.studentId = studentattend.studentId AND studentclass.classId = class.id";
|
||||
PreparedStatement preStmnt = connt.prepareStatement(preQuery);
|
||||
preStmnt.setString(1, studentId);
|
||||
preStmnt.setString(2, year);
|
||||
preStmnt.setInt(3, term);
|
||||
ResultSet result = preStmnt.executeQuery();
|
||||
list = new ArrayList<AttendBean>();
|
||||
while (result.next()) {
|
||||
AttendBean bean = new AttendBean();
|
||||
bean.setId(result.getString("studentAttendanceId"));
|
||||
bean.setDate(result.getString("attendDate"));
|
||||
bean.setAttend(result.getBoolean("attend"));
|
||||
list.add(bean);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public ArrayList<StudentBean> getAllStudentAttendZero(String className) {
|
||||
ArrayList<StudentBean> list = new ArrayList<StudentBean>();
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
//String preQuery = "SELECT * FROM studentattend, studentclass, student, class WHERE studentclass.classId = class.id AND studentclass.studentId = student.id AND class.class = ? AND studentattend.studentId = student.id AND attendDate = ?";
|
||||
String preQuery = "SELECT student.* FROM studentclass, class, student WHERE studentclass.classid = class.id AND studentclass.studentid = student.id AND class.class = ? ORDER BY student.fname ASC";
|
||||
PreparedStatement pStmnt = connt.prepareStatement(preQuery);
|
||||
pStmnt.setString(1, className);
|
||||
// pStmnt.setString(2, date);
|
||||
ResultSet result = pStmnt.executeQuery();
|
||||
while (result.next()) {
|
||||
StudentBean studentBean = new StudentBean();
|
||||
studentBean.setFname(result.getString("fname"));
|
||||
studentBean.setLname(result.getString("lname"));
|
||||
studentBean.setGender(result.getString("gender"));
|
||||
studentBean.setEmail(result.getString("email"));
|
||||
studentBean.setId(result.getString("id"));
|
||||
studentBean.setAttendRate(0);
|
||||
list.add(studentBean);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public ArrayList<LectureTimeBean> getAllTimeLecture() {
|
||||
ArrayList<LectureTimeBean> list = null;
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String sql = "SELECT * FROM timeTable ORDER BY timeTable.starttime ASC";
|
||||
Statement stmnt = connt.createStatement();
|
||||
ResultSet result = stmnt.executeQuery(sql);
|
||||
list = new ArrayList<LectureTimeBean>();
|
||||
while (result.next()) {
|
||||
LectureTimeBean bean = new LectureTimeBean();
|
||||
bean.setId(result.getString("timeId"));
|
||||
bean.setStartTime(result.getString("starttime"));
|
||||
bean.setEndTime(result.getString("endtime"));
|
||||
list.add(bean);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public ArrayList<LectureBean> getAllLecture(String teacherId) {
|
||||
ArrayList<LectureBean> list = null;
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String preQuery = "SELECT * FROM lecture, class, timetable, daytable WHERE lecture.classId = class.id AND lecture.timeId = timetable.timeId AND lecture.teacherId = ? and lecture.dayId = daytable.id";
|
||||
PreparedStatement preStmnt = connt.prepareStatement(preQuery);
|
||||
preStmnt.setString(1, teacherId);
|
||||
ResultSet result = preStmnt.executeQuery();
|
||||
list = new ArrayList<LectureBean>();
|
||||
while (result.next()) {
|
||||
LectureBean lectureBean = new LectureBean();
|
||||
LectureTimeBean timeBean = new LectureTimeBean();
|
||||
LectureDayBean dayBean = new LectureDayBean();
|
||||
lectureBean.setLecture(result.getString("lecture"));
|
||||
lectureBean.setDescription(result.getString("description"));
|
||||
lectureBean.setClassName(result.getString("class"));
|
||||
timeBean.setStartTime(result.getString("starttime"));
|
||||
timeBean.setEndTime(result.getString("endtime"));
|
||||
timeBean.setFullweek(result.getBoolean("fullday"));
|
||||
lectureBean.setTime(timeBean);
|
||||
dayBean.setDay(result.getString("day"));
|
||||
lectureBean.setDay(dayBean);
|
||||
lectureBean.setRoom(result.getString("room"));
|
||||
list.add(lectureBean);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public ArrayList<LectureDayBean> getAllDayLecture() {
|
||||
ArrayList<LectureDayBean> list = null;
|
||||
try {
|
||||
Connection connt = getConnection();
|
||||
String sql = "SELECT * FROM daytable ORDER BY day ASC";
|
||||
Statement stmnt = connt.createStatement();
|
||||
ResultSet result = stmnt.executeQuery(sql);
|
||||
list = new ArrayList<LectureDayBean>();
|
||||
while (result.next()) {
|
||||
LectureDayBean bean = new LectureDayBean();
|
||||
bean.setId(result.getString("id"));
|
||||
bean.setDay(result.getString("day"));
|
||||
list.add(bean);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
while (ex != null) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
//SELECT *, WEEKDAY(start_date) as start_day_week, WEEKDAY(end_date) as end_day_week FROM scheduler
|
||||
//SELECT *, WEEKDAY(start_date) as start_day_week, WEEKDAY(end_date) as end_day_week, end_date - start_date as countDate FROM scheduler WHERE holiday = true
|
||||
|
||||
// get count date select datediff(semester.end_date, semester.start_date) FROM semester, class WHERE class.termId = semester.id AND class.class = "1A"
|
||||
}
|
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import system.bean.StudentBean;
|
||||
import system.db.AdminDB;
|
||||
import system.db.TeacherDB;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JerryKwok
|
||||
*/
|
||||
@WebServlet(name = "AdminAttendController", urlPatterns = {"/admin/attendance"})
|
||||
public class AdminAttendController extends HttpServlet {
|
||||
|
||||
AdminDB db;
|
||||
TeacherDB tdb;
|
||||
|
||||
public void init() {
|
||||
String dbUser = this.getServletContext().getInitParameter("dbUser");
|
||||
String dbPassword = this.getServletContext().getInitParameter("dbPassword");
|
||||
String dbUrl = this.getServletContext().getInitParameter("dbUrl");
|
||||
db = new AdminDB(dbUrl, dbUser, dbPassword);
|
||||
tdb = new TeacherDB(dbUrl, dbUser, dbPassword);
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
|
||||
* methods.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
HttpSession session = request.getSession(false);
|
||||
try {
|
||||
if (session.getAttribute("username") == null) {
|
||||
response.sendRedirect("../index");
|
||||
return;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
response.sendRedirect("../index");
|
||||
return;
|
||||
}
|
||||
String teacherId = (String) session.getAttribute("username");
|
||||
String className = request.getParameter("class");
|
||||
String attendDate = request.getParameter("date");
|
||||
String action = request.getParameter("action");
|
||||
RequestDispatcher rd = null;
|
||||
if (className == null) {
|
||||
request.setAttribute("classList", db.getAllClass());
|
||||
rd = this.getServletContext().getRequestDispatcher("/admin/attendance.jsp");
|
||||
rd.forward(request, response);
|
||||
return;
|
||||
}
|
||||
|
||||
if (action != null && action.equals("save")) {
|
||||
if (className != null && attendDate != null) {
|
||||
ArrayList<StudentBean> studentList = tdb.getAllStudentClass(className);
|
||||
String[] attendStudents = request.getParameterValues("attend");
|
||||
if (attendStudents != null) {
|
||||
for (String studentId : attendStudents) {
|
||||
tdb.insertStudentAttendance(studentId, attendDate, true);
|
||||
for (StudentBean student : studentList) {
|
||||
if (student.getId().equals(studentId)) {
|
||||
studentList.remove(student);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (StudentBean student : studentList) {
|
||||
tdb.insertStudentAttendance(student.getId(), attendDate, false);
|
||||
}
|
||||
}
|
||||
request.setAttribute("message", true);
|
||||
}
|
||||
if (attendDate == null) {
|
||||
attendDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
|
||||
}
|
||||
request.setAttribute("date", attendDate);
|
||||
request.setAttribute("studentAttendList", tdb.getAttendClass(className, attendDate));
|
||||
request.setAttribute("classList", db.getAllClass());
|
||||
rd = this.getServletContext().getRequestDispatcher("/admin/attendanceStudent.jsp");
|
||||
rd.forward(request, response);
|
||||
}
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
|
||||
/**
|
||||
* Handles the HTTP <code>GET</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the HTTP <code>POST</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a short description of the servlet.
|
||||
*
|
||||
* @return a String containing servlet description
|
||||
*/
|
||||
@Override
|
||||
public String getServletInfo() {
|
||||
return "Short description";
|
||||
}// </editor-fold>
|
||||
|
||||
}
|
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import system.db.AdminDB;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JerryKwok
|
||||
*/
|
||||
@WebServlet(name = "AdminClassController", urlPatterns = {"/admin/class"})
|
||||
public class AdminClassController extends HttpServlet {
|
||||
|
||||
AdminDB db;
|
||||
|
||||
public void init() {
|
||||
String dbUser = this.getServletContext().getInitParameter("dbUser");
|
||||
String dbPassword = this.getServletContext().getInitParameter("dbPassword");
|
||||
String dbUrl = this.getServletContext().getInitParameter("dbUrl");
|
||||
db = new AdminDB(dbUrl, dbUser, dbPassword);
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
|
||||
* methods.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
|
||||
try {
|
||||
HttpSession session = request.getSession(false);
|
||||
if (session.getAttribute("username") == null) {
|
||||
response.sendRedirect("../index");
|
||||
return;
|
||||
}
|
||||
String username = (String) session.getAttribute("username");
|
||||
String action = request.getParameter("action");
|
||||
String classId = request.getParameter("id");
|
||||
|
||||
RequestDispatcher rd = null;
|
||||
request.setAttribute("classList", db.getClassList());
|
||||
request.setAttribute("searchList", db.getSearchHistory("6", username));
|
||||
if (action != null && action.equals("addPage")) {
|
||||
request.setAttribute("teacherList", db.getNotClassTeacher());
|
||||
request.setAttribute("classYearList", db.getClassYear());
|
||||
rd = this.getServletContext().getRequestDispatcher("/admin/classAdd.jsp");
|
||||
rd.forward(request, response);
|
||||
|
||||
} else if (action != null && action.equals("add")) {
|
||||
String className = request.getParameter("class");
|
||||
String teacherId = request.getParameter("teacherId");
|
||||
String yearId = request.getParameter("yearId");
|
||||
if (db.checkClassNameDupli(className)) {
|
||||
System.out.println("TESTPOTIN_TRUE");
|
||||
request.setAttribute("className", className);
|
||||
request.setAttribute("teacherId", teacherId);
|
||||
request.setAttribute("yearId", yearId);
|
||||
request.setAttribute("dupMes", true);
|
||||
request.setAttribute("teacherList", db.getNotClassTeacher());
|
||||
request.setAttribute("classYearList", db.getClassYear());
|
||||
rd = this.getServletContext().getRequestDispatcher("/admin/classAdd.jsp");
|
||||
rd.forward(request, response);
|
||||
}else{
|
||||
System.out.println("TESTPOTIN_false");
|
||||
db.insertClass(className, teacherId, yearId, 1);
|
||||
request.setAttribute("addMes", true);
|
||||
request.setAttribute("classList", db.getClassList());
|
||||
|
||||
rd = this.getServletContext().getRequestDispatcher("/admin/class.jsp");
|
||||
rd.forward(request, response);
|
||||
|
||||
}
|
||||
} else if (action != null && action.equals("save")) {
|
||||
String className = request.getParameter("class");
|
||||
String teacherId = request.getParameter("teacherId");
|
||||
String yearId = request.getParameter("yearId");
|
||||
if (db.checkClassNameDupli(className, classId)) {
|
||||
request.setAttribute("className", className);
|
||||
request.setAttribute("teacherId", teacherId);
|
||||
request.setAttribute("yearId", yearId);
|
||||
request.setAttribute("dupMes", true);
|
||||
request.setAttribute("classBean", db.getClassDetails(classId));
|
||||
request.setAttribute("teacherList", db.getNotClassTeacher());
|
||||
request.setAttribute("classYearList", db.getClassYear());
|
||||
rd = this.getServletContext().getRequestDispatcher("/admin/classEdit.jsp");
|
||||
rd.forward(request, response);
|
||||
}
|
||||
db.updateClass(className, teacherId, yearId, 1, classId);
|
||||
System.out.println(className + "asd");
|
||||
System.out.println(teacherId + "asd");
|
||||
System.out.println(yearId + "asd");
|
||||
System.out.println(classId + "asd");
|
||||
request.setAttribute("classList", db.getClassList());
|
||||
request.setAttribute("saveMes", classId);
|
||||
rd = this.getServletContext().getRequestDispatcher("/admin/class.jsp");
|
||||
rd.forward(request, response);
|
||||
|
||||
} else if (action != null && action.equals("search")) {
|
||||
String searchVal = request.getParameter("searchVal");
|
||||
db.insertSearchHistory(searchVal, "6", username);
|
||||
request.setAttribute("classList", db.searchClass(searchVal));
|
||||
request.setAttribute("searchList", db.getSearchHistory("6", username));
|
||||
request.setAttribute("search", true);
|
||||
rd = this.getServletContext().getRequestDispatcher("/admin/class.jsp");
|
||||
rd.forward(request, response);
|
||||
} else if (action != null && action.equals("delete")) {
|
||||
db.deleteClass(classId);
|
||||
request.setAttribute("deleteMes", classId);
|
||||
request.setAttribute("classList", db.getClassList());
|
||||
} else if (classId != null) {
|
||||
request.setAttribute("classBean", db.getClassDetails(classId));
|
||||
request.setAttribute("teacherList", db.getNotClassTeacher());
|
||||
request.setAttribute("classYearList", db.getClassYear());
|
||||
rd = this.getServletContext().getRequestDispatcher("/admin/classEdit.jsp");
|
||||
rd.forward(request, response);
|
||||
}
|
||||
|
||||
rd = this.getServletContext().getRequestDispatcher("/admin/class.jsp");
|
||||
rd.forward(request, response);
|
||||
} catch (Exception e) {
|
||||
response.sendRedirect("../index");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
|
||||
/**
|
||||
* Handles the HTTP <code>GET</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the HTTP <code>POST</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a short description of the servlet.
|
||||
*
|
||||
* @return a String containing servlet description
|
||||
*/
|
||||
@Override
|
||||
public String getServletInfo() {
|
||||
return "Short description";
|
||||
}// </editor-fold>
|
||||
|
||||
}
|
@@ -0,0 +1,156 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import system.db.AdminDB;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JerryKwok
|
||||
*/
|
||||
@WebServlet(name = "AdminClassRegController", urlPatterns = {"/admin/classReg"})
|
||||
public class AdminClassRegController extends HttpServlet {
|
||||
|
||||
AdminDB db;
|
||||
|
||||
public void init() {
|
||||
String dbUser = this.getServletContext().getInitParameter("dbUser");
|
||||
String dbPassword = this.getServletContext().getInitParameter("dbPassword");
|
||||
String dbUrl = this.getServletContext().getInitParameter("dbUrl");
|
||||
db = new AdminDB(dbUrl, dbUser, dbPassword);
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
|
||||
* methods.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
try {
|
||||
HttpSession session = request.getSession(false);
|
||||
if (session.getAttribute("username") == null) {
|
||||
response.sendRedirect("../index");
|
||||
return;
|
||||
}
|
||||
String username = (String) session.getAttribute("username");
|
||||
String action = request.getParameter("action");
|
||||
String studentClassID = request.getParameter("id"); // edit function
|
||||
if (action != null && action.equals("delete")) {
|
||||
String studentId = db.deleteStudentClass(studentClassID);
|
||||
request.setAttribute("deletenMes", studentId);
|
||||
request.setAttribute("studentClassList", db.getAllStudentClass());
|
||||
request.setAttribute("searchList", db.getSearchHistory("2", username));
|
||||
RequestDispatcher rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/classReg.jsp");
|
||||
rd.forward(request, response);
|
||||
} else if (action != null && action.equals("save")) {
|
||||
String className = request.getParameter("className");
|
||||
db.updateStudentClass(studentClassID, className);
|
||||
request.setAttribute("saveMes", studentClassID);
|
||||
request.setAttribute("studentClassList", db.getAllStudentClass());
|
||||
request.setAttribute("searchList", db.getSearchHistory("2", username));
|
||||
RequestDispatcher rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/classReg.jsp");
|
||||
rd.forward(request, response);
|
||||
} else if (action != null && action.equals("search")) {
|
||||
String searchVal = request.getParameter("searchVal");
|
||||
request.setAttribute("studentClassList", db.searchStudentClass(searchVal));
|
||||
db.insertSearchHistory(searchVal, "2", username);
|
||||
request.setAttribute("searchHis", true);
|
||||
request.setAttribute("searchList", db.getSearchHistory("2", username));
|
||||
RequestDispatcher rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/classReg.jsp");
|
||||
rd.forward(request, response);
|
||||
} else if (action != null && action.equals("addPage")) {
|
||||
request.setAttribute("classList", db.getAllClass());
|
||||
request.setAttribute("studnetIdList", db.getUnRegAllStudent());
|
||||
RequestDispatcher rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/classRegAdd.jsp");
|
||||
rd.forward(request, response);
|
||||
} else if (action != null && action.equals("add")) {
|
||||
String className = request.getParameter("className");
|
||||
db.insertStudentClass(studentClassID, className);
|
||||
request.setAttribute("studentClassList", db.getAllStudentClass());
|
||||
request.setAttribute("searchList", db.getSearchHistory("2", username));
|
||||
request.setAttribute("addMes", className);
|
||||
RequestDispatcher rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/classReg.jsp");
|
||||
rd.forward(request, response);
|
||||
}
|
||||
|
||||
if (studentClassID != null) {
|
||||
request.setAttribute("studenBean", db.getStudentClassDeital(studentClassID));
|
||||
request.setAttribute("classList", db.getAllClass());
|
||||
request.setAttribute("studentClassID", studentClassID);
|
||||
RequestDispatcher rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/classRegStudent.jsp");
|
||||
rd.forward(request, response);
|
||||
}
|
||||
request.setAttribute("studentClassList", db.getAllStudentClass());
|
||||
request.setAttribute("searchList", db.getSearchHistory("2", username));
|
||||
RequestDispatcher rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/classReg.jsp");
|
||||
rd.forward(request, response);
|
||||
} catch (NullPointerException e) {
|
||||
response.sendRedirect("../index");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
|
||||
/**
|
||||
* Handles the HTTP <code>GET</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the HTTP <code>POST</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a short description of the servlet.
|
||||
*
|
||||
* @return a String containing servlet description
|
||||
*/
|
||||
@Override
|
||||
public String getServletInfo() {
|
||||
return "Short description";
|
||||
}// </editor-fold>
|
||||
|
||||
}
|
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import system.db.AdminDB;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JerryKwok
|
||||
*/
|
||||
@WebServlet(name = "AdminDashboard", urlPatterns = {"/admin/dashboard"})
|
||||
public class AdminDashboardController extends HttpServlet {
|
||||
|
||||
AdminDB db;
|
||||
|
||||
public void init() {
|
||||
String dbUser = this.getServletContext().getInitParameter("dbUser");
|
||||
String dbPassword = this.getServletContext().getInitParameter("dbPassword");
|
||||
String dbUrl = this.getServletContext().getInitParameter("dbUrl");
|
||||
db = new AdminDB(dbUrl, dbUser, dbPassword);
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
|
||||
* methods.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
try {
|
||||
HttpSession session = request.getSession(false);
|
||||
if (session.getAttribute("username") == null) {
|
||||
response.sendRedirect("../index");
|
||||
return;
|
||||
}
|
||||
request.setAttribute("courseCount", db.getCountClass());
|
||||
request.setAttribute("studentCount", db.getCountStudent());
|
||||
RequestDispatcher rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/dashboard.jsp");
|
||||
rd.forward(request, response);
|
||||
} catch (Exception e) {
|
||||
response.sendRedirect("../index");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
|
||||
/**
|
||||
* Handles the HTTP <code>GET</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the HTTP <code>POST</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a short description of the servlet.
|
||||
*
|
||||
* @return a String containing servlet description
|
||||
*/
|
||||
@Override
|
||||
public String getServletInfo() {
|
||||
return "Short description";
|
||||
}// </editor-fold>
|
||||
|
||||
}
|
@@ -0,0 +1,202 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import system.db.AdminDB;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JerryKwok
|
||||
*/
|
||||
@WebServlet(name = "AdminLectureController", urlPatterns = {"/admin/lecture"})
|
||||
public class AdminLectureController extends HttpServlet {
|
||||
|
||||
AdminDB db;
|
||||
|
||||
public void init() {
|
||||
String dbUser = this.getServletContext().getInitParameter("dbUser");
|
||||
String dbPassword = this.getServletContext().getInitParameter("dbPassword");
|
||||
String dbUrl = this.getServletContext().getInitParameter("dbUrl");
|
||||
db = new AdminDB(dbUrl, dbUser, dbPassword);
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
|
||||
* methods.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
try {
|
||||
HttpSession session = request.getSession(false);
|
||||
if (session.getAttribute("username") == null) {
|
||||
response.sendRedirect("../index");
|
||||
return;
|
||||
}
|
||||
String username = (String) session.getAttribute("username");
|
||||
String action = request.getParameter("action");
|
||||
String lectureId = request.getParameter("id");
|
||||
request.setAttribute("lectureList", db.getLecture());
|
||||
request.setAttribute("searchList", db.getSearchHistory("1", username));
|
||||
RequestDispatcher rd = null;
|
||||
if (action != null && action.equals("delete")) {
|
||||
db.deleteLecture(lectureId);
|
||||
request.setAttribute("deleteMes", lectureId);
|
||||
request.setAttribute("lectureList", db.getLecture());
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/lecture.jsp");
|
||||
rd.forward(request, response);
|
||||
} else if (action != null && action.equals("addPage")) {
|
||||
request.setAttribute("classList", db.getClassList());
|
||||
request.setAttribute("dayList", db.getDayList());
|
||||
request.setAttribute("timeList", db.getTimeList());
|
||||
request.setAttribute("teacherList", db.getTeacher());
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/lectureAdd.jsp");
|
||||
rd.forward(request, response);
|
||||
} else if (action != null && action.equals("search")) {
|
||||
String searchVal = request.getParameter("searchVal");
|
||||
request.setAttribute("lectureList", db.searchLecture(searchVal));
|
||||
db.insertSearchHistory(searchVal, "1", username);
|
||||
request.setAttribute("searchList", db.getSearchHistory("1", username));
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/lecture.jsp");
|
||||
rd.forward(request, response);
|
||||
} else if (action != null && action.equals("save")) {
|
||||
String lecture = request.getParameter("lecture");
|
||||
String description = request.getParameter("description");
|
||||
String className = request.getParameter("className");
|
||||
String time = request.getParameter("time");
|
||||
String day = request.getParameter("day");
|
||||
String teacher = request.getParameter("teacher");
|
||||
if (db.checkTeacherDupSchedule(time, teacher, lectureId)) {
|
||||
request.setAttribute("classList", db.getClassList());
|
||||
request.setAttribute("dayList", db.getDayList());
|
||||
request.setAttribute("timeList", db.getTimeList());
|
||||
request.setAttribute("teacherList", db.getTeacher());
|
||||
request.setAttribute("lectureBean", db.getLectureDetials(lectureId));
|
||||
request.setAttribute("lectureId", lectureId);
|
||||
request.setAttribute("lecture", lecture);
|
||||
request.setAttribute("description", description);
|
||||
request.setAttribute("className", className);
|
||||
request.setAttribute("time", time);
|
||||
request.setAttribute("day", day);
|
||||
request.setAttribute("teacher", teacher);
|
||||
request.setAttribute("dupMes", true);
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/lectureEdit.jsp");
|
||||
rd.forward(request, response);
|
||||
return;
|
||||
}
|
||||
db.updateLecture(lectureId, lecture, description, className, time, day, teacher);
|
||||
request.setAttribute("saveMes", lectureId);
|
||||
request.setAttribute("lectureList", db.getLecture());
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/lecture.jsp");
|
||||
rd.forward(request, response);
|
||||
} else if (action != null && action.equals("add")) {
|
||||
String lecture = request.getParameter("lecture");
|
||||
String description = request.getParameter("description");
|
||||
String className = request.getParameter("className");
|
||||
String time = request.getParameter("time");
|
||||
String day = request.getParameter("day");
|
||||
String teacher = request.getParameter("teacher");
|
||||
if (db.checkTeacherDupSchedule(time, teacher)) {
|
||||
request.setAttribute("classList", db.getClassList());
|
||||
request.setAttribute("dayList", db.getDayList());
|
||||
request.setAttribute("timeList", db.getTimeList());
|
||||
request.setAttribute("teacherList", db.getTeacher());
|
||||
request.setAttribute("lectureId", lectureId);
|
||||
request.setAttribute("lecture", lecture);
|
||||
request.setAttribute("description", description);
|
||||
request.setAttribute("className", className);
|
||||
request.setAttribute("time", time);
|
||||
request.setAttribute("day", day);
|
||||
request.setAttribute("teacher", teacher);
|
||||
request.setAttribute("dupMes", true);
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/lectureAdd.jsp");
|
||||
rd.forward(request, response);
|
||||
return;
|
||||
}
|
||||
db.insertLecture(lecture, description, className, time, day, teacher);
|
||||
request.setAttribute("lectureList", db.getLecture());
|
||||
request.setAttribute("addMes", true);
|
||||
}
|
||||
if (lectureId != null) {
|
||||
request.setAttribute("lectureId", lectureId);
|
||||
request.setAttribute("classList", db.getClassList());
|
||||
request.setAttribute("dayList", db.getDayList());
|
||||
request.setAttribute("timeList", db.getTimeList());
|
||||
request.setAttribute("teacherList", db.getTeacher());
|
||||
request.setAttribute("lectureBean", db.getLectureDetials(lectureId));
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/lectureEdit.jsp");
|
||||
rd.forward(request, response);
|
||||
}
|
||||
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/lecture.jsp");
|
||||
rd.forward(request, response);
|
||||
} catch (Exception e) {
|
||||
response.sendRedirect("../index");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
|
||||
/**
|
||||
* Handles the HTTP <code>GET</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the HTTP <code>POST</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a short description of the servlet.
|
||||
*
|
||||
* @return a String containing servlet description
|
||||
*/
|
||||
@Override
|
||||
public String getServletInfo() {
|
||||
return "Short description";
|
||||
}// </editor-fold>
|
||||
|
||||
}
|
@@ -0,0 +1,256 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import system.bean.AttendBean;
|
||||
import system.bean.SchedulerBean;
|
||||
import system.bean.SemesterBean;
|
||||
import system.bean.StudentBean;
|
||||
import system.db.AdminDB;
|
||||
import system.db.TeacherDB;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JerryKwok
|
||||
*/
|
||||
@WebServlet(name = "AdminReportController", urlPatterns = {"/admin/report"})
|
||||
public class AdminReportController extends HttpServlet {
|
||||
|
||||
AdminDB db;
|
||||
TeacherDB tdb;
|
||||
|
||||
public void init() {
|
||||
String dbUser = this.getServletContext().getInitParameter("dbUser");
|
||||
String dbPassword = this.getServletContext().getInitParameter("dbPassword");
|
||||
String dbUrl = this.getServletContext().getInitParameter("dbUrl");
|
||||
db = new AdminDB(dbUrl, dbUser, dbPassword);
|
||||
tdb = new TeacherDB(dbUrl, dbUser, dbPassword);
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
|
||||
* methods.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
HttpSession session = request.getSession(false);
|
||||
if (session.getAttribute("username") == null) {
|
||||
response.sendRedirect("../index.jsp");
|
||||
return;
|
||||
}
|
||||
RequestDispatcher rd;
|
||||
String className = request.getParameter("class");
|
||||
String strTerm = request.getParameter("term");
|
||||
String studentId = request.getParameter("studentId");
|
||||
request.setAttribute("classList", db.getAllClass());
|
||||
String reportType = request.getParameter("report");
|
||||
if (className != null) {
|
||||
String year = request.getParameter("year");
|
||||
ArrayList<String> errList = new ArrayList<String>();
|
||||
if (strTerm == null) {
|
||||
strTerm = "1";
|
||||
};
|
||||
if (year == null) {
|
||||
year = Calendar.getInstance().get(Calendar.YEAR) + "";
|
||||
}
|
||||
|
||||
try {
|
||||
int term = Integer.parseInt(strTerm);
|
||||
SemesterBean semBean = tdb.getSemsterDate(year, term);
|
||||
int totalSchoolDay = semBean.getCountBusineseDate();
|
||||
int countHoliday = 0;
|
||||
for (SchedulerBean scheduler : tdb.getSchCalenderholiday()) {
|
||||
if (scheduler.isHoliday() && scheduler.getCountDate() == 0) {
|
||||
switch (scheduler.getStart_day_week()) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
countHoliday++;
|
||||
}
|
||||
} else if (scheduler.isHoliday() && scheduler.getCountDate() > 0) {
|
||||
countHoliday += scheduler.getCountBusineseDay() + 1;
|
||||
//countHoliday += scheduler.getCountDate();
|
||||
}
|
||||
}
|
||||
totalSchoolDay = totalSchoolDay - countHoliday;
|
||||
System.out.println(totalSchoolDay);
|
||||
ArrayList<StudentBean> studentList = tdb.getStudentAttend(semBean.getStart_date(), semBean.getEnd_date(), className);
|
||||
int allStudentCountDay = 0;
|
||||
int numberOfStudent = 0;
|
||||
int numberOfStudentNotMeetTar = 0;
|
||||
int numberOfStudentMeetTar = 0;
|
||||
int numberOfStudentWarning = 0;
|
||||
int numberOfStudentDanger = 0;
|
||||
int numberOfStudentLowAtt = 0;
|
||||
double avgStudentAttendDay = 0;
|
||||
StudentBean studentBean = null;
|
||||
|
||||
for (StudentBean student : studentList) {
|
||||
int countDay = student.getAttendDay();
|
||||
allStudentCountDay += countDay;
|
||||
double attendRate = Math.round((countDay / (float) totalSchoolDay) * 100);
|
||||
student.setAttendRate(attendRate);
|
||||
numberOfStudent++;
|
||||
if (attendRate >= tdb.getAttendanceRateTarget(className)) {
|
||||
numberOfStudentMeetTar++;
|
||||
} else {
|
||||
numberOfStudentNotMeetTar++;
|
||||
}
|
||||
System.out.println(student.getId());
|
||||
if (studentId != null && student.getId().equals(studentId)) {
|
||||
studentBean = student;
|
||||
}
|
||||
}
|
||||
ArrayList<StudentBean> lowAttendList = null;
|
||||
if (reportType != null && reportType.equals("low")) {
|
||||
lowAttendList = new ArrayList<StudentBean>();
|
||||
double avgLowAttend = 0;
|
||||
for (StudentBean student : studentList) {
|
||||
if (student.getAttendRate() <= tdb.getAttendanceRateTarget(className)) {
|
||||
lowAttendList.add(student);
|
||||
}
|
||||
if (student.getAttendRate() >= 50.0 && student.getAttendRate() < 60.0) {
|
||||
numberOfStudentWarning++;
|
||||
avgLowAttend += student.getAttendRate();
|
||||
} else if (student.getAttendRate() <= 49.0 && student.getAttendRate() >= 40.0) {
|
||||
numberOfStudentDanger++;
|
||||
avgLowAttend += student.getAttendRate();
|
||||
} else if (student.getAttendRate() >= tdb.getAttendanceRateTarget(className)) {
|
||||
|
||||
} else {
|
||||
numberOfStudentLowAtt++;
|
||||
avgLowAttend += student.getAttendRate();
|
||||
}
|
||||
}
|
||||
avgLowAttend = avgLowAttend / (numberOfStudentWarning + numberOfStudentDanger + numberOfStudentLowAtt);
|
||||
request.setAttribute("attendAVG", avgLowAttend);
|
||||
}
|
||||
|
||||
if (studentList.size() == 0 || reportType != null && reportType.equals("low") && lowAttendList.size() == 0) {
|
||||
request.setAttribute("studentAttendList", tdb.getAllStudentAttendZero(className));
|
||||
} else {
|
||||
if (reportType != null && reportType.equals("low")) {
|
||||
request.setAttribute("studentAttendList", lowAttendList);
|
||||
} else {
|
||||
request.setAttribute("studentAttendList", studentList);
|
||||
}
|
||||
}
|
||||
if (studentId != null) {
|
||||
studentBean.setAttendList(tdb.getStudentAttendDetail(studentId, year, term));
|
||||
request.setAttribute("studentDetials", studentBean);
|
||||
int totalAttendDay = 0;
|
||||
int presentDay = 0;
|
||||
int absDay = 0;
|
||||
for (AttendBean attend : studentBean.getAttendList()) {
|
||||
if (attend.isAttend()) {
|
||||
presentDay++;
|
||||
} else {
|
||||
absDay++;
|
||||
}
|
||||
totalAttendDay++;
|
||||
}
|
||||
request.setAttribute("presentDay", presentDay);
|
||||
request.setAttribute("absDay", absDay);
|
||||
request.setAttribute("totalAttendDay", totalAttendDay);
|
||||
}
|
||||
try {
|
||||
avgStudentAttendDay = (allStudentCountDay / numberOfStudent);
|
||||
} catch (ArithmeticException e) {
|
||||
avgStudentAttendDay = 0;
|
||||
}
|
||||
int attendAVG = 0;
|
||||
if(avgStudentAttendDay>0){
|
||||
attendAVG = (int) Math.round((1-(totalSchoolDay - avgStudentAttendDay) / totalSchoolDay) * 100);
|
||||
}
|
||||
|
||||
|
||||
if (reportType != null && reportType.equals("low")) {
|
||||
request.setAttribute("numberOfStudentWarning", numberOfStudentWarning);
|
||||
request.setAttribute("numberOfStudentDanger", numberOfStudentDanger);
|
||||
request.setAttribute("numberOfStudentLowAtt", numberOfStudentLowAtt);
|
||||
} else {
|
||||
request.setAttribute("numberOfStudentMeetTar", numberOfStudentMeetTar);
|
||||
request.setAttribute("numberOfStudentNotMeetTar", numberOfStudentNotMeetTar);
|
||||
request.setAttribute("attendAVG", attendAVG);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
errList.add("The term must be Integer");
|
||||
}
|
||||
|
||||
request.setAttribute("errMessage", errList);
|
||||
request.setAttribute("yearList", tdb.getLatestReportYear());
|
||||
request.setAttribute("termList", tdb.getSemsterTerm(year));
|
||||
if (studentId != null) {
|
||||
rd = this.getServletContext().getRequestDispatcher("/admin/reportStudent.jsp");
|
||||
rd.forward(request, response);
|
||||
} else {
|
||||
rd = this.getServletContext().getRequestDispatcher("/admin/reportClass.jsp");
|
||||
rd.forward(request, response);
|
||||
}
|
||||
}
|
||||
|
||||
rd = this.getServletContext().getRequestDispatcher("/admin/report.jsp");
|
||||
rd.forward(request, response);
|
||||
}
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
|
||||
/**
|
||||
* Handles the HTTP <code>GET</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the HTTP <code>POST</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a short description of the servlet.
|
||||
*
|
||||
* @return a String containing servlet description
|
||||
*/
|
||||
@Override
|
||||
public String getServletInfo() {
|
||||
return "Short description";
|
||||
}// </editor-fold>
|
||||
|
||||
}
|
@@ -0,0 +1,220 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import system.db.AdminDB;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JerryKwok
|
||||
*/
|
||||
@WebServlet(name = "AdminScheduleController", urlPatterns = {"/admin/schedule"})
|
||||
public class AdminScheduleController extends HttpServlet {
|
||||
|
||||
AdminDB db;
|
||||
|
||||
public void init() {
|
||||
String dbUser = this.getServletContext().getInitParameter("dbUser");
|
||||
String dbPassword = this.getServletContext().getInitParameter("dbPassword");
|
||||
String dbUrl = this.getServletContext().getInitParameter("dbUrl");
|
||||
db = new AdminDB(dbUrl, dbUser, dbPassword);
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
|
||||
* methods.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
try {
|
||||
HttpSession session = request.getSession(false);
|
||||
if (session.getAttribute("username") == null) {
|
||||
response.sendRedirect("../index");
|
||||
return;
|
||||
}
|
||||
RequestDispatcher rd = null;
|
||||
String className = request.getParameter("class");
|
||||
String action = request.getParameter("action");
|
||||
String scheduleId = request.getParameter("id");
|
||||
request.setAttribute("scheduleList", db.getScheduler());
|
||||
request.setAttribute("scheduleAllList", db.getSchedulerAll());
|
||||
if (className != null && className.equalsIgnoreCase("schoolDay")) {
|
||||
if (action != null && action.equals("addPage")) {
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/scheduleSchoolDayAdd.jsp");
|
||||
rd.forward(request, response);
|
||||
} else if (action != null && action.equals("search")) {
|
||||
String searchVal = request.getParameter("searchVal");
|
||||
request.setAttribute("scheduleAllList", db.searchScheduler(searchVal));
|
||||
request.setAttribute("scheduleList", db.searchScheduler(searchVal));
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/scheduleSchoolDay.jsp");
|
||||
rd.forward(request, response);
|
||||
|
||||
} else if (action != null && action.equals("save")) {
|
||||
String title = request.getParameter("title");
|
||||
String startDate = request.getParameter("startDate");
|
||||
String endDate = request.getParameter("endDate");
|
||||
String isHoliday = request.getParameter("holiday");
|
||||
String isSchoolDay = request.getParameter("schoolDay");
|
||||
if (isHoliday != null && isHoliday.equalsIgnoreCase("isHoliday") && isSchoolDay != null && isSchoolDay.equalsIgnoreCase("isSchoolDay")) {
|
||||
request.setAttribute("title", title);
|
||||
request.setAttribute("startDate", startDate);
|
||||
request.setAttribute("endDate", endDate);
|
||||
request.setAttribute("errMes", true);
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/scheduleSchoolDayEdit.jsp");
|
||||
rd.forward(request, response);
|
||||
}
|
||||
System.out.println("TESTADDD");
|
||||
if (isHoliday == null && isSchoolDay == null) {
|
||||
request.setAttribute("title", title);
|
||||
request.setAttribute("startDate", startDate);
|
||||
request.setAttribute("endDate", endDate);
|
||||
request.setAttribute("notselectMes", true);
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/scheduleSchoolDayEdit.jsp");
|
||||
rd.forward(request, response);
|
||||
}
|
||||
db.updateSchedule(title, startDate, endDate, isHoliday, isSchoolDay, scheduleId);
|
||||
request.setAttribute("saveMes", scheduleId);
|
||||
request.setAttribute("scheduleList", db.getScheduler());
|
||||
request.setAttribute("scheduleAllList", db.getSchedulerAll());
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/scheduleSchoolDay.jsp");
|
||||
rd.forward(request, response);
|
||||
|
||||
} else if (action != null && action.equals("add")) {
|
||||
System.out.println("TESTADDD");
|
||||
String title = request.getParameter("title");
|
||||
String startDate = request.getParameter("startDate");
|
||||
String endDate = request.getParameter("endDate");
|
||||
String isHoliday = request.getParameter("holiday");
|
||||
String isSchoolDay = request.getParameter("schoolDay");
|
||||
System.out.println("isC" + isSchoolDay);
|
||||
if (isHoliday != null && isHoliday.equalsIgnoreCase("isHoliday") && isSchoolDay != null && isSchoolDay.equalsIgnoreCase("isSchoolDay")) {
|
||||
request.setAttribute("title", title);
|
||||
request.setAttribute("startDate", startDate);
|
||||
request.setAttribute("endDate", endDate);
|
||||
request.setAttribute("errMes", true);
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/scheduleSchoolDayAdd.jsp");
|
||||
rd.forward(request, response);
|
||||
}
|
||||
System.out.println("TESTADDD");
|
||||
if (isHoliday == null && isSchoolDay == null) {
|
||||
request.setAttribute("title", title);
|
||||
request.setAttribute("startDate", startDate);
|
||||
request.setAttribute("endDate", endDate);
|
||||
request.setAttribute("notselectMes", true);
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/scheduleSchoolDayAdd.jsp");
|
||||
rd.forward(request, response);
|
||||
}
|
||||
System.out.println("test");
|
||||
db.insertSchedule(title, startDate, endDate, isHoliday, isSchoolDay);
|
||||
request.setAttribute("addMes", true);
|
||||
request.setAttribute("scheduleAllList", db.getSchedulerAll());
|
||||
request.setAttribute("scheduleList", db.getScheduler());
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/scheduleSchoolDay.jsp");
|
||||
rd.forward(request, response);
|
||||
|
||||
} else if (action != null && action.equals("delete") && scheduleId != null) {
|
||||
db.deleteSchedule(scheduleId);
|
||||
request.setAttribute("deleteMes", scheduleId);
|
||||
request.setAttribute("scheduleAllList", db.getSchedulerAll());
|
||||
request.setAttribute("scheduleList", db.getScheduler());
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/scheduleSchoolDay.jsp");
|
||||
rd.forward(request, response);
|
||||
} else if (scheduleId != null) {
|
||||
request.setAttribute("scheduleBean", db.getSchedulerDetials(scheduleId));
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/scheduleSchoolDayEdit.jsp");
|
||||
rd.forward(request, response);
|
||||
}
|
||||
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/scheduleSchoolDay.jsp");
|
||||
rd.forward(request, response);
|
||||
}
|
||||
if (className != null) {
|
||||
request.setAttribute("lectureList", db.getLecture(className));
|
||||
request.setAttribute("timeList", db.getTimeList());
|
||||
request.setAttribute("dayList", db.getDayList());
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/scheduleClass.jsp");
|
||||
rd.forward(request, response);
|
||||
} else if (className != null && className.equals("schoolDay")) {
|
||||
|
||||
}
|
||||
request.setAttribute("classList", db.getAllClass());
|
||||
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/schedule.jsp");
|
||||
rd.forward(request, response);
|
||||
} catch (Exception e) {
|
||||
response.sendRedirect("../index");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
|
||||
/**
|
||||
* Handles the HTTP <code>GET</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the HTTP <code>POST</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a short description of the servlet.
|
||||
*
|
||||
* @return a String containing servlet description
|
||||
*/
|
||||
@Override
|
||||
public String getServletInfo() {
|
||||
return "Short description";
|
||||
}// </editor-fold>
|
||||
|
||||
}
|
@@ -0,0 +1,394 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import system.db.AdminDB;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JerryKwok
|
||||
*/
|
||||
@WebServlet(name = "AdminUserController", urlPatterns = {"/admin/user"})
|
||||
public class AdminUserController extends HttpServlet {
|
||||
|
||||
AdminDB db;
|
||||
|
||||
public void init() {
|
||||
String dbUser = this.getServletContext().getInitParameter("dbUser");
|
||||
String dbPassword = this.getServletContext().getInitParameter("dbPassword");
|
||||
String dbUrl = this.getServletContext().getInitParameter("dbUrl");
|
||||
db = new AdminDB(dbUrl, dbUser, dbPassword);
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
|
||||
* methods.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
try {
|
||||
HttpSession session = request.getSession(false);
|
||||
if (session.getAttribute("username") == null) {
|
||||
response.sendRedirect("../index");
|
||||
return;
|
||||
}
|
||||
String username = (String) session.getAttribute("username");
|
||||
RequestDispatcher rd = null;
|
||||
String role = request.getParameter("role");
|
||||
|
||||
if (role.equals("Student")) {
|
||||
request.setAttribute("studentList", db.getStudent());
|
||||
String studentId = request.getParameter("id");
|
||||
String action = request.getParameter("action");
|
||||
System.out.println("TEST Point1");
|
||||
request.setAttribute("searchList", db.getSearchHistory("3", username));
|
||||
if (studentId != null && action != null && action.equals("delete")) {
|
||||
System.out.println("TEST Point2");
|
||||
db.deleteStudent(studentId);
|
||||
request.setAttribute("deleteMes", studentId);
|
||||
request.setAttribute("studentList", db.getStudent());
|
||||
} else if (action != null && action.equals("addPage")) {
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/userAdd.jsp");
|
||||
rd.forward(request, response);
|
||||
return;
|
||||
} else if (action != null && action.equals("add")) {
|
||||
System.out.println("TEST Point3");
|
||||
String fname = request.getParameter("fname");
|
||||
String lname = request.getParameter("lname");
|
||||
String gender = request.getParameter("gender");
|
||||
String birthday = request.getParameter("birthday");
|
||||
String password = request.getParameter("password");
|
||||
String pwd = request.getParameter("pwd");
|
||||
if (!password.equals(pwd)) {
|
||||
request.setAttribute("fname", fname);
|
||||
request.setAttribute("lname", lname);
|
||||
request.setAttribute("gender", gender);
|
||||
request.setAttribute("birthday", birthday);
|
||||
request.setAttribute("pwdMes", true);
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/userAdd.jsp");
|
||||
rd.forward(request, response);
|
||||
return;
|
||||
}
|
||||
String insertId = db.insertStudent(fname, lname, gender, birthday, password);
|
||||
request.setAttribute("addMes", insertId);
|
||||
request.setAttribute("studentList", db.getStudent());
|
||||
} else if (action != null && action.equals("search")) {
|
||||
System.out.println("TEST Point4");
|
||||
String searchVal = request.getParameter("searchVal");
|
||||
request.setAttribute("studentList", db.searchStudent(searchVal));
|
||||
db.insertSearchHistory(searchVal, "3", username);
|
||||
request.setAttribute("searchList", db.getSearchHistory("3", username));
|
||||
} else if (action != null && action.equals("save")) {
|
||||
System.out.println("TEST Point5");
|
||||
String id = request.getParameter("id");
|
||||
String fname = request.getParameter("fname");
|
||||
String lname = request.getParameter("lname");
|
||||
String gender = request.getParameter("gender");
|
||||
String birthday = request.getParameter("birthday");
|
||||
System.out.println("Birthday" + birthday);
|
||||
String email = request.getParameter("email");
|
||||
String password = request.getParameter("password");
|
||||
String pwd = request.getParameter("pwd");
|
||||
request.setAttribute("id", id);
|
||||
if (!password.equals(pwd)) {
|
||||
request.setAttribute("id", id);
|
||||
request.setAttribute("fname", fname);
|
||||
request.setAttribute("lname", lname);
|
||||
request.setAttribute("gender", gender);
|
||||
request.setAttribute("birthday", birthday);
|
||||
request.setAttribute("email", email);
|
||||
request.setAttribute("pwdMes", true);
|
||||
request.setAttribute("student", db.getStudentDetials(studentId));
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/userEdit.jsp");
|
||||
rd.forward(request, response);
|
||||
return;
|
||||
}
|
||||
if (password != "") {
|
||||
db.updateStudent(id, fname, lname, gender, birthday, pwd);
|
||||
} else {
|
||||
db.updateStudent(id, fname, lname, gender, birthday);
|
||||
}
|
||||
request.setAttribute("saveMes", id);
|
||||
request.setAttribute("studentList", db.getStudent());
|
||||
} else if (studentId != null) {
|
||||
System.out.println("TEST Point6");
|
||||
request.setAttribute("student", db.getStudentDetials(studentId));
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/userEdit.jsp");
|
||||
rd.forward(request, response);
|
||||
}
|
||||
|
||||
} else if (role.equals("Teacher")) {
|
||||
String action = request.getParameter("action");
|
||||
String teacherId = request.getParameter("id");
|
||||
request.setAttribute("teacherList", db.getTeacher());
|
||||
request.setAttribute("searchList", db.getSearchHistory("4", username));
|
||||
if (teacherId != null && action != null && action.equals("delete")) {
|
||||
db.deleteTeacher(teacherId);
|
||||
request.setAttribute("deleteMes", teacherId);
|
||||
request.setAttribute("teacherList", db.getTeacher());
|
||||
request.setAttribute("searchList", db.getSearchHistory("4", username));
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/user.jsp");
|
||||
rd.forward(request, response);
|
||||
} else if (action != null && action.equals("admin")) {
|
||||
db.updateTeacherToAdmin(teacherId);
|
||||
request.setAttribute("updateMes", teacherId);
|
||||
request.setAttribute("searchList", db.getSearchHistory("4", username));
|
||||
request.setAttribute("teacherList", db.getTeacher());
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/user.jsp");
|
||||
rd.forward(request, response);
|
||||
} else if (action != null && action.equals("addPage")) {
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/userAdd.jsp");
|
||||
rd.forward(request, response);
|
||||
} else if (action != null && action.equals("add")) {
|
||||
String fname = request.getParameter("fname");
|
||||
String lname = request.getParameter("lname");
|
||||
String gender = request.getParameter("gender");
|
||||
String birthday = request.getParameter("birthday");
|
||||
String password = request.getParameter("password");
|
||||
String pwd = request.getParameter("pwd");
|
||||
if (db.checkTeacherDupliId(teacherId)) {
|
||||
request.setAttribute("fname", fname);
|
||||
request.setAttribute("lname", lname);
|
||||
request.setAttribute("gender", gender);
|
||||
request.setAttribute("birthday", birthday);
|
||||
request.setAttribute("idMes", true);
|
||||
request.setAttribute("id", teacherId);
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/userAdd.jsp");
|
||||
rd.forward(request, response);
|
||||
return;
|
||||
}
|
||||
if (!password.equals(pwd)) {
|
||||
request.setAttribute("fname", fname);
|
||||
request.setAttribute("lname", lname);
|
||||
request.setAttribute("gender", gender);
|
||||
request.setAttribute("birthday", birthday);
|
||||
request.setAttribute("pwdMes", true);
|
||||
request.setAttribute("id", teacherId);
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/userAdd.jsp");
|
||||
rd.forward(request, response);
|
||||
return;
|
||||
}
|
||||
db.insertTeacher(teacherId, fname, lname, gender, birthday, password);
|
||||
request.setAttribute("addMes", teacherId);
|
||||
request.setAttribute("teacherList", db.getTeacher());
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/user.jsp");
|
||||
rd.forward(request, response);
|
||||
} else if (action != null && action.equals("search")) {
|
||||
String searchVal = request.getParameter("searchVal");
|
||||
request.setAttribute("teacherList", db.searchTeacher(searchVal));
|
||||
db.insertSearchHistory(searchVal, "4", username);
|
||||
request.setAttribute("searchList", db.getSearchHistory("4", username));
|
||||
} else if (action != null && action.equals("save")) {
|
||||
String fname = request.getParameter("fname");
|
||||
String lname = request.getParameter("lname");
|
||||
String gender = request.getParameter("gender");
|
||||
String birthday = request.getParameter("birthday");
|
||||
String password = request.getParameter("password");
|
||||
String pwd = request.getParameter("pwd");
|
||||
|
||||
if (!password.equals(pwd)) {
|
||||
request.setAttribute("fname", fname);
|
||||
request.setAttribute("lname", lname);
|
||||
request.setAttribute("gender", gender);
|
||||
request.setAttribute("birthday", birthday);
|
||||
request.setAttribute("pwdMes", true);
|
||||
request.setAttribute("id", teacherId);
|
||||
request.setAttribute("teacher", db.getTeacherDetials(teacherId));
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/userEdit.jsp");
|
||||
rd.forward(request, response);
|
||||
return;
|
||||
}
|
||||
if (password != "") {
|
||||
db.updateTeacher(teacherId, password, fname, lname, gender, birthday);
|
||||
} else {
|
||||
db.updateTeacher(teacherId, fname, lname, gender, birthday);
|
||||
}
|
||||
request.setAttribute("saveMes", teacherId);
|
||||
request.setAttribute("teacherList", db.getTeacher());
|
||||
} else if (teacherId != null) {
|
||||
System.out.println("TEST Point6");
|
||||
request.setAttribute("teacher", db.getTeacherDetials(teacherId));
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/userEdit.jsp");
|
||||
rd.forward(request, response);
|
||||
}
|
||||
|
||||
} else if (role.equals("Admin")) {
|
||||
|
||||
String action = request.getParameter("action");
|
||||
String adminId = request.getParameter("id");
|
||||
request.setAttribute("adminList", db.getAdmin());
|
||||
request.setAttribute("searchList", db.getSearchHistory("5", username));
|
||||
if (adminId != null && action != null && action.equals("delete")) {
|
||||
db.deleteAdmin(adminId);
|
||||
request.setAttribute("deleteMes", adminId);
|
||||
request.setAttribute("adminList", db.getAdmin());
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/user.jsp");
|
||||
rd.forward(request, response);
|
||||
} else if (action != null && action.equals("addPage")) {
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/userAdd.jsp");
|
||||
rd.forward(request, response);
|
||||
} else if (action != null && action.equals("teacher")) {
|
||||
db.updateAdminToTeacher(adminId);
|
||||
request.setAttribute("updateMes", adminId);
|
||||
request.setAttribute("searchList", db.getSearchHistory("5", username));
|
||||
request.setAttribute("adminList", db.getAdmin());
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/user.jsp");
|
||||
} else if (action != null && action.equals("add")) {
|
||||
String fname = request.getParameter("fname");
|
||||
String lname = request.getParameter("lname");
|
||||
String gender = request.getParameter("gender");
|
||||
String birthday = request.getParameter("birthday");
|
||||
String password = request.getParameter("password");
|
||||
String pwd = request.getParameter("pwd");
|
||||
if (db.checkAdminDupliId(adminId)) {
|
||||
request.setAttribute("fname", fname);
|
||||
request.setAttribute("lname", lname);
|
||||
request.setAttribute("gender", gender);
|
||||
request.setAttribute("birthday", birthday);
|
||||
request.setAttribute("idMes", true);
|
||||
request.setAttribute("id", adminId);
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/userAdd.jsp");
|
||||
rd.forward(request, response);
|
||||
return;
|
||||
}
|
||||
if (!password.equals(pwd)) {
|
||||
request.setAttribute("fname", fname);
|
||||
request.setAttribute("lname", lname);
|
||||
request.setAttribute("gender", gender);
|
||||
request.setAttribute("birthday", birthday);
|
||||
request.setAttribute("pwdMes", true);
|
||||
request.setAttribute("id", adminId);
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/userAdd.jsp");
|
||||
rd.forward(request, response);
|
||||
return;
|
||||
}
|
||||
db.insertAdmin(adminId, fname, lname, gender, birthday, password);
|
||||
request.setAttribute("addMes", adminId);
|
||||
request.setAttribute("adminList", db.getAdmin());
|
||||
|
||||
} else if (action != null && action.equals("search")) {
|
||||
String searchVal = request.getParameter("searchVal");
|
||||
request.setAttribute("adminList", db.searchAdmin(searchVal));
|
||||
db.insertSearchHistory(searchVal, "5", username);
|
||||
request.setAttribute("searchList", db.getSearchHistory("5", username));
|
||||
} else if (action != null && action.equals("save")) {
|
||||
String fname = request.getParameter("fname");
|
||||
String lname = request.getParameter("lname");
|
||||
String gender = request.getParameter("gender");
|
||||
String birthday = request.getParameter("birthday");
|
||||
String password = request.getParameter("password");
|
||||
String pwd = request.getParameter("pwd");
|
||||
|
||||
if (!password.equals(pwd)) {
|
||||
request.setAttribute("fname", fname);
|
||||
request.setAttribute("lname", lname);
|
||||
request.setAttribute("gender", gender);
|
||||
request.setAttribute("birthday", birthday);
|
||||
request.setAttribute("pwdMes", true);
|
||||
request.setAttribute("id", adminId);
|
||||
request.setAttribute("admin", db.getAdminDetials(adminId));
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/userEdit.jsp");
|
||||
rd.forward(request, response);
|
||||
return;
|
||||
}
|
||||
if (password != "") {
|
||||
db.updateAdmin(adminId, password, fname, lname, gender, birthday);
|
||||
} else {
|
||||
db.updateAdmin(adminId, fname, lname, gender, birthday);
|
||||
}
|
||||
request.setAttribute("saveMes", adminId);
|
||||
request.setAttribute("adminList", db.getAdmin());
|
||||
|
||||
} else if (adminId != null) {
|
||||
System.out.println("TEST Point6");
|
||||
request.setAttribute("admin", db.getAdminDetials(adminId));
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/userEdit.jsp");
|
||||
rd.forward(request, response);
|
||||
}
|
||||
}
|
||||
System.out.println("TEST Point10");
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/admin/user.jsp");
|
||||
rd.forward(request, response);
|
||||
} catch (Exception e) {
|
||||
response.sendRedirect("../index");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
|
||||
/**
|
||||
* Handles the HTTP <code>GET</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the HTTP <code>POST</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a short description of the servlet.
|
||||
*
|
||||
* @return a String containing servlet description
|
||||
*/
|
||||
@Override
|
||||
public String getServletInfo() {
|
||||
return "Short description";
|
||||
}// </editor-fold>
|
||||
|
||||
}
|
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JerryKwok
|
||||
*/
|
||||
@WebServlet(name = "ErrorController", urlPatterns = {"/error"})
|
||||
public class ErrorController extends HttpServlet {
|
||||
|
||||
/**
|
||||
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
|
||||
* methods.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
RequestDispatcher rd = this.getServletContext()
|
||||
.getRequestDispatcher("/404error.jsp");
|
||||
rd.forward(request, response);
|
||||
}
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
|
||||
/**
|
||||
* Handles the HTTP <code>GET</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the HTTP <code>POST</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a short description of the servlet.
|
||||
*
|
||||
* @return a String containing servlet description
|
||||
*/
|
||||
@Override
|
||||
public String getServletInfo() {
|
||||
return "Short description";
|
||||
}// </editor-fold>
|
||||
|
||||
}
|
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JerryKwok
|
||||
*/
|
||||
@WebServlet(name = "ErrorHandler", urlPatterns = {"/ErrorHandler"})
|
||||
public class ErrorHandler extends HttpServlet {
|
||||
|
||||
/**
|
||||
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
|
||||
* methods.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
response.setContentType("text/html;charset=UTF-8");
|
||||
try (PrintWriter out = response.getWriter()) {
|
||||
/* TODO output your page here. You may use following sample code. */
|
||||
out.println("<!DOCTYPE html>");
|
||||
out.println("<html>");
|
||||
out.println("<head>");
|
||||
out.println("<title>Servlet ErrorHandler</title>");
|
||||
out.println("</head>");
|
||||
out.println("<body>");
|
||||
out.println("<h1>Servlet ErrorHandler at " + request.getContextPath() + "</h1>");
|
||||
out.println("</body>");
|
||||
out.println("</html>");
|
||||
}
|
||||
}
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
|
||||
/**
|
||||
* Handles the HTTP <code>GET</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the HTTP <code>POST</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
private void processError(HttpServletRequest request,
|
||||
HttpServletResponse response) throws IOException {
|
||||
// Analyze the servlet exception
|
||||
Throwable throwable = (Throwable) request
|
||||
.getAttribute("javax.servlet.error.exception");
|
||||
Integer statusCode = (Integer) request
|
||||
.getAttribute("javax.servlet.error.status_code");
|
||||
String servletName = (String) request
|
||||
.getAttribute("javax.servlet.error.servlet_name");
|
||||
if (servletName == null) {
|
||||
servletName = "Unknown";
|
||||
}
|
||||
String requestUri = (String) request
|
||||
.getAttribute("javax.servlet.error.request_uri");
|
||||
if (requestUri == null) {
|
||||
requestUri = "Unknown";
|
||||
}
|
||||
|
||||
// Set response content type
|
||||
response.setContentType("text/html");
|
||||
|
||||
PrintWriter out = response.getWriter();
|
||||
out.write("<html><head><title>Exception/Error Details</title></head><body>");
|
||||
if(statusCode != 500){
|
||||
out.write("<h3>Error Details</h3>");
|
||||
out.write("<strong>Status Code</strong>:"+statusCode+"<br>");
|
||||
out.write("<strong>Requested URI</strong>:"+requestUri);
|
||||
}else{
|
||||
out.write("<h3>Exception Details</h3>");
|
||||
out.write("<ul><li>Servlet Name:"+servletName+"</li>");
|
||||
out.write("<li>Exception Name:"+throwable.getClass().getName()+"</li>");
|
||||
out.write("<li>Requested URI:"+requestUri+"</li>");
|
||||
out.write("<li>Exception Message:"+throwable.getMessage()+"</li>");
|
||||
out.write("</ul>");
|
||||
}
|
||||
|
||||
out.write("<br><br>");
|
||||
out.write(" <button onclick=\"history.back()\" class=\"btn btn-primary btn-lg\">\n" +
|
||||
" <span class=\"glyphicon glyphicon-home\"></span>\n" +
|
||||
" Back to Home\n" +
|
||||
" </button>");
|
||||
out.write("</body></html>");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a short description of the servlet.
|
||||
*
|
||||
* @return a String containing servlet description
|
||||
*/
|
||||
@Override
|
||||
public String getServletInfo() {
|
||||
return "Short description";
|
||||
}// </editor-fold>
|
||||
|
||||
}
|
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JerryKwok
|
||||
*/
|
||||
@WebServlet(name = "IndexController", urlPatterns = {"/index, /"})
|
||||
public class IndexController extends HttpServlet {
|
||||
|
||||
/**
|
||||
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
|
||||
* methods.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
RequestDispatcher rd = null;
|
||||
try {
|
||||
HttpSession session = request.getSession(false);
|
||||
if (session.getAttribute("username") == null || session.getAttribute("userrole") == null) {
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/index.jsp");
|
||||
rd.forward(request, response);
|
||||
} else {
|
||||
if (session.getAttribute("userrole").equals("Admin")) {
|
||||
response.sendRedirect("admin/dashboard");
|
||||
} else if (session.getAttribute("userrole").equals("Teacher")) {
|
||||
response.sendRedirect("teacher/dashboard");
|
||||
} else {
|
||||
response.sendRedirect("dashboard");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
rd = this.getServletContext()
|
||||
.getRequestDispatcher("/index.jsp");
|
||||
rd.forward(request, response);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
|
||||
/**
|
||||
* Handles the HTTP <code>GET</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the HTTP <code>POST</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a short description of the servlet.
|
||||
*
|
||||
* @return a String containing servlet description
|
||||
*/
|
||||
@Override
|
||||
public String getServletInfo() {
|
||||
return "Short description";
|
||||
}// </editor-fold>
|
||||
|
||||
}
|
@@ -0,0 +1,175 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.sql.SQLException;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import system.bean.LoginBean;
|
||||
import system.db.LoginValid;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jerrykwok
|
||||
*/
|
||||
@WebServlet(name = "LoginController", urlPatterns = {"/login"})
|
||||
public class LoginController extends HttpServlet {
|
||||
|
||||
private LoginValid db;
|
||||
|
||||
public void init() {
|
||||
String dbUser = this.getServletContext().getInitParameter("dbUser");
|
||||
String dbPassword = this.getServletContext().getInitParameter("dbPassword");
|
||||
String dbUrl = this.getServletContext().getInitParameter("dbUrl");
|
||||
db = new LoginValid(dbUrl, dbUser, dbPassword);
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
|
||||
* methods.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
response.setContentType("text/html;charset=UTF-8");
|
||||
|
||||
}
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
|
||||
/**
|
||||
* Handles the HTTP <code>GET</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
doPost(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the HTTP <code>POST</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
|
||||
String action = request.getParameter("action");
|
||||
if (action == null) {
|
||||
RequestDispatcher rd = this.getServletContext()
|
||||
.getRequestDispatcher("/login.jsp");
|
||||
rd.forward(request, response);
|
||||
} else if ("authenticate".equals(action)) {
|
||||
try {
|
||||
doAuthenticate(request, response);
|
||||
} catch (SQLException ex) {
|
||||
ex.printStackTrace();
|
||||
ex = ex.getNextException();
|
||||
}
|
||||
} else if ("logout".equals(action)) {
|
||||
doLogout(request, response);
|
||||
} else {
|
||||
response.sendError(HttpServletResponse.SC_NOT_IMPLEMENTED);
|
||||
}
|
||||
}
|
||||
|
||||
private void doAuthenticate(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException, SQLException {
|
||||
String action = request.getParameter("action");
|
||||
String username = request.getParameter("username");
|
||||
String pwd = request.getParameter("pwd");
|
||||
String role = request.getParameter("role");
|
||||
RequestDispatcher rd = null;
|
||||
// System.out.println(action + username + pwd + role);
|
||||
if (!role.equalsIgnoreCase("Teacher") && !role.equalsIgnoreCase("Student") && !role.equalsIgnoreCase("Admin")) {
|
||||
request.setAttribute("roleMes", true);
|
||||
rd = this.getServletContext().getRequestDispatcher("/index.jsp");
|
||||
rd.forward(request, response);
|
||||
}
|
||||
LoginBean loginBean = new LoginBean();
|
||||
loginBean.setUsername(username);
|
||||
loginBean.setPassword(pwd);
|
||||
loginBean.setRole(role);
|
||||
boolean loginSucecss = false;
|
||||
if (role.equalsIgnoreCase("Teacher")) {
|
||||
loginSucecss = db.validateStaffLogin(loginBean, 1);
|
||||
} else if (role.equalsIgnoreCase("Admin")) {
|
||||
loginSucecss = db.validateStaffLogin(loginBean, 2);
|
||||
} else if (role.equalsIgnoreCase("Student")) {
|
||||
loginSucecss = db.validateStudentLogin(loginBean);
|
||||
}
|
||||
if (!loginSucecss) {
|
||||
request.setAttribute("loginMes", username);
|
||||
request.setAttribute("role", role);
|
||||
rd = this.getServletContext().getRequestDispatcher("/login.jsp");
|
||||
rd.forward(request, response);
|
||||
}
|
||||
String targetURL = null;
|
||||
HttpSession session = request.getSession();
|
||||
session.setAttribute("username", username);
|
||||
session.setAttribute("userrole", loginBean.getRole());
|
||||
switch (role) {
|
||||
case "Student":
|
||||
targetURL = "student/dashboard";//
|
||||
break;
|
||||
case "Teacher":
|
||||
targetURL = "teacher/dashboard";
|
||||
break;
|
||||
case "Admin":
|
||||
targetURL = "admin/dashboard";
|
||||
break;
|
||||
}
|
||||
response.sendRedirect(targetURL);
|
||||
}
|
||||
|
||||
private boolean isAuthenticated(HttpServletRequest request) {
|
||||
boolean result = false;
|
||||
HttpSession session = request.getSession();
|
||||
if (session.getAttribute("username") != null) {
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void doLogout(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
HttpSession session = request.getSession(false);
|
||||
if (session != null) {
|
||||
session.removeAttribute("username");
|
||||
session.invalidate();
|
||||
}
|
||||
response.sendRedirect("index");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a short description of the servlet.
|
||||
*
|
||||
* @return a String containing servlet description
|
||||
*/
|
||||
@Override
|
||||
public String getServletInfo() {
|
||||
return "Short description";
|
||||
}// </editor-fold>
|
||||
}
|
@@ -0,0 +1,326 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import system.bean.AttendBean;
|
||||
import system.bean.SchedulerBean;
|
||||
import system.bean.SemesterBean;
|
||||
import system.bean.StudentBean;
|
||||
import system.db.StudentDB;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JerryKwok
|
||||
*/
|
||||
@WebServlet(name = "StudentAttendController", urlPatterns = {"/student/attendance"})
|
||||
public class StudentAttendController extends HttpServlet {
|
||||
|
||||
private StudentDB db;
|
||||
|
||||
public void init() {
|
||||
String dbUser = this.getServletContext().getInitParameter("dbUser");
|
||||
String dbPassword = this.getServletContext().getInitParameter("dbPassword");
|
||||
String dbUrl = this.getServletContext().getInitParameter("dbUrl");
|
||||
db = new StudentDB(dbUrl, dbUser, dbPassword);
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
|
||||
* methods.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
HttpSession session = request.getSession(false);
|
||||
try {
|
||||
if (session.getAttribute("username") == null) {
|
||||
response.sendRedirect("../index");
|
||||
return;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
response.sendRedirect("../index");
|
||||
return;
|
||||
}
|
||||
|
||||
RequestDispatcher rd;
|
||||
String studentId = (String) session.getAttribute("username");
|
||||
|
||||
String className = db.getStudentClass(studentId);
|
||||
String strTerm = db.getMaxTerm();
|
||||
|
||||
// String reportType = request.getParameter("report");
|
||||
if (className != null) {
|
||||
String year = request.getParameter("year");
|
||||
ArrayList<String> errList = new ArrayList<String>();
|
||||
if (strTerm == null) {
|
||||
strTerm = "1";
|
||||
};
|
||||
if (year == null) {
|
||||
year = Calendar.getInstance().get(Calendar.YEAR) + "";
|
||||
}
|
||||
|
||||
try {
|
||||
int term = Integer.parseInt(strTerm);
|
||||
SemesterBean semBean = db.getSemsterDate(year, term);
|
||||
int totalSchoolDay = semBean.getCountBusineseDate();
|
||||
int countHoliday = 0;
|
||||
for (SchedulerBean scheduler : db.getSchCalenderholiday()) {
|
||||
if (scheduler.isHoliday() && scheduler.getCountDate() == 0) {
|
||||
switch (scheduler.getStart_day_week()) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
countHoliday++;
|
||||
}
|
||||
} else if (scheduler.isHoliday() && scheduler.getCountDate() > 0) {
|
||||
countHoliday += scheduler.getCountBusineseDay() + 1;
|
||||
//countHoliday += scheduler.getCountDate();
|
||||
}
|
||||
}
|
||||
totalSchoolDay = totalSchoolDay - countHoliday;
|
||||
System.out.println(totalSchoolDay);
|
||||
ArrayList<StudentBean> studentList = db.getStudentAttend(semBean.getStart_date(), semBean.getEnd_date(), className);
|
||||
int allStudentCountDay = 0;
|
||||
int numberOfStudent = 0;
|
||||
int numberOfStudentNotMeetTar = 0;
|
||||
int numberOfStudentMeetTar = 0;
|
||||
int numberOfStudentWarning = 0;
|
||||
int numberOfStudentDanger = 0;
|
||||
int numberOfStudentLowAtt = 0;
|
||||
double avgStudentAttendDay = 0;
|
||||
StudentBean studentBean = null;
|
||||
for (StudentBean student : studentList) {
|
||||
int countDay = student.getAttendDay();
|
||||
allStudentCountDay += countDay;
|
||||
double attendRate = Math.round((countDay / (float) totalSchoolDay) * 100);
|
||||
student.setAttendRate(attendRate);
|
||||
numberOfStudent++;
|
||||
if (attendRate >= db.getAttendanceRateTarget(className)) {
|
||||
numberOfStudentMeetTar++;
|
||||
} else {
|
||||
numberOfStudentNotMeetTar++;
|
||||
}
|
||||
System.out.println(student.getId());
|
||||
if (studentId != null && student.getId().equals(studentId)) {
|
||||
studentBean = student;
|
||||
}
|
||||
}
|
||||
// ArrayList<StudentBean> lowAttendList = null;
|
||||
/* if (reportType != null && reportType.equals("low")) {
|
||||
lowAttendList = new ArrayList<StudentBean>();
|
||||
double avgLowAttend = 0;
|
||||
for (StudentBean student : studentList) {
|
||||
if (student.getAttendRate() <= db.getAttendanceRateTarget(className)) {
|
||||
lowAttendList.add(student);
|
||||
}
|
||||
if (student.getAttendRate() >= 50.0 && student.getAttendRate() < 60.0) {
|
||||
numberOfStudentWarning++;
|
||||
avgLowAttend += student.getAttendRate();
|
||||
} else if (student.getAttendRate() <= 49.0 && student.getAttendRate() >= 40.0) {
|
||||
numberOfStudentDanger++;
|
||||
avgLowAttend += student.getAttendRate();
|
||||
} else if (student.getAttendRate() >= db.getAttendanceRateTarget(className)) {
|
||||
|
||||
} else {
|
||||
numberOfStudentLowAtt++;
|
||||
avgLowAttend += student.getAttendRate();
|
||||
}
|
||||
}
|
||||
avgLowAttend = avgLowAttend / (numberOfStudentWarning + numberOfStudentDanger + numberOfStudentLowAtt);
|
||||
request.setAttribute("attendAVG", avgLowAttend);
|
||||
}*/
|
||||
|
||||
/* if (studentList.size() == 0 || reportType != null && reportType.equals("low") && lowAttendList.size() == 0) {
|
||||
request.setAttribute("studentAttendList", db.getAllStudentAttendZero(className));
|
||||
} else {
|
||||
if (reportType != null && reportType.equals("low")) {
|
||||
request.setAttribute("studentAttendList", lowAttendList);
|
||||
} else {
|
||||
request.setAttribute("studentAttendList", studentList);
|
||||
}
|
||||
}*/
|
||||
if (studentId != null) {
|
||||
studentBean.setAttendList(db.getStudentAttendDetail(studentId, year, term));
|
||||
request.setAttribute("studentDetials", studentBean);
|
||||
int totalAttendDay = 0;
|
||||
int presentDay = 0;
|
||||
int absDay = 0;
|
||||
for (AttendBean attend : studentBean.getAttendList()) {
|
||||
if (attend.isAttend()) {
|
||||
presentDay++;
|
||||
} else {
|
||||
absDay++;
|
||||
}
|
||||
totalAttendDay++;
|
||||
}
|
||||
request.setAttribute("presentDay", presentDay);
|
||||
request.setAttribute("absDay", absDay);
|
||||
request.setAttribute("totalAttendDay", totalAttendDay);
|
||||
}
|
||||
try {
|
||||
avgStudentAttendDay = (allStudentCountDay / numberOfStudent);
|
||||
} catch (ArithmeticException e) {
|
||||
avgStudentAttendDay = 0;
|
||||
}
|
||||
int attendAVG = 0;
|
||||
if(avgStudentAttendDay>0){
|
||||
attendAVG = (int) Math.round((1-(totalSchoolDay - avgStudentAttendDay) / totalSchoolDay) * 100);
|
||||
}
|
||||
|
||||
|
||||
|
||||
request.setAttribute("numberOfStudentMeetTar", numberOfStudentMeetTar);
|
||||
request.setAttribute("numberOfStudentNotMeetTar", numberOfStudentNotMeetTar);
|
||||
request.setAttribute("attendAVG", attendAVG);
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
errList.add("The term must be Integer");
|
||||
}
|
||||
|
||||
request.setAttribute("errMessage", errList);
|
||||
request.setAttribute("yearList", db.getLatestReportYear());
|
||||
request.setAttribute("termList", db.getSemsterTerm(year));
|
||||
}
|
||||
|
||||
rd = this.getServletContext().getRequestDispatcher("/student/attendanceStudent.jsp");
|
||||
rd.forward(request, response);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*String StudentId = (String) session.getAttribute("username");
|
||||
String className = request.getParameter("class");
|
||||
String attendDate = request.getParameter("date");
|
||||
String action = request.getParameter("action");
|
||||
RequestDispatcher rd = null;
|
||||
db.setStudentId(StudentId);
|
||||
if (className == null) {
|
||||
request.setAttribute("classList", db.getAllClass());
|
||||
rd = this.getServletContext().getRequestDispatcher("/student/attendance.jsp");
|
||||
rd.forward(request, response);
|
||||
return;
|
||||
}
|
||||
/*
|
||||
if (action != null && action.equals("save")) {
|
||||
|
||||
if (className != null && attendDate != null) {
|
||||
ArrayList<StudentBean> studentList = db.getAllStudentClass(className);
|
||||
String[] attendStudents = request.getParameterValues("attend");
|
||||
if (attendStudents != null) {
|
||||
for (String studentId : attendStudents) {
|
||||
db.insertStudentAttendance(studentId, attendDate, true);
|
||||
for (StudentBean student : studentList) {
|
||||
if (student.getId().equals(studentId)) {
|
||||
studentList.remove(student);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (StudentBean student : studentList) {
|
||||
db.insertStudentAttendance(student.getId(), attendDate, false);
|
||||
}
|
||||
}
|
||||
request.setAttribute("message", true);
|
||||
}*/
|
||||
/* if (attendDate == null) {
|
||||
attendDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
|
||||
}
|
||||
request.setAttribute("date", attendDate);
|
||||
request.setAttribute("studentAttendList", db.getAttendClass(className, attendDate));
|
||||
request.setAttribute("classList", db.getAllClass());
|
||||
rd = this.getServletContext().getRequestDispatcher("/student/attendanceStudent.jsp");
|
||||
rd.forward(request, response);*/
|
||||
|
||||
}
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
|
||||
/**
|
||||
* Handles the HTTP <code>GET</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the HTTP <code>POST</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a short description of the servlet.
|
||||
*
|
||||
* @return a String containing servlet description
|
||||
*/
|
||||
@Override
|
||||
public String getServletInfo() {
|
||||
return "Short description";
|
||||
}// </editor-fold>
|
||||
|
||||
}
|
@@ -0,0 +1,68 @@
|
||||
|
||||
package system.servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import system.db.StudentDB;
|
||||
|
||||
|
||||
@WebServlet(name = "StudentDashboardController", urlPatterns = {"/student/dashboard"})
|
||||
public class StudentDashboardController extends HttpServlet {
|
||||
|
||||
private StudentDB db;
|
||||
|
||||
public void init() {
|
||||
String dbUser = this.getServletContext().getInitParameter("dbUser");
|
||||
String dbPassword = this.getServletContext().getInitParameter("dbPassword");
|
||||
String dbUrl = this.getServletContext().getInitParameter("dbUrl");
|
||||
db = new StudentDB(dbUrl, dbUser, dbPassword);
|
||||
}
|
||||
|
||||
|
||||
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
try {
|
||||
HttpSession session = request.getSession(false);
|
||||
if (session.getAttribute("username") == null) {
|
||||
response.sendRedirect("../index");
|
||||
return;
|
||||
}
|
||||
String studentId = (String) session.getAttribute("username");
|
||||
db.setStudentId(studentId);
|
||||
request.setAttribute("courseCount", db.getCountClass());
|
||||
request.setAttribute("studentCount", db.getCountStudent());
|
||||
request.setAttribute("lectureList", db.getLecture(studentId));
|
||||
request.setAttribute("timeList", db.getAllTimeLecture());
|
||||
request.setAttribute("dayList", db.getAllDayLecture());
|
||||
RequestDispatcher rd = this.getServletContext()
|
||||
.getRequestDispatcher("/student/dashboard.jsp");
|
||||
rd.forward(request, response);
|
||||
} catch (NullPointerException e) {
|
||||
response.sendRedirect("../index");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
public String getServletInfo() {
|
||||
return "Short description";
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import system.bean.StudentBean;
|
||||
import system.db.TeacherDB;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JerryKwok
|
||||
*/
|
||||
@WebServlet(name = "TeacherAttendController", urlPatterns = {"/teacher/attendance"})
|
||||
public class TeacherAttendController extends HttpServlet {
|
||||
|
||||
private TeacherDB db;
|
||||
|
||||
public void init() {
|
||||
String dbUser = this.getServletContext().getInitParameter("dbUser");
|
||||
String dbPassword = this.getServletContext().getInitParameter("dbPassword");
|
||||
String dbUrl = this.getServletContext().getInitParameter("dbUrl");
|
||||
db = new TeacherDB(dbUrl, dbUser, dbPassword);
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
|
||||
* methods.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
HttpSession session = request.getSession(false);
|
||||
try {
|
||||
if (session.getAttribute("username") == null) {
|
||||
response.sendRedirect("../index");
|
||||
return;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
response.sendRedirect("../index");
|
||||
return;
|
||||
}
|
||||
String teacherId = (String) session.getAttribute("username");
|
||||
String className = request.getParameter("class");
|
||||
String attendDate = request.getParameter("date");
|
||||
String action = request.getParameter("action");
|
||||
RequestDispatcher rd = null;
|
||||
db.setTeacherId(teacherId);
|
||||
if (className == null) {
|
||||
request.setAttribute("classList", db.getAllClass());
|
||||
rd = this.getServletContext().getRequestDispatcher("/teacher/attendance.jsp");
|
||||
rd.forward(request, response);
|
||||
return;
|
||||
}
|
||||
|
||||
if (action != null && action.equals("save")) {
|
||||
|
||||
if (className != null && attendDate != null) {
|
||||
ArrayList<StudentBean> studentList = db.getAllStudentClass(className);
|
||||
String[] attendStudents = request.getParameterValues("attend");
|
||||
if (attendStudents != null) {
|
||||
for (String studentId : attendStudents) {
|
||||
db.insertStudentAttendance(studentId, attendDate, true);
|
||||
for (StudentBean student : studentList) {
|
||||
if (student.getId().equals(studentId)) {
|
||||
studentList.remove(student);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (StudentBean student : studentList) {
|
||||
db.insertStudentAttendance(student.getId(), attendDate, false);
|
||||
}
|
||||
}
|
||||
request.setAttribute("message", true);
|
||||
}
|
||||
if (attendDate == null) {
|
||||
attendDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
|
||||
}
|
||||
request.setAttribute("date", attendDate);
|
||||
request.setAttribute("studentAttendList", db.getAttendClass(className, attendDate));
|
||||
request.setAttribute("classList", db.getAllClass());
|
||||
rd = this.getServletContext().getRequestDispatcher("/teacher/attendanceStudent.jsp");
|
||||
rd.forward(request, response);
|
||||
|
||||
}
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
|
||||
/**
|
||||
* Handles the HTTP <code>GET</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the HTTP <code>POST</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a short description of the servlet.
|
||||
*
|
||||
* @return a String containing servlet description
|
||||
*/
|
||||
@Override
|
||||
public String getServletInfo() {
|
||||
return "Short description";
|
||||
}// </editor-fold>
|
||||
|
||||
}
|
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import system.db.TeacherDB;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JerryKwok
|
||||
*/
|
||||
@WebServlet(name = "TeacherDashbaordController", urlPatterns = {"/teacher/dashboard"})
|
||||
public class TeacherDashbaordController extends HttpServlet {
|
||||
|
||||
private TeacherDB db;
|
||||
|
||||
public void init() {
|
||||
String dbUser = this.getServletContext().getInitParameter("dbUser");
|
||||
String dbPassword = this.getServletContext().getInitParameter("dbPassword");
|
||||
String dbUrl = this.getServletContext().getInitParameter("dbUrl");
|
||||
db = new TeacherDB(dbUrl, dbUser, dbPassword);
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
|
||||
* methods.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
try {
|
||||
HttpSession session = request.getSession(false);
|
||||
if (session.getAttribute("username") == null) {
|
||||
response.sendRedirect("../index");
|
||||
return;
|
||||
}
|
||||
String teacherId = (String) session.getAttribute("username");
|
||||
db.setTeacherId(teacherId);
|
||||
request.setAttribute("courseCount", db.getCountClass());
|
||||
request.setAttribute("studentCount", db.getCountStudent());
|
||||
request.setAttribute("lectureList", db.getAllLecture(teacherId));
|
||||
request.setAttribute("timeList", db.getAllTimeLecture());
|
||||
request.setAttribute("dayList", db.getAllDayLecture());
|
||||
RequestDispatcher rd = this.getServletContext()
|
||||
.getRequestDispatcher("/teacher/dashboard.jsp");
|
||||
rd.forward(request, response);
|
||||
} catch (NullPointerException e) {
|
||||
response.sendRedirect("../index");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
|
||||
/**
|
||||
* Handles the HTTP <code>GET</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the HTTP <code>POST</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a short description of the servlet.
|
||||
*
|
||||
* @return a String containing servlet description
|
||||
*/
|
||||
@Override
|
||||
public String getServletInfo() {
|
||||
return "Short description";
|
||||
}// </editor-fold>
|
||||
|
||||
}
|
@@ -0,0 +1,258 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.sql.Date;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import system.bean.AttendBean;
|
||||
import system.bean.SchedulerBean;
|
||||
import system.bean.SemesterBean;
|
||||
import system.bean.StudentBean;
|
||||
import system.db.TeacherDB;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JerryKwok
|
||||
*/
|
||||
@WebServlet(name = "TeacherReportController", urlPatterns = {"/teacher/report"})
|
||||
public class TeacherReportController extends HttpServlet {
|
||||
|
||||
private TeacherDB db;
|
||||
|
||||
public void init() {
|
||||
String dbUser = this.getServletContext().getInitParameter("dbUser");
|
||||
String dbPassword = this.getServletContext().getInitParameter("dbPassword");
|
||||
String dbUrl = this.getServletContext().getInitParameter("dbUrl");
|
||||
db = new TeacherDB(dbUrl, dbUser, dbPassword);
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
|
||||
* methods.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
try {
|
||||
HttpSession session = request.getSession(false);
|
||||
if (session.getAttribute("username") == null) {
|
||||
response.sendRedirect("../index.jsp");
|
||||
return;
|
||||
}
|
||||
|
||||
RequestDispatcher rd;
|
||||
String className = request.getParameter("class");
|
||||
String strTerm = request.getParameter("term");
|
||||
String studentId = request.getParameter("studentId");
|
||||
request.setAttribute("classList", db.getAllClass());
|
||||
String reportType = request.getParameter("report");
|
||||
if (className != null) {
|
||||
String year = request.getParameter("year");
|
||||
ArrayList<String> errList = new ArrayList<String>();
|
||||
if (strTerm == null) {
|
||||
strTerm = "1";
|
||||
};
|
||||
if (year == null) {
|
||||
year = Calendar.getInstance().get(Calendar.YEAR) + "";
|
||||
}
|
||||
|
||||
try {
|
||||
int term = Integer.parseInt(strTerm);
|
||||
SemesterBean semBean = db.getSemsterDate(year, term);
|
||||
int totalSchoolDay = semBean.getCountBusineseDate();
|
||||
int countHoliday = 0;
|
||||
for (SchedulerBean scheduler : db.getSchCalenderholiday()) {
|
||||
if (scheduler.isHoliday() && scheduler.getCountDate() == 0) {
|
||||
switch (scheduler.getStart_day_week()) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
countHoliday++;
|
||||
}
|
||||
} else if (scheduler.isHoliday() && scheduler.getCountDate() > 0) {
|
||||
countHoliday += scheduler.getCountBusineseDay() + 1;
|
||||
//countHoliday += scheduler.getCountDate();
|
||||
}
|
||||
}
|
||||
totalSchoolDay = totalSchoolDay - countHoliday;
|
||||
System.out.println(totalSchoolDay);
|
||||
ArrayList<StudentBean> studentList = db.getStudentAttend(semBean.getStart_date(), semBean.getEnd_date(), className);
|
||||
int allStudentCountDay = 0;
|
||||
int numberOfStudent = 0;
|
||||
int numberOfStudentNotMeetTar = 0;
|
||||
int numberOfStudentMeetTar = 0;
|
||||
int numberOfStudentWarning = 0;
|
||||
int numberOfStudentDanger = 0;
|
||||
int numberOfStudentLowAtt = 0;
|
||||
double avgStudentAttendDay = 0;
|
||||
StudentBean studentBean = null;
|
||||
|
||||
for (StudentBean student : studentList) {
|
||||
int countDay = student.getAttendDay();
|
||||
allStudentCountDay += countDay;
|
||||
double attendRate = Math.round((countDay / (float) totalSchoolDay) * 100);
|
||||
student.setAttendRate(attendRate);
|
||||
numberOfStudent++;
|
||||
if (attendRate >= db.getAttendanceRateTarget(className)) {
|
||||
numberOfStudentMeetTar++;
|
||||
} else {
|
||||
numberOfStudentNotMeetTar++;
|
||||
}
|
||||
System.out.println(student.getId());
|
||||
if (studentId != null && student.getId().equals(studentId)) {
|
||||
studentBean = student;
|
||||
}
|
||||
}
|
||||
ArrayList<StudentBean> lowAttendList = null;
|
||||
if (reportType != null && reportType.equals("low")) {
|
||||
lowAttendList = new ArrayList<StudentBean>();
|
||||
double avgLowAttend = 0;
|
||||
for (StudentBean student : studentList) {
|
||||
if (student.getAttendRate() <= db.getAttendanceRateTarget(className)) {
|
||||
lowAttendList.add(student);
|
||||
}
|
||||
if (student.getAttendRate() >= 50.0 && student.getAttendRate() < 60.0) {
|
||||
numberOfStudentWarning++;
|
||||
avgLowAttend += student.getAttendRate();
|
||||
} else if (student.getAttendRate() <= 49.0 && student.getAttendRate() >= 40.0) {
|
||||
numberOfStudentDanger++;
|
||||
avgLowAttend += student.getAttendRate();
|
||||
} else if (student.getAttendRate() >= db.getAttendanceRateTarget(className)) {
|
||||
|
||||
} else {
|
||||
numberOfStudentLowAtt++;
|
||||
avgLowAttend += student.getAttendRate();
|
||||
}
|
||||
}
|
||||
avgLowAttend = avgLowAttend / (numberOfStudentWarning + numberOfStudentDanger + numberOfStudentLowAtt);
|
||||
request.setAttribute("attendAVG", avgLowAttend);
|
||||
}
|
||||
|
||||
if (studentList.size() == 0 || reportType != null && reportType.equals("low") && lowAttendList.size() == 0) {
|
||||
request.setAttribute("studentAttendList", db.getAllStudentAttendZero(className));
|
||||
} else {
|
||||
if (reportType != null && reportType.equals("low")) {
|
||||
request.setAttribute("studentAttendList", lowAttendList);
|
||||
} else {
|
||||
request.setAttribute("studentAttendList", studentList);
|
||||
}
|
||||
}
|
||||
if (studentId != null) {
|
||||
studentBean.setAttendList(db.getStudentAttendDetail(studentId, year, term));
|
||||
request.setAttribute("studentDetials", studentBean);
|
||||
int totalAttendDay = 0;
|
||||
int presentDay = 0;
|
||||
int absDay = 0;
|
||||
for (AttendBean attend : studentBean.getAttendList()) {
|
||||
if (attend.isAttend()) {
|
||||
presentDay++;
|
||||
} else {
|
||||
absDay++;
|
||||
}
|
||||
totalAttendDay++;
|
||||
}
|
||||
request.setAttribute("presentDay", presentDay);
|
||||
request.setAttribute("absDay", absDay);
|
||||
request.setAttribute("totalAttendDay", totalAttendDay);
|
||||
}
|
||||
try {
|
||||
avgStudentAttendDay = (allStudentCountDay / numberOfStudent);
|
||||
} catch (ArithmeticException e) {
|
||||
avgStudentAttendDay = 0;
|
||||
}
|
||||
int attendAVG = 0;
|
||||
if (avgStudentAttendDay > 0) {
|
||||
attendAVG = (int) Math.round((1 - (totalSchoolDay - avgStudentAttendDay) / totalSchoolDay) * 100);
|
||||
}
|
||||
|
||||
if (reportType != null && reportType.equals("low")) {
|
||||
request.setAttribute("numberOfStudentWarning", numberOfStudentWarning);
|
||||
request.setAttribute("numberOfStudentDanger", numberOfStudentDanger);
|
||||
request.setAttribute("numberOfStudentLowAtt", numberOfStudentLowAtt);
|
||||
} else {
|
||||
request.setAttribute("numberOfStudentMeetTar", numberOfStudentMeetTar);
|
||||
request.setAttribute("numberOfStudentNotMeetTar", numberOfStudentNotMeetTar);
|
||||
request.setAttribute("attendAVG", attendAVG);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
errList.add("The term must be Integer");
|
||||
}
|
||||
|
||||
request.setAttribute("errMessage", errList);
|
||||
request.setAttribute("yearList", db.getLatestReportYear());
|
||||
request.setAttribute("termList", db.getSemsterTerm(year));
|
||||
if (studentId != null) {
|
||||
rd = this.getServletContext().getRequestDispatcher("/teacher/reportStudent.jsp");
|
||||
rd.forward(request, response);
|
||||
} else {
|
||||
rd = this.getServletContext().getRequestDispatcher("/teacher/reportClass.jsp");
|
||||
rd.forward(request, response);
|
||||
}
|
||||
}
|
||||
|
||||
rd = this.getServletContext().getRequestDispatcher("/teacher/report.jsp");
|
||||
rd.forward(request, response);
|
||||
} catch (Exception e) {
|
||||
response.sendRedirect("../index");
|
||||
}
|
||||
}
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
|
||||
/**
|
||||
* Handles the HTTP <code>GET</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the HTTP <code>POST</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a short description of the servlet.
|
||||
*
|
||||
* @return a String containing servlet description
|
||||
*/
|
||||
@Override
|
||||
public String getServletInfo() {
|
||||
return "Short description";
|
||||
}// </editor-fold>
|
||||
|
||||
}
|
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package system.tag;
|
||||
|
||||
import java.io.IOException;
|
||||
import javax.servlet.jsp.*;
|
||||
import javax.servlet.jsp.tagext.SimpleTagSupport;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JerryKwok
|
||||
*/
|
||||
public class NavTag extends SimpleTagSupport {
|
||||
|
||||
private String role;
|
||||
private String active;
|
||||
|
||||
public void setRole(String role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public void setActive(String active) {
|
||||
this.active = active;
|
||||
}
|
||||
|
||||
public void doTag() {
|
||||
try {
|
||||
JspWriter out = getJspContext().getOut();
|
||||
out.print("<div class=\"list-group\">");
|
||||
if (role.equalsIgnoreCase("Student")) {
|
||||
|
||||
out.print("<a href=\"dashboard\" class=\"list-group-item main-color-bg-nav>");
|
||||
if (active.equalsIgnoreCase("dashboard")) {
|
||||
out.print(" active\">");
|
||||
} else {
|
||||
out.print("\">");
|
||||
}
|
||||
out.print("<i class=\"material-icons\">dashboard</i> ");
|
||||
out.print("<span>Dashboard</span>");
|
||||
out.print("</a>");
|
||||
out.print("<a href=\"attendance\" class=\"list-group-item >");
|
||||
if (active.equalsIgnoreCase("attendance")) {
|
||||
out.print(" active\">");
|
||||
} else {
|
||||
out.print("\">");
|
||||
}
|
||||
out.print("<i class=\"material-icons\">check_box</i>");
|
||||
out.print("<span> Attendance</span>");
|
||||
out.print("</a>");
|
||||
out.print("<a href=\"../login?action=logout\" class=\"list-group-item text-right\">");
|
||||
out.print("<span> Logout</span> ");
|
||||
out.print("</a>");
|
||||
|
||||
} else if (role.equalsIgnoreCase("Admin")) {
|
||||
|
||||
out.print("<a href=\"dashboard\" class=\"list-group-item main-color-bg-nav");
|
||||
if (active.equalsIgnoreCase("dashboard")) {
|
||||
out.print(" active\">");
|
||||
} else {
|
||||
out.print("\">");
|
||||
}
|
||||
out.print("<i class=\"material-icons\">dashboard</i> ");
|
||||
out.print("<span>Dashboard</span>");
|
||||
out.print("</a>");
|
||||
out.print("<a href=\"lecture\" class=\"list-group-item main-color-bg-nav");
|
||||
if (active.equalsIgnoreCase("Lecture")) {
|
||||
out.print(" active\">");
|
||||
} else {
|
||||
out.print("\">");
|
||||
}
|
||||
out.print("<i class=\"material-icons\">view_module</i> ");
|
||||
out.print("<span>Lecture</span>");
|
||||
out.print("</a>");
|
||||
out.print("<a href=\"class\" class=\"list-group-item");
|
||||
if (active.equalsIgnoreCase("Class")) {
|
||||
out.print(" active\">");
|
||||
} else {
|
||||
out.print("\">");
|
||||
}
|
||||
out.print("<i class=\"material-icons\">class</i><span>Class</span>");
|
||||
out.print("</a>");
|
||||
out.print("<a href=\"classReg\" class=\"list-group-item");
|
||||
if (active.equalsIgnoreCase("ClassReg")) {
|
||||
out.print(" active\">");
|
||||
} else {
|
||||
out.print("\">");
|
||||
}
|
||||
out.print("<i class=\"material-icons\">account_tree</i><span> Class Register</span>");
|
||||
out.print("</a>");
|
||||
out.print("<a href=\"user?role=Student\" class=\"list-group-item");
|
||||
if (active.equalsIgnoreCase("Student")) {
|
||||
out.print(" active\">");
|
||||
} else {
|
||||
out.print("\">");
|
||||
}
|
||||
out.print("<i class=\"material-icons\">library_books</i><span> Student</span>");
|
||||
out.print("</a>");
|
||||
out.print("<a href=\"user?role=Teacher\" class=\"list-group-item");
|
||||
if (active.equalsIgnoreCase("Teacher")) {
|
||||
out.print(" active\">");
|
||||
} else {
|
||||
out.print("\">");
|
||||
}
|
||||
out.print("<i class=\"material-icons\">supervisor_account</i><span> Teacher</span>");
|
||||
out.print("</a>");
|
||||
out.print("<a href=\"user?role=Admin\" class=\"list-group-item");
|
||||
if (active.equalsIgnoreCase("Admin")) {
|
||||
out.print(" active\">");
|
||||
} else {
|
||||
out.print("\">");
|
||||
}
|
||||
out.print("<i class=\"material-icons\">vpn_key</i> <span> Admin</span>");
|
||||
out.print("</a>");
|
||||
out.print("<a href=\"schedule\" class=\"list-group-item");
|
||||
if (active.equalsIgnoreCase("Schdeule")) {
|
||||
out.print(" active\">");
|
||||
} else {
|
||||
out.print("\">");
|
||||
}
|
||||
out.print("<i class=\"material-icons\">schedule</i><span> Schedule</span>");
|
||||
out.print("</a>");
|
||||
out.print(" <a href=\"attendance\" class=\"list-group-item");
|
||||
if (active.equalsIgnoreCase("Attendance")) {
|
||||
out.print(" active\">");
|
||||
} else {
|
||||
out.print("\">");
|
||||
}
|
||||
out.print("<i class=\"material-icons\">check_box</i><span> Attendance</span>");
|
||||
out.print("</a>");
|
||||
out.print("<a href=\"report\" class=\"list-group-item");
|
||||
if (active.equalsIgnoreCase("Report")) {
|
||||
out.print(" active\">");
|
||||
} else {
|
||||
out.print("\">");
|
||||
}
|
||||
out.print("<i class=\"material-icons\">insert_drive_file</i><span> Reports</span>");
|
||||
out.print("</a>");
|
||||
out.print("<a href=\"../login?action=logout\" class=\"list-group-item text-right\">");
|
||||
out.print("<span> Logout</span> ");
|
||||
out.print("</a>");
|
||||
|
||||
} else if (role.equalsIgnoreCase("Teacher")) {
|
||||
out.print(" <a href=\"dashboard\" class=\"list-group-item main-color-bg-nav");
|
||||
if (active.equalsIgnoreCase("dashboard")) {
|
||||
out.print(" active\">");
|
||||
} else {
|
||||
out.print("\">");
|
||||
}
|
||||
out.print("<i class=\"material-icons\">dashboard</i><span>Dashboard</span></a>");
|
||||
out.print(" <a href=\"attendance\" class=\"list-group-item");
|
||||
if (active.equalsIgnoreCase("Attendance")) {
|
||||
out.print(" active\">");
|
||||
} else {
|
||||
out.print("\">");
|
||||
}
|
||||
out.print("<i class=\"material-icons\">check_box</i><span> Attendace</span></a>");
|
||||
out.print("<a href=\"report\" class=\"list-group-item");
|
||||
if (active.equalsIgnoreCase("Report")) {
|
||||
out.print(" active\">");
|
||||
} else {
|
||||
out.print("\">");
|
||||
}
|
||||
out.print("<i class=\"material-icons\">insert_drive_file</i><span> Reports</span></a>");
|
||||
out.print("<a href=\"../login?action=logout\" class=\"list-group-item text-right\"><span> Logout</span></a>");
|
||||
}
|
||||
out.print("</div>");
|
||||
} catch (IOException e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
48
_resources/it114105/itp4511/Assignment/web/404error.jsp
Normal file
48
_resources/it114105/itp4511/Assignment/web/404error.jsp
Normal file
@@ -0,0 +1,48 @@
|
||||
<%--
|
||||
Document : 404error
|
||||
Created on : 2019/12/14, 下午 02:05:51
|
||||
Author : JerryKwok
|
||||
--%>
|
||||
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8"%>
|
||||
<%@ page isErrorPage="true"%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Error page</title>
|
||||
<meta charset="utf-8">
|
||||
<link href="<%= request.getContextPath() %>/css/bootstrap.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="row ">
|
||||
<div class="col-12">
|
||||
<div class="error-template" style="margin-top: 200px">
|
||||
<h1> Oops!</h1>
|
||||
<h2>404 Not Found</h2>
|
||||
<div class="error-details">
|
||||
Sorry, an error has occured, Requested page not found!
|
||||
</div>
|
||||
<div class="error-actions">
|
||||
<br>
|
||||
<button onclick="history.back()" class="btn btn-primary btn-lg">
|
||||
<span class="glyphicon glyphicon-home"></span>
|
||||
Back to Home
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script src="js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
</html>
|
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<taglib version="2.1" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd">
|
||||
<tlib-version>1.0</tlib-version>
|
||||
<short-name>nav</short-name>
|
||||
<uri>/WEB-INF/tlds/nav-taglib.tld</uri>
|
||||
<tag>
|
||||
<name>showNav</name>
|
||||
<tag-class>system.tag.NavTag</tag-class>
|
||||
<body-content>empty</body-content>
|
||||
<attribute>
|
||||
<name>role</name>
|
||||
<required>true</required>
|
||||
<type>java.lang.String</type>
|
||||
<rtexprvalue>true</rtexprvalue>
|
||||
</attribute>
|
||||
<attribute>
|
||||
<name>active</name>
|
||||
<required>true</required>
|
||||
<type>java.lang.String</type>
|
||||
<rtexprvalue>true</rtexprvalue>
|
||||
</attribute>
|
||||
</tag>
|
||||
</taglib>
|
41
_resources/it114105/itp4511/Assignment/web/WEB-INF/web.xml
Normal file
41
_resources/it114105/itp4511/Assignment/web/WEB-INF/web.xml
Normal file
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
||||
version="3.0">
|
||||
<context-param>
|
||||
<param-name>dbUrl</param-name>
|
||||
<param-value>jdbc:mysql://localhost:3306/itp4511assignemnt</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>dbUser</param-name>
|
||||
<param-value>root</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>dbPassword</param-name>
|
||||
<param-value></param-value>
|
||||
</context-param>
|
||||
<session-config>
|
||||
<session-timeout>
|
||||
30
|
||||
</session-timeout>
|
||||
</session-config>
|
||||
<servlet>
|
||||
<servlet-name>IndexController</servlet-name>
|
||||
<servlet-class>system.servlet.IndexController</servlet-class>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>IndexController</servlet-name>
|
||||
<url-pattern>/index</url-pattern>
|
||||
</servlet-mapping>
|
||||
<error-page>
|
||||
<error-code>404</error-code>
|
||||
<location>/error</location>
|
||||
</error-page>
|
||||
<error-page>
|
||||
<exception-type>java.lang.Throwable</exception-type>
|
||||
<location>/errorHandler</location>
|
||||
</error-page>
|
||||
|
||||
</web-app>
|
@@ -0,0 +1,85 @@
|
||||
<%--
|
||||
Document : dashboard
|
||||
Created on : 2019/11/11, 下午 10:08:39
|
||||
Author : JerryKwok
|
||||
--%>
|
||||
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8"%>
|
||||
<%@page import="system.bean.ClassBean, java.util.ArrayList"%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Admin Area | Dashboard</title>
|
||||
<!-- Bootstrap core CSS -->
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
rel="stylesheet">
|
||||
<link href="../css/bootstrap.css" rel="stylesheet">
|
||||
<link href="../css/style.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<jsp:include page="../header.jsp"></jsp:include>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<%@taglib uri="/WEB-INF/tlds/nav-taglib.tld" prefix="nav" %>
|
||||
<nav:showNav role="Admin" active="attendance" />
|
||||
</div>
|
||||
<div class="col-lg-9">
|
||||
<!-- Main -->
|
||||
<div class="card">
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title">Class</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Class</th>
|
||||
<th scope="col"> </th>
|
||||
<th scope="col">Head</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<jsp:useBean id="classList" scope="request" class="java.util.ArrayList<system.bean.ClassBean>"/>
|
||||
<%
|
||||
for (ClassBean classVal : classList) {
|
||||
out.print("<tr data-href=\"attendance?class=" + classVal.getClassName() + "\">");
|
||||
out.print("<td colspan=2>" + classVal.getClassName() + "</td>");
|
||||
out.print("<td>" + classVal.getTeacherBean().getTeacherFormalName() + "</td>");
|
||||
out.print("</tr>");
|
||||
}
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<br><br>
|
||||
<footer></footer>
|
||||
|
||||
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<script src="../js/bootstrap.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$("tr[data-href]").click(function () {
|
||||
window.location.href = $(this).attr("data-href");
|
||||
})
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
@@ -0,0 +1,176 @@
|
||||
<%--
|
||||
Document : dashboard
|
||||
Created on : 2019/11/11, 下午 10:08:39
|
||||
Author : JerryKwok
|
||||
--%>
|
||||
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8"%>
|
||||
<%@page import="system.bean.ClassBean, system.bean.AttendBean, java.util.ArrayList, java.util.Date, java.text.SimpleDateFormat"%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Admin Area | Dashboard</title>
|
||||
<!-- Bootstrap core CSS -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
rel="stylesheet">
|
||||
<link href="../css/bootstrap.css" rel="stylesheet">
|
||||
<link href="../css/bootstrap-datepicker.min.css" rel="stylesheet">
|
||||
<link href="../css/style.css" rel="stylesheet">
|
||||
</head>
|
||||
<%!
|
||||
Date date = new Date();
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
||||
%>
|
||||
<%
|
||||
String urlForm = "attendance?";
|
||||
String urlDate = request.getParameter("date");
|
||||
String urlClass = request.getParameter("class");
|
||||
if (urlDate != null) {
|
||||
urlForm += ("date=" + urlDate + "&");
|
||||
}
|
||||
if (urlDate != null) {
|
||||
urlForm += ("class=" + urlClass);
|
||||
}
|
||||
%>
|
||||
<body>
|
||||
<jsp:include page="../header.jsp"></jsp:include>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<%@taglib uri="/WEB-INF/tlds/nav-taglib.tld" prefix="nav" %>
|
||||
<nav:showNav role="Admin" active="attendance" />
|
||||
</div>
|
||||
<div class="col-lg-9">
|
||||
<%
|
||||
if (request.getAttribute("message") != null) {
|
||||
out.print("<div class='alert alert-success alert-dismissible fade show' role='alert'>");
|
||||
out.print("<strong>Attendance Saved</strong>");
|
||||
out.print("<button type='button' class='close' data-dismiss='alert' aria-label='Close'>");
|
||||
out.print("<span aria-hidden='true'>×</span></button></div>");
|
||||
|
||||
}
|
||||
%>
|
||||
<!-- Main -->
|
||||
<div class="card">
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title">Select Date</h5>
|
||||
</div>
|
||||
<form action="attendance" method="GET">
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<label>Class</label>
|
||||
<select class="form-control" name="class">
|
||||
<jsp:useBean id="classList" scope="request" class="java.util.ArrayList<system.bean.ClassBean>"/>
|
||||
<%
|
||||
for (ClassBean classVal : classList) {
|
||||
if (request.getParameter("class").equals(classVal.getClassName())) {
|
||||
out.print("<option value='" + classVal.getClassName() + "' selected>" + classVal.getClassName() + "</option>");
|
||||
} else {
|
||||
out.print("<option value='" + classVal.getClassName() + "'>" + classVal.getClassName() + "</option>");
|
||||
}
|
||||
}
|
||||
%>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Select Date</label>
|
||||
<div class="input-group date">
|
||||
<input type="text" class="form-control" id="datepicker" name="date" value="<%= request.getParameter("date") == null ? formatter.format(date) : request.getParameter("date")%>">
|
||||
<div class="input-group-addon">
|
||||
<span class="glyphicon glyphicon-th"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<a href="attendance">
|
||||
<button type="button" class="btn btn-secondary">
|
||||
Back
|
||||
</button>
|
||||
</a>
|
||||
<button type="submit" class="btn btn-primary right">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<!-- Main -->
|
||||
<div class="card">
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title">Attend List</h5>
|
||||
</div>
|
||||
<form action="<%= urlForm%>" method="POST">
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<label>Class</label>
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Attend</th>
|
||||
<th scope="col">Student ID</th>
|
||||
<th scope="col">Student Name</th>
|
||||
<th scope="col">Gender</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<jsp:useBean id="studentAttendList" scope="request" class="java.util.ArrayList<system.bean.AttendBean>"/>
|
||||
<%
|
||||
for (AttendBean student : studentAttendList) {
|
||||
out.print("<tr>");
|
||||
out.print("<td>");
|
||||
out.print("<input type='checkbox' name='attend' value='" + student.getStBean().getId() + "'");
|
||||
if (student.isAttend()) {
|
||||
out.print(" checked>");
|
||||
} else {
|
||||
out.print(" >");
|
||||
}
|
||||
out.print("</td>");
|
||||
out.print("<td>" + student.getStBean().getId() + "</td>");
|
||||
out.print("<td>" + student.getStBean().getName() + "</td>");
|
||||
out.print("<td>" + student.getStBean().getGender() + "</td>");
|
||||
out.print("</tr>");
|
||||
}
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary float-right">Save</button>
|
||||
<br><br>
|
||||
<input type="hidden" name="action" value="save">
|
||||
<input type="hidden" name="class" id="attendDate" value="<%= request.getParameter("class")%>">
|
||||
<input type="hidden" name="date" id="class" value=" <%= request.getParameter("date") == null ? formatter.format(date) : request.getParameter("date")%>">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<br><br>
|
||||
<footer></footer>
|
||||
|
||||
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
|
||||
<script src="../js/bootstrap.min.js"></script>
|
||||
<script src="../js/bootstrap-datepicker.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#datepicker').datepicker({
|
||||
format: "yyyy-mm-dd",
|
||||
daysOfWeekDisabled: "0,6",
|
||||
daysOfWeekHighlighted: "1,2,3,4,5",
|
||||
todayHighlight: true
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
140
_resources/it114105/itp4511/Assignment/web/admin/class.jsp
Normal file
140
_resources/it114105/itp4511/Assignment/web/admin/class.jsp
Normal file
@@ -0,0 +1,140 @@
|
||||
<%--
|
||||
Document : dashboard
|
||||
Created on : 2019/11/11, 下午 10:08:39
|
||||
Author : JerryKwok
|
||||
--%>
|
||||
|
||||
<%@page import="system.bean.SearchBean"%>
|
||||
<%@page import="system.bean.LectureBean"%>
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8" import="system.bean.StudentBean, system.bean.ClassBean, system.bean.TeacherBean"%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Admin Area | Dashboard</title>
|
||||
<!-- Bootstrap core CSS -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
rel="stylesheet">
|
||||
<link href="../css/bootstrap.css" rel="stylesheet">
|
||||
<link href="../css/style.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<jsp:include page="../header.jsp"></jsp:include>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<%@taglib uri="/WEB-INF/tlds/nav-taglib.tld" prefix="nav" %>
|
||||
<nav:showNav role="Admin" active="class" />
|
||||
</div>
|
||||
|
||||
<div class="col-lg-9">
|
||||
<!-- Website Overview -->
|
||||
<div class="card">
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title">Class List</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<%
|
||||
if (request.getAttribute("deleteMes") != null) {
|
||||
out.print("<div class='alert alert-success alert-dismissible fade show formated-table' role='alert'>");
|
||||
out.print("<strong>Class #" + request.getAttribute("deleteMes") + " Deleted </strong>");
|
||||
out.print("<button type='button' class='close' data-dismiss='alert' aria-label='Close'>");
|
||||
out.print("<span aria-hidden='true'>×</span></button></div>");
|
||||
} else if (request.getAttribute("saveMes") != null) {
|
||||
out.print("<div class='alert alert-success alert-dismissible fade show formated-table' role='alert'>");
|
||||
out.print("<strong>Class #" + request.getAttribute("saveMes") + " Saved </strong>");
|
||||
out.print("<button type='button' class='close' data-dismiss='alert' aria-label='Close'>");
|
||||
out.print("<span aria-hidden='true'>×</span></button></div>");
|
||||
} else if (request.getAttribute("addMes") != null) {
|
||||
out.print("<div class='alert alert-success alert-dismissible fade show formated-table' role='alert'>");
|
||||
out.print("<strong> Class Added</strong>");
|
||||
out.print("<button type='button' class='close' data-dismiss='alert' aria-label='Close'>");
|
||||
out.print("<span aria-hidden='true'>×</span></button></div>");
|
||||
}
|
||||
%>
|
||||
<div class="format-table">
|
||||
<form action="class" method="POST" class="format">
|
||||
<button type="submit" class="btn btn-primary">Create Class</button>
|
||||
<input type="hidden" name="action" value="addPage">
|
||||
</form>
|
||||
<form class="form-inline float-right" action="class" method="POST">
|
||||
<div class="form-group mb-2">
|
||||
<font>Search: </font>
|
||||
</div>
|
||||
<div class="form-group mx-sm-3 mb-2">
|
||||
<label class="sr-only">Password</label>
|
||||
<input list="searchlist" type="text" class="form-control" name="searchVal" id="searchVal" placeholder="Search...">
|
||||
<datalist id="searchlist">
|
||||
<jsp:useBean scope="request" id="searchList" class="java.util.ArrayList<system.bean.SearchBean>"/>
|
||||
<%
|
||||
for (SearchBean search : searchList) {
|
||||
out.print("<option label='" + search.getKeyword() + "' value='" + search.getKeyword() + "' />");
|
||||
}
|
||||
%>
|
||||
</datalist>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-dark mb-2">Search</button>
|
||||
<input type="hidden" name="action" value="search">
|
||||
</form>
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th>Class</th>
|
||||
<th>Head Teacher</th>
|
||||
<th>Year</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<jsp:useBean id="classList" scope="request" class="java.util.ArrayList<system.bean.ClassBean>"/>
|
||||
<%
|
||||
|
||||
for (ClassBean cl : classList) {
|
||||
out.print("<tr>");
|
||||
out.print("<td>" + cl.getClassName() + "</td>");
|
||||
out.print("<td>" + cl.getTeacherBean().getTeacherFormalName() + "</td>");
|
||||
out.print("<td>" + cl.getYear() + "</td>");
|
||||
out.print("<td>");
|
||||
out.print("<a href='class?id=" + cl.getId() + "'><button type='button' class='btn btn-info tableBtn'><i class='material-icons'>edit</i></button></a> ");
|
||||
out.print("<a href='class?id=" + cl.getId() + "&action=delete'><button type='button' class='btn btn-danger tableBtn'><i class='material-icons'>delete</i></button></a>");
|
||||
out.print("</td>");
|
||||
}
|
||||
if(request.getAttribute("search") == null){
|
||||
out.print("</table>");
|
||||
}else{
|
||||
out.print("</table>");
|
||||
out.print("<a href=\"class\"><button class=\"btn btn-secondary\">Show All</button></a>");
|
||||
}
|
||||
|
||||
%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Latest Users -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<br><br>
|
||||
<footer></footer>
|
||||
|
||||
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<script src="../js/bootstrap.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('.alert').alert();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
139
_resources/it114105/itp4511/Assignment/web/admin/classAdd.jsp
Normal file
139
_resources/it114105/itp4511/Assignment/web/admin/classAdd.jsp
Normal file
@@ -0,0 +1,139 @@
|
||||
<%--
|
||||
Document : dashboard
|
||||
Created on : 2019/11/11, 下午 10:08:39
|
||||
Author : JerryKwok
|
||||
--%>
|
||||
|
||||
<%@page import="system.bean.ClassYearBean"%>
|
||||
<%@page import="system.bean.TeacherBean"%>
|
||||
<%@page import="system.bean.LectureDayBean"%>
|
||||
<%@page import="system.bean.LectureTimeBean"%>
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8" import="system.bean.StudentBean, system.bean.ClassBean, java.util.ArrayList"%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Admin Area | Dashboard</title>
|
||||
<!-- Bootstrap core CSS -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
rel="stylesheet">
|
||||
<link href="../css/bootstrap.css" rel="stylesheet">
|
||||
<link href="../css/style.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<jsp:include page="../header.jsp"></jsp:include>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<%@taglib uri="/WEB-INF/tlds/nav-taglib.tld" prefix="nav" %>
|
||||
<nav:showNav role="Admin" active="class" />
|
||||
</div>
|
||||
|
||||
<div class="col-lg-9">
|
||||
<!-- Website Overview -->
|
||||
<div class="card">
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title">Add Student Class</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<%
|
||||
if (request.getAttribute("dupMes") != null) {
|
||||
out.print("<div class='alert alert-danger alert-dismissible fade show' role='alert'>");
|
||||
out.print("<strong>The Class Name is created</strong>");
|
||||
out.print("<button type='button' class='close' data-dismiss='alert' aria-label='Close'>");
|
||||
out.print("<span aria-hidden='true'>×</span></button></div>");
|
||||
}
|
||||
%>
|
||||
<br>
|
||||
<jsp:useBean id="classYearList" scope="request" class="ArrayList<system.bean.ClassYearBean>" />
|
||||
<jsp:useBean id="teacherList" scope="request" class="ArrayList<system.bean.TeacherBean>" />
|
||||
<form action="class" method="POST">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>Class Name</th>
|
||||
<td><input type="text" name="class" class="form-control" value="<%= request.getAttribute("className") != null ? request.getAttribute("className") : ""%>" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Teacher</th>
|
||||
<td>
|
||||
<select name="teacherId" class="form-control" required="">
|
||||
<%
|
||||
if (request.getAttribute("teacherId") != null) {
|
||||
for (TeacherBean teacher : teacherList) {
|
||||
if (teacher.getId().equals(request.getAttribute("teacherId"))) {
|
||||
out.print("<option value='" + teacher.getId() + "' selected>" + teacher.getTeacherFormalName() + "</option>");
|
||||
} else {
|
||||
out.print("<option value='" + teacher.getId() + "'>" + teacher.getTeacherFormalName() + "</option>");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (TeacherBean teacher : teacherList) {
|
||||
out.print("<option value='" + teacher.getId() + "'>" + teacher.getTeacherFormalName() + "</option>");
|
||||
}
|
||||
}
|
||||
|
||||
%>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Year</th>
|
||||
<td>
|
||||
<select name="yearId" class="form-control" required>
|
||||
<%
|
||||
if (request.getAttribute("yearId") != null) {
|
||||
for (ClassYearBean year : classYearList) {
|
||||
if (year.getId().equals(request.getAttribute("yearId"))) {
|
||||
out.print("<option value='" + year.getId() + "' selected>" + year.getYear() + "</option>");
|
||||
} else {
|
||||
out.print("<option value='" + year.getId() + "'>" + year.getYear() + "</option>");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (ClassYearBean year : classYearList) {
|
||||
out.print("<option value='" + year.getId() + "'>" + year.getYear() + "</option>");
|
||||
}
|
||||
}
|
||||
|
||||
%>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="submit" class="btn btn-primary">Add Lecture</button>
|
||||
<input type="hidden" name="action" value="add">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<a href="class">
|
||||
<button class="btn btn-secondary">
|
||||
Back
|
||||
</button>
|
||||
</a>
|
||||
<!-- Latest Users -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<br><br>
|
||||
<footer></footer>
|
||||
|
||||
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<script src="../js/bootstrap.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('.alert').alert();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
149
_resources/it114105/itp4511/Assignment/web/admin/classEdit.jsp
Normal file
149
_resources/it114105/itp4511/Assignment/web/admin/classEdit.jsp
Normal file
@@ -0,0 +1,149 @@
|
||||
<%--
|
||||
Document : dashboard
|
||||
Created on : 2019/11/11, 下午 10:08:39
|
||||
Author : JerryKwok
|
||||
--%>
|
||||
|
||||
<%@page import="system.bean.ClassYearBean"%>
|
||||
<%@page import="system.bean.TeacherBean"%>
|
||||
<%@page import="system.bean.LectureDayBean"%>
|
||||
<%@page import="system.bean.LectureTimeBean"%>
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8" import="system.bean.StudentBean, system.bean.ClassBean, java.util.ArrayList"%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Admin Area | Dashboard</title>
|
||||
<!-- Bootstrap core CSS -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
rel="stylesheet">
|
||||
<link href="../css/bootstrap.css" rel="stylesheet">
|
||||
<link href="../css/style.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<jsp:include page="../header.jsp"></jsp:include>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<%@taglib uri="/WEB-INF/tlds/nav-taglib.tld" prefix="nav" %>
|
||||
<nav:showNav role="Admin" active="class" />
|
||||
</div>
|
||||
|
||||
<div class="col-lg-9">
|
||||
<!-- Website Overview -->
|
||||
<div class="card">
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title">Edit Student Class</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<%
|
||||
if (request.getAttribute("dupMes") != null) {
|
||||
out.print("<div class='alert alert-danger alert-dismissible fade show' role='alert'>");
|
||||
out.print("<strong>The Class Name is Created</strong>");
|
||||
out.print("<button type='button' class='close' data-dismiss='alert' aria-label='Close'>");
|
||||
out.print("<span aria-hidden='true'>×</span></button></div>");
|
||||
}
|
||||
%>
|
||||
<br>
|
||||
<jsp:useBean id="classBean" scope="request" class="system.bean.ClassBean" />
|
||||
<jsp:useBean id="classYearList" scope="request" class="ArrayList<system.bean.ClassYearBean>" />
|
||||
<jsp:useBean id="teacherList" scope="request" class="ArrayList<system.bean.TeacherBean>" />
|
||||
<form action="class?id=<%= request.getParameter("id") %>" method="POST">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>Class Name</th>
|
||||
<td><input type="text" name="class" class="form-control" value="<%= request.getAttribute("className") != null ? request.getAttribute("className") : classBean.getClassName()%>" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Teacher</th>
|
||||
<td>
|
||||
<select name="teacherId" class="form-control" required="">
|
||||
<%
|
||||
if (request.getAttribute("teacherId") != null) {
|
||||
for (TeacherBean teacher : teacherList) {
|
||||
if (teacher.getId().equals(request.getAttribute("teacherId"))) {
|
||||
out.print("<option value='" + teacher.getId() + "' selected>" + teacher.getTeacherFormalName() + "</option>");
|
||||
} else {
|
||||
out.print("<option value='" + teacher.getId() + "'>" + teacher.getTeacherFormalName() + "</option>");
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
out.print("<option value='" + classBean.getTeacherBean().getId() + "' selected>" + classBean.getTeacherBean().getTeacherFormalName() + "</option>");
|
||||
for (TeacherBean teacher : teacherList) {
|
||||
out.print("<option value='" + teacher.getId() + "'>" + teacher.getTeacherFormalName() + "</option>");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
%>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Year</th>
|
||||
<td>
|
||||
<select name="yearId" class="form-control" required>
|
||||
<% if (request.getAttribute("yearId") != null) {
|
||||
for (ClassYearBean year : classYearList) {
|
||||
if (year.getId().equals(request.getAttribute("yearId"))) {
|
||||
out.print("<option value='" + year.getId() + "' selected>" + year.getYear() + "</option>");
|
||||
} else {
|
||||
out.print("<option value='" + year.getId() + "'>" + year.getYear() + "</option>");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (ClassYearBean year : classYearList) {
|
||||
if (classBean.getYear().equals(year.getYear())) {
|
||||
out.print("<option value='" + year.getId() + "' selected>" + year.getYear() + "</option>");
|
||||
} else {
|
||||
out.print("<option value='" + year.getId() + "'>" + year.getYear() + "</option>");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
%>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="submit" class="btn btn-primary">Save Lecture</button>
|
||||
<input type="hidden" name="action" value="save">
|
||||
<input type="hidden" name="id" value="<%= request.getParameter("id")%>"
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<a href="class">
|
||||
<button class="btn btn-secondary">
|
||||
Back
|
||||
</button>
|
||||
</a>
|
||||
<!-- Latest Users -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<br><br>
|
||||
<footer></footer>
|
||||
|
||||
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<script src="../js/bootstrap.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('.alert').alert();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
155
_resources/it114105/itp4511/Assignment/web/admin/classReg.jsp
Normal file
155
_resources/it114105/itp4511/Assignment/web/admin/classReg.jsp
Normal file
@@ -0,0 +1,155 @@
|
||||
<%--
|
||||
Document : dashboard
|
||||
Created on : 2019/11/11, 下午 10:08:39
|
||||
Author : JerryKwok
|
||||
--%>
|
||||
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8" import="system.bean.SearchBean, system.bean.StudentBean, system.bean.ClassBean, system.bean.TeacherBean"%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Admin Area | Dashboard</title>
|
||||
<!-- Bootstrap core CSS -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
rel="stylesheet">
|
||||
<link href="../css/bootstrap.css" rel="stylesheet">
|
||||
<link href="../css/style.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<jsp:include page="../header.jsp"></jsp:include>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<%@taglib uri="/WEB-INF/tlds/nav-taglib.tld" prefix="nav" %>
|
||||
<nav:showNav role="Admin" active="ClassReg" />
|
||||
</div>
|
||||
|
||||
<div class="col-lg-9">
|
||||
<!-- Website Overview -->
|
||||
<div class="card">
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title">Student Registered Class</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<%
|
||||
if (request.getAttribute("deletenMes") != null) {
|
||||
out.print("<div class='alert alert-success alert-dismissible fade show formated-table' role='alert'>");
|
||||
out.print("<strong>Student #" + request.getAttribute("deletenMes") + " Class Deleted </strong>");
|
||||
out.print("<button type='button' class='close' data-dismiss='alert' aria-label='Close'>");
|
||||
out.print("<span aria-hidden='true'>×</span></button></div>");
|
||||
} else if (request.getAttribute("saveMes") != null) {
|
||||
out.print("<div class='alert alert-success alert-dismissible fade show formated-table' role='alert'>");
|
||||
out.print("<strong>Student Class #" + request.getAttribute("saveMes") + " Saved </strong>");
|
||||
out.print("<button type='button' class='close' data-dismiss='alert' aria-label='Close'>");
|
||||
out.print("<span aria-hidden='true'>×</span></button></div>");
|
||||
} else if (request.getAttribute("addMes") != null) {
|
||||
out.print("<div class='alert alert-success alert-dismissible fade show formated-table' role='alert'>");
|
||||
out.print("<strong> Added the student to Class #" + request.getAttribute("addMes") + "</strong>");
|
||||
out.print("<button type='button' class='close' data-dismiss='alert' aria-label='Close'>");
|
||||
out.print("<span aria-hidden='true'>×</span></button></div>");
|
||||
}
|
||||
%>
|
||||
<div class="format-table">
|
||||
<form action="classReg" method="POST" class="format">
|
||||
<button type="submit" class="btn btn-primary">Add Student to Class</button>
|
||||
<input type="hidden" name="action" value="addPage">
|
||||
</form>
|
||||
<button type="button" class="btn btn-info tableBtn" id="btnExportExcel"><i class="material-icons">save_alt</i></button>
|
||||
<form class="form-inline float-right" action="classReg" method="POST">
|
||||
<div class="form-group mb-2">
|
||||
<font>Search: </font>
|
||||
</div>
|
||||
<div class="form-group mx-sm-3 mb-2">
|
||||
<label class="sr-only">Password</label>
|
||||
<input list="searchlist" type="text" class="form-control" name="searchVal" id="searchVal" placeholder="Search...">
|
||||
<datalist id="searchlist">
|
||||
<jsp:useBean scope="request" id="searchList" class="java.util.ArrayList<system.bean.SearchBean>"/>
|
||||
<%
|
||||
for (SearchBean search : searchList) {
|
||||
out.print("<option label='" + search.getKeyword() + "' value='" + search.getKeyword() + "' />");
|
||||
}
|
||||
%>
|
||||
</datalist>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-dark mb-2">Search</button>
|
||||
<input type="hidden" name="action" value="search">
|
||||
</form>
|
||||
<table class="table exportExcel">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Student Name</th>
|
||||
<th>Class</th>
|
||||
<th>Head Teacher</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<jsp:useBean id="studentClassList" scope="request" class="java.util.ArrayList<system.bean.StudentBean>"/>
|
||||
<%
|
||||
if (studentClassList.size() > 0) {
|
||||
for (StudentBean student : studentClassList) {
|
||||
out.print("<tr>");
|
||||
out.print("<td><a href='user?role=Student&searchVal=" + student.getId() + "&action=search'>" + student.getId() + "</a></td>");
|
||||
out.print("<td>" + student.getName() + "</td>");
|
||||
out.print("<td>" + student.getClassName().getClassName() + "</td>");
|
||||
out.print("<td><a href='user?role=Teacher&searchVal=" + student.getClassName().getTeacherBean().getId() + "&action=search'>" + student.getClassName().getTeacherBean().getTeacherFormalName() + "</a></td>");
|
||||
out.print("<td>");
|
||||
out.print("<a href='classReg?id=" + student.getStudentClassid() + "'><button type='button' class='btn btn-info tableBtn'><i class='material-icons'>edit</i></button></a> ");
|
||||
out.print("<a href='classReg?id=" + student.getStudentClassid() + "&action=delete'><button type='button' class='btn btn-danger tableBtn'><i class='material-icons'>delete</i></button></a>");
|
||||
out.print("</td>");
|
||||
out.print("</tr>");
|
||||
}
|
||||
out.print("</table>");
|
||||
if (request.getAttribute("searchHis") != null) {
|
||||
out.print("<br><br><br><br><br>");
|
||||
out.print("<a href='classReg'><button type='button' class='btn btn-secondary'>Show All</button></a>");
|
||||
}
|
||||
} else {
|
||||
out.print("<tr>");
|
||||
out.print("<td colspon=5>Not Match Result</td>");
|
||||
out.print("</tr>");
|
||||
out.print("</table>");
|
||||
out.print("<br><br><br><br><br>");
|
||||
out.print("<a href='classReg'><button type='button' class='btn btn-secondary'>Show All</button></a>");
|
||||
}
|
||||
%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Latest Users -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<br><br>
|
||||
<footer></footer>
|
||||
|
||||
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<script src="../js/jquery.tableToexcel.js"></script>
|
||||
<script src="../js/bootstrap.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('.alert').alert();
|
||||
$("#btnExportExcel").click(function () {
|
||||
$(".exportExcel").table2excel({
|
||||
exclude: ".excludeThisClass",
|
||||
name: "Worksheet Name",
|
||||
filename: "Class_Report.xls", // do include extension
|
||||
preserveColors: false // set to true if you want background colors and font colors preserved
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
105
_resources/it114105/itp4511/Assignment/web/admin/classRegAdd.jsp
Normal file
105
_resources/it114105/itp4511/Assignment/web/admin/classRegAdd.jsp
Normal file
@@ -0,0 +1,105 @@
|
||||
<%--
|
||||
Document : dashboard
|
||||
Created on : 2019/11/11, 下午 10:08:39
|
||||
Author : JerryKwok
|
||||
--%>
|
||||
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8" import="system.bean.StudentBean, system.bean.ClassBean, java.util.ArrayList"%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Admin Area | Dashboard</title>
|
||||
<!-- Bootstrap core CSS -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
rel="stylesheet">
|
||||
<link href="../css/bootstrap.css" rel="stylesheet">
|
||||
<link href="../css/style.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<jsp:include page="../header.jsp"></jsp:include>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<%@taglib uri="/WEB-INF/tlds/nav-taglib.tld" prefix="nav" %>
|
||||
<nav:showNav role="Admin" active="ClassReg" />
|
||||
</div>
|
||||
<jsp:useBean id="studnetIdList" scope="request" class="ArrayList<system.bean.StudentBean>"/>
|
||||
<div class="col-lg-9">
|
||||
<!-- Website Overview -->
|
||||
<div class="card">
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title">Add Student Class</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<%
|
||||
if (request.getAttribute("studnetIdList") != null && studnetIdList.size() < 1) {
|
||||
out.print("<div class='alert alert-danger alert-dismissible fade show' role='alert'>");
|
||||
out.print("<strong>No student need to class sign up</strong>");
|
||||
out.print("<button type='button' class='close' data-dismiss='alert' aria-label='Close'>");
|
||||
out.print("<span aria-hidden='true'>×</span></button></div>");
|
||||
}
|
||||
%>
|
||||
<br>
|
||||
<jsp:useBean id="classList" scope="request" class="ArrayList<system.bean.ClassBean>"/>
|
||||
<form action="classReg" method="POST">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>Student ID</th>
|
||||
<td>
|
||||
<select name="id">
|
||||
<%
|
||||
for (StudentBean stBean : studnetIdList) {
|
||||
out.print("<option value='" + stBean.getId() + "'>" + stBean.getId() + "</option>");
|
||||
}
|
||||
%>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Class</th>
|
||||
<td>
|
||||
<select name="className">
|
||||
<%
|
||||
for (ClassBean classBean : classList) {
|
||||
out.print("<option value='" + classBean.getClassName() + "'>" + classBean.getClassName() + "</option>");
|
||||
}
|
||||
%>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="submit" class="btn btn-primary" <% if (studnetIdList.size() < 1) {
|
||||
out.print("disabled");
|
||||
}%>>Saved</button>
|
||||
<input type="hidden" name="action" value="add">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<a href="classReg"><button type="button" class="btn btn-secondary">Back</button></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<br><br>
|
||||
<footer></footer>
|
||||
|
||||
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<script src="../js/bootstrap.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('.alert').alert();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
@@ -0,0 +1,105 @@
|
||||
<%--
|
||||
Document : dashboard
|
||||
Created on : 2019/11/11, 下午 10:08:39
|
||||
Author : JerryKwok
|
||||
--%>
|
||||
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8" import="system.bean.StudentBean, system.bean.ClassBean, java.util.ArrayList"%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Admin Area | Dashboard</title>
|
||||
<!-- Bootstrap core CSS -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
rel="stylesheet">
|
||||
<link href="../css/bootstrap.css" rel="stylesheet">
|
||||
<link href="../css/style.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<jsp:include page="../header.jsp"></jsp:include>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<%@taglib uri="/WEB-INF/tlds/nav-taglib.tld" prefix="nav" %>
|
||||
<nav:showNav role="Admin" active="ClassReg" />
|
||||
</div>
|
||||
|
||||
<div class="col-lg-9">
|
||||
<!-- Website Overview -->
|
||||
<div class="card">
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title">Edit Student Class</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<br>
|
||||
<jsp:useBean id="studentDetials" scope="request" class="system.bean.StudentBean"/>
|
||||
<jsp:useBean id="classList" scope="request" class="ArrayList<system.bean.ClassBean>"/>
|
||||
<form action="classReg" method="POST">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>Student Class ID</th>
|
||||
<td>${studentClassID}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Student Name</th>
|
||||
<td><jsp:getProperty name="studenBean" property="name"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Student ID</th>
|
||||
<td><jsp:getProperty name="studenBean" property="id"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Gender</th>
|
||||
<td><jsp:getProperty name="studenBean" property="gender"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Birthday</th>
|
||||
<td><jsp:getProperty name="studenBean" property="birthday"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Class</th>
|
||||
<td>
|
||||
<select name="className">
|
||||
<%
|
||||
for (ClassBean classBean : classList) {
|
||||
out.print("<option value='" + classBean.getClassName() + "'>" + classBean.getClassName() + "</option>");
|
||||
}
|
||||
%>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="submit" class="btn btn-primary">Saved</button>
|
||||
<input type="hidden" name="id" value="${studentClassID}">
|
||||
<input type="hidden" name="action" value="save">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Latest Users -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<br><br>
|
||||
<footer></footer>
|
||||
|
||||
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<script src="../js/bootstrap.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('.alert').alert();
|
||||
});
|
||||
</script>>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
@@ -0,0 +1,140 @@
|
||||
<%--
|
||||
Document : dashboard
|
||||
Created on : 2019/11/11, 下午 10:08:39
|
||||
Author : JerryKwok
|
||||
--%>
|
||||
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8" import="system.bean.StudentBean, system.bean.ClassBean, java.util.ArrayList"%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Admin Area | Dashboard</title>
|
||||
<!-- Bootstrap core CSS -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
rel="stylesheet">
|
||||
<link href="../css/bootstrap.css" rel="stylesheet">
|
||||
<link href="../css/style.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<jsp:include page="../header.jsp"></jsp:include>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<div class="list-group">
|
||||
<a href="dashboard" class="list-group-item main-color-bg-nav">
|
||||
<i class="material-icons">dashboard</i>
|
||||
<span>Dashboard</span>
|
||||
</a>
|
||||
<a href="lecture" class="list-group-item main-color-bg-nav">
|
||||
<i class="material-icons">view_module</i>
|
||||
<span>Lecture</span>
|
||||
</a>
|
||||
<a href="class" class="list-group-item active">
|
||||
<i class="material-icons">class</i><span> Class</span>
|
||||
</a>
|
||||
<a href="user?role=Student" class="list-group-item">
|
||||
<i class="material-icons">library_books</i><span> Student</span>
|
||||
</a>
|
||||
<a href="user?role=Teacher" class="list-group-item">
|
||||
<i class="material-icons">supervisor_account</i><span> Teacher</span>
|
||||
</a>
|
||||
<a href="user?role=Admin" class="list-group-item">
|
||||
<i class="material-icons">vpn_key</i><span> Admin</span>
|
||||
</a>
|
||||
<a href="schedule" class="list-group-item">
|
||||
<i class="material-icons">schedule</i><span> Schedule</span>
|
||||
</a>
|
||||
|
||||
<a href="attendance" class="list-group-item">
|
||||
<i class="material-icons">check_box</i
|
||||
><span> Attendace</span>
|
||||
</a>
|
||||
<a href="report" class="list-group-item">
|
||||
<i class="material-icons">insert_drive_file</i>
|
||||
<span> Reports</span>
|
||||
</a>
|
||||
<a href="../login?action=logout" class="list-group-item text-right">
|
||||
<span> Logout</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-9">
|
||||
<!-- Website Overview -->
|
||||
<div class="card">
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title">Edit Student Class</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<br>
|
||||
<jsp:useBean id="studentDetials" scope="request" class="system.bean.StudentBean"/>
|
||||
<jsp:useBean id="classList" scope="request" class="ArrayList<system.bean.ClassBean>"/>
|
||||
<form action="class" method="POST">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>Student Class ID</th>
|
||||
<td>${studentClassID}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Student Name</th>
|
||||
<td><jsp:getProperty name="studenBean" property="name"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Student ID</th>
|
||||
<td><jsp:getProperty name="studenBean" property="id"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Gender</th>
|
||||
<td><jsp:getProperty name="studenBean" property="gender"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Birthday</th>
|
||||
<td><jsp:getProperty name="studenBean" property="birthday"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Class</th>
|
||||
<td>
|
||||
<select name="className">
|
||||
<%
|
||||
for (ClassBean classBean : classList) {
|
||||
out.print("<option value='" + classBean.getClassName() + "'>" + classBean.getClassName() + "</option>");
|
||||
}
|
||||
%>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="submit" class="btn btn-primary">Saved</button>
|
||||
<input type="hidden" name="id" value="${studentClassID}">
|
||||
<input type="hidden" name="action" value="save">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Latest Users -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<br><br>
|
||||
<footer></footer>
|
||||
|
||||
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<script src="../js/bootstrap.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('.alert').alert();
|
||||
});
|
||||
</script>>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
@@ -0,0 +1,71 @@
|
||||
<%--
|
||||
Document : dashboard
|
||||
Created on : 2019/11/11, 下午 10:08:39
|
||||
Author : JerryKwok
|
||||
--%>
|
||||
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8" import="system.bean.LectureBean, system.bean.LectureDayBean, system.bean.LectureTimeBean"%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Admin Area | Dashboard</title>
|
||||
<!-- Bootstrap core CSS -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
rel="stylesheet">
|
||||
<link href="../css/bootstrap.css" rel="stylesheet">
|
||||
<link href="../css/style.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<jsp:include page="../header.jsp"></jsp:include>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<%@taglib uri="/WEB-INF/tlds/nav-taglib.tld" prefix="nav" %>
|
||||
<nav:showNav role="Admin" active="dashboard" />
|
||||
</div>
|
||||
|
||||
<div class="col-lg-9">
|
||||
<!-- Website Overview -->
|
||||
<div class="card">
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title">Overview</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-sm-12">
|
||||
<div class="card bg-light card-body mb-3 dash-box">
|
||||
<h2><i class="material-icons">library_books</i> ${courseCount}</h2>
|
||||
<h4>Lecture</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 col-sm-12">
|
||||
<div class="card bg-light card-body mb-3 dash-box">
|
||||
<h2> <i class="material-icons">school</i> ${studentCount}</h2>
|
||||
<h4>Student</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Latest Users -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<br><br>
|
||||
<footer></footer>
|
||||
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
|
||||
<script src="js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
147
_resources/it114105/itp4511/Assignment/web/admin/lecture.jsp
Normal file
147
_resources/it114105/itp4511/Assignment/web/admin/lecture.jsp
Normal file
@@ -0,0 +1,147 @@
|
||||
<%--
|
||||
Document : dashboard
|
||||
Created on : 2019/11/11, 下午 10:08:39
|
||||
Author : JerryKwok
|
||||
--%>
|
||||
|
||||
<%@page import="system.bean.SearchBean"%>
|
||||
<%@page import="system.bean.LectureBean"%>
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8" import="system.bean.StudentBean, system.bean.ClassBean, system.bean.TeacherBean"%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Admin Area | Dashboard</title>
|
||||
<!-- Bootstrap core CSS -->
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
rel="stylesheet">
|
||||
<link href="../css/bootstrap.css" rel="stylesheet">
|
||||
<link href="../css/style.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<jsp:include page="../header.jsp"></jsp:include>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<%@taglib uri="/WEB-INF/tlds/nav-taglib.tld" prefix="nav" %>
|
||||
<nav:showNav role="Admin" active="lecture" />
|
||||
</div>
|
||||
|
||||
<div class="col-lg-9">
|
||||
<!-- Website Overview -->
|
||||
<div class="card">
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title">Lecture</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<%
|
||||
if (request.getAttribute("deleteMes") != null) {
|
||||
out.print("<div class='alert alert-success alert-dismissible fade show formated-table' role='alert'>");
|
||||
out.print("<strong>Lecture #" + request.getAttribute("deleteMes") + " Deleted </strong>");
|
||||
out.print("<button type='button' class='close' data-dismiss='alert' aria-label='Close'>");
|
||||
out.print("<span aria-hidden='true'>×</span></button></div>");
|
||||
} else if (request.getAttribute("saveMes") != null) {
|
||||
out.print("<div class='alert alert-success alert-dismissible fade show formated-table' role='alert'>");
|
||||
out.print("<strong>Lecture #" + request.getAttribute("saveMes") + " Saved </strong>");
|
||||
out.print("<button type='button' class='close' data-dismiss='alert' aria-label='Close'>");
|
||||
out.print("<span aria-hidden='true'>×</span></button></div>");
|
||||
} else if (request.getAttribute("addMes") != null) {
|
||||
out.print("<div class='alert alert-success alert-dismissible fade show formated-table' role='alert'>");
|
||||
out.print("<strong> Lecture Added</strong>");
|
||||
out.print("<button type='button' class='close' data-dismiss='alert' aria-label='Close'>");
|
||||
out.print("<span aria-hidden='true'>×</span></button></div>");
|
||||
}
|
||||
%>
|
||||
<div class="format-table">
|
||||
<form action="lecture" method="POST" class="format">
|
||||
<button type="submit" class="btn btn-primary">Create Lecture</button>
|
||||
<input type="hidden" name="action" value="addPage">
|
||||
</form>
|
||||
<form class="form-inline float-right" action="lecture" method="POST">
|
||||
<div class="form-group mb-2">
|
||||
<font>Search: </font>
|
||||
</div>
|
||||
<div class="form-group mx-sm-3 mb-2">
|
||||
<label class="sr-only">Password</label>
|
||||
<input list="searchlist" type="text" class="form-control" name="searchVal" id="searchVal" placeholder="Search...">
|
||||
<datalist id="searchlist">
|
||||
<jsp:useBean scope="request" id="searchList" class="java.util.ArrayList<system.bean.SearchBean>"/>
|
||||
<%
|
||||
for (SearchBean search : searchList) {
|
||||
out.print("<option label='" + search.getKeyword() + "' value='" + search.getKeyword() + "' />");
|
||||
}
|
||||
%>
|
||||
</datalist>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-dark mb-2">Search</button>
|
||||
<input type="hidden" name="action" value="search">
|
||||
</form>
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th>Lecture</th>
|
||||
<th>Description</th>
|
||||
<th>Time</th>
|
||||
<th>Class</th>
|
||||
<th>Day</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<jsp:useBean id="lectureList" scope="request" class="java.util.ArrayList<system.bean.LectureBean>"/>
|
||||
<% if (lectureList.size() == 0) {
|
||||
out.print("<tr>");
|
||||
out.print("<td colspon=5>Not Match Result</td>");
|
||||
out.print("</tr>");
|
||||
} else {
|
||||
for (LectureBean lecture : lectureList) {
|
||||
out.print("<tr>");
|
||||
out.print("<td>" + lecture.getLecture() + "</td>");
|
||||
out.print("<td>" + lecture.getDescription() + "</td>");
|
||||
out.print("<td>" + lecture.getTime().getStartTime() + " - " + lecture.getTime().getEndTime() + "</td>");
|
||||
out.print("<td>" + lecture.getClassName() + "</td>");
|
||||
out.print("<td>" + lecture.getDay().getDay() + "</td>");
|
||||
out.print("<td><a href='lecture?id=" + lecture.getId() + "'><button type='button' class='btn btn-info tableBtn'><i class='material-icons'>edit</i></button></a>");
|
||||
out.print("<a href='lecture?id=" + lecture.getId() + "&action=delete'><button type='button' class='btn btn-danger tableBtn'><i class='material-icons'>delete</i></button></a>");
|
||||
out.print("</td></tr>");
|
||||
}
|
||||
}
|
||||
out.print("</table>");
|
||||
if (lectureList.size() == 0) {
|
||||
out.print("<br><br><br><br><br>");
|
||||
out.print("<a href='lecture'><button type='button' class='btn btn-secondary'>Show All</button></a>");
|
||||
}
|
||||
%>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Latest Users -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<br><br>
|
||||
<footer></footer>
|
||||
|
||||
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/1.10.20/js/dataTables.bootstrap4.min.js"></script>
|
||||
<script src="../js/bootstrap.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('.alert').alert();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
193
_resources/it114105/itp4511/Assignment/web/admin/lectureAdd.jsp
Normal file
193
_resources/it114105/itp4511/Assignment/web/admin/lectureAdd.jsp
Normal file
@@ -0,0 +1,193 @@
|
||||
<%--
|
||||
Document : dashboard
|
||||
Created on : 2019/11/11, 下午 10:08:39
|
||||
Author : JerryKwok
|
||||
--%>
|
||||
|
||||
<%@page import="system.bean.TeacherBean"%>
|
||||
<%@page import="system.bean.LectureDayBean"%>
|
||||
<%@page import="system.bean.LectureTimeBean"%>
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8" import="system.bean.StudentBean, system.bean.ClassBean, java.util.ArrayList"%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Admin Area | Dashboard</title>
|
||||
<!-- Bootstrap core CSS -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
rel="stylesheet">
|
||||
<link href="../css/bootstrap.css" rel="stylesheet">
|
||||
<link href="../css/style.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<jsp:include page="../header.jsp"></jsp:include>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<%@taglib uri="/WEB-INF/tlds/nav-taglib.tld" prefix="nav" %>
|
||||
<nav:showNav role="Admin" active="lecture" />
|
||||
</div>
|
||||
|
||||
<div class="col-lg-9">
|
||||
<!-- Website Overview -->
|
||||
<div class="card">
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title">Edit Student Class</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<%
|
||||
if (request.getAttribute("dupMes") != null) {
|
||||
out.print("<div class='alert alert-danger alert-dismissible fade show' role='alert'>");
|
||||
out.print("<strong>Teacher must attend other class</strong>");
|
||||
out.print("<button type='button' class='close' data-dismiss='alert' aria-label='Close'>");
|
||||
out.print("<span aria-hidden='true'>×</span></button></div>");
|
||||
}
|
||||
%>
|
||||
<br>
|
||||
<jsp:useBean id="classList" scope="request" class="ArrayList<system.bean.ClassBean>"/>
|
||||
<jsp:useBean id="dayList" scope="request" class="ArrayList<system.bean.LectureDayBean>"/>
|
||||
<jsp:useBean id="timeList" scope="request" class="ArrayList<system.bean.LectureTimeBean>" />
|
||||
<jsp:useBean id="teacherList" scope="request" class="ArrayList<system.bean.TeacherBean>" />
|
||||
<form action="lecture" method="POST">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>Lecture ID</th>
|
||||
<td>The Lecutre ID will Auto generate</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Lecture</th>
|
||||
<td><input type="text" name="lecture" class="form-control" value="<%= request.getAttribute("lecture") != null ? request.getAttribute("lecture") : ""%>" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Description</th>
|
||||
<td><textarea class="form-control" name="description"><%= request.getAttribute("description") != null ? request.getAttribute("description") : ""%></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Class</th>
|
||||
<td>
|
||||
<select name="className" required>
|
||||
<%
|
||||
if (request.getAttribute("className") != null) {
|
||||
for (ClassBean className : classList) {
|
||||
if (className.getId().equals(request.getAttribute("className"))) {
|
||||
out.print("<option value='" + className.getId() + "' selected>" + className.getClassName() + "</option>");
|
||||
} else {
|
||||
out.print("<option value='" + className.getId() + "'>" + className.getClassName() + "</option>");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (ClassBean className : classList) {
|
||||
out.print("<option value='" + className.getId() + "'>" + className.getClassName() + "</option>");
|
||||
}
|
||||
}
|
||||
|
||||
%>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Time</th>
|
||||
<td>
|
||||
<select name="time" required>
|
||||
<% if (request.getAttribute("time") != null) {
|
||||
for (LectureTimeBean time : timeList) {
|
||||
if (time.getId().equals(request.getAttribute("time"))) {
|
||||
out.print("<option value='" + time.getId() + "' selected>" + time.getStartTime() + "-" + time.getEndTime() + "</option>");
|
||||
} else {
|
||||
out.print("<option value='" + time.getId() + "'>" + time.getStartTime() + "-" + time.getEndTime() + "</option>");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (LectureTimeBean time : timeList) {
|
||||
out.print("<option value='" + time.getId() + "'>" + time.getStartTime() + "-" + time.getEndTime() + "</option>");
|
||||
}
|
||||
}
|
||||
|
||||
%>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Day</th>
|
||||
<td>
|
||||
<select name="day" required>
|
||||
<% if (request.getAttribute("day") != null) {
|
||||
for (LectureDayBean day : dayList) {
|
||||
if (day.getId().equals(request.getAttribute("day"))) {
|
||||
out.print("<option value='" + day.getId() + "' selected>" + day.getDay() + "</option>");
|
||||
} else {
|
||||
out.print("<option value='" + day.getId() + "'>" + day.getDay() + "</option>");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (LectureDayBean day : dayList) {
|
||||
out.print("<option value='" + day.getId() + "'>" + day.getDay() + "</option>");
|
||||
}
|
||||
}
|
||||
%>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Teacher</th>
|
||||
<td>
|
||||
<select name="teacher" required>
|
||||
<%
|
||||
out.print("<option value=''> </option>");
|
||||
if (request.getAttribute("teacher") != null) {
|
||||
for (TeacherBean teacher : teacherList) {
|
||||
if (teacher.getId().equals(request.getAttribute("teacher"))) {
|
||||
out.print("<option value='" + teacher.getId() + "' selected>" + teacher.getTeacherFormalName() + "</option>");
|
||||
} else {
|
||||
out.print("<option value='" + teacher.getId() + "'>" + teacher.getTeacherFormalName() + "</option>");
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
for (TeacherBean teacher : teacherList) {
|
||||
out.print("<option value='" + teacher.getId() + "'>" + teacher.getTeacherFormalName() + "</option>");
|
||||
}
|
||||
}
|
||||
|
||||
%>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="submit" class="btn btn-primary">Add Lecture</button>
|
||||
<input type="hidden" name="action" value="add">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<a href="lecture">
|
||||
<button type="lecture" class="btn btn-secondary">
|
||||
Back
|
||||
</button>
|
||||
</a>
|
||||
<!-- Latest Users -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<br><br>
|
||||
<footer></footer>
|
||||
|
||||
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<script src="../js/bootstrap.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('.alert').alert();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
211
_resources/it114105/itp4511/Assignment/web/admin/lectureEdit.jsp
Normal file
211
_resources/it114105/itp4511/Assignment/web/admin/lectureEdit.jsp
Normal file
@@ -0,0 +1,211 @@
|
||||
<%--
|
||||
Document : dashboard
|
||||
Created on : 2019/11/11, 下午 10:08:39
|
||||
Author : JerryKwok
|
||||
--%>
|
||||
|
||||
<%@page import="system.bean.TeacherBean"%>
|
||||
<%@page import="system.bean.LectureDayBean"%>
|
||||
<%@page import="system.bean.LectureTimeBean"%>
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8" import="system.bean.StudentBean, system.bean.ClassBean, java.util.ArrayList"%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Admin Area | Dashboard</title>
|
||||
<!-- Bootstrap core CSS -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
rel="stylesheet">
|
||||
<link href="../css/bootstrap.css" rel="stylesheet">
|
||||
<link href="../css/style.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<jsp:include page="../header.jsp"></jsp:include>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<%@taglib uri="/WEB-INF/tlds/nav-taglib.tld" prefix="nav" %>
|
||||
<nav:showNav role="Admin" active="lecture" />
|
||||
</div>
|
||||
|
||||
<div class="col-lg-9">
|
||||
<!-- Website Overview -->
|
||||
<div class="card">
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title">Edit Student Class</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<%
|
||||
if (request.getAttribute("dupMes") != null) {
|
||||
out.print("<div class='alert alert-danger alert-dismissible fade show' role='alert'>");
|
||||
out.print("<strong>Teacher must attend other class</strong>");
|
||||
out.print("<button type='button' class='close' data-dismiss='alert' aria-label='Close'>");
|
||||
out.print("<span aria-hidden='true'>×</span></button></div>");
|
||||
}
|
||||
%>
|
||||
<br>
|
||||
<jsp:useBean id="lectureBean" scope="request" class="system.bean.LectureBean"/>
|
||||
<jsp:useBean id="classList" scope="request" class="ArrayList<system.bean.ClassBean>"/>
|
||||
<jsp:useBean id="dayList" scope="request" class="ArrayList<system.bean.LectureDayBean>"/>
|
||||
<jsp:useBean id="timeList" scope="request" class="ArrayList<system.bean.LectureTimeBean>" />
|
||||
<jsp:useBean id="teacherList" scope="request" class="ArrayList<system.bean.TeacherBean>" />
|
||||
<form action="lecture?id=<%= request.getParameter("id")%>" method="POST">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>Lecture ID</th>
|
||||
<td>${lectureId}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Lecture</th>
|
||||
<td><input type="text" name="lecture" class="form-control" value="<%= request.getAttribute("lecture") != null ? request.getAttribute("lecture") : lectureBean.getLecture()%>" required></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Description</th>
|
||||
<td><textarea class="form-control" name="description"><%= request.getAttribute("description") != null ? request.getAttribute("description") : lectureBean.getDescription()%></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Class</th>
|
||||
<td>
|
||||
<select name="className" required>
|
||||
<%
|
||||
if (request.getAttribute("className") != null) {
|
||||
for (ClassBean className : classList) {
|
||||
if (className.getId().equals(request.getAttribute("className"))) {
|
||||
out.print("<option value='" + className.getId() + "' selected>" + className.getClassName() + "</option>");
|
||||
} else {
|
||||
out.print("<option value='" + className.getId() + "'>" + className.getClassName() + "</option>");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (ClassBean className : classList) {
|
||||
if (className.getClassName().equals(lectureBean.getClassName())) {
|
||||
out.print("<option value='" + className.getId() + "' selected>" + className.getClassName() + "</option>");
|
||||
} else {
|
||||
out.print("<option value='" + className.getId() + "'>" + className.getClassName() + "</option>");
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Time</th>
|
||||
<td>
|
||||
<select name="time" required>
|
||||
<%
|
||||
if (request.getAttribute("time") != null) {
|
||||
for (LectureTimeBean time : timeList) {
|
||||
if (time.getId().equals(request.getAttribute("time"))) {
|
||||
out.print("<option value='" + time.getId() + "' selected>" + time.getStartTime() + "-" + time.getEndTime() + "</option>");
|
||||
} else {
|
||||
out.print("<option value='" + time.getId() + "'>" + time.getStartTime() + "-" + time.getEndTime() + "</option>");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (LectureTimeBean time : timeList) {
|
||||
if (time.getStartTime().equals(lectureBean.getTime().getStartTime()) && time.getEndTime().equals(lectureBean.getTime().getEndTime())) {
|
||||
out.print("<option value='" + time.getId() + "' selected>" + time.getStartTime() + "-" + time.getEndTime() + "</option>");
|
||||
} else {
|
||||
out.print("<option value='" + time.getId() + "'>" + time.getStartTime() + "-" + time.getEndTime() + "</option>");
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Day</th>
|
||||
<td>
|
||||
<select name="day" required>
|
||||
<%
|
||||
if (request.getAttribute("day") != null) {
|
||||
for (LectureDayBean day : dayList) {
|
||||
if (day.getId().equals(request.getAttribute("day"))) {
|
||||
out.print("<option value='" + day.getId() + "' selected>" + day.getDay() + "</option>");
|
||||
} else {
|
||||
out.print("<option value='" + day.getId() + "'>" + day.getDay() + "</option>");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (LectureDayBean day : dayList) {
|
||||
if (day.getDay().equals(lectureBean.getDay().getDay())) {
|
||||
out.print("<option value='" + day.getId() + "' selected>" + day.getDay() + "</option>");
|
||||
} else {
|
||||
out.print("<option value='" + day.getId() + "'>" + day.getDay() + "</option>");
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Teacher</th>
|
||||
<td>
|
||||
<select name="teacher" >
|
||||
<%
|
||||
out.print("<option value=''> </option>");
|
||||
if (request.getAttribute("teacher") != null) {
|
||||
for (TeacherBean teacher : teacherList) {
|
||||
if (teacher.getId().equals(request.getAttribute("teacher"))) {
|
||||
out.print("<option value='" + teacher.getId() + "' selected>" + teacher.getTeacherFormalName() + "</option>");
|
||||
} else {
|
||||
out.print("<option value='" + teacher.getId() + "'>" + teacher.getTeacherFormalName() + "</option>");
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
for (TeacherBean teacher : teacherList) {
|
||||
if (teacher.getId().equals(lectureBean.getTeacherId())) {
|
||||
out.print("<option value='" + teacher.getId() + "' selected>" + teacher.getTeacherFormalName() + "</option>");
|
||||
} else {
|
||||
out.print("<option value='" + teacher.getId() + "'>" + teacher.getTeacherFormalName() + "</option>");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
%>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="submit" class="btn btn-primary">Saved</button>
|
||||
<input type="hidden" name="id" value="${lectureId}">
|
||||
<input type="hidden" name="action" value="save">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<a href="lecture">
|
||||
<button type="lecture" class="btn btn-secondary">
|
||||
Back
|
||||
</button>
|
||||
</a>
|
||||
<!-- Latest Users -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<br><br>
|
||||
<footer></footer>
|
||||
|
||||
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<script src="../js/bootstrap.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('.alert').alert();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
81
_resources/it114105/itp4511/Assignment/web/admin/report.jsp
Normal file
81
_resources/it114105/itp4511/Assignment/web/admin/report.jsp
Normal file
@@ -0,0 +1,81 @@
|
||||
<%--
|
||||
Document : dashboard
|
||||
Created on : 2019/11/11, 下午 10:08:39
|
||||
Author : JerryKwok
|
||||
--%>
|
||||
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8" import="system.bean.ClassBean"%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Admin Area | Dashboard</title>
|
||||
<!-- Bootstrap core CSS -->
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
rel="stylesheet">
|
||||
<link href="../css/bootstrap.css" rel="stylesheet">
|
||||
<link href="../css/style.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<jsp:include page="../header.jsp"></jsp:include>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<%@taglib uri="/WEB-INF/tlds/nav-taglib.tld" prefix="nav" %>
|
||||
<nav:showNav role="Admin" active="report" />
|
||||
</div>
|
||||
<div class="col-lg-9">
|
||||
<!-- Website Overview -->
|
||||
<div class="card">
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title">Select Class to Generate Report </h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Class</th>
|
||||
<th scope="col"> </th>
|
||||
<th scope="col">Head</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<jsp:useBean id="classList" scope="request" class="java.util.ArrayList<system.bean.ClassBean>"/>
|
||||
<%
|
||||
for (ClassBean classVal : classList) {
|
||||
out.print("<tr data-href=\"report?class=" + classVal.getClassName() + "\">");
|
||||
out.print("<td colspan=2>" + classVal.getClassName() + "</td>");
|
||||
out.print("<td>" + classVal.getTeacherBean().getTeacherFormalName() + "</td>");
|
||||
out.print("</tr>");
|
||||
}
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<br>
|
||||
<footer></footer>
|
||||
|
||||
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
|
||||
<script src="js/bootstrap.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$("tr[data-href]").click(function () {
|
||||
window.location.href = $(this).attr("data-href");
|
||||
})
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
257
_resources/it114105/itp4511/Assignment/web/admin/reportClass.jsp
Normal file
257
_resources/it114105/itp4511/Assignment/web/admin/reportClass.jsp
Normal file
@@ -0,0 +1,257 @@
|
||||
<%--
|
||||
Document : dashboard
|
||||
Created on : 2019/11/11, 下午 10:08:39
|
||||
Author : JerryKwok
|
||||
--%>
|
||||
|
||||
<%@page import="java.util.Calendar"%>
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8" import="system.bean.ClassBean, system.bean.SemesterBean, system.bean.StudentBean"%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Admin Area | Dashboard</title>
|
||||
<!-- Bootstrap core CSS -->
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
rel="stylesheet">
|
||||
<link href="../css/bootstrap.css" rel="stylesheet">
|
||||
<link href="../css/style.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
<%
|
||||
String urlStudent = "report?";
|
||||
if (request.getParameter("class") != null) {
|
||||
urlStudent += "class=" + request.getParameter("class") + "&";
|
||||
}
|
||||
if (request.getParameter("year") != null) {
|
||||
urlStudent += "year=" + request.getParameter("year") + "&";
|
||||
} else {
|
||||
urlStudent += "year=" + Calendar.getInstance().get(Calendar.YEAR) + "&";
|
||||
}
|
||||
if (request.getParameter("term") != null) {
|
||||
urlStudent += "term=" + request.getParameter("term") + "&";
|
||||
} else {
|
||||
urlStudent += "term=1&";
|
||||
}
|
||||
%>
|
||||
<body>
|
||||
<jsp:include page="../header.jsp"></jsp:include>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<%@taglib uri="/WEB-INF/tlds/nav-taglib.tld" prefix="nav" %>
|
||||
<nav:showNav role="Admin" active="report" />
|
||||
</div>
|
||||
<div class="col-lg-9">
|
||||
<div class="card">
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title">Select Class to Generate Report</h5>
|
||||
</div>
|
||||
<form action="report" method="GET">
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<label>Class</label>
|
||||
<select class="form-control" name="class">
|
||||
<jsp:useBean id="classList" scope="request" class="java.util.ArrayList<system.bean.ClassBean>"/>
|
||||
<% for (ClassBean classVal : classList) {
|
||||
if (request.getParameter("class").equals(classVal.getClassName())) {
|
||||
out.print("<option value='" + classVal.getClassName() + "' selected>" + classVal.getClassName() + "</option>");
|
||||
} else {
|
||||
out.print("<option value='" + classVal.getClassName() + "'>" + classVal.getClassName() + "</option>");
|
||||
}
|
||||
}
|
||||
%>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Year</label>
|
||||
<select class="form-control" name="year">
|
||||
<jsp:useBean id="yearList" scope="request" class="java.util.ArrayList<system.bean.SemesterBean>"/>
|
||||
<%
|
||||
int counter = 1;
|
||||
for (SemesterBean year : yearList) {
|
||||
if (counter == 1) {
|
||||
out.print("<option value='" + year.getYear() + "' selected>" + year.getYear() + "</option>");
|
||||
} else {
|
||||
out.print("<option value='" + year.getYear() + "'>" + year.getYear() + "</option>");
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
%>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Term</label>
|
||||
<select class="form-control" name="term">
|
||||
<jsp:useBean id="termList" scope="request" class="java.util.ArrayList<system.bean.SemesterBean>"/>
|
||||
<%
|
||||
int count = 1;
|
||||
for (SemesterBean term : termList) {
|
||||
if (count == 1) {
|
||||
out.print("<option value='" + term.getTerm() + "' selected>" + term.getTerm() + " term</option>");
|
||||
} else {
|
||||
out.print("<option value='" + term.getTerm() + "'>" + term.getTerm() + " term</option>");
|
||||
}
|
||||
count++;
|
||||
}
|
||||
%>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<input type="hidden" name="report" id="report" value="">
|
||||
<button type="button" id="btnGenReport" class="btn btn-primary right">Generate</button>
|
||||
<button type="button" id="btnGenLowReport" class="btn btn-danger">Generate Low Attendance</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title"> Report </h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<canvas id="reportChart" width="50px"></canvas>
|
||||
Average Attendance (%): ${attendAVG}
|
||||
</div>
|
||||
</div>
|
||||
<!-- Website Overview -->
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<button type="button" id="btnExportExcel" class="btn btn-outline-info">Export Attendance Data to Excel</button>
|
||||
<br><br>
|
||||
<div class="form-group">
|
||||
<table class="table table-hover exportExcel">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Student ID</th>
|
||||
<th scope="col">Student Name</th>
|
||||
<th scope="col">Attend Rate</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<jsp:useBean id="studentAttendList" scope="request" class="java.util.ArrayList<system.bean.StudentBean>"/>
|
||||
<%
|
||||
for (StudentBean student : studentAttendList) {
|
||||
out.print("<tr data-href='" + urlStudent + "studentId=" + student.getId() + "'>");
|
||||
out.print("<td>" + student.getId() + "</td>");
|
||||
out.print("<td>" + student.getName() + "</td>");
|
||||
out.print("<td>" + student.getAttendRate() + " %</td>");
|
||||
out.print("</tr>");
|
||||
}
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<a href="report">
|
||||
<button type="button" class="btn btn-secondary">
|
||||
Back
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<footer></footer>
|
||||
|
||||
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.min.js"></script>
|
||||
<script src="../js/jquery.tableToexcel.js"></script>
|
||||
<script src="js/bootstrap.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$("tr[data-href]").click(function () {
|
||||
window.location.href = $(this).attr("data-href");
|
||||
});
|
||||
|
||||
$("#btnGenReport").click(function(){
|
||||
$("form").submit();
|
||||
});
|
||||
$("#btnGenLowReport").click(function(){
|
||||
$("#report").val("low");
|
||||
$("form").submit();
|
||||
});
|
||||
$("#btnExportExcel").click(function () {
|
||||
$(".exportExcel").table2excel({
|
||||
exclude: ".excludeThisClass",
|
||||
name: "Worksheet Name",
|
||||
filename: "<%= request.getParameter("studentId") + "_Report"%>.xls", // do include extension
|
||||
preserveColors: false // set to true if you want background colors and font colors preserved
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
let reportChart = document.getElementById('reportChart').getContext('2d');
|
||||
Chart.defaults.global.defaultFontFamily = 'Lato';
|
||||
Chart.defaults.global.defaultFontSize = 18;
|
||||
Chart.defaults.global.defaultFontColor = 'black';
|
||||
let massPopChart = new Chart(reportChart, {
|
||||
type: 'pie', // bar, horizontalBar, pie, line, doughnut, radar, polarArea
|
||||
data: {
|
||||
<%
|
||||
if(request.getParameter("report") != null && request.getParameter("report").equals("low"))
|
||||
out.print("labels: ['Student < 39%','Student 40-49%', 'Student 50-60%']");
|
||||
else
|
||||
out.print("labels: ['Student < 60%', 'Student >=60%']");
|
||||
%>,
|
||||
datasets: [{
|
||||
label: 'Population',
|
||||
data: [
|
||||
<%
|
||||
if(request.getParameter("report") != null && request.getParameter("report").equals("low"))
|
||||
out.print(request.getAttribute("numberOfStudentLowAtt") + ", " + request.getAttribute("numberOfStudentDanger") + ", " + request.getAttribute("numberOfStudentWarning"));
|
||||
else
|
||||
out.print(request.getAttribute("numberOfStudentNotMeetTar") + ", " + request.getAttribute("numberOfStudentMeetTar"));
|
||||
|
||||
%>
|
||||
],
|
||||
//backgroundColor:'green',
|
||||
backgroundColor: [
|
||||
'rgba(236, 107, 86, 0.6)',
|
||||
'rgba(71, 179, 156, 0.9)',
|
||||
'rgba(88,80,141,0.8)'
|
||||
],
|
||||
borderWidth: 1,
|
||||
borderColor: '#777',
|
||||
hoverBorderWidth: 3,
|
||||
hoverBorderColor: '#000'
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Meet the Attendance Target',
|
||||
fontSize: 20
|
||||
},
|
||||
legend: {
|
||||
display: true,
|
||||
position: 'right',
|
||||
labels: {
|
||||
fontColor: '#000'
|
||||
}
|
||||
},
|
||||
layout: {
|
||||
padding: {
|
||||
left: 30,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
top: 0
|
||||
}
|
||||
},
|
||||
tooltips: {
|
||||
enabled: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
@@ -0,0 +1,191 @@
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8" import="system.bean.AttendBean, system.bean.StudentBean"%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Admin Area | Dashboard</title>
|
||||
<!-- Bootstrap core CSS -->
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
rel="stylesheet">
|
||||
<link href="../css/bootstrap.css" rel="stylesheet">
|
||||
<link href="../css/style.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<jsp:include page="../header.jsp"></jsp:include>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<%@taglib uri="/WEB-INF/tlds/nav-taglib.tld" prefix="nav" %>
|
||||
<nav:showNav role="Admin" active="report" />
|
||||
</div>
|
||||
<div class="col-lg-9">
|
||||
<!-- Website Overview -->
|
||||
<!-- Latest Users -->
|
||||
<div class="card">
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title">Student Report</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<button type="button" id="btnExportExcel" class="btn btn-outline-info">Export Attendance Data to Excel</button>
|
||||
<br><br>
|
||||
<jsp:useBean id="studentDetials" scope="request" class="system.bean.StudentBean"/>
|
||||
<table class="table table-borderless">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">Student ID:</th>
|
||||
<td><jsp:getProperty name="studentDetials" property="id"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Student Name:</th>
|
||||
<td><jsp:getProperty name="studentDetials" property="name"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Gender :</th>
|
||||
<td><jsp:getProperty name="studentDetials" property="gender"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Student Email:</th>
|
||||
<td><jsp:getProperty name="studentDetials" property="email"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Birthday:</th>
|
||||
<td><jsp:getProperty name="studentDetials" property="birthday"/></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<canvas id="reportChart" width="50px"></canvas>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Total Present Day: </td>
|
||||
<td> ${totalAttendDay}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Present Day: </td>
|
||||
<td> ${presentDay}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Absent: </td>
|
||||
<td> ${absDay}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table table-hover exportExcel">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Date</th>
|
||||
<th>Attend</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<%
|
||||
int id = 1;
|
||||
for (AttendBean attend : studentDetials.getAttendList()) {
|
||||
out.print("<tr>");
|
||||
out.print("<td>" + (id++) + "</td>");
|
||||
out.print("<td>" + attend.getDate() + "</td>");
|
||||
if (attend.isAttend()) {
|
||||
out.print("<td><a href='#' class='badge badge-success'>Present</a></td>");
|
||||
} else {
|
||||
out.print("<td><a href='#' class='badge badge-danger'>Absent</a></td>");
|
||||
}
|
||||
out.print("</tr>");
|
||||
}
|
||||
|
||||
%>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<a href="report?class=<%= request.getParameter("class")%>&year=<%= request.getParameter("year")%>&term=<%= request.getParameter("term")%>">
|
||||
<button type="button" class="btn btn-secondary">
|
||||
Back
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<br><br>
|
||||
<footer></footer>
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.min.js"></script>
|
||||
<script src="../js/bootstrap.min.js"></script>
|
||||
<script src="../js/jquery.tableToexcel.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$("#btnExportExcel").click(function () {
|
||||
$(".exportExcel").table2excel({
|
||||
exclude: ".excludeThisClass",
|
||||
name: "Worksheet Name",
|
||||
filename: "<%= request.getParameter("studentId") + "_Report"%>.xls", // do include extension
|
||||
preserveColors: false // set to true if you want background colors and font colors preserved
|
||||
});
|
||||
});
|
||||
});
|
||||
let reportChart = document.getElementById('reportChart').getContext('2d');
|
||||
Chart.defaults.global.defaultFontFamily = 'Lato';
|
||||
Chart.defaults.global.defaultFontSize = 18;
|
||||
Chart.defaults.global.defaultFontColor = 'black';
|
||||
let massPopChart = new Chart(reportChart, {
|
||||
type: 'pie', // bar, horizontalBar, pie, line, doughnut, radar, polarArea
|
||||
data: {
|
||||
labels: ['Present(%)', 'Absent(%)'],
|
||||
datasets: [{
|
||||
label: false,
|
||||
data: [
|
||||
Math.round(${presentDay/totalAttendDay*100}),
|
||||
Math.round(${absDay/totalAttendDay*100})
|
||||
],
|
||||
//backgroundColor:'green',
|
||||
backgroundColor: [
|
||||
'rgba(71, 179, 156, 0.9)',
|
||||
'rgba(236, 107, 86, 0.6)'
|
||||
|
||||
],
|
||||
borderWidth: 1,
|
||||
borderColor: '#777',
|
||||
hoverBorderWidth: 3,
|
||||
hoverBorderColor: '#000'
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Attendance',
|
||||
fontSize: 20
|
||||
},
|
||||
legend: {
|
||||
display: true,
|
||||
position: 'right',
|
||||
labels: {
|
||||
fontColor: '#000'
|
||||
}
|
||||
},
|
||||
layout: {
|
||||
padding: {
|
||||
left: 20,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
top: 0
|
||||
}
|
||||
},
|
||||
tooltips: {
|
||||
enabled: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
@@ -0,0 +1,95 @@
|
||||
<%--
|
||||
Document : dashboard
|
||||
Created on : 2019/11/11, 下午 10:08:39
|
||||
Author : JerryKwok
|
||||
--%>
|
||||
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8"%>
|
||||
<%@page import="system.bean.ClassBean, java.util.ArrayList"%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Admin Area | Dashboard</title>
|
||||
<!-- Bootstrap core CSS -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
rel="stylesheet">
|
||||
<link href="../css/bootstrap.css" rel="stylesheet">
|
||||
<link href="../css/style.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<jsp:include page="../header.jsp"></jsp:include>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<%@taglib uri="/WEB-INF/tlds/nav-taglib.tld" prefix="nav" %>
|
||||
<nav:showNav role="Admin" active="Schdeule" />
|
||||
</div>
|
||||
<div class="col-lg-9">
|
||||
<!-- Main -->
|
||||
<div class="card">
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title">Schedule</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Schedule</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr data-href="schedule?class=schoolDay">
|
||||
<td colspon="3">School Day Schedule</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br><br>
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Class</th>
|
||||
<th scope="col"> </th>
|
||||
<th scope="col">Head</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<jsp:useBean id="classList" scope="request" class="java.util.ArrayList<system.bean.ClassBean>"/>
|
||||
<%
|
||||
for (ClassBean classVal : classList) {
|
||||
out.print("<tr data-href=\"schedule?class=" + classVal.getId()+ "\">");
|
||||
out.print("<td colspan=2>" + classVal.getClassName() + "</td>");
|
||||
out.print("<td>" + classVal.getTeacherBean().getTeacherFormalName() + "</td>");
|
||||
out.print("</tr>");
|
||||
}
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<br><br>
|
||||
<footer></footer>
|
||||
|
||||
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
|
||||
<script src="../js/bootstrap.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$("tr[data-href]").click(function () {
|
||||
window.location.href = $(this).attr("data-href");
|
||||
})
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
@@ -0,0 +1,123 @@
|
||||
<%--
|
||||
Document : dashboard
|
||||
Created on : 2019/11/11, 下午 10:08:39
|
||||
Author : JerryKwok
|
||||
--%>
|
||||
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8" import="system.bean.LectureBean, system.bean.LectureDayBean, system.bean.LectureTimeBean"%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Admin Area | Dashboard</title>
|
||||
<!-- Bootstrap core CSS -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
rel="stylesheet">
|
||||
<link href="../css/bootstrap.css" rel="stylesheet">
|
||||
<link href="../css/style.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<jsp:include page="../header.jsp"></jsp:include>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<%@taglib uri="/WEB-INF/tlds/nav-taglib.tld" prefix="nav" %>
|
||||
<nav:showNav role="Admin" active="Schdeule" />
|
||||
</div>
|
||||
|
||||
<div class="col-lg-9">
|
||||
<!-- Latest Users -->
|
||||
<div class="card">
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title">Schedule</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<jsp:useBean id="dayList" scope="request" class="java.util.ArrayList<system.bean.LectureDayBean>"/>
|
||||
<jsp:useBean id="timeList" scope="request" class="java.util.ArrayList<system.bean.LectureTimeBean>"/>
|
||||
<jsp:useBean id="lectureList" scope="request" class="java.util.ArrayList<system.bean.LectureBean>"/>
|
||||
|
||||
<table class="table table-bordered table-hover text-center">
|
||||
|
||||
<%
|
||||
out.print("<tr>");
|
||||
out.print("<th> Time </th>");
|
||||
for (LectureDayBean day : dayList) {
|
||||
out.print("<th>DAY " + day.getDay() + "</th>");
|
||||
}
|
||||
String[] schoolDays = {"A", "B", "C", "D", "E", "F"};
|
||||
out.print("</tr>");
|
||||
int countDay = dayList.size();
|
||||
for (LectureTimeBean time : timeList) {
|
||||
out.print("<tr>");
|
||||
out.print("<td>" + time.getStartTime() + "-" + time.getEndTime());
|
||||
int count = 0;
|
||||
int countPrint = 0;
|
||||
|
||||
|
||||
loopout:
|
||||
for (String schoolDay : schoolDays) {
|
||||
boolean printed = false;
|
||||
System.out.println("TEST---" + schoolDay);
|
||||
for (LectureBean lecture : lectureList) {
|
||||
if (lecture.getTime().getStartTime().equals(time.getStartTime()) && lecture.getTime().getEndTime().equals(time.getEndTime())) {
|
||||
if (lecture.getTime().isFullweek()) {
|
||||
System.out.println("FullWEEK");
|
||||
out.print("<td colspan='" + dayList.size() + "'>" + lecture.getLecture() + "</td>");
|
||||
break loopout;
|
||||
} else {
|
||||
System.out.println("Lecture---" + lecture.getDay().getDay());
|
||||
if (schoolDay.equalsIgnoreCase(lecture.getDay().getDay())) {
|
||||
System.out.println("printed");
|
||||
out.print("<td>" + lecture.getLecture() + "</td>");
|
||||
printed = true;
|
||||
countPrint++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
count++;
|
||||
|
||||
}
|
||||
|
||||
if (!printed) {
|
||||
System.out.println("NOTPrintandPrintTDTD");
|
||||
out.print("<td></td>");
|
||||
}
|
||||
if (lectureList.size() == 0) {
|
||||
for (int i = dayList.size(); i > 0; i--) {
|
||||
out.print("<td></td>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
out.print("</tr>");
|
||||
}
|
||||
%>
|
||||
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<a href="schedule"><button type="button" class="btn btn-secondary">Back</button></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<br><br>
|
||||
<footer></footer>
|
||||
|
||||
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<script src="../js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
@@ -0,0 +1,307 @@
|
||||
<%--
|
||||
Document : dashboard
|
||||
Created on : 2019/11/11, 下午 10:08:39
|
||||
Author : JerryKwok
|
||||
--%>
|
||||
|
||||
<%@page import="java.text.SimpleDateFormat"%>
|
||||
<%@page import="java.util.Calendar"%>
|
||||
<%@page import="java.util.GregorianCalendar"%>
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8" import="system.bean.LectureBean, system.bean.LectureDayBean, system.bean.LectureTimeBean, system.bean.SchedulerBean"%>
|
||||
<!DOCTYPE html>
|
||||
<%
|
||||
String[] dayOfweeks = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
|
||||
String[] months = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
|
||||
String[] schoolDay = {"A", "B", "C", "D", "E", "F"};
|
||||
GregorianCalendar calendar = new GregorianCalendar(2019, 8, 1);
|
||||
GregorianCalendar preCalendar = new GregorianCalendar(2019, 7, 1);
|
||||
SimpleDateFormat dateFormal = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String event = "";
|
||||
%>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Admin Area | Dashboard</title>
|
||||
<!-- Bootstrap core CSS -->
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
rel="stylesheet">
|
||||
<link href="../css/bootstrap.css" rel="stylesheet">
|
||||
<link href="../css/style.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<jsp:include page="../header.jsp"></jsp:include>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<%@taglib uri="/WEB-INF/tlds/nav-taglib.tld" prefix="nav" %>
|
||||
<nav:showNav role="Admin" active="Schdeule" />
|
||||
</div>
|
||||
|
||||
<div class="col-lg-9">
|
||||
<!-- Latest Users -->
|
||||
<div class="card">
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title">Scheel Calendar List</h5>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<%
|
||||
if (request.getAttribute("deleteMes") != null) {
|
||||
out.print("<div class='alert alert-success alert-dismissible fade show formated-table' role='alert'>");
|
||||
out.print("<strong>Schedule #" + request.getAttribute("deleteMes") + " Deleted </strong>");
|
||||
out.print("<button type='button' class='close' data-dismiss='alert' aria-label='Close'>");
|
||||
out.print("<span aria-hidden='true'>×</span></button></div>");
|
||||
}
|
||||
if (request.getAttribute("addMes") != null) {
|
||||
out.print("<div class='alert alert-success alert-dismissible fade show formated-table' role='alert'>");
|
||||
out.print("<strong>Schedule Added </strong>");
|
||||
out.print("<button type='button' class='close' data-dismiss='alert' aria-label='Close'>");
|
||||
out.print("<span aria-hidden='true'>×</span></button></div>");
|
||||
}
|
||||
if (request.getAttribute("saveMes") != null) {
|
||||
out.print("<div class='alert alert-success alert-dismissible fade show formated-table' role='alert'>");
|
||||
out.print("<strong>Schedule #" + request.getAttribute("saveMes") + " Saved </strong>");
|
||||
out.print("<button type='button' class='close' data-dismiss='alert' aria-label='Close'>");
|
||||
out.print("<span aria-hidden='true'>×</span></button></div>");
|
||||
}
|
||||
%>
|
||||
<br>
|
||||
<form action="schedule?class=schoolDay" method="POST" class="format">
|
||||
<button type="submit" class="btn btn-primary">Add Day</button>
|
||||
<input type="hidden" name="action" value="addPage">
|
||||
</form>
|
||||
<form class="form-inline float-right" action="schedule?class=schoolDay" method="POST">
|
||||
<div class="form-group mb-2">
|
||||
<font>Search: </font>
|
||||
</div>
|
||||
<div class="form-group mx-sm-3 mb-2">
|
||||
<input list="searchlist" type="text" class="form-control" name="searchVal" id="searchVal" placeholder="Search...">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-dark mb-2">Search</button>
|
||||
<input type="hidden" name="action" value="search">
|
||||
</form>
|
||||
<jsp:useBean id="scheduleAllList" scope="request" class="java.util.ArrayList<system.bean.SchedulerBean>"/>
|
||||
<table class="table">
|
||||
<thead class="thead-dark">
|
||||
<th>Title</th>
|
||||
<th>Start Date</th>
|
||||
<th>End Date</th>
|
||||
<th>Holiday</th>
|
||||
<th>School Day</th>
|
||||
<th>Action</th>
|
||||
</thead>
|
||||
<%
|
||||
for (SchedulerBean schedule : scheduleAllList) {
|
||||
out.print("<tr>");
|
||||
out.print("<td>" + schedule.getTitle() + "</td>");
|
||||
out.print("<td>" + schedule.getStart_date() + "</td>");
|
||||
out.print("<td>" + schedule.getEnd_date() + "</td>");
|
||||
out.print("<td>" + schedule.isHoliday() + "</td>");
|
||||
out.print("<td>" + schedule.isSchoolDay() + "</td>");
|
||||
out.print("<td>");
|
||||
out.print("<a href='schedule?class=schoolDay&id=" + schedule.getId() + "'><button type='button' class='btn btn-info tableBtn'><i class='material-icons'>edit</i></button></a> ");
|
||||
out.print("<a href='schedule?class=schoolDay&id=" + schedule.getId() + "&action=delete'><button type='button' class='btn btn-danger tableBtn'><i class='material-icons'>delete</i></button></a>");
|
||||
out.print("</td>");
|
||||
out.print("</tr>");
|
||||
}
|
||||
%>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<a href="schedule"><button type="button" class="btn btn-secondary">Back</button></a>
|
||||
<br>
|
||||
<div class="card">
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title">Scheel Calendar</h5>
|
||||
</div>
|
||||
<jsp:useBean id="scheduleList" scope="request" class="java.util.ArrayList<system.bean.SchedulerBean>"/>
|
||||
<div class="card-body">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<% out.print("<tr>");
|
||||
out.print("<th>Month</th>");
|
||||
for (String dayOfweek : dayOfweeks) {
|
||||
out.print("<th>" + dayOfweek + "</th>");
|
||||
}
|
||||
out.print("<th>Events</th>");
|
||||
out.print("</tr>");
|
||||
%>
|
||||
</thead>
|
||||
<%
|
||||
out.print("<tr>");
|
||||
int schoolDayPointer = 0;
|
||||
int lastCache = 0;
|
||||
for (int i = 0; i <= months.length; i++) {
|
||||
int fillError = 0;
|
||||
if (calendar.get(Calendar.MONTH) == 4 || calendar.get(Calendar.MONTH) == 7) {
|
||||
fillError = 1;
|
||||
}
|
||||
out.print("<td rowspan=\"" + (Calendar.WEEK_OF_MONTH + 1 + fillError) + "\">" + (calendar.get(Calendar.MONTH) + 1) + "</td>");
|
||||
System.out.println((Calendar.WEEK_OF_MONTH + 1 + fillError) + "testW");
|
||||
int weekDay = 7;
|
||||
for (int countDay = calendar.getActualMaximum(calendar.DAY_OF_MONTH); countDay > 0; countDay--) {
|
||||
boolean hasEventDay = false;
|
||||
if (schoolDayPointer == schoolDay.length) {
|
||||
schoolDayPointer = 0;
|
||||
}
|
||||
if (weekDay <= 0) {
|
||||
out.print("<td>" + event + "</td>");
|
||||
out.print("</tr>");
|
||||
out.print("<tr>");
|
||||
weekDay = 7;
|
||||
event = "";
|
||||
}
|
||||
|
||||
String today = dateFormal.format(calendar.getTime());
|
||||
System.out.println(today);
|
||||
for (SchedulerBean schedule : scheduleList) {
|
||||
if (schedule.getStart_date().equalsIgnoreCase(today)) {
|
||||
hasEventDay = true;
|
||||
if (!schedule.getEnd_date().equalsIgnoreCase(schedule.getStart_date())) {
|
||||
event += schedule.getStart_day_Date() + "." + schedule.getStart_day_Month() + " - " + schedule.getEnd_day_Date() + "." + schedule.getEnd_day_Month() + " " + schedule.getTitle() + "<br>";
|
||||
System.out.println(schedule.getCountDate());
|
||||
|
||||
for (int count = schedule.getCountDate(); count >= 0; count--) {
|
||||
if (count == 0) {
|
||||
hasEventDay = false;
|
||||
}
|
||||
if (calendar.get(Calendar.DATE) == 1 && lastCache > 0) {
|
||||
if (lastCache >= 7) {
|
||||
out.print("<td>" + calendar.get(Calendar.DATE) + "*</td>");
|
||||
} else {
|
||||
for (int printCache = lastCache; printCache > 0; printCache--) {
|
||||
System.out.println("<td></td>");
|
||||
}
|
||||
out.print("<td>" + calendar.get(Calendar.DATE) + "*</td>");
|
||||
weekDay -= lastCache;
|
||||
}
|
||||
} else if (calendar.get(Calendar.DAY_OF_WEEK) == 1 || calendar.get(Calendar.DAY_OF_WEEK) == 7) {
|
||||
out.print("<td>" + calendar.get(Calendar.DATE) + "*</td>");
|
||||
} else {
|
||||
if (weekDay == 0) {
|
||||
out.print("<td>" + event + "</td>");
|
||||
out.print("</tr>");
|
||||
out.print("<tr>");
|
||||
if (schedule.isHoliday() || !schedule.isSchoolDay()) {
|
||||
out.print("<td>*" + calendar.get(Calendar.DATE) + "*</td>");
|
||||
} else {
|
||||
out.print("<td>*" + calendar.get(Calendar.DATE) + schoolDay[schoolDayPointer] + "^</td>");
|
||||
schoolDayPointer++;
|
||||
if (schoolDayPointer == schoolDay.length) {
|
||||
schoolDayPointer = 0;
|
||||
}
|
||||
}
|
||||
weekDay = 7;
|
||||
} else {
|
||||
if (schedule.isHoliday() || !schedule.isSchoolDay()) {
|
||||
out.print("<td>" + calendar.get(Calendar.DATE) + "*</td>");
|
||||
} else {
|
||||
out.print("<td>" + calendar.get(Calendar.DATE) + schoolDay[schoolDayPointer] + "^</td>");
|
||||
schoolDayPointer++;
|
||||
if (schoolDayPointer == schoolDay.length) {
|
||||
schoolDayPointer = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
calendar.add(Calendar.DAY_OF_WEEK, 1);
|
||||
weekDay--;
|
||||
countDay--;
|
||||
System.out.println(weekDay + "zz");
|
||||
System.out.println(calendar.get(Calendar.DATE) + "hlo");
|
||||
System.out.println(calendar.get(Calendar.DAY_OF_WEEK));
|
||||
if (weekDay == 0) {
|
||||
out.print("<td>" + event + "</td>");
|
||||
out.print("</tr>");
|
||||
out.print("<tr>");
|
||||
weekDay = 7;
|
||||
event = "";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (schedule.isHoliday() || !schedule.isSchoolDay()) {
|
||||
out.print("<td>" + calendar.get(Calendar.DATE) + "*</td>");
|
||||
} else {
|
||||
out.print("<td>" + calendar.get(Calendar.DATE) + schoolDay[schoolDayPointer] + "^</td>");
|
||||
schoolDayPointer++;
|
||||
if (schoolDayPointer == schoolDay.length) {
|
||||
schoolDayPointer = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
event += schedule.getEnd_day_Date() + "." + schedule.getEnd_day_Month() + " " + schedule.getTitle() + "<br>";
|
||||
|
||||
System.out.println("TODAY " + today);
|
||||
}
|
||||
|
||||
}
|
||||
System.out.println(calendar.get(Calendar.DATE) + "weekday");
|
||||
System.out.println(calendar.get(Calendar.DAY_OF_WEEK) + "week");
|
||||
System.out.println(hasEventDay);
|
||||
|
||||
if (!hasEventDay && calendar.get(Calendar.DATE) == 1 && lastCache >= 7) {
|
||||
if (hasEventDay == false && (calendar.get(Calendar.DAY_OF_WEEK) == 1 || calendar.get(Calendar.DAY_OF_WEEK) == 7)) {
|
||||
out.print("<td>" + calendar.get(Calendar.DATE) + "</td>");
|
||||
|
||||
} else if (!hasEventDay && calendar.get(Calendar.DAY_OF_WEEK) != 1 && calendar.get(Calendar.DAY_OF_WEEK) != 7) {
|
||||
out.print("<td>" + calendar.get(Calendar.DATE) + schoolDay[schoolDayPointer] + "</td>");
|
||||
schoolDayPointer++;
|
||||
}
|
||||
} else if (!hasEventDay && calendar.get(Calendar.DATE) == 1 && lastCache > 0) {
|
||||
for (int printCache = lastCache; printCache > 0; printCache--) {
|
||||
out.print("<td></td>");
|
||||
}
|
||||
if (hasEventDay == false && (calendar.get(Calendar.DAY_OF_WEEK) == 1 || calendar.get(Calendar.DAY_OF_WEEK) == 7)) {
|
||||
out.print("<td>" + calendar.get(Calendar.DATE) + "</td>");
|
||||
|
||||
} else if (!hasEventDay && calendar.get(Calendar.DAY_OF_WEEK) != 1 && calendar.get(Calendar.DAY_OF_WEEK) != 7) {
|
||||
out.print("<td>" + calendar.get(Calendar.DATE) + schoolDay[schoolDayPointer] + "</td>");
|
||||
schoolDayPointer++;
|
||||
}
|
||||
weekDay -= lastCache;
|
||||
} else if (!hasEventDay && calendar.get(Calendar.DAY_OF_WEEK) != 1 && calendar.get(Calendar.DAY_OF_WEEK) != 7) {
|
||||
out.print("<td>" + calendar.get(Calendar.DATE) + schoolDay[schoolDayPointer] + "</td>");
|
||||
schoolDayPointer++;
|
||||
} else if (hasEventDay == false && (calendar.get(Calendar.DAY_OF_WEEK) == 1 || calendar.get(Calendar.DAY_OF_WEEK) == 7)) {
|
||||
out.print("<td>" + calendar.get(Calendar.DATE) + "</td>");
|
||||
}
|
||||
|
||||
if (weekDay == 0) {
|
||||
out.print("<td>" + event + "</td>");
|
||||
out.print("</tr>");
|
||||
out.print("<tr>");
|
||||
}
|
||||
System.out.println(weekDay);
|
||||
weekDay--;
|
||||
if (countDay == 1) {
|
||||
lastCache = calendar.get(Calendar.DAY_OF_WEEK);
|
||||
}
|
||||
calendar.add(Calendar.DAY_OF_WEEK, 1);
|
||||
}
|
||||
out.print("</tr>");
|
||||
|
||||
}
|
||||
out.print("</tr>");
|
||||
%>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<a href="schedule"><button type="button" class="btn btn-secondary">Back</button></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<br><br>
|
||||
<footer></footer>
|
||||
|
||||
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<script src="../js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
@@ -0,0 +1,131 @@
|
||||
<%--
|
||||
Document : dashboard
|
||||
Created on : 2019/11/11, 下午 10:08:39
|
||||
Author : JerryKwok
|
||||
--%>
|
||||
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8" import="system.bean.StudentBean, system.bean.ClassBean, java.util.ArrayList"%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Admin Area | Dashboard</title>
|
||||
<!-- Bootstrap core CSS -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
rel="stylesheet">
|
||||
<link href="../css/bootstrap.css" rel="stylesheet">
|
||||
<link href="../css/style.css" rel="stylesheet">
|
||||
<link href="../css/bootstrap-datepicker.min.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
<%
|
||||
String role = request.getParameter("role");
|
||||
%>
|
||||
<body>
|
||||
<jsp:include page="../header.jsp"></jsp:include>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<%@taglib uri="/WEB-INF/tlds/nav-taglib.tld" prefix="nav" %>
|
||||
<nav:showNav role="Admin" active="Schedule" />
|
||||
</div>
|
||||
|
||||
<div class="col-lg-9">
|
||||
<!-- Website Overview -->
|
||||
<div class="card">
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title">Edit Student Information</h5>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<%
|
||||
if (request.getAttribute("errMes") != null) {
|
||||
out.print("<div class='alert alert-danger alert-dismissible fade show' role='alert'>");
|
||||
out.print("<strong>School Day and Holiday can not checked in same time</strong>");
|
||||
out.print("<button type='button' class='close' data-dismiss='alert' aria-label='Close'>");
|
||||
out.print("<span aria-hidden='true'>×</span></button></div>");
|
||||
}
|
||||
if (request.getAttribute("notselectMes") != null) {
|
||||
out.print("<div class='alert alert-danger alert-dismissible fade show' role='alert'>");
|
||||
out.print("<strong>The checkbox must select at least one</strong>");
|
||||
out.print("<button type='button' class='close' data-dismiss='alert' aria-label='Close'>");
|
||||
out.print("<span aria-hidden='true'>×</span></button></div>");
|
||||
}
|
||||
%>
|
||||
<br>
|
||||
<form action="schedule?class=schoolDay" method="POST">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>Title</th>
|
||||
<th><textarea name="title" class="form-control" required><%= request.getAttribute("title") != null ? request.getAttribute("title") : ""%></textarea></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Start Date</th>
|
||||
<td>
|
||||
<div class="form-group">
|
||||
<div class="input-group date">
|
||||
<input type="date" class="form-control" id="startDatedatepicker" name="startDate" value="<%= request.getAttribute("startDate") != null ? request.getAttribute("startDate") : ""%>" required>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>End Date</th>
|
||||
<td>
|
||||
<div class="form-group">
|
||||
<div class="input-group date">
|
||||
<input type="date" class="form-control" id="endDatedatepicker" name="endDate" value="<%= request.getAttribute("endDate") != null ? request.getAttribute("endDate") : ""%>" required>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Holiday</th>
|
||||
<td><input type='checkbox' class="form-check-input" name="holiday" value="isHoliday"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>School Day</th>
|
||||
<td><input type="checkbox" class="form-check-input" name="schoolDay" value="isSchoolDay"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="btn" class="btn btn-primary">Add to Schedule</button>
|
||||
<input type="hidden" name="action" value="add">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<a href="schedule?class=schoolDay"><button type="button" class="btn btn-secondary">Back</button></a>
|
||||
<!-- Latest Users -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<br><br>
|
||||
<footer></footer>
|
||||
|
||||
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<script src="../js/bootstrap.min.js"></script>
|
||||
<script src="../js/bootstrap-datepicker.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#startDatedatepicker').datepicker({
|
||||
format: "yyyy-mm-dd",
|
||||
todayHighlight: true
|
||||
});
|
||||
$('#endDatedatepicker').datepicker({
|
||||
format: "yyyy-mm-dd",
|
||||
todayHighlight: true
|
||||
});
|
||||
$('.alert').alert();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
@@ -0,0 +1,141 @@
|
||||
<%--
|
||||
Document : dashboard
|
||||
Created on : 2019/11/11, 下午 10:08:39
|
||||
Author : JerryKwok
|
||||
--%>
|
||||
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8" import="system.bean.StudentBean, system.bean.ClassBean, java.util.ArrayList"%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Admin Area | Dashboard</title>
|
||||
<!-- Bootstrap core CSS -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
rel="stylesheet">
|
||||
<link href="../css/bootstrap.css" rel="stylesheet">
|
||||
<link href="../css/style.css" rel="stylesheet">
|
||||
<link href="../css/bootstrap-datepicker.min.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
<%
|
||||
String role = request.getParameter("role");
|
||||
%>
|
||||
<body>
|
||||
<jsp:include page="../header.jsp"></jsp:include>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<%@taglib uri="/WEB-INF/tlds/nav-taglib.tld" prefix="nav" %>
|
||||
<nav:showNav role="Admin" active="Schedule" />
|
||||
</div>
|
||||
<jsp:useBean id="scheduleBean" scope="request" class="system.bean.SchedulerBean"/>
|
||||
<div class="col-lg-9">
|
||||
<!-- Website Overview -->
|
||||
<div class="card">
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title">Edit Student Information</h5>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<%
|
||||
if (request.getAttribute("errMes") != null) {
|
||||
out.print("<div class='alert alert-danger alert-dismissible fade show' role='alert'>");
|
||||
out.print("<strong>School Day and Holiday can not checked in same time</strong>");
|
||||
out.print("<button type='button' class='close' data-dismiss='alert' aria-label='Close'>");
|
||||
out.print("<span aria-hidden='true'>×</span></button></div>");
|
||||
}
|
||||
if (request.getAttribute("notselectMes") != null) {
|
||||
out.print("<div class='alert alert-danger alert-dismissible fade show' role='alert'>");
|
||||
out.print("<strong>The checkbox must select at least one</strong>");
|
||||
out.print("<button type='button' class='close' data-dismiss='alert' aria-label='Close'>");
|
||||
out.print("<span aria-hidden='true'>×</span></button></div>");
|
||||
}
|
||||
%>
|
||||
<br>
|
||||
<form action="schedule?class=schoolDay" method="POST">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>Title</th>
|
||||
<th><textarea name="title" class="form-control" required><%= request.getAttribute("title") != null ? request.getAttribute("title") : scheduleBean.getTitle() %></textarea></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Start Date</th>
|
||||
<td>
|
||||
<div class="form-group">
|
||||
<div class="input-group date">
|
||||
<input type="date" class="form-control" id="startDatedatepicker" name="startDate" value="<%= request.getAttribute("startDate") != null ? request.getAttribute("startDate") : scheduleBean.getStart_date() %>" required>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>End Date</th>
|
||||
<td>
|
||||
<div class="form-group">
|
||||
<div class="input-group date">
|
||||
<input type="date" class="form-control" id="endDatedatepicker" name="endDate" value="<%= request.getAttribute("endDate") != null ? request.getAttribute("endDate") : scheduleBean.getEnd_date() %>" required>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<%
|
||||
String holiday ="";
|
||||
String schoolDay = "";
|
||||
if(scheduleBean.isHoliday())
|
||||
holiday = "checked";
|
||||
if(scheduleBean.isSchoolDay())
|
||||
schoolDay = "checked";
|
||||
%>
|
||||
<tr>
|
||||
<th>Holiday</th>
|
||||
<td><input type='checkbox' class="form-check-input" name="holiday" value="isHoliday" <%= holiday %>></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>School Day</th>
|
||||
<td><input type="checkbox" class="form-check-input" name="schoolDay" value="isSchoolDay" <%= schoolDay %>></td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="btn" class="btn btn-primary">Save Schedule</button>
|
||||
<input type="hidden" name="action" value="save">
|
||||
<input type="hidden" name="id" value="<%= request.getParameter("id") %>">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<a href="schedule?class=schoolDay"><button type="button" class="btn btn-secondary">Back</button></a>
|
||||
<!-- Latest Users -->
|
||||
<a href="schedule?class=schoolDay"><button type="button" class="btn btn-secondary">Back</button></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<br><br>
|
||||
<footer></footer>
|
||||
|
||||
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<script src="../js/bootstrap.min.js"></script>
|
||||
<script src="../js/bootstrap-datepicker.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#startDatedatepicker').datepicker({
|
||||
format: "yyyy-mm-dd",
|
||||
todayHighlight: true
|
||||
});
|
||||
$('#endDatedatepicker').datepicker({
|
||||
format: "yyyy-mm-dd",
|
||||
todayHighlight: true
|
||||
});
|
||||
$('.alert').alert();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
7
_resources/it114105/itp4511/Assignment/web/css/bootstrap-datepicker.min.css
vendored
Normal file
7
_resources/it114105/itp4511/Assignment/web/css/bootstrap-datepicker.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
10038
_resources/it114105/itp4511/Assignment/web/css/bootstrap.css
vendored
Normal file
10038
_resources/it114105/itp4511/Assignment/web/css/bootstrap.css
vendored
Normal file
File diff suppressed because it is too large
Load Diff
355
_resources/it114105/itp4511/Assignment/web/css/style.css
Normal file
355
_resources/it114105/itp4511/Assignment/web/css/style.css
Normal file
@@ -0,0 +1,355 @@
|
||||
/*
|
||||
To change this license header, choose License Headers in Project Properties.
|
||||
To change this template file, choose Tools | Templates
|
||||
and open the template in the editor.
|
||||
*/
|
||||
/*
|
||||
Created on : 2019/10/31, 下午 05:12:58
|
||||
Author : jerrykwok
|
||||
*/
|
||||
@font-face {
|
||||
font-family: Raleway-Regular;
|
||||
src: url('../fonts/raleway/Raleway-Regular.ttf');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: Raleway-Medium;
|
||||
src: url('../fonts/raleway/Raleway-Medium.ttf');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: Raleway-SemiBold;
|
||||
src: url('../fonts/raleway/Raleway-SemiBold.ttf');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: Raleway-Bold;
|
||||
src: url('../fonts/raleway/Raleway-Bold.ttf');
|
||||
}
|
||||
|
||||
* {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body, html {
|
||||
height: 100%;
|
||||
font-family: Raleway-Regular, sans-serif;
|
||||
}
|
||||
|
||||
a {
|
||||
font-family: Raleway-Regular;
|
||||
font-size: 14px;
|
||||
line-height: 1.7;
|
||||
color: #666666;
|
||||
margin: 0px;
|
||||
transition: all 0.4s;
|
||||
-webkit-transition: all 0.4s;
|
||||
-o-transition: all 0.4s;
|
||||
-moz-transition: all 0.4s;
|
||||
}
|
||||
|
||||
a:focus {
|
||||
outline: none !important;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
}
|
||||
|
||||
h1,h2,h3,h4,h5,h6 {
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
p {
|
||||
font-family: Raleway-Regular;
|
||||
font-size: 14px;
|
||||
line-height: 1.7;
|
||||
color: #666666;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
ul, li {
|
||||
margin: 0px;
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
input {
|
||||
outline: none;
|
||||
border: none;
|
||||
}
|
||||
|
||||
textarea {
|
||||
outline: none;
|
||||
border: none;
|
||||
}
|
||||
|
||||
textarea:focus, input:focus {
|
||||
border-color: transparent !important;
|
||||
}
|
||||
|
||||
|
||||
label {
|
||||
display: block;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
button {
|
||||
outline: none !important;
|
||||
border: none;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.card{
|
||||
margin-bottom: 20px;
|
||||
background-color: #fff;
|
||||
border-radius: 4px;
|
||||
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05);
|
||||
box-shadow: 0 1px 1px rgba(0,0,0,.05);
|
||||
}
|
||||
.list-group{
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
|
||||
.card-header {
|
||||
padding: 0.85rem 1.25rem 0;
|
||||
}
|
||||
|
||||
iframe {
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
.material-icons {
|
||||
font-size: 20px !important;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.container-login {
|
||||
width: 100%;
|
||||
min-height: 100vh;
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: -moz-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: #ebebeb;
|
||||
}
|
||||
|
||||
|
||||
.wrap-login {
|
||||
width: 560px;
|
||||
background: #fff;
|
||||
border-radius: 10px;
|
||||
position: relative;
|
||||
padding: 80px;
|
||||
min-height: 570px;
|
||||
}
|
||||
|
||||
|
||||
.login-form {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.login-form-title {
|
||||
font-family: Raleway-Medium;
|
||||
font-size: 30px;
|
||||
color: #555555;
|
||||
line-height: 1.2;
|
||||
text-transform: uppercase;
|
||||
text-align: left;
|
||||
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.wrap-input-login {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
background-color: #fff;
|
||||
border: 1px solid #e6e6e6;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.input-login {
|
||||
font-family: Raleway-Medium;
|
||||
color: #555555;
|
||||
line-height: 1.2;
|
||||
font-size: 18px;
|
||||
|
||||
display: block;
|
||||
width: 100%;
|
||||
background: transparent;
|
||||
height: 55px;
|
||||
padding: 0 25px 0 25px;
|
||||
}
|
||||
|
||||
.container-login-form-btn {
|
||||
width: 100%;
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: -moz-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.login-form-btn {
|
||||
font-family: Raleway-Bold;
|
||||
font-size: 16px;
|
||||
color: #fff;
|
||||
line-height: 1.2;
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: -moz-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 0 20px;
|
||||
min-width: 150px;
|
||||
height: 55px;
|
||||
background-color: grey;
|
||||
border-radius: 27px;
|
||||
-webkit-transition: all 0.4s;
|
||||
-o-transition: all 0.4s;
|
||||
-moz-transition: all 0.4s;
|
||||
transition: all 0.4s;
|
||||
}
|
||||
|
||||
.login-form-btn:hover {
|
||||
background-color: black;
|
||||
}
|
||||
|
||||
.bs-callout {
|
||||
padding: 20px;
|
||||
margin: 30px 0;
|
||||
border: 1px solid #BEBEBE;
|
||||
border-left-width: 5px;
|
||||
border-radius: 0px;
|
||||
}
|
||||
.bs-callout h5 {
|
||||
margin-top: 0;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.bs-callout p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.bs-callout code {
|
||||
border-radius: 3px;
|
||||
}
|
||||
.bs-callout+.bs-callout {
|
||||
margin-top: -5px;
|
||||
}
|
||||
.bs-callout-default {
|
||||
border-left-color: black;
|
||||
}
|
||||
|
||||
.bs-callout-primary {
|
||||
border-left-color: gray;
|
||||
}
|
||||
|
||||
.bs-callout-success {
|
||||
border-left-color: #5cb85c;
|
||||
}
|
||||
|
||||
.bs-callout-danger {
|
||||
border-left-color: #d9534f;
|
||||
}
|
||||
|
||||
.bs-callout-warning {
|
||||
border-left-color: #f0ad4e;
|
||||
}
|
||||
|
||||
.bs-callout-info {
|
||||
border-left-color: #5bc0de;
|
||||
}
|
||||
|
||||
#main{
|
||||
min-height: 746px;
|
||||
}
|
||||
.main-color-bg{
|
||||
background-color: black !important;
|
||||
color:#ffffff !important;
|
||||
}
|
||||
.list-group a{
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.header{
|
||||
background-color: #2D2D2D;
|
||||
color:#fff;
|
||||
padding: 20px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.header .userTitle{
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.dash-box{
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
tr[data-href]{
|
||||
cursor: pointer;
|
||||
}
|
||||
.tableBtn {
|
||||
width: 35px;
|
||||
height: 35px;
|
||||
}
|
||||
.tableBtn i{
|
||||
margin-left: -5px;
|
||||
}
|
||||
.format{
|
||||
display: inline;
|
||||
}
|
||||
.format-table{
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
footer{
|
||||
background:#333333;
|
||||
color:#ffffff;
|
||||
text-align:center;
|
||||
padding:30px;
|
||||
margin-top:30px;
|
||||
bottom: 0;
|
||||
width: 100%
|
||||
}
|
||||
|
||||
|
||||
|
||||
@media (max-width: 576px) {
|
||||
.wrap-login {
|
||||
padding-left: 15px;
|
||||
padding-right: 15px;
|
||||
}
|
||||
|
||||
}
|
||||
@media (max-width: 767px) {
|
||||
|
||||
#header .userTitle{
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 990px){
|
||||
footer{
|
||||
position: relative;
|
||||
bottom: 0;
|
||||
}
|
||||
#main{
|
||||
min-height: 760px;
|
||||
}
|
||||
}
|
@@ -0,0 +1,95 @@
|
||||
Copyright (c) 2010, Matt McInerney (matt@pixelspread.com),
|
||||
Copyright (c) 2011, Pablo Impallari (www.impallari.com|impallari@gmail.com),
|
||||
Copyright (c) 2011, Rodrigo Fuenzalida (www.rfuenzalida.com|hello@rfuenzalida.com), with Reserved Font Name Raleway
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
12
_resources/it114105/itp4511/Assignment/web/header.jsp
Normal file
12
_resources/it114105/itp4511/Assignment/web/header.jsp
Normal file
@@ -0,0 +1,12 @@
|
||||
<div class="header">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm-10">
|
||||
<h3>Class Attendance System</h3>
|
||||
</div>
|
||||
<div class="col-sm-2 userTitle text-right">
|
||||
<h6>Hello, <%= session.getAttribute("username") %></h6>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
61
_resources/it114105/itp4511/Assignment/web/index.jsp
Normal file
61
_resources/it114105/itp4511/Assignment/web/index.jsp
Normal file
@@ -0,0 +1,61 @@
|
||||
<%--
|
||||
Document : index
|
||||
Created on : 2019/10/31, 下午 04:52:53
|
||||
Author : jerrykwok
|
||||
--%>
|
||||
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8"%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Login</title>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container-login">
|
||||
<div class="wrap-login">
|
||||
<%
|
||||
if (request.getAttribute("roleMes") != null) {
|
||||
out.print("<div class='alert alert-danger alert-dismissible fade show' role='alert'>");
|
||||
out.print("<strong>Error Role!</strong> You should select the role.");
|
||||
out.print("<button type='button' class='close' data-dismiss='alert' aria-label='Close'>");
|
||||
out.print("<span aria-hidden='true'>×</span>");
|
||||
out.print("</button></div><br>");
|
||||
}
|
||||
%>
|
||||
<form class="login-form" action="/login" method="POST">
|
||||
<span class="login-form-title">
|
||||
Account Login
|
||||
</span>
|
||||
<p>Please select your role</p>
|
||||
<div class="loginFormRole mx-auto">
|
||||
<a href="login?role=Student" class="blockquote text-center">
|
||||
<div class="bs-callout bs-callout-deflaut rounded">
|
||||
<h5>Student</h5>
|
||||
</div>
|
||||
</a>
|
||||
<a href="login?role=Teacher" class="blockquote text-center">
|
||||
<div class="bs-callout bs-callout-primary rounded">
|
||||
<h5>Teacher</h5>
|
||||
</div>
|
||||
</a>
|
||||
<a href="login?role=Admin" class="blockquote text-center">
|
||||
<div class="bs-callout bs-callout-info rounded">
|
||||
<h5>Admin</h5>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<script src="js/bootstrap.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('.alert').alert();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
8
_resources/it114105/itp4511/Assignment/web/js/bootstrap-datepicker.min.js
vendored
Normal file
8
_resources/it114105/itp4511/Assignment/web/js/bootstrap-datepicker.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
7
_resources/it114105/itp4511/Assignment/web/js/bootstrap.min.js
vendored
Normal file
7
_resources/it114105/itp4511/Assignment/web/js/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
_resources/it114105/itp4511/Assignment/web/js/fontawesome.min.js
vendored
Normal file
5
_resources/it114105/itp4511/Assignment/web/js/fontawesome.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,267 @@
|
||||
/*
|
||||
* jQuery table2excel - v1.1.2
|
||||
* jQuery plugin to export an .xls file in browser from an HTML table
|
||||
* https://github.com/rainabba/jquery-table2excel
|
||||
*
|
||||
* Made by rainabba
|
||||
* Under MIT License
|
||||
*/
|
||||
//table2excel.js
|
||||
(function ( $, window, document, undefined ) {
|
||||
var pluginName = "table2excel",
|
||||
|
||||
defaults = {
|
||||
exclude: ".noExl",
|
||||
name: "Table2Excel",
|
||||
filename: "table2excel",
|
||||
fileext: ".xls",
|
||||
exclude_img: true,
|
||||
exclude_links: true,
|
||||
exclude_inputs: true,
|
||||
preserveColors: false
|
||||
};
|
||||
|
||||
// The actual plugin constructor
|
||||
function Plugin ( element, options ) {
|
||||
this.element = element;
|
||||
// jQuery has an extend method which merges the contents of two or
|
||||
// more objects, storing the result in the first object. The first object
|
||||
// is generally empty as we don't want to alter the default options for
|
||||
// future instances of the plugin
|
||||
//
|
||||
this.settings = $.extend( {}, defaults, options );
|
||||
this._defaults = defaults;
|
||||
this._name = pluginName;
|
||||
this.init();
|
||||
}
|
||||
|
||||
Plugin.prototype = {
|
||||
init: function () {
|
||||
var e = this;
|
||||
|
||||
var utf8Heading = "<meta http-equiv=\"content-type\" content=\"application/vnd.ms-excel; charset=UTF-8\">";
|
||||
e.template = {
|
||||
head: "<html xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:x=\"urn:schemas-microsoft-com:office:excel\" xmlns=\"http://www.w3.org/TR/REC-html40\">" + utf8Heading + "<head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets>",
|
||||
sheet: {
|
||||
head: "<x:ExcelWorksheet><x:Name>",
|
||||
tail: "</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet>"
|
||||
},
|
||||
mid: "</x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body>",
|
||||
table: {
|
||||
head: "<table>",
|
||||
tail: "</table>"
|
||||
},
|
||||
foot: "</body></html>"
|
||||
};
|
||||
|
||||
e.tableRows = [];
|
||||
|
||||
// Styling variables
|
||||
var additionalStyles = "";
|
||||
var compStyle = null;
|
||||
|
||||
// get contents of table except for exclude
|
||||
$(e.element).each( function(i,o) {
|
||||
var tempRows = "";
|
||||
$(o).find("tr").not(e.settings.exclude).each(function (i,p) {
|
||||
|
||||
// Reset for this row
|
||||
additionalStyles = "";
|
||||
|
||||
// Preserve background and text colors on the row
|
||||
if(e.settings.preserveColors){
|
||||
compStyle = getComputedStyle(p);
|
||||
additionalStyles += (compStyle && compStyle.backgroundColor ? "background-color: " + compStyle.backgroundColor + ";" : "");
|
||||
additionalStyles += (compStyle && compStyle.color ? "color: " + compStyle.color + ";" : "");
|
||||
}
|
||||
|
||||
// Create HTML for Row
|
||||
tempRows += "<tr style='" + additionalStyles + "'>";
|
||||
|
||||
// Loop through each TH and TD
|
||||
$(p).find("td,th").not(e.settings.exclude).each(function (i,q) { // p did not exist, I corrected
|
||||
|
||||
// Reset for this column
|
||||
additionalStyles = "";
|
||||
|
||||
// Preserve background and text colors on the row
|
||||
if(e.settings.preserveColors){
|
||||
compStyle = getComputedStyle(q);
|
||||
additionalStyles += (compStyle && compStyle.backgroundColor ? "background-color: " + compStyle.backgroundColor + ";" : "");
|
||||
additionalStyles += (compStyle && compStyle.color ? "color: " + compStyle.color + ";" : "");
|
||||
}
|
||||
|
||||
var rc = {
|
||||
rows: $(this).attr("rowspan"),
|
||||
cols: $(this).attr("colspan"),
|
||||
flag: $(q).find(e.settings.exclude)
|
||||
};
|
||||
|
||||
if( rc.flag.length > 0 ) {
|
||||
tempRows += "<td> </td>"; // exclude it!!
|
||||
} else {
|
||||
tempRows += "<td";
|
||||
if( rc.rows > 0) {
|
||||
tempRows += " rowspan='" + rc.rows + "' ";
|
||||
}
|
||||
if( rc.cols > 0) {
|
||||
tempRows += " colspan='" + rc.cols + "' ";
|
||||
}
|
||||
if(additionalStyles){
|
||||
tempRows += " style='" + additionalStyles + "'";
|
||||
}
|
||||
tempRows += ">" + $(q).html() + "</td>";
|
||||
}
|
||||
});
|
||||
|
||||
tempRows += "</tr>";
|
||||
|
||||
});
|
||||
// exclude img tags
|
||||
if(e.settings.exclude_img) {
|
||||
tempRows = exclude_img(tempRows);
|
||||
}
|
||||
|
||||
// exclude link tags
|
||||
if(e.settings.exclude_links) {
|
||||
tempRows = exclude_links(tempRows);
|
||||
}
|
||||
|
||||
// exclude input tags
|
||||
if(e.settings.exclude_inputs) {
|
||||
tempRows = exclude_inputs(tempRows);
|
||||
}
|
||||
e.tableRows.push(tempRows);
|
||||
});
|
||||
|
||||
e.tableToExcel(e.tableRows, e.settings.name, e.settings.sheetName);
|
||||
},
|
||||
|
||||
tableToExcel: function (table, name, sheetName) {
|
||||
var e = this, fullTemplate="", i, link, a;
|
||||
|
||||
e.format = function (s, c) {
|
||||
return s.replace(/{(\w+)}/g, function (m, p) {
|
||||
return c[p];
|
||||
});
|
||||
};
|
||||
|
||||
sheetName = typeof sheetName === "undefined" ? "Sheet" : sheetName;
|
||||
|
||||
e.ctx = {
|
||||
worksheet: name || "Worksheet",
|
||||
table: table,
|
||||
sheetName: sheetName
|
||||
};
|
||||
|
||||
fullTemplate= e.template.head;
|
||||
|
||||
if ( $.isArray(table) ) {
|
||||
Object.keys(table).forEach(function(i){
|
||||
//fullTemplate += e.template.sheet.head + "{worksheet" + i + "}" + e.template.sheet.tail;
|
||||
fullTemplate += e.template.sheet.head + sheetName + i + e.template.sheet.tail;
|
||||
});
|
||||
}
|
||||
|
||||
fullTemplate += e.template.mid;
|
||||
|
||||
if ( $.isArray(table) ) {
|
||||
Object.keys(table).forEach(function(i){
|
||||
fullTemplate += e.template.table.head + "{table" + i + "}" + e.template.table.tail;
|
||||
});
|
||||
}
|
||||
|
||||
fullTemplate += e.template.foot;
|
||||
|
||||
for (i in table) {
|
||||
e.ctx["table" + i] = table[i];
|
||||
}
|
||||
delete e.ctx.table;
|
||||
|
||||
var isIE = navigator.appVersion.indexOf("MSIE 10") !== -1 || (navigator.userAgent.indexOf("Trident") !== -1 && navigator.userAgent.indexOf("rv:11") !== -1); // this works with IE10 and IE11 both :)
|
||||
//if (typeof msie !== "undefined" && msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) // this works ONLY with IE 11!!!
|
||||
if (isIE) {
|
||||
if (typeof Blob !== "undefined") {
|
||||
//use blobs if we can
|
||||
fullTemplate = e.format(fullTemplate, e.ctx); // with this, works with IE
|
||||
fullTemplate = [fullTemplate];
|
||||
//convert to array
|
||||
var blob1 = new Blob(fullTemplate, { type: "text/html" });
|
||||
window.navigator.msSaveBlob(blob1, getFileName(e.settings) );
|
||||
} else {
|
||||
//otherwise use the iframe and save
|
||||
//requires a blank iframe on page called txtArea1
|
||||
txtArea1.document.open("text/html", "replace");
|
||||
txtArea1.document.write(e.format(fullTemplate, e.ctx));
|
||||
txtArea1.document.close();
|
||||
txtArea1.focus();
|
||||
sa = txtArea1.document.execCommand("SaveAs", true, getFileName(e.settings) );
|
||||
}
|
||||
|
||||
} else {
|
||||
var blob = new Blob([e.format(fullTemplate, e.ctx)], {type: "application/vnd.ms-excel"});
|
||||
window.URL = window.URL || window.webkitURL;
|
||||
link = window.URL.createObjectURL(blob);
|
||||
a = document.createElement("a");
|
||||
a.download = getFileName(e.settings);
|
||||
a.href = link;
|
||||
|
||||
document.body.appendChild(a);
|
||||
|
||||
a.click();
|
||||
|
||||
document.body.removeChild(a);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
function getFileName(settings) {
|
||||
return ( settings.filename ? settings.filename : "table2excel" );
|
||||
}
|
||||
|
||||
// Removes all img tags
|
||||
function exclude_img(string) {
|
||||
var _patt = /(\s+alt\s*=\s*"([^"]*)"|\s+alt\s*=\s*'([^']*)')/i;
|
||||
return string.replace(/<img[^>]*>/gi, function myFunction(x){
|
||||
var res = _patt.exec(x);
|
||||
if (res !== null && res.length >=2) {
|
||||
return res[2];
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Removes all link tags
|
||||
function exclude_links(string) {
|
||||
return string.replace(/<a[^>]*>|<\/a>/gi, "");
|
||||
}
|
||||
|
||||
// Removes input params
|
||||
function exclude_inputs(string) {
|
||||
var _patt = /(\s+value\s*=\s*"([^"]*)"|\s+value\s*=\s*'([^']*)')/i;
|
||||
return string.replace(/<input[^>]*>|<\/input>/gi, function myFunction(x){
|
||||
var res = _patt.exec(x);
|
||||
if (res !== null && res.length >=2) {
|
||||
return res[2];
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$.fn[ pluginName ] = function ( options ) {
|
||||
var e = this;
|
||||
e.each(function() {
|
||||
if ( !$.data( e, "plugin_" + pluginName ) ) {
|
||||
$.data( e, "plugin_" + pluginName, new Plugin( this, options ) );
|
||||
}
|
||||
});
|
||||
|
||||
// chain jQuery functions
|
||||
return e;
|
||||
};
|
||||
|
||||
})( jQuery, window, document );
|
5
_resources/it114105/itp4511/Assignment/web/js/popper.min.js
vendored
Normal file
5
_resources/it114105/itp4511/Assignment/web/js/popper.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
59
_resources/it114105/itp4511/Assignment/web/login.jsp
Normal file
59
_resources/it114105/itp4511/Assignment/web/login.jsp
Normal file
@@ -0,0 +1,59 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Login</title>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container-login">
|
||||
<div class="wrap-login">
|
||||
<%
|
||||
if (request.getAttribute("loginMes") != null) {
|
||||
out.print("<div class='alert alert-danger alert-dismissible fade show' role='alert'>");
|
||||
out.print("Invalid login, please try again");
|
||||
out.print("<button type='button' class='close' data-dismiss='alert' aria-label='Close'>");
|
||||
out.print("<span aria-hidden='true'>×</span>");
|
||||
out.print("</button></div><br>");
|
||||
}
|
||||
%>
|
||||
<form class="login-form" action="login?role=<%= request.getParameter("role")%>" method="POST">
|
||||
<span class="login-form-title">
|
||||
Account Login
|
||||
</span>
|
||||
<p><%= request.getParameter("role")%></p>
|
||||
<br><br>
|
||||
<span>
|
||||
Username
|
||||
</span>
|
||||
<div class="wrap-input-login">
|
||||
<input class="input-login" type="text" name="username" value="<%= request.getAttribute("loginMes") != null ? request.getAttribute("loginMes") : ""%>">
|
||||
</div>
|
||||
<br><br>
|
||||
<span>
|
||||
Password
|
||||
</span>
|
||||
<div class="wrap-input-login">
|
||||
<input class="input-login" type="password" name="pwd" >
|
||||
</div>
|
||||
<br><br>
|
||||
<div class="container-login-form-btn">
|
||||
<input type="hidden" name="role" value="<%= request.getParameter("role")%>">
|
||||
<input type="hidden" name="action" value="authenticate">
|
||||
<button class="login-form-btn" type="submit">
|
||||
Login
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<script src="js/bootstrap.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('.alert').alert();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@@ -0,0 +1,191 @@
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8" import="system.bean.AttendBean, system.bean.StudentBean"%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Student Area | Attendance</title>
|
||||
<!-- Bootstrap core CSS -->
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
rel="stylesheet">
|
||||
<link href="../css/bootstrap.css" rel="stylesheet">
|
||||
<link href="../css/style.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<jsp:include page="../header.jsp"></jsp:include>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<%@taglib uri="/WEB-INF/tlds/nav-taglib.tld" prefix="nav" %>
|
||||
<nav:showNav role="Student" active="attendance" />
|
||||
</div>
|
||||
<div class="col-lg-9">
|
||||
<!-- Website Overview -->
|
||||
<!-- Latest Users -->
|
||||
<div class="card">
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title">Attendance</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<button type="button" id="btnExportExcel" class="btn btn-outline-info">Export Attendance Data to Excel</button>
|
||||
<br><br>
|
||||
<jsp:useBean id="studentDetials" scope="request" class="system.bean.StudentBean"/>
|
||||
<table class="table table-borderless">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">Student ID:</th>
|
||||
<td><jsp:getProperty name="studentDetials" property="id"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Student Name:</th>
|
||||
<td><jsp:getProperty name="studentDetials" property="name"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Gender :</th>
|
||||
<td><jsp:getProperty name="studentDetials" property="gender"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Student Email:</th>
|
||||
<td><jsp:getProperty name="studentDetials" property="email"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Birthday:</th>
|
||||
<td><jsp:getProperty name="studentDetials" property="birthday"/></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<canvas id="reportChart" width="50px"></canvas>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Total Present Day: </td>
|
||||
<td> ${totalAttendDay}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Present Day: </td>
|
||||
<td> ${presentDay}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Absent: </td>
|
||||
<td> ${absDay}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table table-hover exportExcel">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Date</th>
|
||||
<th>Attend</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<%
|
||||
int id = 1;
|
||||
for (AttendBean attend : studentDetials.getAttendList()) {
|
||||
out.print("<tr>");
|
||||
out.print("<td>" + (id++) + "</td>");
|
||||
out.print("<td>" + attend.getDate() + "</td>");
|
||||
if (attend.isAttend()) {
|
||||
out.print("<td><a href='#' class='badge badge-success'>Present</a></td>");
|
||||
} else {
|
||||
out.print("<td><a href='#' class='badge badge-danger'>Absent</a></td>");
|
||||
}
|
||||
out.print("</tr>");
|
||||
}
|
||||
|
||||
%>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<a href="report?class=<%= request.getParameter("class")%>&year=<%= request.getParameter("year")%>&term=<%= request.getParameter("term")%>">
|
||||
<button type="button" class="btn btn-secondary">
|
||||
Back
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<br><br>
|
||||
<footer></footer>
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.min.js"></script>
|
||||
<script src="../js/bootstrap.min.js"></script>
|
||||
<script src="../js/jquery.tableToexcel.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$("#btnExportExcel").click(function () {
|
||||
$(".exportExcel").table2excel({
|
||||
exclude: ".excludeThisClass",
|
||||
name: "Worksheet Name",
|
||||
filename: "Student_Report.xls", // do include extension
|
||||
preserveColors: false // set to true if you want background colors and font colors preserved
|
||||
});
|
||||
});
|
||||
});
|
||||
let reportChart = document.getElementById('reportChart').getContext('2d');
|
||||
Chart.defaults.global.defaultFontFamily = 'Lato';
|
||||
Chart.defaults.global.defaultFontSize = 18;
|
||||
Chart.defaults.global.defaultFontColor = 'black';
|
||||
let massPopChart = new Chart(reportChart, {
|
||||
type: 'pie', // bar, horizontalBar, pie, line, doughnut, radar, polarArea
|
||||
data: {
|
||||
labels: ['Present(%)', 'Absent(%)'],
|
||||
datasets: [{
|
||||
label: false,
|
||||
data: [
|
||||
Math.round(${presentDay/totalAttendDay*100}),
|
||||
Math.round(${absDay/totalAttendDay*100})
|
||||
],
|
||||
//backgroundColor:'green',
|
||||
backgroundColor: [
|
||||
'rgba(71, 179, 156, 0.9)',
|
||||
'rgba(236, 107, 86, 0.6)'
|
||||
|
||||
],
|
||||
borderWidth: 1,
|
||||
borderColor: '#777',
|
||||
hoverBorderWidth: 3,
|
||||
hoverBorderColor: '#000'
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Attendance',
|
||||
fontSize: 20
|
||||
},
|
||||
legend: {
|
||||
display: true,
|
||||
position: 'right',
|
||||
labels: {
|
||||
fontColor: '#000'
|
||||
}
|
||||
},
|
||||
layout: {
|
||||
padding: {
|
||||
left: 20,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
top: 0
|
||||
}
|
||||
},
|
||||
tooltips: {
|
||||
enabled: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
143
_resources/it114105/itp4511/Assignment/web/student/dashboard.jsp
Normal file
143
_resources/it114105/itp4511/Assignment/web/student/dashboard.jsp
Normal file
@@ -0,0 +1,143 @@
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8" import="system.bean.LectureBean, system.bean.LectureDayBean, system.bean.LectureTimeBean"%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Student Area | Dashboard</title>
|
||||
<!-- Bootstrap core CSS -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
rel="stylesheet">
|
||||
<link href="../css/bootstrap.css" rel="stylesheet">
|
||||
<link href="../css/style.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<jsp:include page="../header.jsp"></jsp:include>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<div class="list-group">
|
||||
<%@taglib uri="/WEB-INF/tlds/nav-taglib.tld" prefix="nav" %>
|
||||
<nav:showNav role="Student" active="dashboard" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-9">
|
||||
<!-- Website Overview -->
|
||||
<%/*
|
||||
<div class="card">
|
||||
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title">Overview</h5>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-sm-12">
|
||||
<div class="card bg-light card-body mb-3 dash-box">
|
||||
<h2><i class="material-icons">library_books</i> ${courseCount}</h2>
|
||||
<h4>Class</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 col-sm-12">
|
||||
<div class="card bg-light card-body mb-3 dash-box">
|
||||
<h2> <i class="material-icons">school</i> ${studentCount}</h2>
|
||||
<h4>Student</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
*/ %>
|
||||
<!-- Latest Users -->
|
||||
<div class="card">
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title">Schedule</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<jsp:useBean id="dayList" scope="request" class="java.util.ArrayList<system.bean.LectureDayBean>"/>
|
||||
<jsp:useBean id="timeList" scope="request" class="java.util.ArrayList<system.bean.LectureTimeBean>"/>
|
||||
<jsp:useBean id="lectureList" scope="request" class="java.util.ArrayList<system.bean.LectureBean>"/>
|
||||
|
||||
<table class="table table-bordered table-hover text-center">
|
||||
|
||||
<%
|
||||
out.print("<tr>");
|
||||
out.print("<th> Time </th>");
|
||||
for (LectureDayBean day : dayList) {
|
||||
out.print("<th>DAY " + day.getDay() + "</th>");
|
||||
}
|
||||
String[] schoolDays = {"A", "B", "C", "D", "E", "F"};
|
||||
out.print("</tr>");
|
||||
int countDay = dayList.size();
|
||||
for (LectureTimeBean time : timeList) {
|
||||
out.print("<tr>");
|
||||
out.print("<td>" + time.getStartTime() + "-" + time.getEndTime());
|
||||
int count = 0;
|
||||
int countPrint = 0;
|
||||
|
||||
|
||||
loopout:
|
||||
for (String schoolDay : schoolDays) {
|
||||
boolean printed = false;
|
||||
System.out.println("TEST---" + schoolDay);
|
||||
for (LectureBean lecture : lectureList) {
|
||||
if (lecture.getTime().getStartTime().equals(time.getStartTime()) && lecture.getTime().getEndTime().equals(time.getEndTime())) {
|
||||
if (lecture.getTime().isFullweek()) {
|
||||
System.out.println("FullWEEK");
|
||||
out.print("<td colspan='" + dayList.size() + "'>" + lecture.getLecture() + "</td>");
|
||||
break loopout;
|
||||
} else {
|
||||
System.out.println("Lecture---" + lecture.getDay().getDay());
|
||||
if (schoolDay.equalsIgnoreCase(lecture.getDay().getDay())) {
|
||||
System.out.println("printed");
|
||||
out.print("<td>" + lecture.getLecture() + "</td>");
|
||||
printed = true;
|
||||
countPrint++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
count++;
|
||||
|
||||
}
|
||||
|
||||
if (!printed) {
|
||||
System.out.println("NOTPrintandPrintTDTD");
|
||||
out.print("<td></td>");
|
||||
}
|
||||
if (lectureList.size() == 0) {
|
||||
for (int i = dayList.size(); i > 0; i--) {
|
||||
out.print("<td></td>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
out.print("</tr>");
|
||||
}
|
||||
%>
|
||||
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<br><br>
|
||||
<footer></footer>
|
||||
|
||||
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
|
||||
<script src="js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
@@ -0,0 +1,84 @@
|
||||
<%--
|
||||
Document : dashboard
|
||||
Created on : 2019/11/11, 下午 10:08:39
|
||||
Author : JerryKwok
|
||||
--%>
|
||||
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8"%>
|
||||
<%@page import="system.bean.ClassBean, java.util.ArrayList"%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Teacher Area | Attendance</title>
|
||||
<!-- Bootstrap core CSS -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
rel="stylesheet">
|
||||
<link href="../css/bootstrap.css" rel="stylesheet">
|
||||
<link href="../css/style.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<jsp:include page="../header.jsp"></jsp:include>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<%@taglib uri="/WEB-INF/tlds/nav-taglib.tld" prefix="nav" %>
|
||||
<nav:showNav role="Teacher" active="attendance" />
|
||||
</div>
|
||||
<div class="col-lg-9">
|
||||
<!-- Main -->
|
||||
<div class="card">
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title">Class</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Class</th>
|
||||
<th scope="col"> </th>
|
||||
<th scope="col">Head</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<jsp:useBean id="classList" scope="request" class="java.util.ArrayList<system.bean.ClassBean>"/>
|
||||
<%
|
||||
for (ClassBean classVal : classList) {
|
||||
out.print("<tr data-href=\"attendance?class=" + classVal.getClassName() + "\">");
|
||||
out.print("<td colspan=2>" + classVal.getClassName() + "</td>");
|
||||
out.print("<td>" + classVal.getTeacherBean().getTeacherFormalName() + "</td>");
|
||||
out.print("</tr>");
|
||||
}
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<br><br>
|
||||
<footer></footer>
|
||||
|
||||
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
|
||||
<script src="../js/bootstrap.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$("tr[data-href]").click(function () {
|
||||
window.location.href = $(this).attr("data-href");
|
||||
})
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
@@ -0,0 +1,176 @@
|
||||
<%--
|
||||
Document : dashboard
|
||||
Created on : 2019/11/11, 下午 10:08:39
|
||||
Author : JerryKwok
|
||||
--%>
|
||||
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8"%>
|
||||
<%@page import="system.bean.ClassBean, system.bean.AttendBean, java.util.ArrayList, java.util.Date, java.text.SimpleDateFormat"%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Teacher Area | Attendance</title>
|
||||
<!-- Bootstrap core CSS -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
rel="stylesheet">
|
||||
<link href="../css/bootstrap.css" rel="stylesheet">
|
||||
<link href="../css/bootstrap-datepicker.min.css" rel="stylesheet">
|
||||
<link href="../css/style.css" rel="stylesheet">
|
||||
</head>
|
||||
<%!
|
||||
Date date = new Date();
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
||||
%>
|
||||
<%
|
||||
String urlForm = "attendance?";
|
||||
String urlDate = request.getParameter("date");
|
||||
String urlClass = request.getParameter("class");
|
||||
if (urlDate != null) {
|
||||
urlForm += ("date=" + urlDate + "&");
|
||||
}
|
||||
if (urlDate != null) {
|
||||
urlForm += ("class=" + urlClass);
|
||||
}
|
||||
%>
|
||||
<body>
|
||||
<jsp:include page="../header.jsp"></jsp:include>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<%@taglib uri="/WEB-INF/tlds/nav-taglib.tld" prefix="nav" %>
|
||||
<nav:showNav role="Teacher" active="attendance" />
|
||||
</div>
|
||||
<div class="col-lg-9">
|
||||
<%
|
||||
if (request.getAttribute("message") != null) {
|
||||
out.print("<div class='alert alert-success alert-dismissible fade show' role='alert'>");
|
||||
out.print("<strong>Attendance Saved</strong>");
|
||||
out.print("<button type='button' class='close' data-dismiss='alert' aria-label='Close'>");
|
||||
out.print("<span aria-hidden='true'>×</span></button></div>");
|
||||
|
||||
}
|
||||
%>
|
||||
<!-- Main -->
|
||||
<div class="card">
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title">Select Date</h5>
|
||||
</div>
|
||||
<form action="attendance" method="GET">
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<label>Class</label>
|
||||
<select class="form-control" name="class">
|
||||
<jsp:useBean id="classList" scope="request" class="java.util.ArrayList<system.bean.ClassBean>"/>
|
||||
<%
|
||||
for (ClassBean classVal : classList) {
|
||||
if (request.getParameter("class").equals(classVal.getClassName())) {
|
||||
out.print("<option value='" + classVal.getClassName() + "' selected>" + classVal.getClassName() + "</option>");
|
||||
} else {
|
||||
out.print("<option value='" + classVal.getClassName() + "'>" + classVal.getClassName() + "</option>");
|
||||
}
|
||||
}
|
||||
%>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Select Date</label>
|
||||
<div class="input-group date">
|
||||
<input type="text" class="form-control" id="datepicker" name="date" value="<%= request.getParameter("date") == null ? formatter.format(date) : request.getParameter("date")%>">
|
||||
<div class="input-group-addon">
|
||||
<span class="glyphicon glyphicon-th"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<a href="attendance">
|
||||
<button type="button" class="btn btn-secondary">
|
||||
Back
|
||||
</button>
|
||||
</a>
|
||||
<button type="submit" class="btn btn-primary right">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<!-- Main -->
|
||||
<div class="card">
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title">Attend List</h5>
|
||||
</div>
|
||||
<form action="<%= urlForm%>" method="POST">
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<label>Class</label>
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Attend</th>
|
||||
<th scope="col">Student ID</th>
|
||||
<th scope="col">Student Name</th>
|
||||
<th scope="col">Gender</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<jsp:useBean id="studentAttendList" scope="request" class="java.util.ArrayList<system.bean.AttendBean>"/>
|
||||
<%
|
||||
for (AttendBean student : studentAttendList) {
|
||||
out.print("<tr>");
|
||||
out.print("<td>");
|
||||
out.print("<input type='checkbox' name='attend' value='" + student.getStBean().getId() + "'");
|
||||
if (student.isAttend()) {
|
||||
out.print(" checked>");
|
||||
} else {
|
||||
out.print(" >");
|
||||
}
|
||||
out.print("</td>");
|
||||
out.print("<td>" + student.getStBean().getId() + "</td>");
|
||||
out.print("<td>" + student.getStBean().getName() + "</td>");
|
||||
out.print("<td>" + student.getStBean().getGender() + "</td>");
|
||||
out.print("</tr>");
|
||||
}
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary float-right">Save</button>
|
||||
<br><br>
|
||||
<input type="hidden" name="action" value="save">
|
||||
<input type="hidden" name="class" id="attendDate" value="<%= request.getParameter("class")%>">
|
||||
<input type="hidden" name="date" id="class" value=" <%= request.getParameter("date") == null ? formatter.format(date) : request.getParameter("date")%>">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<br><br>
|
||||
<footer></footer>
|
||||
|
||||
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
|
||||
<script src="../js/bootstrap.min.js"></script>
|
||||
<script src="../js/bootstrap-datepicker.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#datepicker').datepicker({
|
||||
format: "yyyy-mm-dd",
|
||||
daysOfWeekDisabled: "0,6",
|
||||
daysOfWeekHighlighted: "1,2,3,4,5",
|
||||
todayHighlight: true
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
141
_resources/it114105/itp4511/Assignment/web/teacher/dashboard.jsp
Normal file
141
_resources/it114105/itp4511/Assignment/web/teacher/dashboard.jsp
Normal file
@@ -0,0 +1,141 @@
|
||||
<%--
|
||||
Document : dashboard
|
||||
Created on : 2019/11/11, 下午 10:08:39
|
||||
Author : JerryKwok
|
||||
--%>
|
||||
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8" import="system.bean.LectureBean, system.bean.LectureDayBean, system.bean.LectureTimeBean"%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Teacher Area | Dashboard</title>
|
||||
<!-- Bootstrap core CSS -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
rel="stylesheet">
|
||||
<link href="../css/bootstrap.css" rel="stylesheet">
|
||||
<link href="../css/style.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<jsp:include page="../header.jsp"></jsp:include>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<%@taglib uri="/WEB-INF/tlds/nav-taglib.tld" prefix="nav" %>
|
||||
<nav:showNav role="Teacher" active="dashboard" />
|
||||
</div>
|
||||
|
||||
<div class="col-lg-9">
|
||||
<!-- Website Overview -->
|
||||
<div class="card">
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title">Overview</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-sm-12">
|
||||
<div class="card bg-light card-body mb-3 dash-box">
|
||||
<h2><i class="material-icons">library_books</i> ${courseCount}</h2>
|
||||
<h4>Lecture</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 col-sm-12">
|
||||
<div class="card bg-light card-body mb-3 dash-box">
|
||||
<h2> <i class="material-icons">school</i> ${studentCount}</h2>
|
||||
<h4>Student</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Latest Users -->
|
||||
<div class="card">
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title">Schedule</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<jsp:useBean id="dayList" scope="request" class="java.util.ArrayList<system.bean.LectureDayBean>"/>
|
||||
<jsp:useBean id="timeList" scope="request" class="java.util.ArrayList<system.bean.LectureTimeBean>"/>
|
||||
<jsp:useBean id="lectureList" scope="request" class="java.util.ArrayList<system.bean.LectureBean>"/>
|
||||
|
||||
<table class="table table-bordered table-hover text-center">
|
||||
|
||||
<%
|
||||
out.print("<tr>");
|
||||
out.print("<th> Time </th>");
|
||||
for (LectureDayBean day : dayList) {
|
||||
out.print("<th>DAY " + day.getDay() + "</th>");
|
||||
}
|
||||
String[] schoolDays = {"A", "B", "C", "D", "E", "F"};
|
||||
out.print("</tr>");
|
||||
int countDay = dayList.size();
|
||||
for (LectureTimeBean time : timeList) {
|
||||
out.print("<tr>");
|
||||
out.print("<td>" + time.getStartTime() + "-" + time.getEndTime());
|
||||
int count = 0;
|
||||
int countPrint = 0;
|
||||
|
||||
|
||||
loopout:
|
||||
for (String schoolDay : schoolDays) {
|
||||
boolean printed = false;
|
||||
System.out.println("TEST---" + schoolDay);
|
||||
for (LectureBean lecture : lectureList) {
|
||||
if (lecture.getTime().getStartTime().equals(time.getStartTime()) && lecture.getTime().getEndTime().equals(time.getEndTime())) {
|
||||
if (lecture.getTime().isFullweek()) {
|
||||
System.out.println("FullWEEK");
|
||||
out.print("<td colspan='" + dayList.size() + "'>" + lecture.getLecture() + "</td>");
|
||||
break loopout;
|
||||
} else {
|
||||
System.out.println("Lecture---" + lecture.getDay().getDay());
|
||||
if (schoolDay.equalsIgnoreCase(lecture.getDay().getDay())) {
|
||||
System.out.println("printed");
|
||||
out.print("<td>" + lecture.getLecture() + "</td>");
|
||||
printed = true;
|
||||
countPrint++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
count++;
|
||||
|
||||
}
|
||||
|
||||
if (!printed) {
|
||||
System.out.println("NOTPrintandPrintTDTD");
|
||||
out.print("<td></td>");
|
||||
}
|
||||
if (lectureList.size() == 0) {
|
||||
for (int i = dayList.size(); i > 0; i--) {
|
||||
out.print("<td></td>");
|
||||
}
|
||||
}
|
||||
}
|
||||
out.print("</tr>");
|
||||
}
|
||||
%>
|
||||
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<br><br>
|
||||
<footer></footer>
|
||||
|
||||
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
|
||||
<script src="js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
@@ -0,0 +1,17 @@
|
||||
<%--
|
||||
Document : isError
|
||||
Created on : 2019/12/14, 下午 02:00:01
|
||||
Author : JerryKwok
|
||||
--%>
|
||||
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8"%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>JSP Page</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello World!</h1>
|
||||
</body>
|
||||
</html>
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user