Professional Documents
Culture Documents
ATG Report
ATG Report
on
AUTOMATIC TIMETABLE GENERATOR
Submitted for partial fulfilment of the requirements for the award of the degree of
BACHELOR OF TECHNOLOGY
in
G Manisha (19N81A0581)
T RenuSree (19N81A0573)
A Sannidhi Reddy (19N81A0581)
i
CERTIFICATE
This is to certify that this Project Seminar Report entitled “ AUTOMATIC TIMETABLE
GENERATOR” is a bonafide work carried out by G Manisha (19N81A0581), T RenuSree
(19N81A0573),A Sannidhi Reddy (19N81A0581), in partial fulfillment of the requirements
for the award of degree of Bachelor of Technology in Computer Science And Engineering
from Sphoorthy Engineering College, affiliated to Jawaharlal Nehru Technological
University Hyderabad, Hyderabad, during the Academic Year 2022-23 under our guidance and
supervision.
The results embodied in this report have not been submitted to any other university or institute
for the award of any degree or diploma.
ii
DECLARATION
We declare that the result embodied in the Mini Project work has not been submittedto any
other University or Institute for the award of any Degree or Diploma.
Date:
Place: Hyderabad
G Manisha (19N81A0581)
T RenuSree (19N81A0573)
A Sannidhi Reddy (19N81A0581)
iii
ACKNOWLEDGEMENT
We express our deep sense of gratitude to our project Co-Ordinator Dr. T. Venkata Ramana for his constant
and continuous support throughout the project, we sincerely thank our Project Guide Mrs. D. Srilatha Reddy,
Asst. Professor, Department of Computer Science & Engineering, Sphoorthy Engineering College,
Jawaharlal Nehru Technological University Hyderabad (JNTUH), Hyderabad for his inspiring
guidance, consistent encouragement, constructive criticism and helpful suggestions during the entire
course of my research work.
We express our sincere thanks to Mr. P. Ram Mohan Rao, Associate Professor & Head of the
Department, Department of Computer Science & Engineering, Sphoorthy Engineering College,
Nadargul (V), Balapur (M), Rangareddy (D) for his encouragement which helped me to complete my
Project work.
We deem it a great privilege to express our profound gratitude and sincere thanks to Mr. S. Chalama
Reddy, Chairman, Mr. S. Jagan Mohan Reddy, Secretary, Prof. J.B.V. Subrahmanyam, Principal,
Prof.M.V.S. Ram Prasad, Director, Sphoorthy Engineering College, Nadargul (V), Balapur (M),
Rangareddy (D), for their moral support and help in the completion of my research work.
We express our heartfelt thanks to Professors, Associate Professors, Assistant Professor and other
professional non-teaching staff of Department of Computer Science and Engineering, Sphoorthy
Engineering College, Nadargul (V), Balapur (M), Rangareddy (D) for providing the necessary
information pertaining to our project work.
iv
ABSTRACT
Time Table Generator is a web- based application which guides you about time table
management System. Timetabling concerns all activities with regard to producing a schedule
that must be subjective to different constraints. Timetable can be defined as the optimization
of given activities, actions or events to a set of objects in space - time matrix to satisfy a set of
desirable constraints. A college timetable is a temporal arrangement of a set of lectures and
classrooms in which all given constraints are satisfied. Most colleges have a number of
different courses and each course has a number of subjects. Now there are limited faculties,
each faculty teaching more than one subjects. So now the time table needed to schedule the
faculty at provided time slots in such a way that their timings do not overlap and the time table
schedule makes best use of all faculty subject demands.
G Manisha (19N81A0564)
v
INDEX
vi
LIST OF FIGURES
Figure Page
Figure Name
No. No.
1 Logo 1
2 System Architecture 9
3 Data Flow Diagram 10
4 Zero Level 10
5 First Level 11
6 Home Page 11
7 Registration Page 12
8 Login Page 12
9 Add Subject 12
10 Add Faculty 13
11 Add Course 13
12 Timings 13
13 Generation Page 14
14 System flow 15
15 Use Case Diagram 16
16 Sequence Diagram 17
17 ER diagram 18
18.1 Login Module 19
18.2 Admin Module 20
19 Data Sets 26
20 Test Cases 30
21 Result 30
vii
1. Introduction
Fig 1: Logo
By using this software users can apply for leave by providing leave required date, reason and
also with substitute faculty. When selecting a faculty as substitute it allows to view timetable
of that faculty for ensure that the faculty is free at that particular period. Substitute can approve
or reject request. Principal can also view the request send by faculty and can also view
substitute response. Principal can approve / reject request.
It is a comprehensive timetable management solution for colleges which help to overcome the
challenges in manually setting the timetable. By using this software, it will be very easy for
faculty to get timetable in their phones.
Our Timetabling Algorithm is main component of our project which produces the HTML based
timetable even / odd semester sheet as the output. Our project takes various inputs from the
user such as Teacher List, Course List, Semester List, Room List, Day List and Timeslot as
well as various rules, facts and constraints using web-based forms, which are stored in XML
based knowledge base. This knowledge base serves as input to our Timetable Generator
Algorithm residing on server machine.
1
1.1 Problem Statement
Timetabling concerns all activities with regard to producing a schedule that must be subjective
to different constraints. Timetable can be defined as the optimization of given activities, actions
or events to a set of objects in space - time matrix to satisfy a set of desirable constraints. A
college timetable is a temporal arrangement of a set of lectures and classrooms in which all
given constraints are satisfied. Creating such timetables manually is complex and time-
consuming process.
1.2 Objective
The purpose of developing Automatic Time Table Generator is to automate the process of
developing time table for our institute. By automating this process with computer assisted
timetable generator cans save a lot of precious time for administrations who are involved in
creating and managing course timetables.
1.3 Motivation
Currently, timetable for our institute is manually prepared by a committee which includes UG
convener, PG convener, Dean of Academic Programs. As the process of generating time table
is time and effort consuming, it creates workload on committee members as they have other
responsibilities also.
This project aims at the development of a web-based application software which will help our
institute to generate timetable for our college. This web app is developed in PHP which will
work with the database developed in MYSQL.
In the existing System each task is carried out manually and processing is a very tedious job.
The person who creates have to keep track of slots, faculties and courses. This makes it more
2
time consuming. The organization is not able to achieve its need in time and the results too
may not be accurate. Due to all the manual maintenance, there are number of difficulties and
draw backs that exist in the system.
• The existing system is manual system. Needs to be converted into automated system.
• Risk of mismanagement of data.
• Less Security.
• No proper coordination between different Applications and Users.
• Fewer Users - Friendly.
• Accuracy not guaranteed.
• Not in reach of distant users.
To avoid all these limitations and make the working more accurately the system needs to be
computerized.
The proposed system is designed to be more efficient than the actual system. In order to deal
with the timetabling issue, we are putting forward a system which is a Web-based Application
Software that will automatically generate timetable for the different courses of the institute. It
takes data like Faculty Names, Courses and Programs and generate the feasible time table.
Timetabling is a task of satisfying some constraints. These constraints are hard constraints and
soft constraints. In this project hard constraints have been taken care of strictly and it has been
ensured that soft constraints are as well followed as much as possible.
The development of the new system contains the following activities, which
try to automate the entire process keeping in view of the database integration approach. Our
Timetabling Algorithm is main component of our project which produces the HTML based
timetable even / odd semester sheet as the output. Our project takes various inputs from the
user such as Teacher List, Course List, Semester List, Room List, Day List and Timeslot as
well as various rules, facts and constraints using web-based forms, which are stored in XML
3
based knowledge base. This knowledge base serves as input to our Timetable Generator
Algorithm residing on server machine.
The system is simple in design and to implement. The system requires very low system
resources and the system will work in almost all configurations. It has got following
FEATURES
1.6 Scope
Most colleges have a number of different courses and each course has a number of subjects.
Now there are limited faculties, each faculty teaching more than one subjects. So now the time
table needed to schedule the faculty at provided time slots in such a way that their timings do
not overlap and the time table schedule makes best use of all faculty subject demands. We can
use Automatic Timetable Generator for this purpose.
In our project the scope of Automatic Timetable Generator is to provide easy and efficient
system for automating the process of developing timetable. The main scope of our system is to
generate feasible time table by taking required inputs.
4
FEATURES OF THE SYSTEM
Software requirements –
Software Requirements deal with defining software resource requirements and pre – requisites
that need to be installed on a computer to provide optimal functioning of an application. These
requirements or pre - requisites are generally not included in the software installation package
and need to be installed separately before the software is installed. The development of the
Automatic Time Table Generating System will require the following software interfaces:
1) OS: Windows
4) Database: SQL
Hardware requirements -
The most common set of requirements defined by any operating system or software application
is the physical computer resources, also known as hardware. A hardware requirements list is
often accompanied by a hardware compatibility list (HCL), especially in case of operating
systems. An HCL lists tested, compatibility and sometimes incompatible hardware devices for
a particular operating system or application. The following sub – sections discuss the various
aspects of hardware requirements.
5
a) RAM: 2 GB and above.
2.Literature Survey
In some years two main approaches have been successful for implementing the timetabling
problem. The first Approach is based on local search procedures method such as simulated
annealing, tabu search and genetic algorithms. These methods express constraints as some
value of functions, which are minimized by a heuristic search of better solutions in reference
of some initial feasible solution. The second approach is based on constraint programming
(CP). Its main advantage is declaratively a direct statement of the constraints serves as part of
6
the program. This makes the program easy to modify, which is critical in timetabling problems.
The constraints are handled through a system of constraint propagation, which decrease
domains of variables, coupled with backtracking search. The main disadvantages of these
approaches are
A. Bhaduri A [1], evolutionary techniques have been used to solve the time table scheduling
problem. In this paper, we have reviewed the problem of educational time table scheduling
with genetic algorithm
B. Dipti Srinivasan [2], Find a feasible tutorial timetable in a large university department is a
challenging problem faced repeatedly in educational establishments. This paper represents an
evolutionary algorithm (EA) based approach to solving a strong constrained university
timetabling problem.
C. A. Elkhyari [5], the proposed algorithm aids solving the timetabling problem while giving
import to teacher availability. This algorithm uses a heuristic approach to give a overall
solution to school timetabling difficulties.
• Initially, we find a logo page followed by about us information with a link asking to Login.
7
• If the user is new to the website, then he needs to register using registration link. After
registering, it will go to next page
• User need to fill the details in Add subject, add faculty, Add courses and Timings
webpages.
• After filling, the user needs to click generate timetable button which automatically creates
Timetable.
2.3 Applications
• Universities
• schools
• colleges
3.System Design
The most creative and challenging phase of the life cycle is system design. The term design
describes a final system and the process by which it is developed. It refers to
the technical specifications that will be applied in implementations of the system. The
importance of software design can be stated in a single word “Quality”. Design provides us
with representations of software that can be assessed for quality. Design is the only way where
we can accurately translate user requirements into a complete software product or system.
Without design we risk building an unstable system that might fail if small changes are made.
It may as well be difficult to test, or could be one who’s quality can’t be tested. So, it is an
essential phase in the development of a software product.
A system architecture is the conceptual model that defines the structure, behavior, and more
views of a system. An architecture description is a formal description and representation of a
system, organized in a way that supports reasoning about the structures and behaviors of the
system.
8
Fig 2: System Architecture
Data flow diagram is a graphical representation of data movement, process files used in support
of an information system. Unlike detail flow charts, DFDs do not supply detailed description
of modules but graphically describe a system’s data and how the data interact with the system.
Workflow focuses on what happens to the data through various points in the system. A data
flow diagram represents the information at each processing points in the system and the
direction it takes from the source and destination.
• Arrows
• Circles
• Open-ended boxes
• Squares
An arrow identifies data flow or data in motion. Circle stands for a process that converts data
into information. An open-ended box represents a data source or a temporary repository of
data. A square defines a source or the destination of given data.
9
Fig 3: Data Flow Diagram
10
Fig 4: Zero Level
11
Fig 7: Registration Page
12
Fig 10: Add Faculty Page
13
Fig 13: Generation Page
In project management, a flow chart is a visual aid to understand the methodology you’re
using to manage the project. The diagram shows the interdependent and parallel processes
over the course of the project’s life cycle.
A flow chart displays graphically the project’s objective and seeks to more logically order the
activities therein. But a flow chart can also help with monitoring progress and even status
reporting.
Flow diagrams, also known as flowcharts, are powerful tools for optimizing the paths - or flow
- of people, objects or information through a system or procedure. Flow diagram meaning
comes from the connectors and symbols working together to create a visual representation of
the direction of movement and what's needed to make that movement happen.
The uses of flow diagrams are vast and honestly endless. If something requires multiple steps,
a graphical representation of it can be made to visualize each of those steps with a diagram
creator. There are specific types of flowcharts that are better suited to meet certain goals and
here we'll break down which type of flow diagram you'd want to use for which circumstances.
14
Fig 14: System Flow
A "system" is something being developed or operated, such as a web site. The "actors" are
people or entities operating under defined roles within the system.
15
Use case diagrams are valuable for visualizing the functional requirements of a system that will
translate into design choices and development priorities.
Sequence Diagram
A sequence diagram is a form of interaction diagram which shows objects as lifelines running
down the page, with their interactions over time represented as messages drawn as arrows
from the source lifeline to the target lifeline. Sequence diagrams are good at showing which
objects communicate with which other objects; and what messages trigger those
communications. Sequence diagrams are not intended for showing complex procedural logic.
16
Admin
ER Diagram
The Entity-Relationship (ER) model was originally proposed by Peter in 1976 as a way to
unify the network and relational database views. Simply stated the ER model is a conceptual
data model that views the real world as entities and relationships.
A basic component of the model is the Entity-Relationship diagram which is used to visually
represent data objects. Since Chen wrote his paper the model has been extended and today it
commonly used for database design for the database designer, the utility of the ER model.
• It maps well to the relational model. The constructs used in the ER model can easily be
transformed into relational tables.
• It is simple and easy to understand with a minimum of training, Therefore, the model can
be used by the database designer to communicate the design to the end user.
• In addition, the model can be used as a design plan by the database developer to implement
a data model in specific database management software
17
E-R data model employs three basic notions: entity sets, relationship sets and attributes.
• Entity set an entity is a thing or object in the real world that is distinguishable from all
other objects. An entity has a set of properties and values of some properties uniquely
define the entities. An entity set is the set of all the entities of same type that share same
properties or attributes.
• Attributes attributes are the descriptive properties possessed by each member of an entity
set. Each entity may have its own value for each attribute. For each attribute, there is a set
of permitted values, called as domain or value set of an attribute.
• Relationship set a relationship is an association among several entities. A relationship set
is the set of the relationships of same type. The function that an entity plays in a
relationship is the entity's role. A relationship may also have attributes called as
descriptive attributes.
18
3.3 Module Description
A module is a collection of source files and build settings that allow you to divide your
project into discrete units of functionality. Your project can have one or many modules, and
one module may use another module as a dependency. You can independently build, test, and
debug each module.
Additional modules are often useful when creating code libraries within your own project or
when you want to create different sets of code and resources for different device types, such
as phones and wearables, but keep all the files scoped within the same project and share some
code.
1.Login Module:
Description:
The user is required to login using the username and the password, to access the web - app.
The login credentials are verified, and checked if the user is a valid user or not. Based on that
the features are made available on the web - app for access.
19
2.Admin Module:
Description -
a. Add Subject:
Using this feature, Admin can fill the details related to subject.
b. Add Faculty:
Using this feature, Admin can fill the details related to Faculty.
c. Add course:
Using this feature, Admin can fill the details related to Course.
d. Add Timing:
Using this feature, Admin can fill the details related to Timings.
e. Generate Timetable:
Using this feature, Admin has to give the Student Registration details and course faculty
details and this system generate the feasible timetable accordingly.
20
4.Implementation
A fully - compatible environment is been chosen for the implementation of the system which
will ensure a functionally consistent interface for the user with no dependency on the
environment or the type of the system they use to access it. The web app is built with the
technologies that are widely supported by all the major desktop environment wherein
Windows and Mac OS.
Time Table Generator is a web-based application which guides you about time table
management. This Project includes mainly modules
LOGIN MODULE:
• Admin - The admin is required to login using the username and the password
ADMINISTRATIVE MODULE
The page requires user id and password to start the application Login is a process by which
individual access to a computer system is controlled by identifying and authenticating the
user through the cardinalities presented by the user. Admin can add or delete the category,
subcategory etc.
21
4.3 Integration and Development
The objective of project integration management is to ensure that all the project processes are
properly coordinated. Project integration management involves: project plan development,
project plan execution and overall change control. The project plan is a formal, approved
document used to manage and control project execution. The project manager uses techniques
like preparation of project planning methodology, and PMIS to develop a project plan.
The project manager executes the project on the basis of the project plan. The
project manager requires managerial skills, product knowledge and the ability to use the tools
like the work authorization system, and system review meetings to execute the project
successfully. Overall change control deals with coordinating changes across the processes. If
all these steps are properly handled, the project can produce the desired project end
deliverable(s).
In the case of program development first of all the problem is defined. It includes
input-output specifications, requirements, execution times, accuracy etc. A necessary system
flowchart is expended to show additional detail input and out files are identified, and computer
programs logic flowchart are prepared for each computer program component. An algorithm
can also write to solve the problem. The following are the stages for the development of
software.
1. Problem definition
2. Program design
3. Coding
4. Debugging
5.Testing
6. Documentation
22
5. Evaluation
5.1 Datasets
A collection of related sets of information that is composed of separate elements but can be
manipulated as a unit by a computer.
One of the simplest methods used to analyze the data and to display the data is in tabular form.
In the tabular form, you get a systematic arrangement of rows and columns. The first column
is used to indicate the titles and the first row is also used to indicate the same. It is very accurate
as well as an easy method to display the data. Although this is a simple method, it can be time-
consuming as well. To solve this section easily we will provide you with some tips and tricks.
The dataset is a JSON file that contains different tags like, Admin_search, Details search, etc.
Each tag contains a list of patterns a user can ask and the responses a Chabot can respond
according to that pattern. The dataset is good for understanding how Chabot data works.
A dataset is a set of numbers or values that pertain to a specific topic. A dataset is, for example,
each student’s test scores in a certain class. Datasets can be written as a list of integers in a
random order, a table, or with curly brackets around them. The data sets are normally labelled
so you understand what the data represents, however, while dealing with data sets, you don’t
always know what the data stands for, and you don’t necessarily need to realize what the data
represents to accomplish the problem.
23
a) Registration:
b) Add Course:
24
c) Add Faculty:
d) Add Subject:
e) Table Sheet:
25
f) Timings:
g) Time Table:
26
5.2 Evaluation Metrics
Evaluation of the projects, conducted and described in this paper was done accordingly to
MOMENTUM framework methodology. Peer review questionnaires were filled in based on
public information provided by the initiators and developers of the systems, results of
independent evaluations and testing, and finally, evaluation made by the authors of the paper
using electronic voting.
The criteria for evolution of a program are reliability, speed hardware cost, programming time
and cost of use error tolerance and extensibility. A good program should utilize memory and
times efficiently. An interface should be simple and less costly as far as possible to perform a
ascertain task. Good design and clear documentation make a program simple and it can be used
by others.
27
5.3 Tests Cases
Test Planning:
Like any project, the testing also should be driven by a plan. The test plan generates the report
for the execution and tracking of the entire testing project.
What needs to be the tested-the scope of testing, including clear identification of what will be
the tested & what will not be tested.
How the testing is going to be performed – breaking down the testing into small and
manageable tasks and identifying the strategies to be used for carrying out the tasks.
Risks that may be faced in all of the above, with appropriate mitigation and contingency plans.
Using the test plan as the basis, the testing team design test case specification which then
becomes the basis for preparing for individual test cases.
A test case is nothing but a series of step executed on a product, using a predefined set of input
data, expected to produce a pre-defined set of outputs, in a given environment.
Test case specifications are useful as it enlists the specification details of the items.
• User Login/Registration: To begin with login, user need to register by filling up basic
registration details. There are multiple fields in registration page and every field has to fill
by user. User cannot use character in the login Id field.
• Admin Login: - Admin login id and password is kept compulsory fields, and if the admin
id or password doesn’t match then it will show an error message.
28
TEST UI (USER INTERFACE) INPUT OUTPUT SUCCESS
CASES
1 Username, Pass
password
2 College Fail
name,
Username,
Email,
Password
3 Username, Fail
Password
4 College Pass
name,
Username,
Email,
Password
29
5 Course Pass
name,
Year,
Semester,
Course
Code
5.4 Results
30
6. Conclusion and Future Enhancement
Conclusion-
The Automatic Timetable Generator is a web-based system. Its basic function is to generate
the time table according to the data filled. This application will simplify the process of time
table generation smoothly which may otherwise need to done using spread sheet manually
possibly leading to constraints problem that are difficult to determine when time table is
generated manually. The project is developed in such a way that, no slot clashes occur
providing features to tailor the timetable as of wish. Separate timetable for the individual class
is generated automatically by this system. Various slot combinations can be acquired so that
another timetable is generated as of need. The project reduces time consumption and the pain
in framing the timetable manually.
It is complicated task that to handle many Faculty's and allocating subjects for them at a time
physically. So our proposed system will help to overcome this disadvantage. Thus we can
produce timetable for any number of courses and multiple semesters. This system will help
to create dynamic pages so that for implementing such a system we can make use of the
different tools are widely applicable and free to use also.
Future enhancement-
The future enhancement that can be developed from the project may include Leave
Management, Exam Schedule Generation, Exam Room Scheduling and Time Constrain
Problems. This enhancement can be achieved my making further modifications keeping the
approach and techniques used for this project.
References
31
[3] Anuja Chowdhary “TIME TABLE GENERATION SYSTEM”. Vol.3 Issue.2, February-
2014, pg. 410- 414
[4] Chris Bates.” Web Programming Building Internet Applications”, 3rd Edition, Wiley
India,2006
[5] Kenneth E. Kendall “System Analysis and Design” Publisher Pearson College Div.; 4th
edition Year December 1, 2002
[6] lan Sommerville “Software Engineering”, 9th Edition, Pearson Education, 2012.
[7] Introduction to the “Design and Analysis of Algorithms”, Anany Levitin, 2rd Edition,
2009, Pearson.
Websites-
https://www.mysql.com/
https://www.w3schools.com/css/default.asp
https://www.w3schools.com/php/
https://www.phptpoint.com/mysql-tutorial/
https://stackoverflow.com/questions/19444890/automated-timetable-in-genetic-algorithm-using-
php
https://www.phptpoint.com/
Appendix
Definitions, Acronyms, Abbreviations
HTML-Hyper Text Markup Language.
CSS - Cascading Style Sheet.
PHP- Hypertext Pre-processor
JS- Java Script
SQL
32
Sample Code
Index.php
<?php
$path = $_SERVER['DOCUMENT_ROOT'];
$path .= "/timetable/header.php";
include_once($path);
?>
<body>
<nav class="navbar navbar-default navbar-static-top">
<div class="container">
<h3>Automatic Timetable Generator</h3>
</div>
</nav>
<div id="content">
<div id="form">
<form class="form-horizontal" method="post"
action="libs/register.php">
<fieldset>
</div>
</div>
</div>
</div>
33
<label class="col-md-4 control-label"
for="email">Email</label>
<div class="col-md-4">
<input id="email" name="email" type="text" placeholder=""
class="form-control input-md" required="">
</div>
</div>
</div>
</div>
</fieldset>
</form>
</div>
<div id="login">
Already Registered. <a href="../timetable/login.php">Login </a>
</div>
</div>
</body>
<?php
$path = $_SERVER['DOCUMENT_ROOT'];
$path .= "/timetable/footer.php";
include_once($path);
?>
34
Login.php:
<?php
session_start();
$path = $_SERVER['DOCUMENT_ROOT'];
$path .= "/timetable/header.php";
include_once($path);
$path = $_SERVER['DOCUMENT_ROOT'];
$path .= "/timetable/class.ManageUsers.php";
include_once($path);
if(isset($_POST['lgn']))
{
$username = $_POST['username'];
$password = $_POST['password'];
?>
<body>
<nav class="navbar navbar-default navbar-static-top">
<div class="container">
<h3>Automatic Timetable Generator</h3>
</div>
35
</nav>
<div id="content">
<div id="form">
<form class="form-horizontal" method="post" action="">
<fieldset>
</div>
</div>
</div>
</div>
</fieldset>
</form>
</div>
</div>
</body>
<?php
36
$path = $_SERVER['DOCUMENT_ROOT'];
$path .= "/timetable/footer.php"; include_once($path);?>
AddSubject.php
<?php
session_start();
if(@$_SESSION['user_id']){
$path = $_SERVER['DOCUMENT_ROOT'];
$path .= "/timetable/header.php";
include_once($path);
$path = $_SERVER['DOCUMENT_ROOT'];
$path .= "/timetable/class.database.php";
include_once($path);
include_once("navbar.php");
function GetSubjectInfo($subcode,$user_id){
$db_connection = new dbConnection();
$link = $db_connection->connect();
$query = $link->query("SELECT * FROM subject WHERE subject_code =
'$subcode' AND user_id='$user_id'");
$rowCount = $query->rowCount();
if($rowCount ==1)
{
$result = $query->fetchAll();
return $result;
}
else
{
return $rowCount;
}
}
function add_subjects($user_id,$code,$name,$lecture,$tutorial,$practicle){
$db_connection = new dbConnection();
$link = $db_connection->connect();
$query = $link->prepare("INSERT INTO subject
(user_id,subject_code,subject_name,l,t,p) VALUES(?,?,?,?,?,?)");
$values = array
($user_id,$code,$name,$lecture,$tutorial,$practicle);
$query->execute($values);
$count = $query->rowCount();
return $count;
}
37
if(isset($_POST['submit']))
{
$check_subject =
GetSubjectInfo($_POST['subcode'],$_SESSION['user_id']);
if($check_subject === 0){
$count=
add_subjects($_SESSION['user_id'],$_POST['subcode'],$_POST['name'],$_POST['l']
,$_POST['t'],$_POST['p'] );
if($count){
}
else{
echo "You are not logged in yet. please go back and login again";
exit();
}
?>
<div class="container">
<div class="row">
<div class="col-lg-6">
<div class="jumbotron">
38
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="subcode">Subject
Code</label>
<div class="col-md-8">
<input id="subcode" name="subcode" type="text"
placeholder="" class="form-control input-md" required="">
</div>
</div>
</div>
</div>
39
<div class="form-group">
<label class="col-md-4 control-label" for="p">Total
Practical</label>
<div class="col-md-8">
<input id="p" name="p" type="text" placeholder="P"
class="form-control input-md" required="">
<span class="help-block">Total Practical for this
subject</span>
</div>
</div>
</fieldset>
</form>
</div>
</div>
<div class="col-lg-6">
<div class="jumbotron">
<?php
if($_SESSION['user_id']){
40
$link = $db_connection->connect();
$query = $link->query("SELECT * FROM subject WHERE
user_id= '$user_id'");
$query->setFetchMode(PDO::FETCH_ASSOC);
echo
"<h2>List of Subjects Already Added</h2>".
"<table class='table'>".
"<thead>".
"<tr>".
"<th>Subject Id</th>".
"<th>Subject Code</th>".
"<th>Subject Name</th>".
"<th>L</th>".
"<th>T</th>".
"<th>P</th>".
"<th>Options</th>".
"</tr>".
"</thead>".
"<tbody>";
while($result = $query->fetch()){
echo "<tr>"
."<td>".$result['subject_id']."</td>"
."<td>".$result['subject_code']."</td>"
."<td>".$result['subject_name']."</td>"
."<td>".$result['l']."</td>"
."<td>".$result['t']."</td>"
."<td>".$result['p']."</td>"
."<td><a
href='add.subject.php?delete=true&id=".$result['subject_id']."'>Delete</a></td
>"
."</tr>".
"</tr>";
}
echo "</tbody>".
"</table>".
"</div>";
Subjectlist($_SESSION['user_id']);
}
else{
echo "You are not logged in yet. Please go back and login
again";
}
41
?</div></div></div></div>
EditTimetable.php
<?php
session_start();
$path = $_SERVER['DOCUMENT_ROOT'];
$path .= "/timetable/class.database.php";
include_once($path);
if($_SESSION['user_id']){
//the below function deletes a table when user clicks the delete
link...
function deletetable($timetable_id,$user_id) {
$db_connection = new dbConnection();
$link = $db_connection->connect();
}
// When user clicks delete deletetable function is called here with
parameters semester, course, branch..
if (isset($_GET['delete'])) {
deletetable($_GET['id'],$_SESSION['user_id']);
echo '<div class="alert alert-success">
<a class="close" data-dismiss="alert">X</a>
<strong>Tada Success! </strong>Table Successfully
deleted.
</div>';
}
}
?>
42
ViewTimetable.php
<?php
session_start();
$path = $_SERVER['DOCUMENT_ROOT'];
$path .= "/timetable/class.database.php";
include_once($path);
if(@$_SESSION['user_id']){
// if edit button is clicked on the dashboard it passes semester, course,
branch in url and accordingly the correct tablesheet is loaded.
if (isset($_GET['view'])) {
$semester = $_GET['semester'];
$course_code = $_GET['coursecode'];
$course_full_name = $_GET['coursefullname'];
$year = $_GET['year'];
$timetable_id = $_GET['id'];
$user_id= $_SESSION['user_id'];
$i=0;
$cell = array();
$cellid = array();
while($result = $query->fetch()){
$cell[$i] = $result['data'];
$cellid[$i] = $result['cell'];
$i++;
}
}
// Fetch timting from the database
$query = $link->query("SELECT * FROM timing WHERE
user_id='$user_id'");
$query->setFetchMode(PDO::FETCH_ASSOC);
while($result = $query->fetch()){
$first = $result['first'];
$second= $result['second'];
$third= $result['third'];
$fourth= $result['fourth'];
$fifth= $result['fifth'];
$sixth= $result['sixth'];
$seventh= $result['seventh'];
$eight= $result['eight'];
43
}
while($result = $query->fetch()){
$uname = $result['uname'];
}
}
else
{
echo "You are not logged in. Please go back and log in again";
}
?>
44