You are on page 1of 99

A Project Report

On
“AUTOMATIC TIMETABLE GENERATOR”
Submitted in partial fulfillment of the requirements for the award of the degree of
BACHELOR OF COMPUTER APPLICATION
OF
BANGALORE UNIVERSITY

Submitted by

RADHA M (171KSB7057)

2019-2020

Guided By
Mrs. Vybhavi
Assistant professor
Department of Computer Science

Kasturi Nagar, Bangalore – 560 043

Automatic Timetable Generator Page 1


CERTIFICATE

This is to certify that Radha M (Reg.No: 171KSB7057) is a bona fide student


of New Horizon College and has carried out a project entitled “AUTOMATIC
TIMETABLE GENERATOR” under the guidance of Mrs. Vybhavi. This
project report has been submitted during the academic year 2019-2020 in
partial fulfillment of requirements of the Degree in Bachelor of Computer
Application, Bangalore University.

Mrs. Vybhavi Dr. T. LOGESWARI


Assistant Professor Associate Professor
Guide Head of the Department

Ms. Sunitha S
Principal-Incharge

Date :
Place : NHC-K, Bangalore

Automatic Timetable Generator Page 2


DECLARATION

I Radha M (Reg.No: 171KSB7057) do hereby declare that the project work


entitled “AUTOMATIC TIMETABLE GENERATOR ” is a bonafide work
carried out by me under the guidance of Mrs. Vybhavi. This project is my
original work and has not been presented for any other university award. This
project has been submitted as partial fulfillment of requirements for the Degree
of Bachelor of Computer Application, Bangalore University.

RADHA M

Date :
Place : NHC-K, Bangalore

Automatic Timetable Generator Page 3


ACKNOWLEDGEMENT

It is a great pleasure to express my sincere gratitude to those who have


contributed to my learning, through support, encouragement and guidance.

I sincerely thank the Chairman, Dr. Mohan Manghnani of “New Horizon


College” for providing me the necessary facilities for the completion of the
project.

With great pleasure I place on record my deep gratitude to the


Principal-Incharge, Ms. Sunitha S,for providing all the facilities for the
completion of the project.

I am grateful for the co-operation and valuable suggestions rendered by my


guide Mrs. Vybhavi, Assistant Professor, Department of Computer Science
for her sincere assistance, valuable guidance and careful reviews, without which
my effort would have been in vain. Thanks for the inspiration given to me in my
task by her kind appreciation and suggestion through my project.

I also express my gratitude to all the faculty members of the Department of


Computer Science.

Finally I thank my parents, friends and colleagues who have always been a great
inspiration to the success of my project.

RADHA M

Automatic Timetable Generator Page 4


CONTENTS

SL.NO SUBJECT PG.


NO.

1. SYNOPSIS 08

2. INTRODUCTION 10

3. SPECIFICATION REQUIREMENTS 13
• Software Requirement specification
• Hardware Requirement specification

4. SYSTEM ANALYSIS 15
• Existing System
• Proposed System

5. PERT CHART 18

6. TECHNOLOGIES USED 20
• Microsoft Visual Studio 2019 [Front End]
• Microsoft SQL Server management studio 2019 [Back End]

7. FUNCTIONAL SPECIFICATION 35

8. SYSTEM DESIGN & DATABASE DESIGN 38


• System Design
• Database Design

9. SYSTEM IMPLEMENTATION
• Data Flow Diagram (DFD) 45
• Entity Relationship Diagram (ERD)
• Database Design (Table form)
• Table Structure

10. SCREEN SHOTS 58


• Output Screens

11. CODING 69

12. FUTURE ENHANCEMENT 94

13. CONCLUSION 96

14. BIBLIOGRAPHY 98

Automatic Timetable Generator Page 5


LIST OF FIGURES

Figures Figures Pg.


No. No.
1. Pert Chart 19

2. Level zero DFD 49

3. Level one DFD 49

4. ER Diagram 51

5. Home Page 59

6. Admin Login Page 59

7. Teacher Login Page 60

8. Teacher Home Page 60

9. Admin Home Page 61

10. Add Teacher Page 61


11. Subjects Page 62

12. Add subjects Page 62

13. Classroom Page 63

14. Add classroom Page 63

15. Courses Page 64

16. Add course Page 64

17. Theory subjects Allotment Page 65

18. Practical Subjects Allotment Page 65


19. Classroom Allotment Page 66

20. Generate Timetable Page 66

21. Timetable View Page 67

22. Timetable View (*.pdf) 67

23. Students Timetable view Page 68

Automatic Timetable Generator Page 6


LIST OF TABLES

Table
Table Contents Pg.
No.
No.
1. Admin login 52

2. Courses 53

3. Classrooms 53

4. Individual semester table 54

5. Teachers table 54

6. Individual Teacher table 55

7. Subjects 55

Automatic Timetable Generator Page 7


SYNOPSIS

Automatic Timetable Generator Page 8


SYNOPSIS

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.

By automating this process with computer assisted timetable generator can save a lot
of precious time of administrators who are involved in creating and managing course
timetables. Since every college has its own timetabling problem, the commercially
available software packages may not suit the need of every college.

Hence we have developed practical approach for building lecture course timetabling
system, which can be customized to fit to any colleges timetabling problem. This
system introduces a practical timetabling algorithm capable of taking care of both
strong and weak constraints effectively, used in an automated timetabling system. So
that each teacher and student can view their timetable once they are finalized for a
given semester but they can’t edit them.

Automatic Timetable Generator Page 9


INTRODUCTION

Automatic Timetable Generator Page 10


INTRODUCTION

Even though most college administrative work has been computerized, the lecture
timetable scheduling is still mostly done manually due to its inherent difficulties. The
manual lecture-timetable scheduling demands considerable time and efforts. The
lecture-timetable scheduling is a Constraint satisfaction problem in which we find a
solution that satisfies the given set of 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. By automating this process with computer
assisted timetable generator can save a lot of precious time of administrators who are
involved in creating and managing course timetables.

Since every college has its own timetabling problem, the commercially available
software packages may not suit the need of every college. Hence we have developed p
racticalapproach for building lecture course timetabling system, which can be
customized to fit to any colleges timetabling problem.

The college lecture-timetabling problem asks us to find some time slots and
classrooms which satisfy the constraints imposed on offered.

Our Timetabling Algorithm is main component of our project which produces he


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. Our knowledgebase is in the middle, because it is between our timetabling
algorithm and GUI front end which is designed in the last. After the representation of
KB is standardized, we designed the timetabling algorithm.

Automatic Timetable Generator Page 11


SCOPE OF PROJECT

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 use a genetic algorithm for this purpose. In our
Timetable Generation algorithm we propose to utilize a timetable object. This object
comprises of Classroom objects and the timetable for every semester likewise a fitness
score for the timetable. Fitness score relates to the quantity of crashes the timetable
has regarding alternate calendars for different classes. Classroom object comprises of
week objects. Week objects comprise of Days. also Days comprises of Timeslots.
Timeslot has an address in which a subject, student gathering going to the address and
educator showing the subject is related Also further on discussing the imperatives, We
have utilized composite configuration design, which make it well extendable to
include or uproot as numerous obligations. In every obligation class the condition as
determined in our inquiry is now checked between two timetable objects. On the off
chance that condition is fulfilled i.e., there is a crash is available then the score is
augmented by one.

FEATURES OF THE SYSTEM

 Automatic Timetable manger is a Java based software used to


 Generate timetable automatically.
 Will help you to manage all the periods automatically and also will be
 Proposed system will help to generate it automatically also helps save
the time.
 There is no need for Faculty to worry about their timetable
 It is a comprehensive timetable management solutions for Colleges
which help to overcome the challenges in current system.

Automatic Timetable Generator Page 12


SPECIFICATION
REQUIREMENTS

Automatic Timetable Generator Page 13


SPECIFICATION REQUIREMENTS

To be used efficiently, all computer software needs certain hardware components or


the other software resources to be present on a computer. These pre-requisites are known
as(computer) system requirements and are often used as a guideline as opposed to an absolute
rule. Most software defines two sets of system requirements: minimum and recommended.
With increasing demand for higher processing power and resources in newer versions of
software, system requirements tend to increase over time.

1. 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.
HARDWARE REQUIREMENTS FOR PRESENT PROJECT:

PROCESSOR : Intel (R) Core (TM) i37020U CPU @2.30 GHZ


RAM : 8.00 GB
HARD DISK : 221 GB
MONITOR : Standard color monitor
KEYBOARD : Standard keyboard
MOUSE : Standard mouse

2. 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.
SOFTWARE REQUIREMENTS FOR PRESENT PROJECT:

OPERATING SYSTEM : Windows 10 Home Single Language


UI DESIGN : HTML, Bootstrap, CSS
CLIENT SIDE SCRIPTING : JavaScript
SERVER SIDE SCRIPTING : PHP
DATABASE : MySQL
LOCAL SERVER : APACHE

Automatic Timetable Generator Page 14


SYSTEM
ANALYSIS

Automatic Timetable Generator Page 15


SYSTEM ANALYSIS

EXISTING SYSTEM AND PROPOSED SYSTEM

After analyzing the necessities of the task to be performed, the next step is to analyze
the problem and understand its context. The first activity in the phase is studying the existing
system and other is to understand the necessities and domain of the new system. Both the
behaviors are equally significant, but the first movement serves as a basis of giving the
purposeful specifications and then winning design of the proposed system. Understanding the
properties and necessities of a new system is more difficult and requires creative thinking and
understanding of existing running system is also difficult, improper understanding of present
system can lead diversion from solution.

PROBLEMS IN EXISTING SYSTEM


Previously Time Table was manually made by the head of the departments that
involves lot manual work and time consumptive process. It takes lot of time, energy wastage,
paper wastage, and there will be also clashes between the classes if there is a new teacher
added. So, to overcome all these problems this system has been developed to generate
automatically the timetable.
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.

Automatic Timetable Generator Page 16


PROPOSED SYSTEM:

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
based knowledge base. This knowledge base serves as input to our Timetable Generator
Algorithm residing on server machine.

Expected Advantages of Proposed System


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

System can generate immediately getting the data and report.


Avoid stationary expense.
Any record is easy to store and manage.
Provide better security in new system.
Ensure data Accuracy’s.
Reduce the damages of the machine.
Better service.
Minimize manual data entry.
Greater efficiency.
User Friendliness and interactive.
Minimum time required.

Automatic Timetable Generator Page 17


PERT CHART

Automatic Timetable Generator Page 18


PERT CHART

Planning and Scheduling:-

(04TH JAN -07TH JAN)

COLLECTION OF REQUIREMENTS

(08TH JAN-16TH JAN)

ANALYSIS

DESIGN
(17TH JAN-28TH JAN)

CODING
(01ST FEB-29TH FEB)

QUALIFY CHECKING
(01ST MAR-30TH MAR)

TESTING
(01ST MAR-30TH MAR)

Automatic Timetable Generator Page 19


TECHNOLOGIES
USED

Automatic Timetable Generator Page 20


TECHNOLOGIES USED

HTML
Hypertext Markup Language (HTML) is the standard markup language for creating web
pages and web applications. With Cascading Style Sheets (CSS) and JavaScript, it forms a
triad of cornerstone technologies for the World Wide Web. Web browsers receive HTML
documents from a web server or from local storage and render the documents into multimedia
web pages. HTML describes the structure of a web page semantically and originally included
cues for the appearance of the document.

HTML elements are the building blocks of HTML pages. With HTML
constructs, images and other objects such as interactive forms may be embedded into the
rendered page. HTML provides a means to create structured documents by denoting
structural semantics for text such as headings, paragraphs, lists, links, quotes and other items.
HTML elements are delineated by tags, written using angle brackets. Tags such
as <img/> and <input/> directly introduce content into the page. Other tags such
as <p>...</p> surround and provide information about document text and may include other
tags as sub-elements. Browsers do not display the HTML tags, but use them to interpret the
content of the page.

HTML can embed programs written in a scripting language such as JavaScript which affects
the behavior and content of web pages. Inclusion of CSS defines the look and layout of
content. The World Wide Web Consortium (W3C), maintainer of both the HTML and the
CSS standards, has encouraged the use of CSS over explicit presentational HTML since
1997.

CSS

CSS Stands for "Cascading Style Sheet." Cascading style sheets are used to format the layout
of Web pages. They can be used to define text styles, table sizes, and other aspects of Web
pages that previously could only be defined in a page's HTML.

Automatic Timetable Generator Page 21


CSS helps Web developers create a uniform look across several pages of a Web site. Instead
of defining the style of each table and each block of text within a page's HTML, commonly
used styles need to be defined only once in a CSS document. Once the style is defined in
cascading style sheet, it can be used by any page that references the CSS file. Plus, CSS
makes it easy to change styles across several pages at once. For example, a Web developer
may want to increase the default text size from 10pt to 12pt for fifty pages of a Web site. If
the pages all reference the same style sheet, the text size only needs to be changed on the
style sheet and all the pages will show the larger text.

While CSS is great for creating text styles, it is helpful for formatting other aspects of Web
page layout as well. For example, CSS can be used to define the cell padding of table cells,
the style, thickness, and color of a table's border, and the padding around images or other
objects. CSS gives Web developers more exact control over how Web pages will look than
HTML does. This is why most Web pages today incorporate cascading style sheets.

Example

CSS is used to style and lay out web pages — for example, to alter the font, colour, size and
spacing of your content, split it into multiple columns, or add animations and other decorative
features. This module gets you started on the path to CSS mastery with the basics of how it
works, including selectors and properties, writing CSS rules, applying CSS to HTML, how to
specify length, colour, and other units in CSS, cascade and inheritance, and debugging CSS.
<html>
<head>
<meta charset="utf-8">
<title>My CSS experiment</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>Hello World!</h1>
<p>This is my first CSS example</p>
</body>
</html>

Now let's look at a very simple CSS example containing two rules:

Automatic Timetable Generator Page 22


h1 {
color: blue;
background-color: yellow;
border:1px solid black;
}

p{
color: red;
}

At this point you have some choices of how to use the CSS, either internally or externally.
Internal Style sheet

First we will explore the internal method. This way you are simply placing the CSS code
within the <head></head> tags of each (X)HTML file you want to style with the CSS. The
format for this is shown in the example below.
<head>
<title><title>
<styletype=”text/css”>
CSS Content Goes Here
</style>
</head>
<body>

Automatic Timetable Generator Page 23


With this method each (X)HTML file contains the CSS code needed to style the page.
Meaning that any changes you want to make to one page, will have to be made to all. This
method can be good if you need to style only one page, or if you want different pages to have
varying styles.

External Style sheet

Next we will explore the external method. An external CSS file can be created with any text
or HTML editor such as “Notepad” or “Dreamweaver”. A CSS file contains no (X)HTML,
only CSS. You simply save it with the .css file extension. You can link to the file externally
by placing one of the following links in the head section of every (X)HTML file you want to
style with the CSS file.

<link rel=”stylesheet” type=”text/css” href=“Path To stylesheet.css” />


Or you can also use the @import method as shown below
<style type=”text/css”>@import url(Path To stylesheet.css)</style>

Either of these methods are achieved by placing one or the other in the head section as shown
in example below.
<head>
<title><title>
<link rel=”stylesheet” type=”text/css” href=”style.css”/>
</head>
<body>
or
<head>
<title><title>
<style type=”text/css”> @import url(Path To stylesheet.css) </style>
</head>
<body>
By using an external style sheet, all of your (X)HTML files link to one CSS file in order to
style the pages. This means, that if you need to alter the design of all your pages, you only
need to edit one .css file to make global changes to your entire website.
Here are a few reasons this is better.
 Easier Maintenance

Automatic Timetable Generator Page 24


 Reduced File Size
 Reduced Bandwidth
 Improved Flexibility

JavaScript

JavaScript often abbreviated as JS, is a high-level, interpreted programming language. It is a


language which is also characterized as dynamic, weakly typed, prototype-based and multi-
paradigm. Alongside HTML and CSS, JavaScript is one of the three core technologies
of World Wide Web content engineering. It is used to make dynamic web pages interactive
and provide online programs, including video games. The majority of websites employ it, and
all modern web browsers support it without the need for plug-ins by means of a built-
in JavaScript engine. Each of the many JavaScript engines represent a different
implementation of JavaScript, all based on the ECMA Script specification, with some engines
not supporting the spec fully, and with many engines supporting additional features beyond
ECMA.

As a multi-paradigm language, JavaScript supports event-driven, functional,


and imperative (including object-oriented and prototype-based) programming styles. It has
an API for working with text, arrays, dates, regular expressions, and basic manipulation of
the DOM, but the language itself does not include any I/O, such as networking, storage, or
graphics facilities, relying for these upon the host environment in which it is embedded.

Initially only implemented client-side in web browsers, JavaScript engines are now
embedded in many other types of host software, including server-side in web servers and
databases, and in non-web programs such as word processors and PDF software, and in
runtime environments that make JavaScript available for writing mobile and desktop
applications, including desktop widgets.

Although there are strong outward similarities between JavaScript and Java, including
language name, syntax, and respective standard libraries, the two languages are distinct and
differ greatly in design; JavaScript was influenced by programming languages such
as Self and Scheme.

Automatic Timetable Generator Page 25


What is a Web Server?

Wondering what the heck is a web server? Well a web server is like a restaurant host. When
you arrive in a restaurant, the host greets you, checks your booking information and takes you
to your table. Similar to the restaurant host, the web server checks for the web page you have
requested and fetches it for your viewing pleasure. However, A web server is not just your
host but also your server. Once it has found the web page you requested, it also serves you
the web page. A web server like Apache, is also the Maitre D’ of the restaurant. It handles
your communications with the website (the kitchen), handles your requests, makes sure that
other staff (modules) are ready to serve you. It is also the bus boy, as it cleans the tables
(memory, cache, modules) and clears them for new customers.

So basically a web server is the software that receives your request to access a web page. It
runs a few security checks on your HTTP request and takes you to the web page. Depending
on the page you have requested, the page may ask the server to run a few extra modules while
generating the document to serve you. It then serves you the document you requested. Pretty
awesome isn’t it.

What is Apache?

The Apache web server, more popular as simply Apache, represents an open-source web
server platform lying in the basis of most of the websites we see today on the World Wide
Web. Looking back at the time when it was introduced in mid 90's and gradually adopted as a
preferred server platform on the web, we could state that Apache acted as the main driving
force behind today's web expansion. As a web server 'pioneer', Apache has turned into a
standard for the development of other successful web server platforms.

The Apache web server is a work of the Apache Software Foundation open source
community. Namely the fact that it is backed up by the efforts of many supporters worldwide
keeps it so well maintained and regularly updated with new useful features and functionalities
up to the latest quality and security requirements in HTTP service delivery.

Where does that strange name of the popular server come from? There are two intriguing and
radically different stories behind its origin. The more popular one says that naming the server
this way is a kind of a tribute to the Native American Indian tribe Apache, known for its
fighting strength and dauntless spirit. According to the other story, the name ‘Apache server’

Automatic Timetable Generator Page 26


represents a sound analogue to ‘a patchy server’, with 'patchy' referring to the bundle of
patches that are attached to the codebase of NCSA HTTPd 1.3.

MySQL

MySQL is a database management system that is used by Word Press to store and retrieve all
your blog information. Think of it this way. If your database is a filing cabinet that
WordPress uses to organize and store all the important data from your website (posts, pages,
images, etc), then MySQL is the company that created this special type of filing cabinet.

MySQL is an open source relational database management system. It runs as a server and
allows multiple users to manage and create numerous databases. It is a central component in
the LAMP stack of open source web application software that is used to create websites.
LAMP stands for Linux, Apache, MySQL, and PHP. Most WordPress installations use the
LAMP stack because it is open source and works seamlessly with WordPress.

WordPress requires MySQL to store and retrieve all of its data including post content, user
profiles, and custom post types. Most web hosting providers already have MySQL installed
on their web servers as it is widely used in many open source web applications such as
WordPress.

WordPress uses the PHP programming language to store and retrieve data from the MySQL
database. To retrieve data from the database, WordPress runs SQL queries to dynamically
generate content. SQL stands for Structured Query Language and is the programming
language typically used to query databases.

For users that are not comfortable writing their own PHP and SQL scripts, most web
hosting providers offer easy to use web applications to manage databases. One such web
application is phpMyAdmin which allows users to manage their database using a web based
graphical interface. You can manipulate your tables visually while phpMyAdmin runs the
SQL queries for you.

Out of the box MySQL doesn’t come with any graphical interface and advanced level users
may prefer to just manage their databases from the command line.

Automatic Timetable Generator Page 27


PHP

PHP is a server side scripting language. that is used to develop Static websites or Dynamic
websites or Web applications. PHP stands for Hypertext Pre-processor, that earlier stood for
Personal Home Pages.PHP scripts can only be interpreted on a server that has PHP
installed.The client computers accessing the PHP scripts require a web browser only.A PHP
file contains PHP tags and ends with the extension ".php".

What is a Scripting Language?

A script is a set of programming instructions that is interpreted at runtime.


A scripting language is a language that interprets scripts at runtime. Scripts are usually
embedded into other software environments.
The purpose of the scripts is usually to enhance the performance or perform routine tasks for
an application.
Server side scripts are interpreted on the server while client side scripts are interpreted by the
client application.
PHP is a server side script that is interpreted on the server while JavaScript is an example of a
client side script that is interpreted by the client browser. Both PHP and JavaScript can be
embedded into HTML pages.

What does PHP stand for?

PHP means - Personal Home Page, but it now stands for the recursive backronym PHP:
Hypertext Preprocessor.
PHP code may be embedded into HTML code, or it can be used in combination with various
web template systems, web content management system and web frameworks.

Php Syntax

A PHP file can also contain tags such as HTML and client side scripts such as JavaScript.
HTML is an added advantage when learning PHP Language. You can even learn PHP
without knowing HTML but it’s recommended you at least know the basics of HTML.

Automatic Timetable Generator Page 28


Database management systems DBMS for database powered applications.
For more advanced topics such as interactive applications and web services, you will
need JavaScript and XML.

Why use PHP?

You have obviously head of a number of programming languages out there; you may be
wondering why we would want to use PHP as our poison for the web programming. Below
are some of the compelling reasons.
PHP is open source and free.
Short learning curve compared to other languages such as JSP, ASP etc.
Large community document
Most web hosting servers support PHP by default unlike other languages such as ASP
that need IIS. This makes PHP a cost effective choice.
PHP is regular updated to keep abreast with the latest technology trends.
Other benefit that you get with PHP is that it’s a server side scripting language; this
means you only need to install it on the server and client computers requesting for
resources from the server do not need to have PHP installed; only a web browser
would be enough.
PHP has in built support for working hand in hand with MySQL; this doesn’t
mean you can’t use PHP with other database management systems.
PHP is cross platform; this means you can deploy your application on a number of
different operating systems such as windows, Linux, Mac OS etc.

What is PHP used for & Market share

In terms of market share, there are over 20 million websites and application on the internet
developed using PHP scripting language.
This may be attributed to the points raised above;
The diagram below shows some of the popular sites that use PHP

Automatic Timetable Generator Page 29


PHP File Extensions
File extension and Tags In order for the server to identify our PHP files and scripts, we
must save the file with the “.php” extension. Older PHP file extensions include
.phtml
.php3
.php4
.php5
.phps

PHP was designed to work with HTML, and as such, it can be embedded into the HTML
code.

You can create PHP files without any html tags and that is called Pure PHP file.

The server interprets the PHP code and outputs the results as HTML code to the web
browsers.

In order for the server to identify the PHP code from the HTML code, we must always
enclose the PHP code in PHP tags.

A PHP tag starts with the less than symbol followed by the question mark and then the words
“php”.

PHP is a case sensitive language, “VAR” is not the same as “var”.

Automatic Timetable Generator Page 30


The PHP tags themselves are not case-sensitive, but it is strongly recommended that we use
lower case letter. The code below illustrates the above point.
<?php … ?>

We will be referring to the PHP lines of code as statements. PHP statements end with a semi
colon (;). If you only have one statement, you can omit the semi colon. If you have more than
one statement, then you must end each line with a semi colon. For the sake of consistency, it
is recommended that you always end your statement(s) with a semi colon. PHP scripts are
executed on the server. The output is returned in form of HTML.

What is Bootstrap?

Bootstrap is a powerful front-end framework for faster and easier web development. It
includes HTML and CSS based design templates for common user interface components like
Typography, Forms, Buttons, Tables, Navigations, Dropdowns, Alerts, Modals, Tabs,
Accordion, Carousel and many other as well as optional JavaScript extensions. Bootstrap also
gives you ability to create responsive layout with much less efforts.

Here are some more advantages, why one should opt for Bootstrap:

Save lots of time — You can save lots of time and efforts using the Bootstrap predefined
design templates and classes and concentrate on other development work.
Responsive features — Using Bootstrap you can easily create responsive designs. Bootstrap
responsive features make your web pages to appear more appropriately on different devices
and screen resolutions without any change in markup.
Consistent design — All Bootstrap components share the same design templates and styles
through a central library, so that the designs and layouts of your web pages are consistent
throughout your development.
Easy to use — Bootstrap is very easy to use. Anybody with the basic working knowledge of
HTML and CSS can start development with Bootstrap.
Compatible with browsers — Bootstrap is created with modern browsers in mind and it is
compatible with all modern browsers such as Mozilla Firefox, Google Chrome, Safari,
Internet Explorer, and Opera.
Open Source — And the best part is, it is completely free to download and use.

Automatic Timetable Generator Page 31


CONTENT MANAGEMENT SYSTEM

A content management system or CMS is software that facilitates creating, editing,


organizing, and publishing content. WordPress is a Content Management System that allows
you to create and publish your content on the web. Although it is mostly used for web
publishing, it can be used to manage content on an intranet, or in a single computer.

WordPress allows users to have full control over the files, documents, as well as the design
and display of the content. You don’t have to know a single line of code to publish content
using WordPress. The beauty of a good content management system is to allow any user to
create and manage their content without any technical know-how.

In the earlier days, an average user or a small company had to rely on static HTML sites
because they could not afford a content management system which would cost hundreds of
thousands of dollars. That problem is now solved. WordPress is open source and free for
anyone to use.

WordPress is being used in all sort of creative ways. We have seen WordPress being used to
power small business websites, blogs, large university websites, portfolios, real estate
property listing site, internal communication system for companies, web directories, movie
databases, application infrastructure base, arcade sites, and basically anything else you can
think of.

A content management system may have the following functions:


 Making publishing easier and more consistent with existing structure/design
 Allowing the input of data that classifies content (e.g. keywords) so that it can
be searched for and retrieved
 Tracking changes to pages and, if necessary, allowing previous versions to be
accessed.
 Make it easy to edit content
 Allow for collaborative work on content
 Integrated document management systems
 Workflow management: Allowing for parallel content development
 Provide extensions and plug-ins for increased functionality Etc.

Automatic Timetable Generator Page 32


Installation and setup

Installing and setting up MySQL takes a matter of a few minutes. You can use MySQL from
the command line tools, but there is a GUI-based utility which lets you use MySQL through a
decent graphical interface. For this tutorial, you will be using DB Browser for MySQL. To
start, you will first download this tool from here with respect to your OS platform.
The interface for DB Browser for MySQL looks like this –

Creating databases and tables

Once you are ready with the DB Browser tool, you can create a new MySQL database to
proceed. To do this, you can click on the New Database tab –

After clicking on the New Database tab, you will be prompted to enter a name for the
database. Give a name of your choice and then proceed. An empty database of the name that
you entered will be created instantaneously, and you will be prompted to create a table under
that database. You can skip the table creation part, for now, you will get to it shortly.

Automatic Timetable Generator Page 33


Importing a .csv file into MySQL database
To import a .csv file into the database you created, just follow this navigation: File -> Import
-> Table from CSV file. You can use this .csv file for the purpose. It contains details about
different countries around the globe. Navigate to the file, and you will get a dialog box like
the following after that -

DB Browser lets you specify many things here including the names of the table. Make sure
you check the Column names in the first line option, so that MySQL can extract the column
names automatically. Click on OK after you are done with the specifications.

Automatic Timetable Generator Page 34


FUNCTIONAL
SPECIFICATION

Automatic Timetable Generator Page 35


FUNCTIONAL SPECIFICATION

MODULE:
 Encapsulates code and data to implement a particular functionality.
 Has an interface that lets clients to access its functionality in an uniform manner.
 Is easily pluggable with another module that expects its interface.
 Is usually packaged in a single unit so that it can be easily deployed.

Time Table Generator is a web based application which guides you about time table
management. This project includes mainly 3 main modules
LOGIN:
 Admin
 Teacher
 Student
ADMINISTRATIVE MODULE
The page require 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.
Sub modules of Admin

 Add teachers – Adds the teacher’s details such as name, id, designation, mobile
number, email etc.
 Add subjects – Adds the subject details such as name of the subject, subject code,
class etc.
 Add classrooms – Adds the classrooms details like classroom number etc.
 Add courses – Adds the course details.
 Allotment –Alloting the subjects to teachers like theory subjects, practical subjects,
classrooms etc
 Generate timetable – generates the timetable for teacher and class wise timetable.

Automatic Timetable Generator Page 36


TEACHER MODULE
Teacher can register by admin. The teacher have to login to get more information
about the time schedule.
Sub modules of Teacher

 View other teacher’s timetable.


 View their timetable.
 Download the copy of timetable.
 View student’s timetable.

STUDENT MODULE:

Students can just visit the site and they can check their timetable schedule and they
can download it for their own purpose easily.

Automatic Timetable Generator Page 37


SYSTEM DESIGN
&
DATABASE DESIGN

Automatic Timetable Generator Page 38


SYSTEM DESIGN

INTRODUCTION TO SYSTEM DESIGN

The design phase is the life cycle phase in which the detailed design of the
selected system in the study phase is accomplished. In the design phase, the technical
specifications are prepared for the performance of all allocated tasks. It also includes the
construction of programs and program testing. In the design phase, the first step is to
determine the output is to be produced and in what format. Second, input data and master
files have to be designed to meet the requirements of proposed output. The system analyst has
to define the methods of capturing and input programs and format of the output and its use by
the users.

The design is a solution, the translation of requirements into center ways of


meeting. The design is actually the process of analyzing, organizing and developing a
database model that accurately reflects the organization functioning in the real world and
implementing that model by creating a database requires an appropriate methodology. System
can be divided into two phases:
1. Logical Design
2. Physical Design

Logical Design

The logical design describes the detail specification for the proposed system. We
can say that it describes its own feature. Input, output, file (table) and database in manner that
meets the project needs. In logical design work with users is done to develop general design,
choose best design, develop system flow charts, identify hardware, software and personal
needs and revise estimates etc.

Physical Design

The purpose of physical design is to translate the logical description of data into
the technical specification for storing and retrieving data. The goal is to create design for
storing data that will provide adequate performance and ensure database integrity, security

Automatic Timetable Generator Page 39


and recovery. Physical database design does not include implementing files and databases
(i.e. creating them and loading data into them).

Input Design

The input design specifies the number in which the user enters the data to the
system for processing at later stage. Input design can insure the reliability of the system and
provide an accurate result. The input determines whether the user interacts with the system
efficiently or not. The input design can also be explained as a link between the user and the
world. Input design consists of those steps necessary to put transactions data into usable form
of processing. While designing the input for the Crime Reporting System for police
departments of KPK has the following objectives were kept in mind as guidelines.

1. Reducing the amount of input


2. Avoiding errors in data
3. Keeping extra steps
4. Keeping the process simple
5. Avoiding delays

Data Capturing

In input design only those items are captured which must actually be the subject of
input while designing the input, following points were kept in mind.
1. Crime information
2. Complaint report record
3. Admin information
4. User information

Input Validation

Input validation is general term given to method, aim for detecting errors in the
input. The main thing, which is considered in the input, is that what the chances of error are?
Following are input validation used for centralized system for Crime Reporting System for
police department.
1. Empty entry Control
2. Data Type Validation

Automatic Timetable Generator Page 40


3. Not Null

Output Design

A system is considered to be successful or unsuccessful on the basis of output


design. The term “output” means that after compilation of physical design what errors come
out of the computer system for the user. The output in project is considered as the backbone
of the project. All managerial design is actually made through these reports. Basically the
reports are very important aspect of the output. The user creates various reports in response to
queries.

DATABASE DESIGN

Data Base Design

Database Design is a creative process of transforming:


1. Problems into Solution
2. The description of solution
3. Intelligent database design is perhaps the most critical element of an optimal solution with
respect to performance. In fact, poor design is usually the culprit for poorly performing
solutions.
4. Designer of the database should satisfy the user.

Architectural Design

The primary objective of architectural design is to develop a modular program structure and
represent the control relationship between them.

Conceptual Database Design

Tells the user exactly


1. What the system will do
2. Describe the functions of the systems
3. The system will work in the following areas
4. Unique authorized access to all registered users
5. Purchasing of produce

Automatic Timetable Generator Page 41


Modular Design

Modular design occurs after data; architecture and interface designs have been established. In
and world, the modular specification required to be define algorithmic details would be stated
in a natural language such as English because it is easily understandable. And then that
straight forward plain English are converted to diagrams. There is no question that graphics
tools such as flow charts or box diagrams provide excellent pictorial patterns that readily
depict modular details. However graphical tools are misused, the wrong picture may lead to
wrong software. In this section we will demonstrate some of our basic modules by using
Flow Charts. Such as form entry, deletion, insertion, updating and reports.

Data Flow Diagram

The Data Flow Diagram (DFD) is the graphical representation of the processes and the flow
of data among them. A data flow diagram illustrates the processes, data stores, external
entities and the connecting data flows in a system. It is a common practice to draw a context-
level Data Flow Diagram first which shows the interaction between the system and outside
entities.

A data flow diagram is a graphical tool used to describe and analyze movement of data
through a system. They are the central tool and forms the basis from which the other
components are developed. The transformation of data from input to output may be described
logically and independently of physical components associated with the system. These are
known as the logical data flow diagrams. The physical data flow diagrams show the actual
implements and movements of data between people, departments and workstations. A full
description of a system actually consists of a set of data flow diagrams. Using two familiar
notations Yourdon, Gane and Sarson notation develops the data flow diagram. Each
component in a DFD is labelled with a descriptive name. Process is further identified with a
number that will be used for identification purpose. The development of DFD’s is done in
several levels. Each process in lower level diagrams can be broken down into a more detailed
DFD in the next level. The top level diagram is often called context diagram. It consists a
single process bit, which plays vital role in studying the current system. The process in the
context level diagram is exploded into other process at the first level DFD.

Automatic Timetable Generator Page 42


The idea behind the explosion of a process into more process is that understanding at one
level of detail is exploded into greater detail at the next level. This is done until further
explosion is necessary and an adequate amount of detail is described for analyst to understand
the process. Larry Constantine first developed the DFD as a way of expressing system
requirements in a graphical form, this lead to the modular design.

A DFD is also known as a “bubble Chart” has the purpose of clarifying systemrequirements
and identifying major transformations that will become programs in system design.So it is the
starting point of the design to the lowest level of detail. A DFD consists of a series ofbubbles
joined by data flows in the system.

DFD SYMBOLS

In the DFD, there are four symbols

A square defines a source (originator) or destination of system


data.

An arrow defines data flow. It is the pipeline through which the information
Flows.

A circle or a bubble represents a process that transforms incoming data flow


into outgoing dataflows.

An open rectangle is a data store, data at rest or a temporary repository


Of data.

CONSTRUCTING A DFD
There are several rules of thumb that are used in drawing DFD’s. They are

 Process should be named and numbered for an easy reference. Each name should be
representative of the process.
 The direction of flow is from top to bottom and from left to right. Data traditionally
flow from source to the destination although they may flow back to the source. One
way to indicate this is to draw long flow line back to a source. An alternative way is

Automatic Timetable Generator Page 43


to repeat the source symbol as a destination. Since it is used more than once in the
DFD, it is marked with a short diagonal.
 When a process is exploded into lower level details, they are numbered.

DATA STORE

 Data cannot move directly from one data store to another data store, a process must
move data.
 Data cannot move directly from an outside source to a data store. Data must be moved
by a process that receives data from the source and places the data into the data store.
 Data cannot move directly to an outside sink from a data store. Data must be moved
by a process.
 A data store has a noun phrase label.

DATA FLOW
 A data flow has only one direction of flow between symbols. It may flow in both
directions between a process and a data store to show a read before an update.
 A fork in a data flow means that exactly the same data goes from a common location
to two or more different processes, data stores, or source/sinks.
 A join in a data flow means that exactly the same data come from any of two or more
different processes, data stores, or source/sinks to a common location
 A data flow cannot go directly back to the same process it leaves.
 A data flow to a data store means update.
 A data flow from a data store means retrieve or use.
 A data flow has a noun phase label.

Automatic Timetable Generator Page 44


SYSTEM
IMPLEMENTATION

Automatic Timetable Generator Page 45


SYSTEM IMPLEMENTATION

PROGRAM DEVELOPMENT

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

7. Maintenance, Extension, and Redesign.

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.

SOFTWARE SELECTION

Software selection is critical aspect of system development. These are two ways of
acquiring software custom-made or “off-the-shelf” packages. Today’s trend towards
purchasing packages, which represent roughly 10 percent of what are costs to, developed
same in house. Prior to selecting the software, the project team must setup criteria for

Automatic Timetable Generator Page 46


software selection.
Software readability brings up the concept of modularity. Functionally, it is definition
of the e facilities, performance and other factors that the user requires in the finished product.
Capacity refers to the capability of the software package to handle the user’s requirements.
The criterion, usability refers to the effort required to the operate, prepare the input and
interpret the output program. Serviceability focuses on documentation and vendor support
lost is major consideration. The other criteria are flexibility, security, performance, and
ownership.

SECURITY FEATURES

Every candidate system must provide built in for security and integrity of data.
Without safeguards against unauthorized access and natural disasters, a system could be so
vulnerable as to threaten survival of the organization. To do an adequate job on security, a
system analyst must analyze the risks, exposure and costs and specify measures such as
passwords and encryption to provide protection. In addition, backup copies of software and
recovery re start procedures must be available when needed.

ANALYSIS

Data Flow Diagram (DFD)


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.

To construct a data flow diagram, we use


 Arrows
 Circles
 Open-ended boxes
 Squares

Automatic Timetable Generator Page 47


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.
The following information rules govern construction of DFD
a) Arrows should not cross each other

b) Squares, circles, and files must bear names.

DATA FLOW DIAGRAM

Automatic Timetable Generator Page 48


Automatic Timetable Generator Page 49
Entity-Relationship Diagram (ERD)

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
is commonly used for database design for the database designer, the utility of the ER model
is:
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.

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.

Automatic Timetable Generator Page 50


ALIAS
DESIGNATION
PASSWORD FIRSTNAME
USER
PHONE
COURSE
ADMIN
FACULTY EMAIL
FAC_ID
COURSENAME

VIEW TEACHES
COURSEID
HAVE
GENERATE
& VIEW SUB_ID

COURSE FAC_SUB

FAC_ID
ADD

TIMETABLE
COURSE_ID

TEACHER SEM_ID

SUBJECT
DAY
PERIOD
CONTAIN

ADD

HAVE SUB_NAME
SEM_NAME
SUB_ID
SEMESTER
COURSENAME

CONTAIN
SUBJECT
SEM_ID SEM_NAME

COURSE_ID

ER DIGRAM OF AUTOMATIC TIMETABLE GENERATOR

Automatic Timetable Generator Page 51


DATABASE DESIGN
The general theme behind a database is to handle information as an integrated whole. A
database is a collection of interrelated data stored with minimum redundancy to serve many
users quickly and effectively. After designing input and output, the analyst must concentrate
on database design or how data should be organized around user requirements. The general
objective is to make information access, easy quick, inexpensive and flexible for other users.

During database design the following objectives are concerned


Controlled Redundancy
Data independence
Accurate and integrating
More information at low cost
Recovery from failure
Privacy and security
Performance
Ease of learning and use

TABLE STRUCTURE
Table 01: Admin Login

Automatic Timetable Generator Page 52


Table 02: Classrooms

Table 03: Courses

Automatic Timetable Generator Page 53


Table 04: Individual Semester Table

Table 05: Teachers Table

Automatic Timetable Generator Page 54


Table 06: Individual Teacher Table

Table 07: Subjects Table

Automatic Timetable Generator Page 55


TESTING
What is Software Testing?
Software testing is an activity to check whether the actual results match the
expected results and to ensure that the software system is Defect free. It involves execution of
a software component or system component to evaluate one or more properties of interest.
Software testing also helps to identify errors, gaps or missing requirements in contrary to the
actual requirements. It can be either done manually or using automated tools. Some prefer
saying Software testing as a white box and Black Box Testing.

STRATEGIC APPROACH TO SOFTWARE TESTING

The software engineering process can be viewed as a spiral. Initially system


engineering defines the role of software and leads to software requirement analysis where the
information domain, functions, behavior, performance, constraints and validation criteria for
software are established. Moving inward along the spiral, we come to design and finally to
coding.
Unit Testing

Unit testing focuses verification effort on the smallest unit of software design, the module.
The unit testing we have is white box oriented and some modules the steps are conducted in
parallel.

1. WHITE BOX TESTING

This type of testing ensures that


• All independent paths have been exercised at least once

• All logical decisions have been exercised on their true and false sides

• All loops are executed at their boundaries and within their operational bounds

• All internal data structures have been exercised to assure their validity.

To follow the concept of white box testing we have tested each form .we have created
independently to verify that Data flow is correct, All conditions are exercised to check their
validity, All loops are executed on their boundaries.

Automatic Timetable Generator Page 56


2. BASIC PATH TESTING

Established technique of flow graph with Cyclomatic complexity was used to derive test
cases for all the functions. The main steps in deriving test cases were:

Use the design of the code and draw correspondent flow graph.
Determine the Cyclomatic complexity of resultant flow graph, using formula:
V(G)=E-N+2 or V(G)=P+1 or
V(G)=Number Of Regions
Where V(G) is Cyclomatic complexity, E is the number of edges, N is the number of flow
graph nodes, P is the number of predicate nodes.
Determine the basis of set of linearly independent paths.

3. CONDITIONAL TESTING

In this part of the testing each of the conditions were tested to both true and false aspects.
And all the resulting paths were tested. So that each path that may be generate on particular
condition is traced to uncover any possible errors.

4. DATA FLOW TESTING

This type of testing selects the path of the program according to the location of definition and
use of variables. This kind of testing was used only when some local variable were declared.
The definition-use chain method was used in this type of testing. These were particularly
useful in nested statements.

5. LOOP TESTING

In this type of testing all the loops are tested to all the limits possible. The following exercise
was adopted for all loops:
 All the loops were tested at their limits, just above them and just below them.
 All the loops were skipped at least once.
 For nested loops test the inner most loop first and then work outwards.
 For concatenated loops the values of dependent loops were set with the help of
connected loop.
 Unstructured loops were resolved into nested loops or concatenated loops and tested
as above.
Each unit has been separately tested by the development team itself and all the input have
been validated.

Automatic Timetable Generator Page 57


SCREEN SHOTS

Automatic Timetable Generator Page 58


SCREEN SHOTS

Figure 01: Home Page

Figure 02: Admin Login Page

Automatic Timetable Generator Page 59


Figure 03: Teacher Login page

Figure 04: Teacher Page

Automatic Timetable Generator Page 60


Figure 05: Admin Page

Figure 06: Add Teacher Page

Automatic Timetable Generator Page 61


Figure 07: Subjects Page

Figure 08: Add Subject Page

Automatic Timetable Generator Page 62


Figure 09: Classroom Page

Figure 10: Add Classroom Page

Automatic Timetable Generator Page 63


Figure 11: Courses Page

Figure 12: Add Course Page

Automatic Timetable Generator Page 64


Figure 13: Theory Subject Allotment Page

Figure 14: Practical Subject Allotment Page

Automatic Timetable Generator Page 65


Figure 15: Classrooms Allotment Page

Figure 16: Generate Timetable page

Automatic Timetable Generator Page 66


Figure 17: Timetable view

Figure 18: Timetable View (*.pdf)

Automatic Timetable Generator Page 67


Figure 19: Student Timetable View Page

Automatic Timetable Generator Page 68


CODING

Automatic Timetable Generator Page 69


CODING

INDEX PAGE CODING


<?php
if (isset($_GET['generated']) && $_GET['generated'] == "false") {
unset($_GET['generated']);
echo '<script>alert("Timetable not generated yet!!");</script>';
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-
scale=1"/>
<meta name="description" content=""/>
<meta name="author" content=""/>
<title>AUTOMATIC TIMETABLE GENERATOR</title>
<!-- BOOTSTRAP CORE STYLE CSS -->
<link href="assets/css/bootstrap.css" rel="stylesheet"/>
<!-- FONT AWESOME CSS -->
<link href="assets/css/font-awesome.min.css" rel="stylesheet"/>
<!-- FLEXSLIDER CSS -->
<link href="assets/css/flexslider.css" rel="stylesheet"/>
<!-- CUSTOM STYLE CSS -->
<link href="assets/css/style.css" rel="stylesheet"/>
<!-- Google Fonts -->
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700,300'
rel='stylesheet' type='text/css'/>

</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top " id="menu">
<div class="container">
<div align="center">
<h3 align="center">AUTOMATIC TIMETABLE GENERATOR</h3>
</div>
</div>
</div>

<div id="myCarousel" class="carousel slide" data-ride="carousel">


<!-- Indicators -->
<ol class="carousel-indicators" style="margin-bottom: 160px">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
<li data-target="#myCarousel" data-slide-to="3"></li>
</ol>

Automatic Timetable Generator Page 70


<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="assets/img/TTG.jpg" alt="Chania">
</div>

<div class="item">
<img src="assets/img/download1.jpg" alt="Chania">
</div>

<div class="item">
<img src="assets/img/TTG.jpg" alt="Flower">
</div>

<div class="item">
<img src="assets/img/download1.jpg" alt="Flower">
</div>
</div>
</div>
<script type="text/javascript">
function genpdf() {
var doc = new jsPDF();

doc.addHTML(document.getElementById('TT'), function () {
doc.save('demo timetable.pdf');
});
window.alert("Downloaded!");
}
</script>
<div align="center" STYLE="margin-top: 30px">
<button data-scroll-reveal="enter from the bottom after 0.2s"
id="teacherLoginBtn" class="btn btn-info btn-lg">TEACHER LOGIN
</button>
<button data-scroll-reveal="enter from the bottom after 0.2s"
id="adminLoginBtn" class="btn btn-success btn-lg">ADMIN LOGIN
</button>
</div>
<br>
<div align="center">
<form data-scroll-reveal="enter from the bottom after 0.2s" action="studentvalidation.php"
method="post">
<select id="select_semester" name="select_semester" class="list-group-item">
<option selected disabled>Select Semester</option>
<option value="1"> BCA I Year ( Semester I )</option>
<option value="2"> BCA I Year ( Semester II )</option>
<option value="3"> BCA II Year ( Semester III )</option>
<option value="4"> BCA II Year ( Semester IV )</option>
<option value="5"> BCA III Year ( Semester V )</option>
<option value="6"> BCA III Year ( Semester VI )</option>
</select>
<button type="submit" class="btn btn-info btn-lg" style="margin-top:
10px">Download</button>

Automatic Timetable Generator Page 71


</form>
</div>
<!-- The Modal -->
<div id="myModal" class="modal">
<!-- Modal content -->
<div class="modal-content">
<div class="modal-header">
<span class="close">&times</span>
<h2 id="popupHead">Modal Header</h2>
</div>
<div class="modal-body" id="LoginType">
<!--Admin Login Form-->
<div style="display:none" id="adminForm">
<form action="adminFormvalidation.php" method="POST">
<div class="form-group">
<label for="adminname">Username</label>
<input type="text" class="form-control" id="adminname" name="UN"
placeholder="Username ...">
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" class="form-control" id="password" name="PASS"
placeholder="Password ...">
</div>
<div align="right">
<input type="submit" class="btn btn-default" name="LOGIN"
value="LOGIN">
</div>
</form>
</div>
</div>
<!--Faculty Login Form-->
<div style="display:none" id="facultyForm">
<form action="facultyformvalidation.php" method="POST" style="overflow:
hidden">
<div class="form-group">
<label for="facultyno">Faculty No.</label>
<input type="text" class="form-control" id="facultyno" name="FN"
placeholder="Faculty No .... ">
</div>
<div align="right">
<button type="submit" class="btn btn-default"
name="LOGIN">LOGIN</button>
</div>
</form>
</div>
</div>
</div>
<script>
// Get the modal
var modal = document.getElementById('myModal');

// Get the button that opens the modal

Automatic Timetable Generator Page 72


var teacherLoginBtn = document.getElementById("teacherLoginBtn");
var adminLoginBtn = document.getElementById("adminLoginBtn");
var heading = document.getElementById("popupHead");
var facultyForm = document.getElementById("facultyForm");
var adminForm = document.getElementById("adminForm");
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];

// When the user clicks the button, open the modal


adminLoginBtn.onclick = function () {
modal.style.display = "block";
heading.innerHTML = "Admin Login";
adminForm.style.display = "block";
facultyForm.style.display = "none";
}
teacherLoginBtn.onclick = function () {
modal.style.display = "block";
heading.innerHTML = "Faculty Login";
facultyForm.style.display = "block";
adminForm.style.display = "none";
}

// When the user clicks on <span> (x), close the modal


span.onclick = function () {
modal.style.display = "none";
adminForm.style.display = "none";
facultyForm.style.display = "none";
}

// When the user clicks anywhere outside of the modal, close it


window.onclick = function (event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
</script>
<!--HOME SECTION END-->
<!--HOME SECTION TAG LINE END-->

<div id="faculty-sec">
<div class="container set-pad">
<div class="row text-center">
<div class="col-lg-8 col-lg-offset-2 col-md-8 col-sm-8 col-md-offset-2 col-sm-offset-
2">
<h1 data-scroll-reveal="enter from the bottom after 0.1s" class="header-
line">OUR FACULTY </h1>

</div>

</div>
<!--/.HEADER LINE END-->

<div class="row">

Automatic Timetable Generator Page 73


<div class="col-lg-4 col-md-4 col-sm-4" data-scroll-reveal="enter from the bottom
after 0.4s">
<div class="faculty-div">
<img src="assets/img/Chairman.png" class="img-rounded"/>
<h3 align="center">Dr. Mohan Manghnani</h3>
<hr/>
<h4 align="center">CHAIRMAN<br/>New Horizon Educational
Institution</h4>

</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-4" data-scroll-reveal="enter from the bottom
after 0.5s">
<div class="faculty-div">
<img src="assets/img/faculty/principal.jpg" class="img-rounded"/>
<h3 align="center">Dr. Vijaya Reddy</h3>
<hr/>
<h4 align="center">Principal<br/> New Horizon College, Kasthurinagar</h4>

</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-4" data-scroll-reveal="enter from the bottom
after 0.6s">
<div class="faculty-div">
<img src="assets/img/hod1.jpg" class="img-rounded"/>
<h3 align="center">PROF. DR.T.Logeshwari</h3>
<hr/>
<h4 align="center">Professor<br/>Computer Science Department</h4>

</div>
</div>

</div>
</div>
</div>

<div class="container">
<div class="row set-row-pad">
<div class="col-lg-4 col-md-4 col-sm-4 col-lg-offset-1 col-md-offset-1 col-sm-offset-1
"
data-scroll-reveal="enter from the bottom after 0.4s">

<h2><strong>Our Location </strong></h2>


<hr/>
<div>
<h4>3rd A Cross, 2nd A Main Rd, East of NGEF Layout Kasturi Nagar,
Bengaluru, Karnataka 560043
</h4>
<h4>Kasturi Nagar, Bengaluru, Karnataka 560043 </h4>
<h4><strong>Call:</strong> 080 2542 9361 </h4>
<h4><strong>Email: </strong>principalnhck@newhorizonindia.edu</h4>

Automatic Timetable Generator Page 74


</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-4 col-lg-offset-1 col-md-offset-1 col-sm-offset-
1"
data-scroll-reveal="enter from the bottom after 0.4s">

<h2><strong>Social Conectivity </strong></h2>


<hr/>
<div>
<a href="#"> <img src="assets/img/Social/facebook.png" alt=""/> </a>
<a href="#"> <img src="assets/img/Social/google-plus.png" alt=""/></a>
<a href="#"> <img src="assets/img/Social/twitter.png" alt=""/></a>
</div>
</div>

</div>
</div>
<!-- CONTACT SECTION END-->
<div id="footer">
<!-- &copy 2014 yourdomain.com | All Rights Reserved | <a
href="http://binarytheme.com" style="color: #fff" target="_blank">Design by :
binarytheme.com</a>
--></div>
<!-- FOOTER SECTION END-->

<!-- Jquery Core Script -->


<script src="assets/js/jquery-1.10.2.js"></script>
<!-- Core Bootstrap Script -->
<script src="assets/js/bootstrap.js"></script>
<!-- Flexslider Scripts -->
<script src="assets/js/jquery.flexslider.js"></script>
<!-- Scrolling Reveal Script -->
<script src="assets/js/scrollReveal.js"></script>
<!-- Scroll Scripts -->
<script src="assets/js/jquery.easing.min.js"></script>
<!-- Custom Scripts -->
<script src="assets/js/custom.js"></script>
</div>
</body>
</html>

ADMIN FORM
<?php
/**
* Created by PhpStorm.
* User: MSaqib
* Date: 20-02-2020
* Time: 02:56
*/

include 'connection.php';

Automatic Timetable Generator Page 75


if (isset($_POST['UN']) && isset($_POST['PASS'])) {
$id = $_POST['UN'];
$password = $_POST['PASS'];
} else {
die();
}
$q = mysqli_query(mysqli_connect("localhost", "root", "", "ttms"), "SELECT name FROM
admin WHERE name = '$id' and password = '$password' ");
if (mysqli_num_rows($q) == 1) {
echo 'welcome admin';
} else {
$message = "Username and/or Password incorrect.\\nTry again.";
echo "<script type='text/javascript'>alert('$message');</script>";
}

?>

ALGORITHM PAGE
<?php

/**Class to store subject details**/


class Subject
{
public $code; //Subject code
public $classes = 0; //No. of classes
public $semester; //semester of subject
public $alias; //alias for subject teacher
public $alias2; //alias for subject teacher2 (only for practical subjects)
public $alias3; //alias for subject teacher3 (only for practical subjects)
public $subjectteacher; //faculty number of teacher1
public $subjectteacher2; //faculty number of teacher2
public $subjectteacher3; //faculty number of teacher3
}

/**Class to store teachers details**/


class Teacher
{
public $id; //faculty number
public $days = array(); //schedule
public $classroom_names = array(); //classroom names
}

$subjectslots = array(); //subjects slots for all semesters


$aliasslots = array(); //alias slots corresponding to each subject

$query = mysqli_query(mysqli_connect("localhost", "root", "", "ttms"), "SELECT * FROM


subjects ");
$subjects[] = new Subject(); //to store theory subjects
$practicals[] = new Subject(); //to store practical subjects

$count = 0;

Automatic Timetable Generator Page 76


/** fetching theory subjects and saving in subjects array*/
while ($row = mysqli_fetch_assoc($query)) {
if ($row['course_type'] == 'LAB')
continue;
$temp = new Subject();
$temp->code = $row['subject_code'];
$temp->semester = $row['semester'];
$temp->subjectteacher = $row['allotedto'];
if (isset($temp->subjectteacher)) {
$teacheralias_query = mysqli_query(mysqli_connect("localhost", "root", "", "ttms"),
"SELECT * FROM teachers WHERE faculty_number='$temp->subjectteacher'");
$row = mysqli_fetch_assoc($teacheralias_query);
$temp->alias = $row['alias'];
}
$subjects[$count++] = $temp;
}
$subjects_count = $count;
/**Fetching teachers and saving into teachers array*/
$query = mysqli_query(mysqli_connect("localhost", "root", "", "ttms"), "SELECT * FROM
teachers ");

$teachers[] = new Teacher();


$count = 0;
while ($row = mysqli_fetch_assoc($query)) {
$temp = new Teacher();
$temp->id = $row['faculty_number'];
$teachers[$count++] = $temp;
}
$teachers_count = $count;
$r = -1;

/** Genrating timetable for theory courses, with maximum class for each subject equal to 4 */
for ($I = 0; $I < $subjects_count * 4; $I++) {
$i = $I % $subjects_count;
$sem = $subjects[$i]->semester;
$year = ($sem + 1) / 2;
$classroom_query = mysqli_query(mysqli_connect("localhost", "root", "", "ttms"),
"SELECT name FROM classrooms WHERE status='$year'");
$row = mysqli_fetch_assoc($classroom_query);
$classroom = $row['name'];
for ($j = 0; $j < 30; $j++) {
$subject_teacher;
for ($z = 0; $z < $count; $z++) {
if ($teachers[$z]->id == $subjects[$i]->subjectteacher) {
$tindex = $z;
break;
}
}
if ($j % 6 == 0)
$r++;
if (isset($subjectslots[$sem][$r % 6][$j % 5])) {
//check if subjectslot is empty
continue;

Automatic Timetable Generator Page 77


} else if (isset($teachers[$tindex]->days[$sem % 2][$r % 6][$j % 5])) {
//check if subject teacher is free
continue;
} else {
//check if existing in same day
$already = false;
for ($z = 0; $z < 5; $z++) {
if (isset($subjectslots[$sem][$r % 6][$z])) {
if ($z == ($j % 5)) {
continue;
}
if ($subjectslots[$sem][$r % 6][$z] == $subjects[$i]->code) {
$already = true;
}
}
}
if ($already) {
continue;
}
// set subject
$subjects[$i]->classes++;
$subjectslots[$sem][$r % 6][$j % 5] = $subjects[$i]->code;
$aliasslots[$sem][$r % 6][$j % 5][0] = $subjects[$i]->alias;
$teachers[$tindex]->days[$sem % 2][$r % 6][$j % 5] = $subjects[$i]->code;
$teachers[$tindex]->classroom_names[$sem % 2][$r % 6][$j % 5] = $classroom;
break;
}
}
}
/**********************check for empty slots in semester's
timetable*******************************/
for ($i = 1; $i < 6; $i += 1) {
for ($k = 0; $k < 6; $k++) {
for ($j = 0; $j < 5; $j++) {

if (isset($subjectslots[$i][$k][$j % 5])) {
} else {
$subjectslots[$i][$k][$j % 5] = "-";
$aliasslots[$i][$k][$j % 5][0] = "-";
}

}
}
}
/**********************check for empty slots in teacher's
timetable*******************************/
for ($i = 0; $i < $count; $i++) {
for ($k = 0; $k < 6; $k++) {
for ($j = 0; $j < 5; $j++) {

if (isset($teachers[$i]->days[1][$k][$j])) {
} else {
$teachers[$i]->days[1][$k][$j] = "-";

Automatic Timetable Generator Page 78


$teachers[$i]->classroom_names[1][$k][$j] = "-";
}
}
}
}
/**Fetching info of practical courses **/

$query = mysqli_query(mysqli_connect("localhost", "root", "", "ttms"), "SELECT * FROM


subjects ");
$count = 0;
while ($row = mysqli_fetch_assoc($query)) {
if (!($row['course_type'] == 'LAB'))
continue;
$temp = new Subject();
$temp->code = $row['subject_code'];
$temp->semester = $row['semester'];
$temp->subjectteacher = $row['allotedto'];
$temp->subjectteacher2 = $row['allotedto2'];
$temp->subjectteacher3 = $row['allotedto3'];
$teacheralias_query = mysqli_query(mysqli_connect("localhost", "root", "", "ttms"),
"SELECT * FROM teachers WHERE faculty_number='$temp->subjectteacher'");
$row = mysqli_fetch_assoc($teacheralias_query);
$temp->alias = $row['alias'];
$teacheralias_query = mysqli_query(mysqli_connect("localhost", "root", "", "ttms"),
"SELECT * FROM teachers WHERE faculty_number='$temp->subjectteacher2'");
$row = mysqli_fetch_assoc($teacheralias_query);
$temp->alias2 = $row['alias'];
$teacheralias_query = mysqli_query(mysqli_connect("localhost", "root", "", "ttms"),
"SELECT * FROM teachers WHERE faculty_number='$temp->subjectteacher3'");
$row = mysqli_fetch_assoc($teacheralias_query);
$temp->alias3 = $row['alias'];
$practicals[$count++] = $temp;
}
for ($I = 0; $I < 2 * $count; $I++) {
$i = $I % $count;
$sem = $practicals[$i]->semester;
$tindex = -1;
$tindex2 = -1;
$tindex3 = -1;
for ($z = 0; $z < $teachers_count; $z++) {
if (isset($practicals[$i]->subjectteacher)) {
if ($teachers[$z]->id == $practicals[$i]->subjectteacher) {
$tindex = $z;
}
}
if (isset($practicals[$i]->subjectteacher2)) {
if ($teachers[$z]->id == $practicals[$i]->subjectteacher2) {
$tindex2 = $z;
}
}
if (isset($practicals[$i]->subjectteacher3)) {
if ($teachers[$z]->id == $practicals[$i]->subjectteacher3) {
$tindex3 = $z;

Automatic Timetable Generator Page 79


}
}
}

//checking if all three teachers are free


for ($j = 0; $j < 6; $j++) {
if (isset($subjectslots[$sem][$j][5])) {
continue;
} else if (isset($teachers[$tindex]->days[$sem % 2][$j][5]) || isset($teachers[$tindex2]-
>days[$sem % 2][$j][5]) ||
isset($teachers[$tindex3]->days[$sem % 2][$j][5])
){
continue;
} else {
//if free then assign practical
$practicals[$i]->classes++;
$subjectslots[$sem][$j][5] = $practicals[$i]->code;
$aliasslots[$sem][$j][5][0] = $practicals[$i]->alias;
$aliasslots[$sem][$j][5][1] = $practicals[$i]->alias2;
$aliasslots[$sem][$j][5][2] = $practicals[$i]->alias3;
$teachers[$tindex]->days[$sem % 2][$j][5] = $practicals[$i]->code;
$teachers[$tindex2]->days[$sem % 2][$j][5] = $practicals[$i]->code;
$teachers[$tindex3]->days[$sem % 2][$j][5] = $practicals[$i]->code;
break;
}
}
}

/**checks for empty slot**/


for ($i = 1; $i < 7; $i += 1) {
for ($j = 0; $j < 6; $j++) {
if (isset($subjectslots[$i][$j][5])) {}
else {
$subjectslots[$i][$j][5] = '-';
$aliasslots[$i][$j][5][0] = '-';
$aliasslots[$i][$j][5][1] = '-';
$aliasslots[$i][$j][5][2] = '-';
}
if (isset($subjectslots[$i][$j][0])) {}
else {
$subjectslots[$i][$j][0] = '-';
$aliasslots[$i][$j][0][0] = '-';
$aliasslots[$i][$j][0][1] = '-';
$aliasslots[$i][$j][0][2] = '-';
}
if (isset($subjectslots[$i][$j][1])) {}
else {
$subjectslots[$i][$j][1] = '-';
$aliasslots[$i][$j][1][0] = '-';
$aliasslots[$i][$j][1][1] = '-';
$aliasslots[$i][$j][1][2] = '-';
}
if (isset($subjectslots[$i][$j][2])) {}

Automatic Timetable Generator Page 80


else {
$subjectslots[$i][$j][2] = '-';
$aliasslots[$i][$j][2][0] = '-';
$aliasslots[$i][$j][2][1] = '-';
$aliasslots[$i][$j][2][2] = '-';
}
if (isset($subjectslots[$i][$j][3])) {}
else {
$subjectslots[$i][$j][3] = '-';
$aliasslots[$i][$j][3][0] = '-';
$aliasslots[$i][$j][3][1] = '-';
$aliasslots[$i][$j][3][2] = '-';
}
if (isset($subjectslots[$i][$j][4])) {}
else {
$subjectslots[$i][$j][4] = '-';
$aliasslots[$i][$j][4][0] = '-';
$aliasslots[$i][$j][4][1] = '-';
$aliasslots[$i][$j][4][2] = '-';
}
}
}

for ($i = 0; $i < $teachers_count; $i++) {


for ($k = 0; $k < 6; $k++) {

if (isset($teachers[$i]->days[1][$k][5])) {}
else {
$teachers[$i]->days[1][$k][5] = "-";
}
}
}

/******Saving semesters timetable into database*****/


$days = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday');
for ($i = 1; $i < 7; $i += 1) {
$database_name = " semester" . $i . " ";
for ($j = 0; $j < 6; $j++) {
$query = "UPDATE" . $database_name . " SET period1= '" . $subjectslots[$i][$j][0] .
"<br>" . $aliasslots[$i][$j][0][0] . "',
period2='" . $subjectslots[$i][$j][1] . "<br>" . $aliasslots[$i][$j][1][0] . "',
period3='" . $subjectslots[$i][$j][2] . "<br>" . $aliasslots[$i][$j][2][0] . "',
period4='" . $subjectslots[$i][$j][3] . "<br>" . $aliasslots[$i][$j][3][0] . "',
period5='" . $subjectslots[$i][$j][4] . "<br>" . $aliasslots[$i][$j][4][0] . "',
period6='" . $subjectslots[$i][$j][5] . "<br>" . $aliasslots[$i][$j][5][0] . ", " .
$aliasslots[$i][$j][5][1] . ", " . $aliasslots[$i][$j][5][2] . "'
WHERE day='" . $days[$j] . "' ";
echo 'HI';
}

}
/******Saving teachers timetable into database*****/

Automatic Timetable Generator Page 81


for ($i = 0; $i < $teachers_count; $i++) {
$database_name = " " . strtolower($teachers[$i]->id) . " ";
for ($j = 0; $j < 6; $j++) {
$query = "UPDATE" . $database_name . " SET period1= '" . $teachers[$i]-
>days[1][$j][0] . "<br>" . $teachers[$i]->classroom_names[1][$j][0] . "',
period2='" . $teachers[$i]->days[1][$j][1] . "<br>" . $teachers[$i]-
>classroom_names[1][$j][1] . "',
period3='" . $teachers[$i]->days[1][$j][2] . "<br>" . $teachers[$i]-
>classroom_names[1][$j][2] . "',
period4='" . $teachers[$i]->days[1][$j][3] . "<br>" . $teachers[$i]-
>classroom_names[1][$j][3] . "',
period5='" . $teachers[$i]->days[1][$j][4] . "<br>" . $teachers[$i]-
>classroom_names[1][$j][4] . "',
period6='" . $teachers[$i]->days[1][$j][5] . "'
WHERE day='" . $days[$j] . "' ";

}
}

/******redirect back to generate timetable **/

?>

FACULTY PAGE

<?php
session_start();
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-
scale=1"/>
<meta name="description" content=""/>
<meta name="author" content=""/>
<title>TimeTable Management System</title>
<script type="text/javascript" src="assets/jsPDF/dist/jspdf.min.js"></script>
<script type="text/javascript" src="assets/js/html2canvas.js"></script>
<!-- BOOTSTRAP CORE STYLE CSS -->
<link href="assets/css/bootstrap.css" rel="stylesheet"/>
<!-- FONT AWESOME CSS -->
<link href="assets/css/font-awesome.min.css" rel="stylesheet"/>
<!-- FLEXSLIDER CSS -->
<link href="assets/css/flexslider.css" rel="stylesheet"/>
<!-- CUSTOM STYLE CSS -->
<link href="assets/css/style.css" rel="stylesheet"/>
<!-- Google Fonts -->
</head>
<body>

Automatic Timetable Generator Page 82


<div class="navbar navbar-inverse navbar-fixed-top " id="menu">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-
target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>

</div>
<div class="navbar-collapse collapse move-me">
<ul class="nav navbar-nav navbar-left">
<li><a href="#">Hello <?php echo $_SESSION['loggedin_name']; ?></a></li>

</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="index.php">LOGOUT</a></li>
</ul>

</div>
</div>
</div>
<!--NAVBAR SECTION END-->
<br>
<!--Algorithm Implementation-->

<form action="facultypage.php" method="post">


<div style="margin-top: 100px" align="center">
<select name="select_teacher" class="list-group-item">
<option selected disabled>Select Teacher</option>
<?php
$q = mysqli_query(mysqli_connect("localhost", "root", "", "ttms"),
"SELECT * FROM teachers ");
while ($row = mysqli_fetch_assoc($q)) {
echo " \"<option value=\"{$row['faculty_number']}\">{$row['name']}</option>\"";
}
?>
</select>
<button type="submit" id="viewteacher" class="btn btn-success btn-lg" style="margin-
top: 5px">VIEW TIMETABLE
</button>
</div>
</form>

Automatic Timetable Generator Page 83


<form action="facultypage.php" method="post">
<div align="center" style="margin-top: 10px">
<select name="select_semester" class="list-group-item">
<option selected disabled>Select Semester</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</select>
<button type="submit" id="viewsemester" style="margin-top: 5px" class="btn btn-
success btn-lg">VIEW TIMETABLE
</button>
</div>
</form>

<div>
<br>
<style>
table {
margin-top: 20px;
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}

td, th {
border: 2px solid #dddddd;
text-align: left;
padding: 8px;
}

tr:nth-child(even) {
background-color: #ffffff;
}

tr:nth-child(odd) {
background-color: #ffffff;
}
</style>
<div id="TT" style="background-color: #FFFFFF">
<table border="2" cellspacing="3" align="center" id="timetable">
<caption><strong><br><br>
<?php
if (isset($_POST['select_semester'])) {

Automatic Timetable Generator Page 84


echo "COMPUTER ENGINEERING DEPARTMENT SEMESTER " .
$_POST['select_semester'] . " ";
$year = (int)($_POST['select_semester'] / 2) + $_POST['select_semester'] %
2;
$r = mysqli_fetch_assoc(mysqli_query(mysqli_connect("localhost", "root", "",
"ttms"), "SELECT * from classrooms
WHERE status = '$year'"));
echo " ( " . $r['name'], " ) ";
} else if (isset($_POST['select_teacher'])) {
$id = $_POST['select_teacher'];
$r = mysqli_fetch_assoc(mysqli_query(mysqli_connect("localhost", "root", "",
"ttms"), "SELECT * from teachers
WHERE faculty_number = '$id'"));
echo $r['name'];
} else if (isset($_SESSION['loggedin_name'])) {
echo $_SESSION['loggedin_name'];

}
?>
</strong></caption>
<tr>
<td style="text-align:center">WEEKDAYS</td>
<td style="text-align:center">9:10-10:10</td>
<td style="text-align:center">10:10-11:10</td>
<td style="text-align:center">11:10-12:10</td>
<td style="text-align:center">12:10-12:40</td>
<td style="text-align:center">12:40-1:40</td>
<td style="text-align:center">1:40-2:40</td>
<td style="text-align:center">2:40-3:40</td>
</tr>
<tr>
<?php
$table = null;
if (isset($_POST['select_semester'])) {
$table = " semester" . $_POST['select_semester'] . " ";
} else if (isset($_POST['select_teacher'])) {
$table = " " . $_POST['select_teacher'] . " ";
} else if (isset($_SESSION['loggedin_id'])) {
$table = " " . $_SESSION['loggedin_id'] . " ";
} else
echo '</table>';
if (isset($_POST['select_semester']) || isset($_POST['select_teacher']) ||
isset($_SESSION['loggedin_id'])) {
$q = mysqli_query(mysqli_connect("localhost", "root", "", "ttms"),
"SELECT * FROM" . $table);
$qq = mysqli_query(mysqli_connect("localhost", "root", "", "ttms"),

Automatic Timetable Generator Page 85


"SELECT * FROM subjects");
$days = array('MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY',
'FRIDAY', 'SATURDAY');
$i = -1;
$str = "<br>";
if (isset($_POST['select_semester'])) {
while ($r = mysqli_fetch_assoc($qq)) {
if ($r['isAlloted'] == 1 && $r['semester'] == $_POST['select_semester']) {
$str .= $r['subject_code'] . ": " . $r['subject_name'] . " ";
if (isset($r['allotedto'])) {
$id = $r['allotedto'];
$qqq = mysqli_query(mysqli_connect("localhost", "root", "", "ttms"),
"SELECT * FROM teachers WHERE faculty_number = '$id'");
$rr = mysqli_fetch_assoc($qqq);
$str .= " " . $rr['alias'] . ": " . $rr['name'] . " ";
}
if ($r['course_type'] !== "LAB") {
$str .= "<br>";
continue;
} else {
$str .= ", ";
}
if (isset($r['allotedto2'])) {
$id = $r['allotedto2'];
$qqq = mysqli_query(mysqli_connect("localhost", "root", "", "ttms"),
"SELECT * FROM teachers WHERE faculty_number = '$id'");
$rr = mysqli_fetch_assoc($qqq);
$str .= " " . $rr['alias'] . ": " . $rr['name'] . ", ";
}
if (isset($r['allotedto3'])) {
$id = $r['allotedto3'];
$qqq = mysqli_query(mysqli_connect("localhost", "root", "", "ttms"),
"SELECT * FROM teachers WHERE faculty_number = '$id'");
$rr = mysqli_fetch_assoc($qqq);
$str .= " " . $rr['alias'] . ": " . $rr['name'] . "<br>";
}
}
}
} else if (isset($_POST['select_teacher']) || isset($_SESSION['loggedin_id'])) {
if (isset($_POST['select_teacher'])) {
$tid = $_POST['select_teacher'];
} else {
$tid = $_SESSION['loggedin_id'];
}
while ($r = mysqli_fetch_assoc($qq)) {
if ($r['isAlloted'] == 1 && $r['allotedto'] == $tid) {

Automatic Timetable Generator Page 86


$str .= $r['subject_code'] . ": " . $r['subject_name'] . " <br>";
} else if ($r['isAlloted'] == 1 && isset($r['allotedto2']) && $r['allotedto2']
== $tid) {
$str .= $r['subject_code'] . ": " . $r['subject_name'] . " <br>";
} else if ($r['isAlloted'] == 1 && isset($r['allotedto3']) && $r['allotedto3']
== $tid) {
$str .= $r['subject_code'] . ": " . $r['subject_name'] . " <br>";
}
}
}
while ($row = mysqli_fetch_assoc($q)) {
$i++;

echo "
<tr><td style=\"text-align:center\">$days[$i]</td>
<td style=\"text-align:center\">{$row['period1']}</td>
<td style=\"text-align:center\">{$row['period2']}</td>
<td style=\"text-align:center\">{$row['period3']}</td>
<td style=\"text-align:center\">LUNCH</td>
<td style=\"text-align:center\">{$row['period4']}</td>
<td style=\"text-align:center\">{$row['period5']}</td>
<td style=\"text-align:center\">{$row['period6']}</td>
</tr>\n";
}
echo '</table>';
$sign = "GENERATED VIA TIMETABLE MANAGEMENT SYSTEM,
COMPUTER ENGINEERING DEPARTMENT, AMU.";
echo "<div align=\"center\">" . "<br>" . $str . "<br>
<strong>" . $sign . "<br></strong></div>";
}
?>
</div>
</div>
<script type="text/javascript">
function gendf() {
var doc = new jsPDF();
doc.addHTML(document.getElementById('TT'), function () {
doc.save('<?php
if (isset($_POST["select_semester"])) {
echo "ttms semester " . $_POST["select_semester"];
} else if (isset($_POST["select_teacher"])) {
echo "ttms " . $_POST["select_teacher"];
} else if (isset($_SESSION["loggedin_id"])) {
echo "ttms " . $_SESSION["loggedin_id"];
}
?>' + '.pdf');

Automatic Timetable Generator Page 87


alert("Downloaded!");

});
}
</script>
<div align="center" style="margin-top: 10px">
<button id="saveaspdf" class="btn btn-info btn-lg" onclick="gendf()">SAVE AS
PDF</button>
</div>
<!--HOME SECTION END-->
<!--<div id="footer">
<!-- &copy 2014 yourdomain.com | All Rights Reserved | <a
href="http://binarytheme.com" style="color: #fff" target="_blank">Design by :
binarytheme.com</a>
-->
<!-- FOOTER SECTION END-->
<!-- Jquery Core Script -->
<script src="assets/js/jquery-1.10.2.js"></script>
<!-- Core Bootstrap Script -->
<script src="assets/js/bootstrap.js"></script>
<!-- Flexslider Scripts -->
<script src="assets/js/jquery.flexslider.js"></script>
<!-- Scrolling Reveal Script -->
<script src="assets/js/scrollReveal.js"></script>
<!-- Scroll Scripts -->
<script src="assets/js/jquery.easing.min.js"></script>
<!-- Custom Scripts -->
<script src="assets/js/custom.js"></script>
</body>
</html>

ADD COURSES

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-
scale=1"/>
<meta name="description" content=""/>
<meta name="author" content=""/>
<title>TimeTable Management System</title>
<!-- BOOTSTRAP CORE STYLE CSS -->
<link href="assets/css/bootstrap.css" rel="stylesheet"/>
<!-- FONT AWESOME CSS -->
<link href="assets/css/font-awesome.min.css" rel="stylesheet"/>

Automatic Timetable Generator Page 88


<!-- FLEXSLIDER CSS -->
<link href="assets/css/flexslider.css" rel="stylesheet"/>
<!-- CUSTOM STYLE CSS -->
<link href="assets/css/style.css" rel="stylesheet"/>
<!-- Google Fonts -->
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700,300'
rel='stylesheet' type='text/css'/>
</head>
<body>

<div class="navbar navbar-inverse navbar-fixed-top " id="menu">


<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-
target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>

</div>
<div class="navbar-collapse collapse move-me">
<ul class="nav navbar-nav navbar-left">
<li><a href="addteachers.php">ADD TEACHERS</a></li>
<li><a href="addsubjects.php">ADD SUBJECTS</a></li>
<li><a href="addclassrooms.php">ADD CLASSROOMS</a></li>
<li><a href="addcourses.php">ADD COURSES</a></li>
<li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown" aria-
expanded="false">ALLOTMENT
<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>
<a href=allotsubjects.php>THEORY COURSES</a>
</li>
<li>
<a href=allotpracticals.php>PRACTICAL COURSES</a>
</li>
<li>
<a href=allotclasses.php>CLASSROOMS</a>
</li>
</ul>
</li>
<li><a href="generatetimetable.php">GENERATE TIMETABLE</a></li>

</ul>
<ul class="nav navbar-nav navbar-right">

Automatic Timetable Generator Page 89


<li><a href="index.php">LOGOUT</a></li>
</ul>

</div>
</div>
</div>
<!--NAVBAR SECTION END-->
<br>

<div align="center"
style="margin-top:10%">
<button
id="coursemanual" class="btn btn-success btn-lg">ADD COURSES
</button>
</div>

<div id="myModal" class="modal">


<!-- Modal content -->
<div class="modal-content">
<div class="modal-header">
<span class="close">&times</span>
<h2 id="popupHead">Add Course</h2>
</div>
<div class="modal-body" id="EnterCourse">
<!--Admin Login Form-->
<div style="display:none" id="addCourseForm">
<form action="addcourseFormValidation.php" method="POST">
<div class="form-group">
<label for="coursename">Name</label>
<input type="text" class="form-control" id="coursename" name="CN"
placeholder="BCA 1st Year. .. " required>
<label for="coursename">Year</label>
<input type="text" class="form-control" id="status" name="status"
placeholder="1 for first year 2 for 2nd year and so on... " required>

</div>

<div align="right">
<input type="submit" class="btn btn-default" name="ADD" value="ADD">
</div>
</form>
</div>
</div>
<div class="modal-footer">
</div>
</div>

Automatic Timetable Generator Page 90


</div>
<script>
// Get the modal
var modal = document.getElementById('myModal');

// Get the button that opens the modal


var addcourseBtn = document.getElementById("coursemanual");
var heading = document.getElementById("popupHead");
var courseForm = document.getElementById("addCourseForm");
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];

// When the user clicks the button, open the modal

addcourseBtn.onclick = function () {
modal.style.display = "block";
//heading.innerHTML = "Faculty Login";
courseForm.style.display = "block";
//adminForm.style.display = "none";

// When the user clicks on <span> (x), close the modal


span.onclick = function () {
modal.style.display = "none";
//adminForm.style.display = "none";
courseForm.style.display = "none";

// When the user clicks anywhere outside of the modal, close it


window.onclick = function (event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
</script>

<script>
function deleteHandlers() {

var table = document.getElementById("coursetable");


var rows = table.getElementsByTagName("tr");
for (i = 0; i < rows.length; i++) {
var currentRow = table.rows[i];

Automatic Timetable Generator Page 91


//var b = currentRow.getElementsByTagName("td")[0];
var createDeleteHandler =
function (row) {
return function () {
var cell = row.getElementsByTagName("td")[0];
var id = cell.innerHTML;
var x;

if (confirm("Are You Sure?") == true) {


window.location.href = "deletecourse.php?name=" + id;

}
};
};
currentRow.cells[1].onclick = createDeleteHandler(currentRow);
}
}
</script>

<div align="center">
<br>
<style>
table {
margin-top: 10px;
font-family: arial, sans-serif;
border-collapse: collapse;
width: 70%;
}

td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}

tr:nth-child(even) {
background-color: #dddddd;
}
</style>

<table id=coursetable>
<caption><strong>ADDED COURSES</strong></caption>
<tr>

<th width="100">Name</th>
<th width="60">Action</th>

Automatic Timetable Generator Page 92


</tr>
<?php
include 'connection.php';
$q = mysqli_query(mysqli_connect("localhost", "root", "", "ttms"),
"SELECT * FROM courses ");
$q1 = mysqli_query(mysqli_connect("localhost", "root", "", "ttms"),
"SELECT * FROM courses ");
while ($row = mysqli_fetch_assoc($q)) {
echo "<tr><td>{$row['name']}</td>
<td><button>Delete</button></td>
\n";
}
echo "<script>deleteHandlers();</script>";
?>
</table>
</div>
<!--HOME SECTION END-->

<!--<div id="footer">
<!-- &copy 2014 yourdomain.com | All Rights Reserved | <a
href="http://binarytheme.com" style="color: #fff" target="_blank">Design by :
binarytheme.com</a>
--></div>
<!-- FOOTER SECTION END-->

<!-- Jquery Core Script -->


<script src="assets/js/jquery-1.10.2.js"></script>
<!-- Core Bootstrap Script -->
<script src="assets/js/bootstrap.js"></script>
<!-- Flexslider Scripts -->
<script src="assets/js/jquery.flexslider.js"></script>
<!-- Scrolling Reveal Script -->
<script src="assets/js/scrollReveal.js"></script>
<!-- Scroll Scripts -->
<script src="assets/js/jquery.easing.min.js"></script>
<!-- Custom Scripts -->
<script src="assets/js/custom.js"></script>
</body>
</html>

Automatic Timetable Generator Page 93


FUTURE
ENHANCEMENT

Automatic Timetable Generator Page 94


FUTURE ENHANCEMENT

I think that not a single project is ever considered as complete forever. Because our mind is
always thinking something new and our necessities also are growing day by day. We always
want something more than what we have. Our application also,

If you see at the first glance then you find it to be complete but we want to make it still
mature and fully automatically.

This project can be easily implemented under various situations. We can add new features as
and when we require. Reusability is possible as and when require in this project. There is
flexibility in all the modules.
The system can have following changes in future:-

 To generate Timetable for all classes which uses shared resources.


 To format the exported timetable in HTML
 To provide additional features:
 Student Attendance
 Assignment Distribution over internet
 Direct Export to college site
 Sending timetable to the faculties directly through their email id’s.
 Substitute teachers if a teacher is absent.
 Making a mobile (android) app for the user is also a future step development.

Automatic Timetable Generator Page 95


CONCLUSION

Automatic Timetable Generator Page 96


CONCLUSION

This project gives good idea on developing a full-fledged application satisfying the user
requirements. The system is very flexible and versatile. This software has a user-friendly
screen that enables the user to use without any inconvenience. Validation checks induced
have greatly reduced errors. Provisions have been made to upgrade the software.

Time Table Generator is a convenient time table managing website .Time table management
may be aided by a range of skills, tools, and techniques used to manage time table when
accomplishing specific subjects, semesters, and students. Initially, time table management
referred to just work activities, but eventually the term broadened to include personal
activities as well. A time table management system is a designed combination of processes,
tools, techniques, and methods. Timetable management is usually a necessity in project
development as it determines the project completion time and scope.

This software is developed with scalability in mind. Additional modules can be easily added
when necessary. The software is developed with modular approach. All modules in the
system have been tested with valid data and invalid data and everything work successfully.
Thus the system has fulfilled all the objectives identified and is able to replace the existing
system.

Automatic Timetable Generator Page 97


BIBLIOGRAPHY

Automatic Timetable Generator Page 98


BIBLIOGRAPHY

Books
1. Kenneth E. Kendall “System Analysis and Design” Publisher Pearson College Div.; 4th
edition Year December 1, 2002
2. The Joy of PHP Programming: A Beginner’s Guide – by Alan Forbes
3. Ian Sommerville “Software Engineering”, 9th Edition, Pearson Education, 2012.
4. Introduction to the “Design and Analysis of Algorithms”, Anany Levitin, 2rd Edition,
2009, Pearson.
5. Sourav Sahay, “Object Oriented Programming with C++”, Oxford University Press, 2006
6. Chris Bates, “Web Programming Building Internet Applications”, 3rd Edition, Wiley
India, 2006
7. A.Balaguruswamy, “Programming with JAVA”, A Primer, TMH, 1999
8. E. Balaguruswamy: Object Oriented Programming with C++, Tata McGraw Hill
Publications, 2011.

Websites
www.google.com
www.mysql.com
http://en.wikipedia.org
www.w3schools.com
www.google.co.in
https://www.w3schools.com/php
https://www.w3schools.com/bootstrap/default.asp
https://www.w3schools.com/js/default.asp
https://www.w3schools.com/css/default.asp
https://www.phptpoint.com
https://www.phptpoint.com/mysql-tutorial/
https://stackoverflow.com/questions/19444890/automated-timetable-in-
genetic-algorithm-using-php
https://code-projects.org

Automatic Timetable Generator Page 99

You might also like