Project Report of Online Examination System
Report of Online Examination System
Page - 1
Project Report of Online Examination System Introduction of the Project Online Examination System: The "Online Examination System" has been developed to override the problems prevailing in the practicing manual system. This software is supported to eliminate and in some cases reduce the hardships faced by this existing system. Moreover this system is designed for the particular need of the company to carry out operations in a smooth and effective manner. The application is reduced as much as possible to avoid errors while entering the data. It also provides error message while entering invalid data. No formal knowledge is needed for the user to use this system. Thus by this all it proves it is user-friendly. Online Examination System , as described above, can lead to error free, secure, reliable and fast management system. It can assist the user to concentrate on their other activities rather to concentrate on the record keeping. Thus it will help organization in better utilization of resources. Every organization, whether big or small, has challenges to overcome and managing the information of Long Question, Exam, True-False Question, Answer, Matching Question. Every Online Examination System has different Exam needs, therefore we design exclusive employee management systems that are adapted to your managerial requirements. This is designed to assist in strategic planning, and will help you ensure that your organization is equipped with the right level of information and details for your future goals. Also, for those busy executive who are always on the go, our systems come with remote access features, which will allow you to manage your workforce anytime, at all times.
These systems will ultimately allow you to better manage
resources.
Page - 2
Project Report of Online Examination System Abstract of the Project Online Examination System: The purpose of Online Examination System is to automate the existing manual system by the help of computerized equipments and full-fledged computer software, fulfilling their requirements, so that their valuable data/information can be stored for a longer period with easy accessing and manipulation of the same. The required software and hardware are easily available and easy to work with.
Online Examination System, as described above, can lead to error free, secure, reliable and fast management system. It can assist the user to concentrate on their other activities rather to concentrate on the record keeping. Thus it will help organization in better utilization of resources. The organization can maintain computerized records without redundant entries. That means that one need not be distracted by information that is not relevant, while being able to reach the information. The aim is to automate its existing manual system by the help of computerized equipments and full-fledged computer software, fulfilling their requirements, so that their valuable data/information can be stored for a longer period with easy accessing and manipulation of the same. Basically the project describes how to manage for good performance and better services for the clients.
Page - 3
Project Report of Online Examination System Objective of Project on Online Examination System: The main objective of the Project on Online Examination System is to manage the details of Exam, Long Question, Short Question, True-False Question, Matching Question. It manages all the information about Exam, Answer, Matching Question, Exam. The project is totally built at administrative end and thus only the administrator is guaranteed the access. The purpose of the project is to build an application program to reduce the manual work for managing the Exam, Long Question, Answer, Short Question. It tracks all the details about the Short Question, True-False Question, Matching Question. Functionalities provided by Online Examination System are as follows:
Provides the searching facilities based on various factors. Such as Exam, Short Question, True-False Question, Matching Question
Online Examination System also manage the Answer details online for True-False Question details, Matching Question details, Exam.
It tracks all the information of Long Question, Answer, True-False Question etc
Manage the information of Long Question
Shows the information and description of the Exam, Short Question
To increase efficiency of managing the Exam, Long Question
It deals with monitoring the information and transactions of True-False Question.
Manage the information of Exam
Editing, adding and updating of Records is improved which results in proper resource management of Exam data.
Manage the information of True-False Question
Integration of all records of Matching Question.
Page - 4
Project Report of Online Examination System Scope of the project Online Examination System It may help collecting perfect management in details. In a very short time, the collection will be obvious, simple and sensible. It will help a person to know the management of passed year perfectly and vividly. It also helps in current all works relative to Online Examination System. It will be also reduced the cost of collecting the management & collection procedure will go on smoothly. Our project aims at Business process automation, i.e. we have tried to computerize various processes of Online Examination System.
In computer system the person has to fill the various forms & number of copies of the forms can be easily generated at a time.
In computer system, it is not necessary to create the manifest but we can directly print it, which saves our time.
To assist the staff in capturing the effort spent on their respective working areas.
To utilize resources in an efficient manner by increasing their productivity through automation.
The system generates types of information that can be used for various purposes.
It satisfy the user requirement
Be easy to understand by the user and operator
Be easy to operate
Have a good user interface
Be expandable
Delivered on schedule within the budget.
Page - 5
Project Report of Online Examination System Reports of Online Examination System:
It generates the report on Exam, Long Question, Answer
Provide filter reports on Short Question, True-False Question, Matching Question
You can easily export PDF for the Exam,Answer, True-False Question
Application also provides excel export for Long Question, Short Question, Matching Question
You can also export the report into csv format for Exam, Long Question, Matching Question
Modules of Online Examination System:
Exam Management Module: Used for managing the Exam details.
Matching Question Module : Used for managing the details of Matching Question
Answer Module : Used for managing the details of Answer
Long Question Management Module: Used for managing the information and details of the Long Question.
Short Question Module : Used for managing the Short Question details
True-False Question Module : Used for managing the True-False Question information
Login Module: Used for managing the login details
Users Module : Used for managing the users of the system
Page - 6
Project Report of Online Examination System Input Data and Validation of Project on Online Examination System
All the fields such as Exam, Short Question, Matching Question are validated and does not take invalid values
Each form for Exam, Long Question, Answer can not accept blank value fields
Avoiding errors in data
Controlling amount of input
Integration of all the modules/forms in the system.
Preparation of the test cases.
Preparation of the possible test data with all the validation checks.
Actual testing done manually.
Recording of all the reproduced errors.
Modifications done for the errors found during testing.
Prepared the test result scripts after rectification of the errors.
Functionality of the entire module/forms.
Validations for user input.
Checking of the Coding standards to be maintained during coding.
Testing the module with all the possible test data.
Testing of the functionality involving all type of calculations etc.
Commenting standard in the source files.
The software quality plan we will use the following SQA Strategy:
In the first step, we will select the test factors and rank them. The selected test factors such as reliability, maintainability, portability or etc, will be placed in the matrix according to their ranks.
The second step is for identifying the phases of the development process. The phase should be recorded in the matrix.
The third step is that identifying the business risks of the software deliverables. The risks will be ranked into three ranks such as high, medium and low.
Page - 7
Project Report of Online Examination System Features of the project Online Examination System:
Product and Component based
Creating & Changing Issues at ease
Query Issue List to any depth
Reporting & Charting in more comprehensive way
User Accounts to control the access and maintain security
Simple Status & Resolutions
Multi-level Priorities & Severities.
Targets & Milestones for guiding the programmers
Attachments & Additional Comments for more information
Robust database back-end
Various level of reports available with a lot of filter criteria’s
It contain better storage capacity.
Accuracy in work.
Easy & fast retrieval of information.
Well designed reports.
Decrease the load of the person involve in existing manual system.
Access of any information individually.
Work becomes very speedy.
Easy to update information
Page - 8
Project Report of Online Examination System Software Requirement Specification The Software Requirements Specification is produced at the culmination of the analysis task. The function and performance allocated to software as part of system engineering are refined by establishing a complete information description, a detailed functional and behavioral description, an indication of performance requirements and design constraints, appropriate validation criteria, and other data pertinent to requirements.
The proposed system has the following requirements:
System needs store information about new entry of Exam.
System needs to help the internal staff to keep information of Long Question and find them as per various queries.
System need to maintain quantity record.
System need to keep the record of Short Question.
System need to update and delete the record.
System also needs a search area.
It also needs a security system to prevent data.
Page - 9
Project Report of Online Examination System Identification of need: The old manual system was suffering from a series of drawbacks. Since whole of the system was to be maintained with hands the process of keeping, maintaining and retrieving the information was very tedious and lengthy. The records were never used to be in a systematic order. there used to be lots of difficulties in associating any particular transaction with a particular context. If any information was to be found it was required to go through the different registers, documents there would never exist anything like report generation. There would always be unnecessary consumption of time while entering records and retrieving records. One more problem was that it was very difficult to find errors while entering the records. Once the records were entered it was very difficult to update these records. The reason behind it is that there is lot of information to be maintained and have to be kept in mind while running the business .For this reason we have provided features Present system is partially automated (computerized), actually existing system is quite laborious as one has to enter same information at three different places. Following points should be well considered:
Documents and reports that must be provided by the new system: there can also be few reports, which can help management in decision-making and cost controlling, but since these reports do not get required attention, such kind of reports and information were also identified and given required attention.
Details of the information needed for each document and report.
The required frequency and distribution for each document.
Probable sources of information for each document and report.
With the implementation of computerized system, the task of keeping records in an organized manner will be solved. The greatest of all is the retrieval of information, which will be at the click of the mouse. So the proposed system helps in saving the time in different operations and making information flow easy giving valuable reports.
Page - 10
Project Report of Online Examination System Feasibility Study: After doing the project Online Examination System, study and analyzing all the existing or required functionalities of the system, the next task is to do the feasibility study for the project. All projects are feasible - given unlimited resources and infinite time. Feasibility study includes consideration of all the possible ways to provide a solution to the given problem. The proposed solution should satisfy all the user requirements and should be flexible enough so that future changes can be easily done based on the future upcoming requirements. A. Economical Feasibility This is a very important aspect to be considered while developing a project. We decided the technology based on minimum possible cost factor.
All hardware and software cost has to be borne by the organization.
Overall we have estimated that the benefits the organization is going to receive from the proposed system will surely overcome the initial costs and the later on running cost for system.
B. Technical Feasibility This included the study of function, performance and constraints that may affect the ability to achieve an acceptable system. For this feasibility study, we studied complete functionality to be provided in the system, as described in the System Requirement Specification (SRS), and checked if everything was possible using different type of frontend and backend plaformst.
C. Operational Feasibility No doubt the proposed system is fully GUI based that is very user friendly and all inputs to be taken all self-explanatory even to a layman. Besides, a proper training has been conducted to let know the essence of the system to the users so that they feel comfortable with new system. As far our study is concerned the clients are comfortable and happy as the system has cut down their loads and doing.
Page - 11
Project Report of Online Examination System System Design of Online Examination System In this phase, a logical system is built which fulfils the given requirements. Design phase of software development deals with transforming the clients’s requirements into a logically working system. Normally, design is performed in the following in the following two steps: 1. Primary Design Phase: In this phase, the system is designed at block level. The blocks are created on the basis of analysis done in the problem identification phase. Different blocks are created for different functions emphasis is put on minimising the information flow between blocks. Thus, all activities which require more interaction are kept in one block. 2. Secondary Design Phase: In the secondary phase the detailed design of every block is performed.
The general tasks involved in the design process are the following: 1. Design various blocks for overall system processes. 2. Design smaller, compact and workable modules in each block. 3. Design various database structures. 4. Specify details of programs to achieve desired functionality. 5. Design the form of inputs, and outputs of the system. 6. Perform documentation of the design. 7. System reviews.
Page - 12
Project Report of Online Examination System User Interface Design User Interface Design is concerned with the dialogue between a user and the computer. It is concerned with everything from starting the system or logging into the system to the eventually presentation of desired inputs and outputs. The overall flow of screens and messages is called a dialogue. The following steps are various guidelines for User Interface Design: 1. The system user should always be aware of what to do next. 2. The screen should be formatted so that various types of information, instructions and messages always appear in the same general display area. 3. Message, instructions or information should be displayed long enough to allow the system user to read them. 4. Use display attributes sparingly. 5. Default values for fields and answers to be entered by the user should be specified. 6. A user should not be allowed to proceed without correcting an error. 7. The system user should never get an operating system message or fatal error.
Page - 13
Project Report of Online Examination System Preliminary Product Description: The first step in the system development life cycle is the preliminary investigation to determine the feasibility of the system. The purpose of the preliminary investigation is to evaluate project requests. It is not a design study nor does it include the collection of details to describe the business system in all respect. Rather, it is the collecting of information that helps committee members to evaluate the merits of the project request and make an informed judgment about the feasibility of the proposed project. Analysts working on the preliminary investigation should accomplish the following objectives:
Clarify and understand the project request
Determine the size of the project.
Assess costs and benefits of alternative approaches.
Determine the technical and operational feasibility of alternative approaches.
Report the findings to management, with recommendations outlining the acceptance or rejection of the proposal.
Benefit to Organization The organization will obviously be able to gain benefits such as savings in
operating cost, reduction in paperwork, better utilization of human resources and more presentable image increasing goodwill.
The Initial Cost The initial cost of setting up the system will include the cost of hardware software
(OS, add-on software, utilities) & labour (setup & maintenance). The same has to bear by the organization.
Page - 14
Project Report of Online Examination System
Running Cost Besides, the initial cost the long term cost will include the running cost for the
system including the AMC, stationary charges, cost for human resources, cost for update/renewal of various related software.
Need for Training The users along with the administrator need to be trained at the time of
implementation of the system for smooth running of the system. The client will provide the training site. We talked to the management people who were managing a the financial issues of the center, the staff who were keeping the records in lots of registers and the reporting manager regarding their existing system, their requirements and their expectations from the new proposed system. Then, we did the system study of the entire system based on their requirements and the additional features they wanted to incorporate in this system. Reliable, accurate and secure data was also considered to be a complex task without this proposed system. Because there was no such record for keeping track of all the activities, which was done by the Online Examination System on the daily basis. The new system proposed and then developed by me will ease the task of the organization in consideration. It will be helpful in generating the required reports by the staff, which will help them to track their progress and services. Thus, it will ease the task of Management to a great extent as all the major activities to be performed, are computerized through this system.
Page - 15
Project Report of Online Examination System Project Category Relational Database Management System (RDBMS) : This is an RDBMS based project which is currently using MySQL for all the transaction statements. MySQL is an opensource RDBMS System. Brief Introduction about RDBSM : A relational database management system (RDBMS) is a database management system (DBMS) that is based on the relational model as invented by E. F. Codd, of IBM's San Jose Research Laboratory. Many popular databases currently in use are based on the relational database model. RDBMSs have become a predominant choice for the storage of information in new databases used for financial records, manufacturing and logistical information, personnel data, and much more since the 1980s. Relational databases have often replaced legacy hierarchical databases and network databases because they are easier to understand and use. However, relational databases have been challenged by object databases, which were introduced in an attempt to address the object-relational impedance mismatch in relational database, and XML databases.
Page - 16
Project Report of Online Examination System Implementation Methodology: Model View Controller or MVC as it is popularly called, is a software design pattern for developing web applications. A Model View Controller pattern is made up of the following three parts:
Model - The lowest level of the pattern which is responsible for maintaining data.
View - This is responsible for displaying all or a portion of the data to the user.
Controller - Software Code that controls the interactions between the Model and View.
MVC is popular as it isolates the application logic from the user interface layer and supports separation of concerns. Here the Controller receives all requests for the application and then works with the Model to prepare any data needed by the View. The View then uses the data prepared by the Controller to generate a final presentable response. The MVC abstraction can be graphically represented as follows. MVC (Model View Controller Flow) Diagram DATA FLOW DIAGRAMS
Page - 17
Project Report of Online Examination System Project Planning: Software project plan can be viewed as the following: 1) Within the organization: How the project is to be implemented? What are various constraints (time, cost, staff)? What is market strategy? 2) With respect to the customer: Weekly or timely meetings with the customer with presentation on status reports. Customers feedback is also taken and further modification and developments are done. Project milestones and deliverables are also presented to the customer. For a successful software project, the following steps can be followed:
Select a project o Identifying project’s aims and objectives o Understanding requirements and specification o Methods of analysis, design and implementation o Testing techniques o Documentation
Project milestones and deliverables
Budget allocation o Exceeding limits within control
Project Estimates o Cost o Time o Size of code
Page - 18
Project Report of Online Examination System o Duration
Resource Allocation o Hardware o Software o Previous relevant project information o Digital Library
Risk Management o Risk avoidance o Risk detection
Page - 19
Project Report of Online Examination System Project Scheduling: An elementary Gantt chart or Timeline chart for the development plan is given below. The plan explains the tasks versus the time (in weeks) they will take to complete.
January
February
March
Requirement Gathering Analysis Design Coding Testing Implement W1 W2 W3 W4 W1 W2 W3 W4 W1 W2 W3 W4
Wi‘s are weeks of the months, for i =1, 2, 3, 4
Page - 20
Project Report of Online Examination System Cost estimation of the project: Software cost comprises a small percentage of overall computer-based system cost. There are a number of factors, which are considered, that can affect the ultimate cost of the software such as - human, technical, Hardware and Software availability etc. The main point that was considered during the cost estimation of project was its sizing. In spite of complete software sizing, function point and approximate lines of code were also used to "size" each element of the Software and their costing. The cost estimation done by me for Project also depend upon the baseline metrics collected from past projects and these were used in conjunction with estimation variables to develop cost and effort projections. We have basically estimated this project mainly on two bases 1) Effort Estimation - This refers to the total man-hours required for the development of the project. It even includes the time required for doing documentation and user manual. 2) Hardware Required Estimation - This includes the cost of the PCs and the hardware cost required for development of this project.
Page - 21
Project Report of Online Examination System Tools/Platform, Hardware and Software Requirement specifications:
Software Requirements: Name of component
Specification
Operating System
Windows 98, Windows XP, Windows7, Linux
Language
Java 2 Runtime Environment
Database
MySQL Server
Browser
Any of Mozilla, Opera, Chrome etc
Web Server
Tomcat 7
Software Development Kit
Java JDK 1.7 or Above
Scripting Language Enable
JSP (Java Server Pages)
Database JDBC Driver
MySQL Jconnector
Hardware Requirements: Name of component
Specification
Processor
Pentium III 630MHz
RAM
128 MB
Hard disk
20 GB
Monitor
15” color monitor
Keyboard
122 keys
Page - 22
Project Report of Online Examination System Project Profile There has been continuous effort to develop tools, which can ease the process of software development. But, with the evolving trend of different programming paradigms today’s software developers are really challenged to deal with the changing technology. Among other issues, software re-engineering is being regarded as an important process in the software development industry. One of the major tasks here is to understand software systems that are already developed and to transform them to a different software environment. Generally, this requires a lot of manual effort in going through a program that might have been developed by another programmer. This project makes a novel attempt to address the issued of program analysis and generation of diagrams, which can depict the structure of a program in a better way. Today, UML is being considered as an industrial standard for software engineering design process.
It
essential provides several diagramming tools that can express different aspects/ characteristics of program such as Use cases: Elicit requirement from users in meaningful chunks. Construction planning is built around delivering some use cases n each interaction basis for system testing. Class diagrams: shows static structure of concepts, types and class. Concepts how users think about the world; type shows interfaces of software components; classes shows implementation of software components. Interaction diagrams: shows how several objects collaborate in single use case. Package diagram: show group of classes and dependencies among them. State diagram: show how single object behaves across many use cases. Activity diagram: shows behavior with control structure. Can show many objects over many uses, many object in single use case, or implementations methods encourage parallel behavior, etc.
Page - 23
Project Report of Online Examination System The end-product of this project is a comprehensive tool that can parse any vb.net program and extract most of the object oriented features inherent in the program such as polymorphism, inheritance, encapsulation and abstraction. What is UML? UML stands for Unified Modeling Language is the successor to the wave of Object Oriented Analysis and Design (OOA&D) methods that appeared in the late 80’s. It most directly unifies the methods of Booch, Rumbaugh (OMT) and Jacobson. The UML is called a modeling language, not a method. Most methods consist at least in principle, of both a modeling language and a process. The Modeling language is that notation that methods used to express design. Notations and meta-models: The notation is the graphical stuff; it is the syntax of the modeling language. For instance, class diagram notation defines how items are concepts such as class, association, and multiplicity is represented. These are: Class Diagram: The class diagram technique has become truly central within objectoriented methods. Virtually every method has included some variation on this technique. Class diagram is also subject to the greatest range of modeling concept. Although the basic elements are needed by everyone, advanced concepts are used less often. A class diagram describes the types of objects in the system and the various kinds of static relationship that exist among them.
There are two principal kinds of static
relationship:
Association
Subtype
Class diagram also show the attributes and operations of a class and the constraints that apply to the way objects are connected.
Page - 24
Project Report of Online Examination System Association: Association represent between instances of class. From the conceptual perspective, association represents conceptual relations between classes. Each association has two roles. Each role is a direction on the association. A role also has multiplicity, which is a indication of how many object may participate in the given relationship. Generalization: A typical example of generalization evolves the personal and corporate customer of a business. They have differences but also many similarity. The similarities can be placed in generalization with personal customer and corporate customer sub type. Aggregation: aggregation is the part of relationship. It is like saying a car has engine and wheels as its parts. This sounds good, but difficult thing is considering, what is the difference is aggregation and association. Interaction: interaction diagrams are models that describes how groups of objects collaboration in some behavior. Typically, an interaction diagram captures the behavior a single use cases. The diagram shows a number of example objects and the messages that are passed between these objects in use cases. These are following approaches with simple use case that exhibits the following behavior. Objects can send a message to another. Each message is checks with given stock item. There are two diagrams: Sequence and Collaboration diagram. Package Diagram: One of the oldest questions in software methods is: how do you break down a large system into smaller systems? It becomes difficult to understand and the changes we make to them. Structured methods used functional decomposition in which the overall system was mapped as a function broken down into sub function, which is further broken down into sub function and so forth. The separation of process data is gone, functional decomposition is gone, but the old question is still remains. One idea is to group the classes together into higher-level unit. This idea, applied very loosely, appears in many
Page - 25
Project Report of Online Examination System objects. In UML, this grouping mechanism is package. The term package diagram for a diagram that shows packages of classes and the dependencies among them. A dependency exists between two elements if changes to the definition of one element may cause to other. With classes, dependencies exist for various reasons: one class sends a message to another; one class has another as part of its data; one class mentions another as a parameter to an operation. A dependency between two packages exists; and any dependencies exist between any two classes in the package. State diagram: State diagram are a familiar technique to describe the behavior of a system. They describe all the possible states a particular object can get into and how the objects state changes as a result of events that reach the objects. In most OO technique, state diagrams are drawn for a single class to show the lifetime behavior of a singe object. There are many form of state diagram, each with slightly different semantics. The most popular one used in OO technique is based on David Harel’s state chart.
Page - 26
Project Report of Online Examination System PERT CHART (Program Evaluation Review Technique) PERT chart is organized for events, activities or tasks. It is a scheduling device that shows graphically the order of the tasks to be performed. It enables the calculation of the critical path. The time and cost associated along a path is calculated and the path requires the greatest amount of elapsed time in critical path.
Specification
Design Database Part
Code database Part
Design GUI part
Code GUI Part
Integrate and Test
Implementation Write User Manual
PERT Chart representation
Page - 27
Project Report of Online Examination System GANTT CHART It is also known as Bar chart is used exclusively for scheduling purpose. It is a project controlling technique. It is used for scheduling. Budgeting and resourcing planning. A Gantt is a bar chart with each bar representing activity. The bars are drawn against a time line. The length of time planned for the activity. The Gantt chart in the figure shows the Gray parts is slack time that is the latest by which a task has been finished.
1-19 MAY 10 20-3 JUNE 10 6-25 JUNE 10 26-15 JULY 10 JULY 16 AUG 31 Specification Design Database Part
Design GUI Part
Modulation
CODE DATABASE PART
CODE GUI
BLACK BOX TESTING
PART INTEGRATE AND TEST
IMPLEMENTATION
WRITE USER MANUAL
GANTT CHART REPRESENTATION
Page - 28
Project Report of Online Examination System Use Case Model of the Project: The use case model for any system consists of “use cases”. Use cases represent different ways in which the system can be used by the user. A simple way to find all the use case of a system is to ask the questions “What the user can do using the system?” The use cases partition the system behavior into transactions such that each transaction performs some useful action from the users’ point of view. The purpose of the use case to define a piece of coherent behavior without reveling the internal structure of the system. An use case typically represents a sequence of interaction between the user and the system. These interactions consists of one main line sequence is represent the normal interaction between the user and the system. The use case model is an important analysis and design artifact (task).Use cases can be represented by drawing a use case diagram and writing an accompany text elaborating the drawing. In the use case diagram each use case is represented by an ellipse with the name of use case written inside the ellipse. All the ellipses of the system are enclosed with in a rectangle which represents the system boundary. The name of the system being moduled appears inside the rectangle. The different users of the system are represented by using stick person icon. The stick person icon is normally referred to as an Actor. The line connecting the actor and the use cases is called the communication relationship. When a stick person icon represents an external system it is annotated by the stereo type<
>.
Page - 29
Project Report of Online Examination System Dataflow Diagram: Data flow diagram is the starting point of the design phase that functionally decomposes the requirements specification. A DFD consists of a series of bubbles joined by lines. The bubbles represent data transformation and the lines represent data flows in the system. A DFD describes what data flow rather than how they are processed, so it does not hardware, software and data structure. A data-flow diagram (DFD) is a graphical representation of the "flow" of data through an information system. DFDs can also be used for the visualization of data processing (structured design). A data flow diagram (DFD) is a significant modeling technique for analyzing and constructing information processes. DFD literally means an illustration that explains the course or movement of information in a process. DFD illustrates this flow of information in a process based on the inputs and outputs. A DFD can be referred to as a Process Model. The data flow diagram is a graphical description of a system’s data and how to Process transform the data is known as Data Flow Diagram (DFD). Unlike details flow chart, DFDs don’t supply detail descriptions of modules that graphically describe a system’s data and how the data interact with the system. Data flow diagram number of symbols and the following symbols are of by DeMarco.
process
Data store
Source/sink Data Flow DeMarco & Yourdon symbols
Gane & Sarson symbols
Page - 30
Project Report of Online Examination System There are seven rules for construct a data flow diagram. i) Arrows should not cross each other. ii) Squares, circles and files must wears names. iii) Decomposed data flows must be balanced. iv) No two data flows, squares or circles can be the same names. v) Draw all data flows around the outside of the diagram. vi) Choose meaningful names for data flows, processes & data stores. vii) Control information such as record units, password and validation requirements are not penitent to a data flow diagram. Additionally, a DFD can be utilized to visualize data processing or a structured design. This basic DFD can be then disintegrated to a lower level diagram demonstrating smaller steps exhibiting details of the system that is being modeled. On a DFD, data items flow from an external data source or an internal data store to an internal data store or an external data sink, via an internal process. It is common practice to draw a context-level data flow diagram first, which shows the interaction between the system and external agents, which act as data sources and data sinks. On the context diagram (also known as the Level 0 DFD’), the system's interactions with the outside world are modeled purely in terms of data flows across the system boundary. The context diagram shows the entire system as a single process, and gives no clues as to its internal organization. This context-level DFD is next "exploded", to produce a Level 1 DFD that shows some of the detail of the system being modeled. The Level 1 DFD shows how the system is divided into sub-systems (processes), each of which deals with one or more of the data flows to or from an external agent, and which together provide all of the functionality of the system as a whole. The level 1 DFD is further spreaded and split into more descriptive and detailed description about the project as level 2 DFD.The level 2 DFD can be a number of data flows which will finally show the entire description of the software project.
Page - 31
Project Report of Online Examination System About ER Diagram: Entity Relationship Diagram E-R Model is a popular high level conceptual data model. This model and its variations are frequently used for the conceptual design of database application and many database design tools employ its concept. A database that confirms to an E-R diagram can be represented by a collecton of tables in the relational system. The mapping of E-R diagram to the entities are:
Attributes
Relations o Many-to-many o Many-to-one o One-to-many o One-to-one
Weak entities
Sub-type and super-type
The entities and their relationshops between them are shown using the following conventions.
An entity is shown in rectangle.
A diamond represent the relationship among number of entities.
The attributes shown as ovals are connected to the entities or relationship by lines.
Diamond,oval and relationships are labeled.
Page - 32
Project Report of Online Examination System
Model is an abstraction process that hides super details while highlighting details relation to application at end.
A data model is a mechanism that provides this abstraction for database application.
Data modeling is used for representing entities and their relationship in the database.
Entities are the basic units used in modeling database entities can have concrete existence or constitute ideas or concepts.
Entity type or entity set is a group of similar objects concern to an organization for which it maintain data,
Properties are characteristics of an entity also called as attributes.
A key is a single attribute or combination of 2 or more attributes of an entity set is used to identify one or more instances of the set.
In relational model we represent the entity by a relation and use tuples to represent an instance of the entity.
Relationship is used in data modeling to represent in association between an entity set.
An association between two attributes indicates that the values of the associated attributes are independent.
Page - 33
Project Report of Online Examination System Security Testing of the Project Testing is vital for the success of any software. no system design is ever perfect. Testing is also carried in two phases. first phase is during the software engineering that is during the module creation. second phase is after the completion of software. this is system testing which verifies that the whole set of programs hanged together. White Box Testing: In this technique, the close examination of the logical parts through the software are tested by cases that exercise species sets of conditions or loops. all logical parts of the software checked once. errors that can be corrected using this technique are typographical errors, logical expressions which should be executed once may be getting executed more than once and error resulting by using wrong controls and loops. When the box testing tests all the independent part within a module a logical decisions on their true and the false side are exercised , all loops and bounds within their operational bounds were exercised and internal data structure to ensure their validity were exercised once. Black Box Testing: This method enables the software engineer to device sets of input techniques that fully exercise all functional requirements for a program. black box testing tests the input, the output and the external data. it checks whether the input data is correct and whether we are getting the desired output. Alpha Testing: Acceptance testing is also sometimes called alpha testing. Be spoke systems are developed for a single customer. The alpha testing proceeds until the system developer and the customer agree that the provided system is an acceptable implementation of the system requirements. Beta Testing: On the other hand, when a system isto be marked as a software product, another process called beta testing is often conducted. During beta testing, a system is delivered among a number of potential users who agree to use it. The customers then report problems to the
Page - 34
Project Report of Online Examination System developers. This provides the product for real use and detects errors which may not have been anticipated by the system developers. Unit Testing: Each module is considered independently. it focuses on each unit of software as implemented in the source code. it is white box testing. Integration Testing: Integration testing aims at constructing the program structure while at the same constructing tests to uncover errors associated with interfacing the modules. modules are integrated by using the top down approach. Validation Testing: Validation testing was performed to ensure that all the functional and performance requirements are met. System Testing: It is executing programs to check logical changes made in it with intention of finding errors. a system is tested for online response, volume of transaction, recovery from failure etc. System testing is done to ensure that the system satisfies all the user requirements.
Page - 35
Project Report of Online Examination System Implementation and Software Specification Testings Detailed Design of Implementation This phase of the systems development life cycle refines hardware and software specifications, establishes programming plans, trains users and implements extensive testing procedures, to evaluate design and operating specifications and/or provide the basis for further modification. Technical Design This activity builds upon specifications produced during new system design, adding detailed technical specifications and documentation. Test Specifications and Planning This activity prepares detailed test specifications for individual modules and programs, job streams, subsystems, and for the system as a whole. Programming and Testing This activity encompasses actual development, writing, and testing of program units or modules. User Training This activity encompasses writing user procedure manuals, preparation of user training materials, conducting training programs, and testing procedures. Acceptance Test A final procedural review to demonstrate a system and secure user approval before a system becomes operational.
Installation Phase In this phase the new Computerized system is installed, the conversion to new procedures is fully implemented, and the potential of the new system is explored.
Page - 36
Project Report of Online Examination System System Installation The process of starting the actual use of a system and training user personnel in its operation. Review Phase This phase evaluates the successes and failures during a systems development project, and to measure the results of a new Computerized Transystem in terms of benefits and savings projected at the start of the project. Development Recap A review of a project immediately after completion to find successes and potential problems in future work. Post-Implementation Review A review, conducted after a new system has been in operation for some time, to evaluate actual system
performance
against
original
expectations
and
projections
for
cost-benefit
improvements. Also identifies maintenance projects to enhance or improve the system. THE STEPS IN THE SOFTWARE TESTING The steps involved during Unit testing are as follows: a. Preparation of the test cases. b. Preparation of the possible test data with all the validation checks. c. Complete code review of the module. d. Actual testing done manually. e. Modifications done for the errors found during testing. f.
Prepared the test result scripts.
The unit testing done included the testing of the following items: 1. Functionality of the entire module/forms. 2. Validations for user input. 3. Checking of the Coding standards to be maintained during coding.
Page - 37
Project Report of Online Examination System 4.
Testing the module with all the possible test data.
5.
Testing of the functionality involving all type of calculations etc.
6. Commenting standard in the source files. After completing the Unit testing of all the modules, the whole system is integrated with all its dependencies in that module. While System Integration, We integrated the modules one by one and tested the system at each step. This helped in reduction of errors at the time of the system testing. The steps involved during System testing are as follows:
Integration of all the modules/forms in the system.
Preparation of the test cases.
Preparation of the possible test data with all the validation checks.
Actual testing done manually.
Recording of all the reproduced errors.
Modifications done for the errors found during testing.
Prepared the test result scripts after rectification of the errors.
The System Testing done included the testing of the following items: 1. Functionality of the entire system as a whole. 2. User Interface of the system. 3. Testing the dependent modules together with all the possible test data scripts. 4. Verification and Validation testing. 5. Testing the reports with all its functionality. After the completion of system testing, the next following phase was the Acceptance Testing. Clients at their end did this and accepted the system with appreciation. Thus, we reached the final phase of the project delivery. There are other six tests, which fall under special category. They are described below:
Peak Load Test: It determines whether the system will handle the volume of activities that occur when the system is at the peak of its processing demand. For example, test the system by activating all terminals at the same time.
Page - 38
Project Report of Online Examination System
Storage Testing: It determines the capacity of the system to store transaction data on a disk or in other files.
Performance Time Testing: it determines the length of time system used by the system to process transaction data. This test is conducted prior to implementation to determine how long it takes to get a response to an inquiry, make a backup copy of a file, or send a transmission and get a response.
Recovery Testing: This testing determines the ability of user to recover data or re-start system after failure. For example, load backup copy of data and resume processing without data or integrity loss.
Procedure Testing: It determines the clarity of documentation on operation and uses of system by having users do exactly what manuals request. For example, powering down system at the end of week or responding to paper-out light on printer.
Human Factors Testing: It determines how users will use the system when processing data or preparing reports.
Page - 39
Project Report of Online Examination System System Analysis: System analysis is a process of gathering and interpreting facts, diagnosing problems and the information about the Online Examination System to recommend improvements on the system. It is a problem solving activity that requires intensive communication between the system users and system developers. System analysis or study is an important phase of any system development process. The system is studied to the minutest detail and analyzed. The system analyst plays the role of the interrogator and dwells deep into the working of the present system. The system is viewed as a whole and the input to the system are identified. The outputs from the organizations are traced to the various processes. System analysis is concerned with becoming aware of the problem, identifying the relevant and decisional variables, analyzing and synthesizing the various factors and determining an optimal or at least a satisfactory solution or program of action. A detailed study of the process must be made by various techniques like interviews, questionnaires etc. The data collected by these sources must be scrutinized to arrive to a conclusion. The conclusion is an understanding of how the system functions. This system is called the existing system. Now the existing system is subjected to close study and problem areas are identified. The designer now functions as a problem solver and tries to sort out the difficulties that the enterprise faces. The solutions are given as proposals. The proposal is then weighed with the existing system analytically and the best one is selected. The proposal is presented to the user for an endorsement by the user. The proposal is reviewed on user request and suitable changes are made. This is loop that ends as soon as the user is satisfied with proposal. Preliminary study is the process of gathering and interpreting facts, using the information for further studies on the system. Preliminary study is problem solving activity that requires intensive communication between the system users and system developers. It does various feasibility studies. In these studies a rough figure of the system activities can be obtained, from which the decision about the strategies to be followed for effective system study and analysis can be taken.
Page - 40
Project Report of Online Examination System
Existing System of Online Examination System: In the existing system the exams are done only manually but in proposed system we have to computerize the exams using this application.
Lack of security of data.
More man power.
Time consuming.
Consumes large volume of pare work.
Needs manual calculations.
No direct role for the higher officials
Proposed System of Online Examination System: The aim of proposed system is to develop a system of improved facilities. The proposed system can overcome all the limitations of the existing system. The system provides proper security and reduces the manual work.
Security of data.
Ensure data accuracy’s.
Proper control of the higher officials.
Minimize manual data entry.
Minimum time needed for the various processing.
Greater efficiency.
Better service.
User friendliness and interactive.
Minimum time required.
Page - 41
Project Report of Online Examination System Data Dictionary: This is normally represented as the data about data. It is also termed as metadata some times which gives the data about the data stored in the database. It defines each data term encountered during the analysis and design of a new system. Data elements can describe files or the processes. Following are some major symbols used in the data dictionary
= equivalent to
+ and
[] either/ or
() Optional entry
Following are some rules, which defines the construction of data dictionary entries: 1. Words should be defined to understand for what they need and not the variable need by which they may be described in the program . 2. Each word must be unique. We cannot have two definition of the same client. 3. Aliases or synonyms are allowed when two or more enters shows the same meaning. For example a vendor number may also be called as customer number. 4. A self-defining word should not be decomposed. It means that the reduction of any information in to subpart should be done only if it is really required that is it is not easy to understand directly. Data dictionary includes information such as the number of records in file, the frequency a process will run, security factor like pass word which user must enter to get excess to the information.
Page - 42
Project Report of Online Examination System
Screenshot of the Project Online Examination System
Page - 43
Project Report of Online Examination System
Page - 44
Project Report of Online Examination System
Page - 45
Project Report of Online Examination System
Page - 46
Project Report of Online Examination System
Page - 47
Project Report of Online Examination System
Page - 48
Project Report of Online Examination System
Page - 49
Project Report of Online Examination System
Page - 50
Project Report of Online Examination System
Page - 51
Project Report of Online Examination System
Page - 52
Project Report of Online Examination System
Page - 53
Project Report of Online Examination System
Page - 54
Project Report of Online Examination System
Page - 55
Project Report of Online Examination System
Page - 56
Project Report of Online Examination System
Page - 57
Project Report of Online Examination System
Page - 58
Project Report of Online Examination System
Page - 59
Project Report of Online Examination System
Page - 60
Project Report of Online Examination System
Page - 61
Project Report of Online Examination System
Page - 62
Project Report of Online Examination System
Page - 63
Project Report of Online Examination System
Page - 64
Project Report of Online Examination System
Page - 65
Project Report of Online Examination System
Page - 66
Project Report of Online Examination System
Page - 67
Project Report of Online Examination System
Page - 68
Project Report of Online Examination System
Page - 69
Project Report of Online Examination System
Page - 70
Project Report of Online Examination System
Page - 71
Project Report of Online Examination System
Code of the Project Online Examination System
Page - 72
Project Report of Online Examination System Source Code of the Project
/** * @file * Enables multi-user blogs. */
/** * Implements hook_node_info(). */ function blog_node_info() { return array( 'blog' => array( 'name' => t('Blog entry'), 'base' => 'blog', 'description' => t('Use for multi-user blogs. Every user gets a personal blog.'), ) ); }
/** * Implements hook_user_view(). */
Page - 73
Project Report of Online Examination System function blog_user_view($account) { if (user_access('create blog content', $account)) { $account->content['summary']['blog'] = array( '#type' => 'user_profile_item', '#title' => t('Blog'), // l() escapes the attributes, so we should not escape !username here. '#markup' => l(t('View recent blog entries'), "blog/$account->uid", array('attributes' => array('title' => t("Read !username's latest blog entries.", array('!username' => format_username($account)))))), '#attributes' => array('class' => array('blog')), ); } }
/** * Implements hook_help(). */ function blog_help($path, $arg) { switch ($path) { case 'admin/help#blog': $output = '' . t('About') . '
'; $output .= '' . t("The Blog module allows registered users to maintain an online journal, or blog. Blogs are made up of individual blog entries. By default, the blog entries are displayed by creation time in descending order, with comments enabled, and are promoted to the site's front page. For more information, see the online handbook entry for Blog module.", array('@blog' => 'http://drupal.org/documentation/modules/blog/')) . '
'; $output .= '' . t('Uses') . '
'; $output .= '';
Page - 74
Project Report of Online Examination System $output .= '- ' . t('Single-user blogs') . '
'; $output .= '- ' . t("Each user's blog entries are automatically displayed with a link to the user's main blog page. You can create as many single-user blogs as you have site users with permission to create blog content.") . '
'; $output .= '- ' . t('Multi-user blogs') . '
'; $output .= '- ' . t("Blog entries from each single-user blog are also aggregated into one central multi-user blog, which displays the blog content of all users in a single listing.") . '
'; $output .= '- ' . t('Navigation') . '
'; $output .= '- ' . t("There is an optional Blogs menu item added to the Navigation menu, which displays all blogs available on your site, and a My blog item displaying the current user's blog entries.") . '
'; $output .= '- ' . t('Blocks') . '
'; $output .= '- ' . t('The Blog module also creates a default Recent blog posts block that may be enabled at the blocks administration page.', array('@blocks' => url('admin/structure/block'))) . '
'; $output .= '
'; return $output; } }
/** * Implements hook_form(). */ function blog_form($node, $form_state) { return node_content_form($node, $form_state); }
/**
Page - 75
Project Report of Online Examination System * Implements hook_view(). */ function blog_view($node, $view_mode) { if ($view_mode == 'full' && node_is_page($node)) { // Breadcrumb navigation. l() escapes title, so we should not escape !name. drupal_set_breadcrumb(array(l(t('Home'), NULL), l(t('Blogs'), 'blog'), l(t("!name's blog", array('!name' => format_username($node))), 'blog/' . $node->uid))); } return $node; }
/** * Implements hook_node_view(). */ function blog_node_view($node, $view_mode) { if ($view_mode != 'rss') { if ($node->type == 'blog' && (arg(0) != 'blog' || arg(1) != $node->uid)) { // This goes to l(), which escapes !username in both title and attributes. $links['blog_usernames_blog'] = array( 'title' => t("!username's blog", array('!username' => format_username($node))), 'href' => "blog/$node->uid", 'attributes' => array('title' => t("Read !username's latest blog entries.", array('!username' => format_username($node)))), ); $node->content['links']['blog'] = array( '#theme' => 'links__node__blog',
Page - 76
Project Report of Online Examination System '#links' => $links, '#attributes' => array('class' => array('links', 'inline')), ); } } }
/** * Implements hook_menu(). */ function blog_menu() { $items['blog'] = array( 'title' => 'Blogs', 'page callback' => 'blog_page_last', 'access arguments' => array('access content'), 'type' => MENU_SUGGESTED_ITEM, 'file' => 'blog.pages.inc', ); $items['blog/%user_uid_optional'] = array( 'title' => 'My blog', 'page callback' => 'blog_page_user', 'page arguments' => array(1), 'access callback' => 'blog_page_user_access', 'access arguments' => array(1), 'file' => 'blog.pages.inc',
Page - 77
Project Report of Online Examination System ); $items['blog/%user/feed'] = array( 'title' => 'Blogs', 'page callback' => 'blog_feed_user', 'page arguments' => array(1), 'access callback' => 'blog_page_user_access', 'access arguments' => array(1), 'type' => MENU_CALLBACK, 'file' => 'blog.pages.inc', ); $items['blog/feed'] = array( 'title' => 'Blogs', 'page callback' => 'blog_feed_last', 'access arguments' => array('access content'), 'type' => MENU_CALLBACK, 'file' => 'blog.pages.inc', );
return $items; }
/** * Implements hook_menu_local_tasks_alter(). */ function blog_menu_local_tasks_alter(&$data, $router_item, $root_path) {
Page - 78
Project Report of Online Examination System global $user;
// Add action link to 'node/add/blog' on 'blog' page. if ($root_path == 'blog') { $item = menu_get_item('node/add/blog'); if ($item['access']) { $item['title'] = t('Create new blog entry'); $data['actions']['output'][] = array( '#theme' => 'menu_local_action', '#link' => $item, ); } } // Provide a helper action link to the author on the 'blog/%' page. elseif ($root_path == 'blog/%' && $router_item['page_arguments'][0]->uid == $user->uid) { $data['actions']['output']['blog'] = array( '#theme' => 'menu_local_action', ); if (user_access('create blog content')) { $data['actions']['output']['blog']['#link']['title'] = t('Post new blog entry.'); $data['actions']['output']['blog']['#link']['href'] = 'node/add/blog'; } else { $data['actions']['output']['blog']['#link']['title'] = t('You are not allowed to post a new blog entry.'); }
Page - 79
Project Report of Online Examination System } }
/** * Access callback for user blog pages. */ function blog_page_user_access($account) { // The visitor must be able to access the site's content. // For a blog to 'exist' the user must either be able to // create new blog entries, or it must have existing posts. return $account->uid && user_access('access content') && (user_access('create blog content', $account) || _blog_post_exists($account)); }
/** * Helper function to determine if a user has blog posts already. */ function _blog_post_exists($account) { return (bool)db_select('node', 'n') ->fields('n', array('nid')) ->condition('type', 'blog') ->condition('uid', $account->uid) ->condition('status', 1) ->range(0, 1) ->addTag('node_access') ->execute()
Page - 80
Project Report of Online Examination System ->fetchField(); }
/** * Implements hook_block_info(). */ function blog_block_info() { $block['recent']['info'] = t('Recent blog posts'); $block['recent']['properties']['administrative'] = TRUE; return $block; }
/** * Implements hook_block_configure(). */ function blog_block_configure($delta = '') { if ($delta == 'recent') { $form['blog_block_count'] = array( '#type' => 'select', '#title' => t('Number of recent blog posts to display'), '#default_value' => variable_get('blog_block_count', 10), '#options' => drupal_map_assoc(array(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 25, 30)), ); return $form; }
Page - 81
Project Report of Online Examination System }
/** * Implements hook_block_save(). */ function blog_block_save($delta = '', $edit = array()) { if ($delta == 'recent') { variable_set('blog_block_count', $edit['blog_block_count']); } }
/** * Implements hook_block_view(). * * Displays the most recent 10 blog titles. */ function blog_block_view($delta = '') { global $user;
if (user_access('access content')) { $result = db_select('node', 'n') ->fields('n', array('nid', 'title', 'created')) ->condition('type', 'blog') ->condition('status', 1) ->orderBy('created', 'DESC')
Page - 82
Project Report of Online Examination System ->range(0, variable_get('blog_block_count', 10)) ->addTag('node_access') ->execute();
if ($node_title_list = node_title_list($result)) { $block['subject'] = t('Recent blog posts'); $block['content']['blog_list'] = $node_title_list; $block['content']['blog_more'] = array( '#theme' => 'more_link', '#url' => 'blog', '#title' => t('Read the latest blog entries.'), );
return $block; } } }
/** * Implements hook_rdf_mapping(). */ function blog_rdf_mapping() { return array( array( 'type' => 'node',
Page - 83
Project Report of Online Examination System 'bundle' => 'blog', 'mapping' => array( 'rdftype' => array('sioc:Post', 'sioct:BlogPost'), ), ), ); }
Page - 84
Project Report of Online Examination System
/** * @file * Allows users to create and organize related content in an outline. */
/** * Implements hook_help(). */ function book_help($path, $arg) { switch ($path) { case 'admin/help#book': $output = '' . t('About') . '
'; $output .= '' . t('The Book module is used for creating structured, multi-page content, such as site resource guides, manuals, and wikis. It allows you to create content that has chapters, sections, subsections, or any similarly-tiered structure. For more information, see the online handbook entry for Book module.', array('@book' => 'http://drupal.org/documentation/modules/book/')) . '
'; $output .= '' . t('Uses') . '
'; $output .= ''; $output .= '- ' . t('Adding and managing book content') . '
'; $output .= '- ' . t('You can assign separate permissions for creating, editing, and deleting book content, as well as adding content to books, and creating new books. Users with the Administer book outlines permission can add any type of content to a book by selecting the appropriate book outline while editing the content. They can also view a list of all books, and edit and rearrange section titles on the Book administration page.', array('@admin-book' => url('admin/content/book'))) . '
';
Page - 85
Project Report of Online Examination System $output .= '- ' . t('Book navigation') . '
'; $output .= '- ' . t("Book pages have a default book-specific navigation block. This navigation block contains links that lead to the previous and next pages in the book, and to the level above the current page in the book's structure. This block can be enabled on the Blocks administration page. For book pages to show up in the book navigation, they must be added to a book outline.", array('@admin-block' => url('admin/structure/block'))) . '
'; $output .= '- ' . t('Collaboration') . '
'; $output .= '- ' . t('Books can be created collaboratively, as they allow users with appropriate permissions to add pages into existing books, and add those pages to a custom table of contents menu.') . '
'; $output .= '- ' . t('Printing books') . '
'; $output .= '- ' . t("Users with the View printer-friendly books permission can select the printer-friendly version link visible at the bottom of a book page's content to generate a printer-friendly display of the page and all of its subsections.") . '
'; $output .= '
'; return $output; case 'admin/content/book': return '' . t('The book module offers a means to organize a collection of related content pages, collectively known as a book. When viewed, this content automatically displays links to adjacent book pages, providing a simple navigation system for creating and reviewing structured content.') . '
'; case 'node/%/outline': return '' . t('The outline feature allows you to include pages in the Book hierarchy, as well as move them within the hierarchy or to reorder an entire book.', array('@book' => url('book'), '@book-admin' => url('admin/content/book'))) . '
'; } }
/** * Implements hook_theme(). */
Page - 86
Project Report of Online Examination System function book_theme() { return array( 'book_navigation' => array( 'variables' => array('book_link' => NULL), 'template' => 'book-navigation', ), 'book_export_html' => array( 'variables' => array('title' => NULL, 'contents' => NULL, 'depth' => NULL), 'template' => 'book-export-html', ), 'book_admin_table' => array( 'render element' => 'form', ), 'book_title_link' => array( 'variables' => array('link' => NULL), ), 'book_all_books_block' => array( 'render element' => 'book_menus', 'template' => 'book-all-books-block', ), 'book_node_export_html' => array( 'variables' => array('node' => NULL, 'children' => NULL), 'template' => 'book-node-export-html', ), );
Page - 87
Project Report of Online Examination System }
/** * Implements hook_permission(). */ function book_permission() { return array( 'administer book outlines' => array( 'title' => t('Administer book outlines'), ), 'create new books' => array( 'title' => t('Create new books'), ), 'add content to books' => array( 'title' => t('Add content and child pages to books'), ), 'access printer-friendly version' => array( 'title' => t('View printer-friendly books'), 'description' => t('View a book page and all of its sub-pages as a single document for ease of printing. Can be performance heavy.'), ), ); }
/** * Adds relevant book links to the node's links.
Page - 88
Project Report of Online Examination System * * @param $node * The book page node to add links to. * @param $view_mode * The view mode of the node. */ function book_node_view_link($node, $view_mode) { $links = array();
if (isset($node->book['depth'])) { if ($view_mode == 'full' && node_is_page($node)) { $child_type = variable_get('book_child_type', 'book'); if ((user_access('add content to books') || user_access('administer book outlines')) && node_access('create', $child_type) && $node->status == 1 && $node->book['depth'] < MENU_MAX_DEPTH) { $links['book_add_child'] = array( 'title' => t('Add child page'), 'href' => 'node/add/' . str_replace('_', '-', $child_type), 'query' => array('parent' => $node->book['mlid']), ); }
if (user_access('access printer-friendly version')) { $links['book_printer'] = array( 'title' => t('Printer-friendly version'), 'href' => 'book/export/html/' . $node->nid,
Page - 89
Project Report of Online Examination System 'attributes' => array('title' => t('Show a printer-friendly version of this book page and its subpages.')) ); } } }
if (!empty($links)) { $node->content['links']['book'] = array( '#theme' => 'links__node__book', '#links' => $links, '#attributes' => array('class' => array('links', 'inline')), ); } }
/** * Implements hook_menu(). */ function book_menu() { $items['admin/content/book'] = array( 'title' => 'Books', 'description' => "Manage your site's book outlines.", 'page callback' => 'book_admin_overview', 'access arguments' => array('administer book outlines'), 'type' => MENU_LOCAL_TASK,
Page - 90
Project Report of Online Examination System 'file' => 'book.admin.inc', ); $items['admin/content/book/list'] = array( 'title' => 'List', 'type' => MENU_DEFAULT_LOCAL_TASK, ); $items['admin/content/book/settings'] = array( 'title' => 'Settings', 'page callback' => 'drupal_get_form', 'page arguments' => array('book_admin_settings'), 'access arguments' => array('administer site configuration'), 'type' => MENU_LOCAL_TASK, 'weight' => 8, 'file' => 'book.admin.inc', ); $items['admin/content/book/%node'] = array( 'title' => 'Re-order book pages and change titles', 'page callback' => 'drupal_get_form', 'page arguments' => array('book_admin_edit', 3), 'access callback' => '_book_outline_access', 'access arguments' => array(3), 'type' => MENU_CALLBACK, 'file' => 'book.admin.inc', ); $items['book'] = array(
Page - 91
Project Report of Online Examination System 'title' => 'Books', 'page callback' => 'book_render', 'access arguments' => array('access content'), 'type' => MENU_SUGGESTED_ITEM, 'file' => 'book.pages.inc', ); $items['book/export/%/%'] = array( 'page callback' => 'book_export', 'page arguments' => array(2, 3), 'access arguments' => array('access printer-friendly version'), 'type' => MENU_CALLBACK, 'file' => 'book.pages.inc', ); $items['node/%node/outline'] = array( 'title' => 'Outline', 'page callback' => 'book_outline', 'page arguments' => array(1), 'access callback' => '_book_outline_access', 'access arguments' => array(1), 'type' => MENU_LOCAL_TASK, 'weight' => 2, 'file' => 'book.pages.inc', ); $items['node/%node/outline/remove'] = array( 'title' => 'Remove from outline',
Page - 92
Project Report of Online Examination System 'page callback' => 'drupal_get_form', 'page arguments' => array('book_remove_form', 1), 'access callback' => '_book_outline_remove_access', 'access arguments' => array(1), 'file' => 'book.pages.inc', );
return $items; }
/** * Access callback: Determines if the outline tab is accessible. * * @param $node * The node whose outline tab is to be viewed. */ function _book_outline_access($node) { return user_access('administer book outlines') && node_access('view', $node); }
/** * Access callback: Determines if the user can remove nodes from the outline. * * @param $node * The node to remove from the outline.
Page - 93
Project Report of Online Examination System * * @see book_menu() */ function _book_outline_remove_access($node) { return _book_node_is_removable($node) && _book_outline_access($node); }
/** * Determines if a node can be removed from the book. * * A node can be removed from a book if it is actually in a book and it either * is not a top-level page or is a top-level page with no children. * * @param $node * The node to remove from the outline. */ function _book_node_is_removable($node) { return (!empty($node->book['bid']) && (($node->book['bid'] != $node->nid) || !$node>book['has_children'])); }
/** * Implements hook_admin_paths(). */ function book_admin_paths() { if (variable_get('node_admin_theme')) {
Page - 94
Project Report of Online Examination System $paths = array( 'node/*/outline' => TRUE, 'node/*/outline/remove' => TRUE, ); return $paths; } }
/** * Implements hook_entity_info_alter(). */ function book_entity_info_alter(&$info) { // Add the 'Print' view mode for nodes. $info['node']['view modes'] += array( 'print' => array( 'label' => t('Print'), 'custom settings' => FALSE, ), ); }
/** * Implements hook_block_info(). */ function book_block_info() {
Page - 95
Project Report of Online Examination System $block = array(); $block['navigation']['info'] = t('Book navigation'); $block['navigation']['cache'] = DRUPAL_CACHE_PER_PAGE | DRUPAL_CACHE_PER_ROLE;
return $block; }
/** * Implements hook_block_view(). * * Displays the book table of contents in a block when the current page is a * single-node view of a book node. */ function book_block_view($delta = '') { $block = array(); $current_bid = 0; if ($node = menu_get_object()) { $current_bid = empty($node->book['bid']) ? 0 : $node->book['bid']; }
if (variable_get('book_block_mode', 'all pages') == 'all pages') { $block['subject'] = t('Book navigation'); $book_menus = array(); $pseudo_tree = array(0 => array('below' => FALSE)); foreach (book_get_books() as $book_id => $book) {
Page - 96
Project Report of Online Examination System if ($book['bid'] == $current_bid) { // If the current page is a node associated with a book, the menu // needs to be retrieved. $book_menus[$book_id] = menu_tree_output(menu_tree_all_data($node->book['menu_name'], $node->book)); } else { // Since we know we will only display a link to the top node, there // is no reason to run an additional menu tree query for each book. $book['in_active_trail'] = FALSE; // Check whether user can access the book link. $book_node = node_load($book['nid']); $book['access'] = node_access('view', $book_node); $pseudo_tree[0]['link'] = $book; $book_menus[$book_id] = menu_tree_output($pseudo_tree); } } $book_menus['#theme'] = 'book_all_books_block'; $block['content'] = $book_menus; } elseif ($current_bid) { // Only display this block when the user is browsing a book. $select = db_select('node', 'n') ->fields('n', array('title')) ->condition('n.nid', $node->book['bid']) ->addTag('node_access');
Page - 97
Project Report of Online Examination System $title = $select->execute()->fetchField(); // Only show the block if the user has view access for the top-level node. if ($title) { $tree = menu_tree_all_data($node->book['menu_name'], $node->book); // There should only be one element at the top level. $data = array_shift($tree); $block['subject'] = theme('book_title_link', array('link' => $data['link'])); $block['content'] = ($data['below']) ? menu_tree_output($data['below']) : ''; } }
return $block; }
/** * Implements hook_block_configure(). */ function book_block_configure($delta = '') { $block = array(); $options = array( 'all pages' => t('Show block on all pages'), 'book pages' => t('Show block only on book pages'), ); $form['book_block_mode'] = array( '#type' => 'radios',
Page - 98
Project Report of Online Examination System '#title' => t('Book navigation block display'), '#options' => $options, '#default_value' => variable_get('book_block_mode', 'all pages'), '#description' => t("If Show block on all pages is selected, the block will contain the automatically generated menus for all of the site's books. If Show block only on book pages is selected, the block will contain only the one menu corresponding to the current page's book. In this case, if the current page is not in a book, no block will be displayed. The Page specific visibility settings or other visibility settings can be used in addition to selectively display this block."), );
return $form; }
/** * Implements hook_block_save(). */ function book_block_save($delta = '', $edit = array()) { $block = array(); variable_set('book_block_mode', $edit['book_block_mode']); }
/** * Returns HTML for a link to a book title when used as a block title. * * @param $variables * An associative array containing: * - link: An array containing title, href and options for the link.
Page - 99
Project Report of Online Examination System * * @ingroup themeable */ function theme_book_title_link($variables) { $link = $variables['link'];
$link['options']['attributes']['class'] = array('book-title');
return l($link['title'], $link['href'], $link['options']); }
/** * Returns an array of all books. * * This list may be used for generating a list of all the books, or for building * the options for a form select. * * @return * An array of all books. */ function book_get_books() { $all_books = &drupal_static(__FUNCTION__);
if (!isset($all_books)) { $all_books = array();
Page - 100
Project Report of Online Examination System $nids = db_query("SELECT DISTINCT(bid) FROM {book}")->fetchCol();
if ($nids) { $query = db_select('book', 'b', array('fetch' => PDO::FETCH_ASSOC)); $query->join('node', 'n', 'b.nid = n.nid'); $query->join('menu_links', 'ml', 'b.mlid = ml.mlid'); $query->addField('n', 'type', 'type'); $query->addField('n', 'title', 'title'); $query->fields('b'); $query->fields('ml'); $query->condition('n.nid', $nids, 'IN'); $query->condition('n.status', 1); $query->orderBy('ml.weight'); $query->orderBy('ml.link_title'); $query->addTag('node_access'); $result2 = $query->execute(); foreach ($result2 as $link) { $link['href'] = $link['link_path']; $link['options'] = unserialize($link['options']); $all_books[$link['bid']] = $link; } } }
return $all_books;
Page - 101
Project Report of Online Examination System }
/** * Implements hook_form_BASE_FORM_ID_alter() for node_form(). * * Adds the book fieldset to the node form. * * @see book_pick_book_nojs_submit() */ function book_form_node_form_alter(&$form, &$form_state, $form_id) { $node = $form['#node']; $access = user_access('administer book outlines'); if (!$access) { if (user_access('add content to books') && ((!empty($node->book['mlid']) && !empty($node->nid)) || book_type_is_allowed($node->type))) { // Already in the book hierarchy, or this node type is allowed. $access = TRUE; } }
if ($access) { _book_add_form_elements($form, $form_state, $node); // Since the "Book" dropdown can't trigger a form submission when // JavaScript is disabled, add a submit button to do that. book.css hides // this button when JavaScript is enabled. $form['book']['pick-book'] = array(
Page - 102
Project Report of Online Examination System '#type' => 'submit', '#value' => t('Change book (update list of parents)'), '#submit' => array('book_pick_book_nojs_submit'), '#weight' => 20, ); } }
/** * Form submission handler for node_form(). * * This handler is run when JavaScript is disabled. It triggers the form to * rebuild so that the "Parent item" options are changed to reflect the newly * selected book. When JavaScript is enabled, the submit button that triggers * this handler is hidden, and the "Book" dropdown directly triggers the * book_form_update() Ajax callback instead. * * @see book_form_update() * @see book_form_node_form_alter() */ function book_pick_book_nojs_submit($form, &$form_state) { $form_state['node']->book = $form_state['values']['book']; $form_state['rebuild'] = TRUE; }
Page - 103
Project Report of Online Examination System /** * Builds the parent selection form element for the node form or outline tab. * * This function is also called when generating a new set of options during the * Ajax callback, so an array is returned that can be used to replace an * existing form element. * * @param $book_link * A fully loaded menu link that is part of the book hierarchy. * * @return * A parent selection form element. */ function _book_parent_select($book_link) { if (variable_get('menu_override_parent_selector', FALSE)) { return array(); } // Offer a message or a drop-down to choose a different parent page. $form = array( '#type' => 'hidden', '#value' => -1, '#prefix' => '', '#suffix' => '
', );
Page - 104
Project Report of Online Examination System if ($book_link['nid'] === $book_link['bid']) { // This is a book - at the top level. if ($book_link['original_bid'] === $book_link['bid']) { $form['#prefix'] .= '' . t('This is the top-level page in this book.') . ''; } else { $form['#prefix'] .= '' . t('This will be the top-level page in this book.') . ''; } } elseif (!$book_link['bid']) { $form['#prefix'] .= '' . t('No book selected.') . ''; } else { $form = array( '#type' => 'select', '#title' => t('Parent item'), '#default_value' => $book_link['plid'], '#description' => t('The parent page in the book. The maximum depth for a book and all child pages is !maxdepth. Some pages in the selected book may not be available as parents if selecting them would exceed this limit.', array('!maxdepth' => MENU_MAX_DEPTH)), '#options' => book_toc($book_link['bid'], $book_link['parent_depth_limit'], array($book_link['mlid'])), '#attributes' => array('class' => array('book-title-select')), '#prefix' => '', '#suffix' => '
', ); }
Page - 105
Project Report of Online Examination System
return $form; }
/** * Builds the common elements of the book form for the node and outline forms. * * @param $node * The node whose form is being viewed. */ function _book_add_form_elements(&$form, &$form_state, $node) { // If the form is being processed during the Ajax callback of our book bid // dropdown, then $form_state will hold the value that was selected. if (isset($form_state['values']['book'])) { $node->book = $form_state['values']['book']; }
$form['book'] = array( '#type' => 'fieldset', '#title' => t('Book outline'), '#weight' => 10, '#collapsible' => TRUE, '#collapsed' => TRUE, '#group' => 'additional_settings', '#attributes' => array(
Page - 106
Project Report of Online Examination System 'class' => array('book-outline-form'), ), '#attached' => array( 'js' => array(drupal_get_path('module', 'book') . '/book.js'), ), '#tree' => TRUE, ); foreach (array('menu_name', 'mlid', 'nid', 'router_path', 'has_children', 'options', 'module', 'original_bid', 'parent_depth_limit') as $key) { $form['book'][$key] = array( '#type' => 'value', '#value' => $node->book[$key], ); }
$form['book']['plid'] = _book_parent_select($node->book);
// @see _book_admin_table_tree(). The weight may be larger than 15. $form['book']['weight'] = array( '#type' => 'weight', '#title' => t('Weight'), '#default_value' => $node->book['weight'], '#delta' => max(15, abs($node->book['weight'])), '#weight' => 5, '#description' => t('Pages at a given level are ordered first by weight and then by title.'), );
Page - 107
Project Report of Online Examination System $options = array(); $nid = isset($node->nid) ? $node->nid : 'new';
if (isset($node->nid) && ($nid == $node->book['original_bid']) && ($node->book['parent_depth_limit'] == 0)) { // This is the top level node in a maximum depth book and thus cannot be moved. $options[$node->nid] = $node->title; } else { foreach (book_get_books() as $book) { $options[$book['nid']] = $book['title']; } }
if (user_access('create new books') && ($nid == 'new' || ($nid != $node->book['original_bid']))) { // The node can become a new book, if it is not one already. $options = array($nid => '<' . t('create a new book') . '>') + $options; } if (!$node->book['mlid']) { // The node is not currently in the hierarchy. $options = array(0 => '<' . t('none') . '>') + $options; }
// Add a drop-down to select the destination book. $form['book']['bid'] = array( '#type' => 'select',
Page - 108
Project Report of Online Examination System '#title' => t('Book'), '#default_value' => $node->book['bid'], '#options' => $options, '#access' => (bool) $options, '#description' => t('Your page will be a part of the selected book.'), '#weight' => -5, '#attributes' => array('class' => array('book-title-select')), '#ajax' => array( 'callback' => 'book_form_update', 'wrapper' => 'edit-book-plid-wrapper', 'effect' => 'fade', 'speed' => 'fast', ), ); }
/** * Renders a new parent page select element when the book selection changes. * * This function is called via Ajax when the selected book is changed on a node * or book outline form. * * @return * The rendered parent page select element. */
Page - 109
Project Report of Online Examination System function book_form_update($form, $form_state) { return $form['book']['plid']; }
/** * Handles additions and updates to the book outline. * * This common helper function performs all additions and updates to the book * outline through node addition, node editing, node deletion, or the outline * tab. * * @param $node * The node that is being saved, added, deleted, or moved. * * @return * TRUE if the menu link was saved; FALSE otherwise. */ function _book_update_outline($node) { if (empty($node->book['bid'])) { return FALSE; } $new = empty($node->book['mlid']);
$node->book['link_path'] = 'node/' . $node->nid; $node->book['link_title'] = $node->title;
Page - 110
Project Report of Online Examination System $node->book['parent_mismatch'] = FALSE; // The normal case.
if ($node->book['bid'] == $node->nid) { $node->book['plid'] = 0; $node->book['menu_name'] = book_menu_name($node->nid); } else { // Check in case the parent is not is this book; the book takes precedence. if (!empty($node->book['plid'])) { $parent = db_query("SELECT * FROM {book} WHERE mlid = :mlid", array( ':mlid' => $node->book['plid'], ))->fetchAssoc(); } if (empty($node->book['plid']) || !$parent || $parent['bid'] != $node->book['bid']) { $node->book['plid'] = db_query("SELECT mlid FROM {book} WHERE nid = :nid", array( ':nid' => $node->book['bid'], ))->fetchField(); $node->book['parent_mismatch'] = TRUE; // Likely when JS is disabled. } }
if (menu_link_save($node->book)) { if ($new) { // Insert new. db_insert('book')
Page - 111
Project Report of Online Examination System ->fields(array( 'nid' => $node->nid, 'mlid' => $node->book['mlid'], 'bid' => $node->book['bid'], )) ->execute(); // Reset the cache of stored books. drupal_static_reset('book_get_books'); } else { if ($node->book['bid'] != db_query("SELECT bid FROM {book} WHERE nid = :nid", array( ':nid' => $node->nid, ))->fetchField()) { // Update the bid for this page and all children. book_update_bid($node->book); // Reset the cache of stored books. drupal_static_reset('book_get_books'); } }
return TRUE; }
// Failed to save the menu link. return FALSE;
Page - 112
Project Report of Online Examination System }
/** * Updates the book ID of a page and its children when it moves to a new book. * * @param $book_link * A fully loaded menu link that is part of the book hierarchy. */ function book_update_bid($book_link) { $query = db_select('menu_links'); $query->addField('menu_links', 'mlid'); for ($i = 1; $i <= MENU_MAX_DEPTH && $book_link["p$i"]; $i++) { $query->condition("p$i", $book_link["p$i"]); } $mlids = $query->execute()->fetchCol();
if ($mlids) { db_update('book') ->fields(array('bid' => $book_link['bid'])) ->condition('mlid', $mlids, 'IN') ->execute(); } }
/**
Page - 113
Project Report of Online Examination System * Gets the book menu tree for a page and returns it as a linear array. * * @param $book_link * A fully loaded menu link that is part of the book hierarchy. * * @return * A linear array of menu links in the order that the links are shown in the * menu, so the previous and next pages are the elements before and after the * element corresponding to the current node. The children of the current node * (if any) will come immediately after it in the array, and links will only * be fetched as deep as one level deeper than $book_link. */ function book_get_flat_menu($book_link) { $flat = &drupal_static(__FUNCTION__, array());
if (!isset($flat[$book_link['mlid']])) { // Call menu_tree_all_data() to take advantage of the menu system's caching. $tree = menu_tree_all_data($book_link['menu_name'], $book_link, $book_link['depth'] + 1); $flat[$book_link['mlid']] = array(); _book_flatten_menu($tree, $flat[$book_link['mlid']]); }
return $flat[$book_link['mlid']]; }
Page - 114
Project Report of Online Examination System /** * Recursively converts a tree of menu links to a flat array. * * @param $tree * A tree of menu links in an array. * @param $flat * A flat array of the menu links from $tree, passed by reference. * * @see book_get_flat_menu(). */ function _book_flatten_menu($tree, &$flat) { foreach ($tree as $data) { if (!$data['link']['hidden']) { $flat[$data['link']['mlid']] = $data['link']; if ($data['below']) { _book_flatten_menu($data['below'], $flat); } } } }
/** * Fetches the menu link for the previous page of the book. * * @param $book_link
Page - 115
Project Report of Online Examination System * A fully loaded menu link that is part of the book hierarchy. * * @return * A fully loaded menu link for the page before the one represented in * $book_link. */ function book_prev($book_link) { // If the parent is zero, we are at the start of a book. if ($book_link['plid'] == 0) { return NULL; } $flat = book_get_flat_menu($book_link); // Assigning the array to $flat resets the array pointer for use with each(). $curr = NULL; do { $prev = $curr; list($key, $curr) = each($flat); } while ($key && $key != $book_link['mlid']);
if ($key == $book_link['mlid']) { // The previous page in the book may be a child of the previous visible link. if ($prev['depth'] == $book_link['depth'] && $prev['has_children']) { // The subtree will have only one link at the top level - get its data. $tree = book_menu_subtree_data($prev); $data = array_shift($tree);
Page - 116
Project Report of Online Examination System // The link of interest is the last child - iterate to find the deepest one. while ($data['below']) { $data = end($data['below']); }
return $data['link']; } else { return $prev; } } }
/** * Fetches the menu link for the next page of the book. * * @param $book_link * A fully loaded menu link that is part of the book hierarchy. * * @return * A fully loaded menu link for the page after the one represented in * $book_link. */ function book_next($book_link) { $flat = book_get_flat_menu($book_link);
Page - 117
Project Report of Online Examination System // Assigning the array to $flat resets the array pointer for use with each(). do { list($key, $curr) = each($flat); } while ($key && $key != $book_link['mlid']);
if ($key == $book_link['mlid']) { return current($flat); } }
/** * Formats the menu links for the child pages of the current page. * * @param $book_link * A fully loaded menu link that is part of the book hierarchy. * * @return * HTML for the links to the child pages of the current page. */ function book_children($book_link) { $flat = book_get_flat_menu($book_link);
$children = array();
Page - 118
Project Report of Online Examination System if ($book_link['has_children']) { // Walk through the array until we find the current page. do { $link = array_shift($flat); } while ($link && ($link['mlid'] != $book_link['mlid'])); // Continue though the array and collect the links whose parent is this page. while (($link = array_shift($flat)) && $link['plid'] == $book_link['mlid']) { $data['link'] = $link; $data['below'] = ''; $children[] = $data; } }
if ($children) { $elements = menu_tree_output($children); return drupal_render($elements); } return ''; }
/** * Generates the corresponding menu name from a book ID. * * @param $bid
Page - 119
Project Report of Online Examination System * The book ID for which to make a menu name. * * @return * The menu name. */ function book_menu_name($bid) { return 'book-toc-' . $bid; }
/** * Implements hook_node_load(). */ function book_node_load($nodes, $types) { $result = db_query("SELECT * FROM {book} b INNER JOIN {menu_links} ml ON b.mlid = ml.mlid WHERE b.nid IN (:nids)", array(':nids' => array_keys($nodes)), array('fetch' => PDO::FETCH_ASSOC)); foreach ($result as $record) { $nodes[$record['nid']]->book = $record; $nodes[$record['nid']]->book['href'] = $record['link_path']; $nodes[$record['nid']]->book['title'] = $record['link_title']; $nodes[$record['nid']]->book['options'] = unserialize($record['options']); } }
/** * Implements hook_node_view(). */
Page - 120
Project Report of Online Examination System function book_node_view($node, $view_mode) { if ($view_mode == 'full') { if (!empty($node->book['bid']) && empty($node->in_preview)) { $node->content['book_navigation'] = array( '#markup' => theme('book_navigation', array('book_link' => $node->book)), '#weight' => 100, ); } }
if ($view_mode != 'rss') { book_node_view_link($node, $view_mode); } }
/** * Implements hook_page_alter(). * * Adds the book menu to the list of menus used to build the active trail when * viewing a book page. */ function book_page_alter(&$page) { if (($node = menu_get_object()) && !empty($node->book['bid'])) { $active_menus = menu_get_active_menu_names(); $active_menus[] = $node->book['menu_name'];
Page - 121
Project Report of Online Examination System menu_set_active_menu_names($active_menus); } }
/** * Implements hook_node_presave(). */ function book_node_presave($node) { // Always save a revision for non-administrators. if (!empty($node->book['bid']) && !user_access('administer nodes')) { $node->revision = 1; // The database schema requires a log message for every revision. if (!isset($node->log)) { $node->log = ''; } } // Make sure a new node gets a new menu link. if (empty($node->nid)) { $node->book['mlid'] = NULL; } }
/** * Implements hook_node_insert(). */
Page - 122
Project Report of Online Examination System function book_node_insert($node) { if (!empty($node->book['bid'])) { if ($node->book['bid'] == 'new') { // New nodes that are their own book. $node->book['bid'] = $node->nid; } $node->book['nid'] = $node->nid; $node->book['menu_name'] = book_menu_name($node->book['bid']); _book_update_outline($node); } }
/** * Implements hook_node_update(). */ function book_node_update($node) { if (!empty($node->book['bid'])) { if ($node->book['bid'] == 'new') { // New nodes that are their own book. $node->book['bid'] = $node->nid; } $node->book['nid'] = $node->nid; $node->book['menu_name'] = book_menu_name($node->book['bid']); _book_update_outline($node); }
Page - 123
Project Report of Online Examination System }
/** * Implements hook_node_delete(). */ function book_node_delete($node) { if (!empty($node->book['bid'])) { if ($node->nid == $node->book['bid']) { // Handle deletion of a top-level post. $result = db_query("SELECT b.nid FROM {menu_links} ml INNER JOIN {book} b on b.mlid = ml.mlid WHERE ml.plid = :plid", array( ':plid' => $node->book['mlid'] )); foreach ($result as $child) { $child_node = node_load($child->nid); $child_node->book['bid'] = $child_node->nid; _book_update_outline($child_node); } } menu_link_delete($node->book['mlid']); db_delete('book') ->condition('mlid', $node->book['mlid']) ->execute(); drupal_static_reset('book_get_books'); } }
Page - 124
Project Report of Online Examination System
/** * Implements hook_node_prepare(). */ function book_node_prepare($node) { // Prepare defaults for the add/edit form. if (empty($node->book) && (user_access('add content to books') || user_access('administer book outlines'))) { $node->book = array();
if (empty($node->nid) && isset($_GET['parent']) && is_numeric($_GET['parent'])) { // Handle "Add child page" links: $parent = book_link_load($_GET['parent']);
if ($parent && $parent['access']) { $node->book['bid'] = $parent['bid']; $node->book['plid'] = $parent['mlid']; $node->book['menu_name'] = $parent['menu_name']; } } // Set defaults. $node->book += _book_link_defaults(!empty($node->nid) ? $node->nid : 'new'); } else { if (isset($node->book['bid']) && !isset($node->book['original_bid'])) { $node->book['original_bid'] = $node->book['bid'];
Page - 125
Project Report of Online Examination System } } // Find the depth limit for the parent select. if (isset($node->book['bid']) && !isset($node->book['parent_depth_limit'])) { $node->book['parent_depth_limit'] = _book_parent_depth_limit($node->book); } }
/** * Finds the depth limit for items in the parent select. * * @param $book_link * A fully loaded menu link that is part of the book hierarchy. * * @return * The depth limit for items in the parent select. */ function _book_parent_depth_limit($book_link) { return MENU_MAX_DEPTH - 1 - (($book_link['mlid'] && $book_link['has_children']) ? menu_link_children_relative_depth($book_link) : 0); }
/** * Implements hook_form_FORM_ID_alter() for node_delete_confirm(). * * Alters the confirm form for a single node deletion.
Page - 126
Project Report of Online Examination System * * @see node_delete_confirm() */ function book_form_node_delete_confirm_alter(&$form, $form_state) { $node = node_load($form['nid']['#value']);
if (isset($node->book) && $node->book['has_children']) { $form['book_warning'] = array( '#markup' => '' . t('%title is part of a book outline, and has associated child pages. If you proceed with deletion, the child pages will be relocated automatically.', array('%title' => $node->title)) . '
', '#weight' => -10, ); } }
/** * Returns an array with default values for a book page's menu link. * * @param $nid * The ID of the node whose menu link is being created. * * @return * The default values for the menu link. */ function _book_link_defaults($nid) {
Page - 127
Project Report of Online Examination System return array('original_bid' => 0, 'menu_name' => '', 'nid' => $nid, 'bid' => 0, 'router_path' => 'node/%', 'plid' => 0, 'mlid' => 0, 'has_children' => 0, 'weight' => 0, 'module' => 'book', 'options' => array()); }
/** * Processes variables for book-all-books-block.tpl.php. * * All non-renderable elements are removed so that the template has full access * to the structured data but can also simply iterate over all elements and * render them (as in the default template). * * @param $variables * An associative array containing the following key: * - book_menus * * @see book-all-books-block.tpl.php */ function template_preprocess_book_all_books_block(&$variables) { // Remove all non-renderable elements. $elements = $variables['book_menus']; $variables['book_menus'] = array(); foreach (element_children($elements) as $index) { $variables['book_menus'][$index] = $elements[$index]; } }
Page - 128
Project Report of Online Examination System /** * Processes variables for book-navigation.tpl.php. * * @param $variables * An associative array containing the following key: * - book_link * * @see book-navigation.tpl.php */ function template_preprocess_book_navigation(&$variables) { $book_link = $variables['book_link'];
// Provide extra variables for themers. Not needed by default. $variables['book_id'] = $book_link['bid']; $variables['book_title'] = check_plain($book_link['link_title']); $variables['book_url'] = 'node/' . $book_link['bid']; $variables['current_depth'] = $book_link['depth']; $variables['tree'] = '';
if ($book_link['mlid']) { $variables['tree'] = book_children($book_link);
if ($prev = book_prev($book_link)) { $prev_href = url($prev['href']); drupal_add_html_head_link(array('rel' => 'prev', 'href' => $prev_href));
Page - 129
Project Report of Online Examination System $variables['prev_url'] = $prev_href; $variables['prev_title'] = check_plain($prev['title']); }
if ($book_link['plid'] && $parent = book_link_load($book_link['plid'])) { $parent_href = url($parent['href']); drupal_add_html_head_link(array('rel' => 'up', 'href' => $parent_href)); $variables['parent_url'] = $parent_href; $variables['parent_title'] = check_plain($parent['title']); }
if ($next = book_next($book_link)) { $next_href = url($next['href']); drupal_add_html_head_link(array('rel' => 'next', 'href' => $next_href)); $variables['next_url'] = $next_href; $variables['next_title'] = check_plain($next['title']); } }
$variables['has_links'] = FALSE; // Link variables to filter for values and set state of the flag variable. $links = array('prev_url', 'prev_title', 'parent_url', 'parent_title', 'next_url', 'next_title'); foreach ($links as $link) { if (isset($variables[$link])) { // Flag when there is a value.
Page - 130
Project Report of Online Examination System $variables['has_links'] = TRUE; } else { // Set empty to prevent notices. $variables[$link] = ''; } } }
/** * Recursively processes and formats menu items for book_toc(). * * This helper function recursively modifies the table of contents array for * each item in the menu tree, ignoring items in the exclude array or at a depth * greater than the limit. Truncates titles over thirty characters and appends * an indentation string incremented by depth. * * @param $tree * The data structure of the book's menu tree. Includes hidden links. * @param $indent * A string appended to each menu item title. Increments by '--' per depth * level. * @param $toc * Reference to the table of contents array. This is modified in place, so the * function does not have a return value.
Page - 131
Project Report of Online Examination System * @param $exclude * (optional) An array of menu link ID values. Any link whose menu link ID is * in this array will be excluded (along with its children). Defaults to an * empty array. * @param $depth_limit * Any link deeper than this value will be excluded (along with its children). */ function _book_toc_recurse($tree, $indent, &$toc, $exclude, $depth_limit) { foreach ($tree as $data) { if ($data['link']['depth'] > $depth_limit) { // Don't iterate through any links on this level. break; }
if (!in_array($data['link']['mlid'], $exclude)) { $toc[$data['link']['mlid']] = $indent . ' ' . truncate_utf8($data['link']['title'], 30, TRUE, TRUE); if ($data['below']) { _book_toc_recurse($data['below'], $indent . '--', $toc, $exclude, $depth_limit); } } } }
/** * Returns an array of book pages in table of contents order.
Page - 132
Project Report of Online Examination System * * @param $bid * The ID of the book whose pages are to be listed. * @param $depth_limit * Any link deeper than this value will be excluded (along with its children). * @param $exclude * Optional array of menu link ID values. Any link whose menu link ID is in * this array will be excluded (along with its children). * * @return * An array of (menu link ID, title) pairs for use as options for selecting a * book page. */ function book_toc($bid, $depth_limit, $exclude = array()) { $tree = menu_tree_all_data(book_menu_name($bid)); $toc = array(); _book_toc_recurse($tree, '', $toc, $exclude, $depth_limit);
return $toc; }
/** * Processes variables for book-export-html.tpl.php. * * @param $variables
Page - 133
Project Report of Online Examination System * An associative array containing the following keys: * - title * - contents * - depth * * @see book-export-html.tpl.php */ function template_preprocess_book_export_html(&$variables) { global $base_url, $language;
$variables['title'] = check_plain($variables['title']); $variables['base_url'] = $base_url; $variables['language'] = $language; $variables['language_rtl'] = ($language->direction == LANGUAGE_RTL); $variables['head'] = drupal_get_html_head(); $variables['dir'] = $language->direction ? 'rtl' : 'ltr'; }
/** * Traverses the book tree to build printable or exportable output. * * During the traversal, the $visit_func() callback is applied to each node and * is called recursively for each child of the node (in weight, title order). * * @param $tree
Page - 134
Project Report of Online Examination System * A subtree of the book menu hierarchy, rooted at the current page. * @param $visit_func * A function callback to be called upon visiting a node in the tree. * * @return * The output generated in visiting each node. */ function book_export_traverse($tree, $visit_func) { $output = '';
foreach ($tree as $data) { // Note- access checking is already performed when building the tree. if ($node = node_load($data['link']['nid'], FALSE)) { $children = '';
if ($data['below']) { $children = book_export_traverse($data['below'], $visit_func); }
if (function_exists($visit_func)) { $output .= call_user_func($visit_func, $node, $children); } else { // Use the default function. $output .= book_node_export($node, $children);
Page - 135
Project Report of Online Examination System } } }
return $output; }
/** * Generates printer-friendly HTML for a node. * * @param $node * The node that will be output. * @param $children * (optional) All the rendered child nodes within the current node. Defaults * to an empty string. * * @return * The HTML generated for the given node. * * @see book_export_traverse() */ function book_node_export($node, $children = '') { $build = node_view($node, 'print'); unset($build['#theme']); // @todo Rendering should happen in the template using render().
Page - 136
Project Report of Online Examination System $node->rendered = drupal_render($build);
return theme('book_node_export_html', array('node' => $node, 'children' => $children)); }
/** * Processes variables for book-node-export-html.tpl.php. * * @param $variables * An associative array containing the following keys: * - node * - children * * @see book-node-export-html.tpl.php */ function template_preprocess_book_node_export_html(&$variables) { $variables['depth'] = $variables['node']->book['depth']; $variables['title'] = check_plain($variables['node']->title); $variables['content'] = $variables['node']->rendered; }
/** * Determine if a given node type is in the list of types allowed for books. * * @param $type
Page - 137
Project Report of Online Examination System * A node type. * * @return * A Boolean TRUE if the node type can be included in books; otherwise, FALSE. */ function book_type_is_allowed($type) { return in_array($type, variable_get('book_allowed_types', array('book'))); }
/** * Implements hook_node_type_update(). * * Updates the Book module's persistent variables if the machine-readable name * of a node type is changed. */ function book_node_type_update($type) { if (!empty($type->old_type) && $type->old_type != $type->type) { // Update the list of node types that are allowed to be added to books. $allowed_types = variable_get('book_allowed_types', array('book')); $key = array_search($type->old_type, $allowed_types);
if ($key !== FALSE) { $allowed_types[$type->type] = $allowed_types[$key] ? $type->type : 0; unset($allowed_types[$key]); variable_set('book_allowed_types', $allowed_types);
Page - 138
Project Report of Online Examination System }
// Update the setting for the "Add child page" link. if (variable_get('book_child_type', 'book') == $type->old_type) { variable_set('book_child_type', $type->type); } } }
/** * Gets a book menu link by its menu link ID. * * Like menu_link_load(), but adds additional data from the {book} table. * * Do not call when loading a node, since this function may call node_load(). * * @param $mlid * The menu link ID of the menu item. * * @return * A menu link, with the link translated for rendering and data added from the * {book} table. FALSE if there is an error. */ function book_link_load($mlid) { if ($item = db_query("SELECT * FROM {menu_links} ml INNER JOIN {book} b ON b.mlid = ml.mlid LEFT JOIN {menu_router} m ON m.path = ml.router_path WHERE ml.mlid = :mlid", array(
Page - 139
Project Report of Online Examination System ':mlid' => $mlid, ))->fetchAssoc()) { _menu_link_translate($item); return $item; }
return FALSE; }
/** * Gets the data representing a subtree of the book hierarchy. * * The root of the subtree will be the link passed as a parameter, so the * returned tree will contain this item and all its descendents in the menu * tree. * * @param $link * A fully loaded menu link. * * @return * A subtree of menu links in an array, in the order they should be rendered. */ function book_menu_subtree_data($link) { $tree = &drupal_static(__FUNCTION__, array());
Page - 140
Project Report of Online Examination System // Generate a cache ID (cid) specific for this $menu_name and $link. $cid = 'links:' . $link['menu_name'] . ':subtree-cid:' . $link['mlid'];
if (!isset($tree[$cid])) { $cache = cache_get($cid, 'cache_menu');
if ($cache && isset($cache->data)) { // If the cache entry exists, it will just be the cid for the actual data. // This avoids duplication of large amounts of data. $cache = cache_get($cache->data, 'cache_menu');
if ($cache && isset($cache->data)) { $data = $cache->data; } }
// If the subtree data was not in the cache, $data will be NULL. if (!isset($data)) { $query = db_select('menu_links', 'ml', array('fetch' => PDO::FETCH_ASSOC)); $query->join('menu_router', 'm', 'm.path = ml.router_path'); $query->join('book', 'b', 'ml.mlid = b.mlid'); $query->fields('b'); $query->fields('m', array('load_functions', 'to_arg_functions', 'access_callback', 'access_arguments', 'page_callback', 'page_arguments', 'delivery_callback', 'title', 'title_callback', 'title_arguments', 'type')); $query->fields('ml'); $query->condition('menu_name', $link['menu_name']);
Page - 141
Project Report of Online Examination System for ($i = 1; $i <= MENU_MAX_DEPTH && $link["p$i"]; ++$i) { $query->condition("p$i", $link["p$i"]); } for ($i = 1; $i <= MENU_MAX_DEPTH; ++$i) { $query->orderBy("p$i"); } $links = array(); foreach ($query->execute() as $item) { $links[] = $item; } $data['tree'] = menu_tree_data($links, array(), $link['depth']); $data['node_links'] = array(); menu_tree_collect_node_links($data['tree'], $data['node_links']); // Compute the real cid for book subtree data. $tree_cid = 'links:' . $item['menu_name'] . ':subtree-data:' . hash('sha256', serialize($data)); // Cache the data, if it is not already in the cache.
if (!cache_get($tree_cid, 'cache_menu')) { cache_set($tree_cid, $data, 'cache_menu'); } // Cache the cid of the (shared) data using the menu and item-specific cid. cache_set($cid, $tree_cid, 'cache_menu'); } // Check access for the current user to each item in the tree. menu_tree_check_access($data['tree'], $data['node_links']);
Page - 142
Project Report of Online Examination System $tree[$cid] = $data['tree']; }
return $tree[$cid]; }
Page - 143
Project Report of Online Examination System
/** * Implements hook_help(). */ function dashboard_help($path, $arg) { switch ($path) { case 'admin/help#dashboard': $output = ''; $output .= '' . t('About') . '
'; $output .= '' . t('The Dashboard module provides a Dashboard page in the administrative interface for organizing administrative tasks and navigation, and tracking information within your site. The Dashboard page contains blocks, which you can add to and arrange using the drag-and-drop interface that appears when you click on the Customize dashboard link. Within this interface, blocks that are not primarily used for site administration do not appear by default, but can be added via the Add other blocks link. For more information, see the online handbook entry for Dashboard module.', array('@handbook' => 'http://drupal.org/documentation/modules/dashboard', '@dashboard' => url('admin/dashboard'))) . '
'; $output .= '' . t('Uses') . '
'; $output .= ''; $output .= '- ' . t('Tracking user activity') . '
'; $output .= '- ' . t("By enabling blocks such as Who's online and Who's new, site users can track who is logged in and new user signups at a centralized location.") . '
';
Page - 144
Project Report of Online Examination System $output .= '- ' . t('Tracking content activity') . '
'; $output .= '- ' . t('By enabling blocks such as Recent blog posts, New forum topics and Recent comments, site users can view newly added site content at a glance.') . '
'; $output .= '
'; return $output;
case 'admin/dashboard/configure': // @todo This assumes the current page is being displayed using the same // theme that the dashboard is displayed in. $output = '' . t('Rearrange blocks for display on the Dashboard page. Blocks placed in the Dashboard (inactive) region are not displayed when viewing the Dashboard page, but are available within its Customize dashboard interface. Removing a block from active dashboard display makes it available on the main blocks administration page.', array('@dashboard-url' => url('admin/dashboard'), '@blocks-url' => url("admin/structure/block/list/{$GLOBALS['theme_key']}"))) . '
'; return $output; } }
/** * Implements hook_menu(). */ function dashboard_menu() { $items['admin/dashboard'] = array( 'title' => 'Dashboard', 'description' => 'View and customize your dashboard.', 'page callback' => 'dashboard_admin',
Page - 145
Project Report of Online Examination System 'access arguments' => array('access dashboard'), // Make this appear first, so for example, in admin menus, it shows up on // the top corner of the window as a convenient "home link". 'weight' => -15, ); $items['admin/dashboard/configure'] = array( 'title' => 'Configure available dashboard blocks', 'description' => 'Configure which blocks can be shown on the dashboard.', 'page callback' => 'dashboard_admin_blocks', 'access arguments' => array('administer blocks'), 'type' => MENU_VISIBLE_IN_BREADCRUMB, ); $items['admin/dashboard/customize'] = array( 'title' => 'Customize dashboard', 'description' => 'Customize your dashboard.', 'page callback' => 'dashboard_admin', 'page arguments' => array(TRUE), 'access arguments' => array('access dashboard'), 'type' => MENU_VISIBLE_IN_BREADCRUMB, ); $items['admin/dashboard/drawer'] = array( 'page callback' => 'dashboard_show_disabled', 'access arguments' => array('administer blocks'), 'type' => MENU_CALLBACK, );
Page - 146
Project Report of Online Examination System $items['admin/dashboard/block-content/%/%'] = array( 'page callback' => 'dashboard_show_block_content', 'page arguments' => array(3, 4), 'access arguments' => array('administer blocks'), 'type' => MENU_CALLBACK, ); $items['admin/dashboard/update'] = array( 'page callback' => 'dashboard_update', 'access arguments' => array('administer blocks'), 'type' => MENU_CALLBACK, );
return $items; }
/** * Implements hook_permission(). */ function dashboard_permission() { return array( 'access dashboard' => array( 'title' => t('View the administrative dashboard'), // Note: We translate the 'Administer blocks' permission string here with // a separate t() call, to make sure it gets the same translation as when // it's in block_permission().
Page - 147
Project Report of Online Examination System 'description' => t('Customizing the dashboard requires the !permission-name permission.', array( '!permission-name' => l(t('Administer blocks'), 'admin/people/permissions', array('fragment' => 'module-block')), )), ), ); }
/** * Implements hook_block_info_alter(). */ function dashboard_block_info_alter(&$blocks, $theme, $code_blocks) { $admin_theme = variable_get('admin_theme'); if (($admin_theme && $theme == $admin_theme) || (!$admin_theme && $theme == variable_get('theme_default', 'bartik'))) { foreach ($blocks as $module => &$module_blocks) { foreach ($module_blocks as $delta => &$block) { // Make administrative blocks that are not already in use elsewhere // available for the dashboard. if (empty($block['status']) && (empty($block['region']) || $block['region'] == BLOCK_REGION_NONE) && !empty($code_blocks[$module][$delta]['properties']['administrative'])) { $block['status'] = 1; $block['region'] = 'dashboard_inactive'; } } } }
Page - 148
Project Report of Online Examination System }
/** * Implements hook_block_list_alter(). * * Skip rendering dashboard blocks when not on the dashboard page itself. This * prevents expensive dashboard blocks from causing performance issues on pages * where they will never be displayed. */ function dashboard_block_list_alter(&$blocks) { if (!dashboard_is_visible()) { foreach ($blocks as $key => $block) { if (in_array($block->region, dashboard_regions())) { unset($blocks[$key]); } } } }
/** * Implements hook_page_build(). * * Display dashboard blocks in the main content region. */ function dashboard_page_build(&$page) {
Page - 149
Project Report of Online Examination System global $theme_key;
if (dashboard_is_visible()) { $block_info = array();
// Create a wrapper for the dashboard itself, then insert each dashboard // region into it. $page['content']['dashboard'] = array('#theme_wrappers' => array('dashboard')); foreach (dashboard_regions() as $region) { // Do not show dashboard blocks that are disabled. if ($region == 'dashboard_inactive') { continue; } // Insert regions even when they are empty, so that they will be // displayed when the dashboard is being configured. $page['content']['dashboard'][$region] = !empty($page[$region]) ? $page[$region] : array(); $page['content']['dashboard'][$region]['#dashboard_region'] = $region; // Allow each dashboard region to be themed differently, or fall back on // the generic theme wrapper function for dashboard regions. $page['content']['dashboard'][$region]['#theme_wrappers'][] = array($region, 'dashboard_region'); unset($page[$region]); $blocks_found = array(); foreach ($page['content']['dashboard'][$region] as $item) { if (isset($item['#theme_wrappers']) && is_array($item['#theme_wrappers']) && in_array('block', $item['#theme_wrappers'])) { // If this item is a block, ensure it has a subject.
Page - 150
Project Report of Online Examination System if (empty($item['#block']->subject)) { // Locally cache info data for the object for all blocks, in case // we find a block similarly missing title from the same module. if (!isset($block_info[$item['#block']->module])) { $block_info[$item['#block']->module] = module_invoke($item['#block']->module, 'block_info'); } $item['#block']->subject = $block_info[$item['#block']->module][$item['#block']->delta]['info']; } $blocks_found[$item['#block']->module . '_' . $item['#block']->delta] = TRUE; } }
// Find blocks which were not yet displayed on the page (were empty), and // add placeholder items in their place for rendering. $block_list = db_select('block') ->condition('theme', $theme_key) ->condition('status', 1) ->condition('region', $region) ->fields('block') ->execute(); foreach ($block_list as $block) { if (!isset($blocks_found[$block->module . '_' . $block->delta])) { $block->enabled = $block->page_match = TRUE; $block->content = array('#markup' => '(empty)
'); if (!isset($block_info[$block->module])) {
Page - 151
Project Report of Online Examination System $block_info[$block->module] = module_invoke($block->module, 'block_info'); } $block->subject = t('@title', array('@title' => $block_info[$block->module][$block->delta]['info'])); $block_render = array($block->module . '_' . $block->delta => $block); $build = _block_get_renderable_array($block_render); $page['content']['dashboard'][$block->region][] = $build; } } } } }
/** * Implements hook_system_info_alter(). * * Add regions to each theme to store the dashboard blocks. */ function dashboard_system_info_alter(&$info, $file, $type) { if ($type == 'theme') { // Add the dashboard regions (the "inactive" region should always appear // last in the list, for usability reasons). $dashboard_regions = dashboard_region_descriptions(); if (isset($dashboard_regions['dashboard_inactive'])) { $inactive_region = $dashboard_regions['dashboard_inactive']; unset($dashboard_regions['dashboard_inactive']);
Page - 152
Project Report of Online Examination System $dashboard_regions['dashboard_inactive'] = $inactive_region; } $info['regions'] += $dashboard_regions; // Indicate that these regions are intended to be displayed whenever the // dashboard is displayed in an overlay. This information is provided for // any module that might need to use it, not just the core Overlay module. $info['overlay_regions'] = !empty($info['overlay_regions']) ? array_merge($info['overlay_regions'], dashboard_regions()) : dashboard_regions(); } }
/** * Implements hook_theme(). */ function dashboard_theme() { return array( 'dashboard' => array( 'render element' => 'element', ), 'dashboard_admin' => array( 'render element' => 'element', ), 'dashboard_region' => array( 'render element' => 'element', ), 'dashboard_disabled_blocks' => array(
Page - 153
Project Report of Online Examination System 'variables' => array('blocks' => NULL), ), 'dashboard_disabled_block' => array( 'variables' => array('block' => NULL), ), 'dashboard_admin_display_form' => array( // When building the form for configuring dashboard blocks, reuse the // Block module's template for the main block configuration form. 'template' => 'block-admin-display-form', 'path' => drupal_get_path('module', 'block'), 'file' => 'block.admin.inc', 'render element' => 'form', ), ); }
/** * Implements hook_forms(). */ function dashboard_forms() { // Reroute the dashboard configuration form to the main blocks administration // form. This allows us to distinguish them by form ID in hook_form_alter(). $forms['dashboard_admin_display_form'] = array( 'callback' => 'block_admin_display_form', );
Page - 154
Project Report of Online Examination System
return $forms; }
/** * Page callback: Displays the dashboard. * * @param $launch_customize * Whether to launch in customization mode right away. TRUE or FALSE. */ function dashboard_admin($launch_customize = FALSE) { $js_settings = array( 'dashboard' => array( 'drawer' => url('admin/dashboard/drawer'), 'blockContent' => url('admin/dashboard/block-content'), 'updatePath' => url('admin/dashboard/update'), 'formToken' => drupal_get_token('dashboard-update'), 'launchCustomize' => $launch_customize, 'dashboard' => url('admin/dashboard'), 'emptyBlockText' => t('(empty)'), 'emptyRegionTextInactive' => t('This dashboard region is empty. Click Customize dashboard to add blocks to it.'), 'emptyRegionTextActive' => t('DRAG HERE'), ), ); $build = array(
Page - 155
Project Report of Online Examination System '#theme' => 'dashboard_admin', '#message' => t('To customize the dashboard page, move blocks to the dashboard regions on the Dashboard administration page, or enable JavaScript on this page to use the drag-and-drop interface.', array('@dashboard' => url('admin/dashboard/configure'))), '#access' => user_access('administer blocks'), '#attached' => array( 'js' => array( drupal_get_path('module', 'dashboard') . '/dashboard.js', array('data' => $js_settings, 'type' => 'setting'), ), 'library' => array(array('system', 'ui.sortable')), ), ); return $build; }
/** * Page callback: Builds the page for administering dashboard blocks. * * This page reuses the Block module's administration form but limits editing * to blocks that are available to appear on the dashboard. * * @see block_admin_display() * @see block_admin_display_form() * @see dashboard_form_dashboard_admin_display_form_alter() * @see template_preprocess_dashboard_admin_display_form()
Page - 156
Project Report of Online Examination System */ function dashboard_admin_blocks() { global $theme_key; drupal_theme_initialize(); module_load_include('inc', 'block', 'block.admin');
// Prepare the blocks for the current theme, and remove those that are // currently displayed in non-dashboard regions. // @todo This assumes the current page is being displayed using the same // theme that the dashboard is displayed in. $blocks = block_admin_display_prepare_blocks($theme_key); $dashboard_regions = dashboard_region_descriptions(); $regions_to_remove = array_diff_key(system_region_list($theme_key, REGIONS_VISIBLE), $dashboard_regions); foreach ($blocks as $id => $block) { if (isset($regions_to_remove[$block['region']])) { unset($blocks[$id]); } }
// Pass in the above blocks and dashboard regions to the form, so that only // dashboard-related regions will be displayed. return drupal_get_form('dashboard_admin_display_form', $blocks, $theme_key, $dashboard_regions); }
Page - 157
Project Report of Online Examination System /** * Implements hook_form_FORM_ID_alter(). */ function dashboard_form_block_admin_display_form_alter(&$form, &$form_state, $form_id) { // Hide dashboard regions (and any blocks placed within them) from the block // administration form and from the options list on that form. This // function is called for both the dashboard block configuration form and the // standard block configuration form so that both forms can share the same // constructor. As a result the form_id must be checked. if ($form_id != 'dashboard_admin_display_form') { $dashboard_regions = dashboard_region_descriptions(); $form['block_regions']['#value'] = array_diff_key($form['block_regions']['#value'], $dashboard_regions); foreach (element_children($form['blocks']) as $i) { $block = &$form['blocks'][$i]; if (isset($block['region']['#default_value']) && isset($dashboard_regions[$block['region']['#default_value']]) && $block['region']['#default_value'] != 'dashboard_inactive') { $block['#access'] = FALSE; } elseif (isset($block['region']['#options'])) { $block['region']['#options'] = array_diff_key($block['region']['#options'], $dashboard_regions); } // Show inactive dashboard blocks as disabled on the main block // administration form, so that they are available to place in other // regions of the theme. Note that when the form is submitted, any such // blocks which still remain disabled will immediately be put back in the
Page - 158
Project Report of Online Examination System // 'dashboard_inactive' region, because dashboard_block_info_alter() is // called when the blocks are rehashed. Fortunately, this is the exact // behavior we want. if ($block['region']['#default_value'] == 'dashboard_inactive') { // @todo These do not wind up in correct alphabetical order. $block['region']['#default_value'] = NULL; } } } }
/** * Implements hook_form_FORM_ID_alter(). */ function dashboard_form_dashboard_admin_display_form_alter(&$form, &$form_state) { // Redirect the 'configure' and 'delete' links on each block back to the // dashboard blocks administration page. foreach ($form['blocks'] as &$block) { if (isset($block['configure']['#href'])) { $block['configure']['#options']['query']['destination'] = 'admin/dashboard/configure'; } if (isset($block['delete']['#href'])) { $block['delete']['#options']['query']['destination'] = 'admin/dashboard/configure'; } }
Page - 159
Project Report of Online Examination System }
/** * Implements hook_form_FORM_ID_alter(). */ function dashboard_form_block_admin_configure_alter(&$form, &$form_state) { global $theme_key; drupal_theme_initialize(); // Hide the dashboard regions from the region select list on the block // configuration form, for all themes except the current theme (since the // other themes do not display the dashboard). // @todo This assumes the current page is being displayed using the same // theme that the dashboard is displayed in. $dashboard_regions = dashboard_region_descriptions(); foreach (element_children($form['regions']) as $region_name) { $region = &$form['regions'][$region_name]; if ($region_name != $theme_key && isset($region['#options'])) { $region['#options'] = array_diff_key($region['#options'], $dashboard_regions); } } }
/** * Implements hook_form_FORM_ID_alter(). */
Page - 160
Project Report of Online Examination System function dashboard_form_block_add_block_form_alter(&$form, &$form_state) { dashboard_form_block_admin_configure_alter($form, $form_state); }
/** * Preprocesses variables for block-admin-display-form.tpl.php. */ function template_preprocess_dashboard_admin_display_form(&$variables) { template_preprocess_block_admin_display_form($variables); if (isset($variables['block_regions'][BLOCK_REGION_NONE])) { $variables['block_regions'][BLOCK_REGION_NONE] = t('Other blocks'); } }
/** * Determines if the dashboard should be displayed on the current page. * * This function checks if the user is currently viewing the dashboard and has * access to see it. It is used by other functions in the dashboard module to * decide whether or not the dashboard content should be displayed to the * current user. * * Although the menu system normally handles the above tasks, it only does so * for the main page content. However, the dashboard is not part of the main * page content, but rather is displayed in special regions of the page (so it
Page - 161
Project Report of Online Examination System * can interface with the Block module's method of managing page regions). We * therefore need to maintain this separate function to check the menu item for * us. * * @return * TRUE if the dashboard should be visible on the current page, FALSE * otherwise. * * @see dashboard_block_list_alter() * @see dashboard_page_build() */ function dashboard_is_visible() { static $is_visible; if (!isset($is_visible)) { // If the current menu item represents the page on which we want to display // the dashboard, and if the current user has access to see it, return // TRUE. $menu_item = menu_get_item(); $is_visible = isset($menu_item['page_callback']) && $menu_item['page_callback'] == 'dashboard_admin' && !empty($menu_item['access']); } return $is_visible; }
/** * Returns an array of dashboard region descriptions, keyed by region name.
Page - 162
Project Report of Online Examination System */ function dashboard_region_descriptions() { $regions = module_invoke_all('dashboard_regions'); drupal_alter('dashboard_regions', $regions); return $regions; }
/** * Returns an array of dashboard region names. */ function dashboard_regions() { $regions = &drupal_static(__FUNCTION__); if (!isset($regions)) { $regions = array_keys(dashboard_region_descriptions()); } return $regions; }
/** * Implements hook_dashboard_regions(). */ function dashboard_dashboard_regions() { return array( 'dashboard_main' => 'Dashboard (main)', 'dashboard_sidebar' => 'Dashboard (sidebar)',
Page - 163
Project Report of Online Examination System 'dashboard_inactive' => 'Dashboard (inactive)', ); }
/** * Ajax callback: Shows disabled blocks in the dashboard customization mode. */ function dashboard_show_disabled() { global $theme_key;
// Blocks are not necessarily initialized at this point. $blocks = _block_rehash();
// Limit the list to blocks that are marked as disabled for the dashboard. foreach ($blocks as $key => $block) { if ($block['theme'] != $theme_key || $block['region'] != 'dashboard_inactive') { unset($blocks[$key]); } }
// Theme the output and end the page request. print theme('dashboard_disabled_blocks', array('blocks' => $blocks)); drupal_exit(); }
Page - 164
Project Report of Online Examination System /** * Ajax callback: Displays the rendered contents of a specific block. * * @param $module * The block's module name. * @param $delta * The block's delta. */ function dashboard_show_block_content($module, $delta) { drupal_theme_initialize(); global $theme_key;
$blocks = array(); $block_object = db_query("SELECT * FROM {block} WHERE theme = :theme AND module = :module AND delta = :delta", array( ":theme" => $theme_key, ":module" => $module, ":delta" => $delta, )) ->fetchObject(); $block_object->enabled = $block_object->page_match = TRUE; $blocks[$module . "_" . $delta] = $block_object; $block_content = _block_render_blocks($blocks); $build = _block_get_renderable_array($block_content); $rendered_block = drupal_render($build); print $rendered_block;
Page - 165
Project Report of Online Examination System drupal_exit(); }
/** * Sets the new weight of each region according to the drag-and-drop order. */ function dashboard_update() { drupal_theme_initialize(); global $theme_key; // Check the form token to make sure we have a valid request. if (!empty($_REQUEST['form_token']) && drupal_valid_token($_REQUEST['form_token'], 'dashboardupdate')) { parse_str($_REQUEST['regions'], $regions); foreach ($regions as $region_name => $blocks) { if ($region_name == 'disabled_blocks') { $region_name = 'dashboard_inactive'; } foreach ($blocks as $weight => $block_string) { // Parse the query string to determine the block's module and delta. preg_match('/block-([^-]+)-(.+)/', $block_string, $matches); $block = new stdClass(); $block->module = $matches[1]; $block->delta = $matches[2];
$block->region = $region_name; $block->weight = $weight;
Page - 166
Project Report of Online Examination System $block->status = 1;
db_merge('block') ->key(array( 'module' => $block->module, 'delta' => $block->delta, 'theme' => $theme_key, )) ->fields(array( 'status' => $block->status, 'weight' => $block->weight, 'region' => $block->region, 'pages' => '', )) ->execute(); } } drupal_set_message(t('The configuration options have been saved.'), 'status', FALSE); } drupal_exit(); }
/** * Returns HTML for the entire dashboard. *
Page - 167
Project Report of Online Examination System * @param $variables * An associative array containing: * - element: A render element containing the properties of the dashboard *
region element, #dashboard_region and #children.
* * @ingroup themeable */ function theme_dashboard($variables) { extract($variables); drupal_add_css(drupal_get_path('module', 'dashboard') . '/dashboard.css'); return '' . $element['#children'] . '
'; }
/** * Returns HTML for the non-customizable part of the dashboard page. * * @param $variables * An associative array containing: * - element: A render element containing a #message. * * @ingroup themeable */ function theme_dashboard_admin($variables) { // We only return a simple help message, since the actual content of the page // will be populated via the dashboard regions in dashboard_page_build().
Page - 168
Project Report of Online Examination System return '' . $variables['element']['#message'] . '
'; }
/** * Returns HTML for a generic dashboard region. * * @param $variables * An associative array containing: * - element: A render element containing the properties of the dashboard *
region element, #dashboard_region and #children.
* * @ingroup themeable */ function theme_dashboard_region($variables) { extract($variables); $output = ''; $output .= '
'; $output .= $element['#children']; // Closing div.region $output .= '
'; // Closing div.dashboard-region $output .= '
'; return $output; }
Page - 169
Project Report of Online Examination System /** * Returns HTML for disabled blocks, for use in dashboard customization mode. * * @param $variables * An associative array containing: * - blocks: An array of block objects from _block_rehash(). * * @ingroup themeable */ function theme_dashboard_disabled_blocks($variables) { extract($variables); $output = '' . t('Drag and drop these blocks to the columns below. Changes are automatically saved. More options are available on the configuration page.', array('@dashboard-url' => url('admin/dashboard/configure'))) . '
'; $output .= '
'; foreach ($blocks as $block) { $output .= theme('dashboard_disabled_block', array('block' => $block)); } $output .= '
'; $output .= '
' . l(t('Add other blocks'), 'admin/dashboard/configure') . '
'; $output .= '
'; return $output; }
/** * Returns HTML for disabled blocks, for use in dashboard customization mode.
Page - 170
Project Report of Online Examination System * * @param $variables * An associative array containing: * - block: A block object from _block_rehash(). * * @ingroup themeable */ function theme_dashboard_disabled_block($variables) { extract($variables); $output = ""; if (isset($block)) { $output .= '' . '
' . (!empty($block['title']) && $block['title'] != '' ? check_plain($block['title']) : check_plain($block['info'])) . '
' . '
' . '
'; } return $output; }
Page - 171
Project Report of Online Examination System Conclusion of the Project Online Examination System: Our project is only a humble venture to satisfy the needs to manage their project work. Several user friendly coding have also adopted. This package shall prove to be a powerful package in satisfying all the requirements of the school. The objective of software planning is to provide a frame work that enables the manger to make reasonable estimates made within a limited time frame at the beginning of the software project and should be updated regularly as the project progresses. At the end it is concluded that we have made effort on following points…
A description of the background and context of the project and its relation to work already done in the area.
Made statement of the aims and objectives of the project.
The description of Purpose, Scope, and applicability.
We define the problem on which we are working in the project.
We describe the requirement Specifications of the system and the actions that can be done on these things.
We understand the problem domain and produce a model of the system, which describes operations that can be performed on the system.
We included features and operations in detail, including screen layouts.
We designed user interface and security issues related to system.
Finally the system is implemented and tested according to test cases.
Page - 172
Project Report of Online Examination System Future Scope of the Project: In a nutshell, it can be summarized that the future scope of the project circles around maintaining information regarding:
We can add printer in future.
We can give more advance software for Online Examination System including more facilities
We will host the platform on online servers to make it accessible worldwide
Integrate multiple load balancers to distribute the loads of the system
Create the master and slave database structure to reduce the overload of the database queries
Implement the backup mechanism for taking backup of codebase and database on regular basis on different servers
The above mentioned points are the enhancements which can be done to increase the applicability and usage of this project. Here we can
maintain the records of Exam
and Long Question. Also, as it can be seen that now-a-days the players are versatile, i.e. so there is a scope for introducing a method to maintain the Online Examination System. Enhancements can be done to maintain all the Exam, Long Question, Short Question, True-False Question, Matching Question.
We have left all the options open so that if there is any other future requirement in the system by the user for the enhancement of the system then it is possible to implement them.In the last we would like to thanks all the persons involved in the development of the system directly or indirectly. We hope that the project will serve its purpose for which it is develop there by underlining success of process.
Page - 173
Project Report of Online Examination System Limitation of Project on Online Examination System Although I have put my best efforts to make the software flexible, easy to operate but limitations cannot be ruled out even by me. Though the software presents a broad range of options to its users some intricate options could not be covered into it; partly because of logistic and partly due to lack of sophistication. Paucity of time was also major constraint, thus it was not possible to make the software foolproof and dynamic. Lack of time also compelled me to ignore some part such as storing old result of the candidate etc. Considerable efforts have made the software easy to operate even for the people not related to the field of computers but it is acknowledged that a layman may find it a bit problematic at the first instance. The user is provided help at each step for his convenience in working with the software. List of limitations which is available in the Online Examination System:
Excel export has not been developed for Exam, Long Question due to some criticality.
The transactions are executed in off-line mode, hence on-line data for Short Question, True-False Question capture and modification is not possible.
Off-line reports of Exam, Matching Question, Short Question cannot be generated due to batch mode execution.
Page - 174
Project Report of Online Examination System References and Bibliography:
Google for problem solving
http://www.javaworld.com/javaworld/jw-01-1998/jw-01-Credentialreview.html
Database Programming with JDBC and Java by O'Reilly
Head First Java 2nd Edition
http://www.jdbc-tutorial.com/
Java and Software Design Concepts by Apress
https://www.tutorialspoint.com/java/
http://www.javatpoint.com/java-tutorial
https://docs.oracle.com/javase/tutorial/
http://www.wampserver.com/en/
http://www.JSP.net/
http://www.tutorialspoint.com/mysql/
httpd.apache.org/docs/2.0/misc/tutorials.html
Page - 175