Courier Management System
Title of the Project
- (1) -
Courier Management System
Introduction to Purpose System (Courier Management System) This Courier Management System Project will have different modules. The login section will have login facility for the admin and for the user who will operate this system. While taking orders from its customers, it will take all the details of its customers who is placing the orders and all the details for the recipient such as its address, name, mobile number. During billing process system will generate a tracking id for their products. Through this tracking id, customers or its recipient will able to track their products from any location using internet. It will provide status of the product after placing orders within 1 minute. This Courier Management System Project will provide information recipient with following details:- where the current consignment is, till when it will reached its final destination, if any delay then reason of the delay, the route of current consignment, date of placing consignment, final date to reach its destination. When the consignment will visit to the city office of destination, a message will be send to the recipient with delivery status confirmation. Then after getting this message its recipient can take its parcels by using their Track Id. When its recipient will receive their parcels, then this Track Id will be deleted automatically from the system database after 1 week by sending final confirmation message to its recipient mobile number which will include information of Track Id, date of receiving and time along with greeting message for providing further service in future. In modern age, as time increase, needs & requirements of the person are also increased. They want more facility & try to do their task quickly & within time. But they can not get all the things at nearest market or area, so they have to import the things from any place in the world. Within the country, the things can be imported through post service. But it consumes the time & sometimes problem of damage or missing occur. Where as in the international market, the one way is shipping. But it also requires more time.
- (2) -
Courier Management System
The courier service is one of the solutions of these problems. It is used to send some things to any person in the world within time. The courier company has number of branches, which are spread over the country or the world. So that when person wants to send things then he has to contact at nearest courier service branch. The courier company creates the schedule & gives internal/external services. The courier service work as destination office or source office. The source office branch receives the order means consignments & sends it to the destination courier branch. The company has certain rules according to the weight. Using the courier service person can easily send his/her parcel to other person in the particular destination within the time. Now days, 50% of companies of the world uses the services of various courier company.
- (3) -
Courier Management System Problem Definition: People when transfer their products using any courier service wants to know whether their product has been shifted to their right place or not, if not then by what time it will be shifted and where it is now. Taking all this information manually is very difficult and time taking process. To handle all these activities include various processes and paper work from the management side also.
Motivation behind this project: To gain maximum business region, customer demands good service. So to make more profit and gain maximum business region, their administration must also have a system to tackle all these problems on time. Its administration can take immediate orders and provide a receipt which will include all the details of the products along with appropriate price to their customers. Thus saving time and eliminating line making process.
- (4) -
Courier Management System Features of Purposed System: These are the important features of the project Courier Management System:
In computer system of the courier service computation of the rate is easily & quickly done.
Computer system of the courier service provide fast access.
If our documents or any consignment is missed then we can know it easily using the databases in the computer system of courier services.
Using this computerized system, bill issued procedure becomes fast.
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.
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.
- (5) -
Courier Management System Working of Existing System: This system will have different modules. The login section will have login facility for the admin and for the user who will operate this system. While taking orders from its customers, it will take all the details of its customers who is placing the orders and all the details for the recipient such as its address, name, mobile number. During billing process system will generate a tracking id for their products. Through this tracking id, customers or its recipient will able to track their products from any location using internet. It will provide status of the product after placing orders within 1 minute. This system will provide information recipient with following details:where the current consignment is, till when it will reached its final destination, if any delay then reason of the delay, the route of current consignment, date of placing consignment, final date to reach its destination. When the consignment will visit to the city office of destination, a message will be sended to the recipient with delivery status confirmation. Then after getting this message its recipient can take its parcels by using their Track Id. When its recipient will receive their parcels, then this Track Id will be deleted automatically from the system database after 1 week by sending final confirmation message to its recipient mobile number which will include information of Track Id, date of receiving and time along with greeting message for providing further service in future.
- (6) -
Courier Management System Feasibility Study: After doing the 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 Visual Basic 6.0 and MS Access. 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.
- (7) -
Courier Management System System Requirements: Software Requirement:
Apache Server 2.0
PHP Version 5.3 or above
MySQL Version 5.5 or above
Latest browser : Chorme, Firefox, Safari etc
Operating System : Any (Linux, Windows, Mac etc)
Hardware Requirements:
Processor Pentium IV or higher version.
Ram 128 MB or above
Hard Disk 150 MB or above
- (8) -
Courier Management System
Activity Diagram for Courier Management System
- (9) -
Courier Management System
Component Diagram for Courier Management System
- (10) -
Courier Management System
Dataflow Diagram for Courier Management System
- (11) -
Courier Management System
Class Diagram for Courier Management System
- (12) -
Courier Management System
Deployment Diagram for Courier Management System
- (13) -
Courier Management System
Entity Relationship Diagram for Courier Management System
- (14) -
Courier Management 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 objectrelational impedance mismatch in relational database, and XML databases.
- (15) -
Courier Management System
RDBMS Architecture Diagram Tools/Platform, Hardware and Software Requirement specifications: For setting this ecommerce portal, it requires certain technical requirements to be met for the store to operate properly. First, a web server must be created to make the ecommerce store publicly available on the web. Domain names and hosting services can easily be purchased for an affordable price. When selecting a hosting service, you should check to see that these server requirements are provided and installed on their web servers:
- (16) -
Courier Management System
Software Details for running E-Commerce Portal
Web Server (preferably Apache) PHP (at least 5.2) MySQL Curl
Required PHP libraries / modules
Curl ZIP Zlib GD Library Mcrypt Mbstrings
The above PHP extensions should be available by almost all hosting providers, during the install processa it will check you have them all enabled. You should contact your hosting provider if one is missing.
- (17) -
Courier Management 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
- (18) -
Courier Management System
SYSTEM ANALYSIS The analysis model is a concise, precise abstraction of what the desired system must do, and not how it will be done after the study of the existing system is completed. This basically includes
system
study
and
the
requirement
analysis.
Interacting with the clients regarding their requirements and expectations from the system does requirement analysis. The steps, which are essential for system analysis, are: 1. Research and define essential components. 2. Analyze current processes and identify gaps. 3. Interview users, Trainee, Trainers and other concerned personnel
regarding
essential
components
and
current
processes. 4. Write requirements document. 5. Define standards for standards, policies, and procedures. 6. Review draft requirements document with users, Trainee, Trainers and other concerned personnel. 7. Update and expand project plan.
- (19) -
Courier Management System
IDENTIFICATION OF NEED Online Library Management Systems described above can lead to error free, secure reliable and fast management system for library . It can assist the staff to concentrate on their related(for library) activities rather to concentrate on the records and reports of issuing
books,
registration
and
suppliers.
This
will
help
organization in better utilization of human resources. In this phase, the user identifies the need for a new or improved system. In large organizations this identification may be part of a systems planning process.
- (20) -
Courier Management System
PRELIMINARY INVESTIGATION 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 other benefits are improved service and faster and better access to up-to-date information. The Initial Cost The initial cost of setting up the system will include the cost of hardware
(server/clients,
network
adapter
and
related
hardware), software (server OS, add-on software, utilities) & labor (setup & maintenance). The same has to bear by the organization. Running Cost Besides, the initial cost the long term cost will include the running cost for the system including the AMC, book charges, cost for human resources, cost for update/renewal of various related software. Need for Training
- (21) -
Courier Management System
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.
Depending upon this definition, we analyzed the present Library Management System, during the analysis process; we had to go through the entire manual system that was being followed in the Organization for past few years. We talked to the management people who were managing a the financial issues of the center, 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. The manual system was very complex to be managed and searching or updating the information was also very difficult. There was a lengthy procedure for entering the details of books, members, visitors, and then making their timings and Bills.
- (22) -
Courier Management System
The other problem with the manual system was of report generation.
The
reports
to
be
generated
on
a
daily/weekly/monthly basis required lot of paper work and calculations etc. Thus, Reporting Manager had to manually calculate all the consultation fees of every player at the end of every day/week/month. Even a small calculation mistake was leading to reanalysis and recreation of whole work.
- (23) -
Courier Management System
FEASIBILITY STUDY At this stage, the analyst estimates the urgency of the project and estimates the development cost. In feasibility analysis, we have to study the following: 1) Technical Feasibility: Technical feasibility is concerned with the availability of hardware and software required for the development of the system, to see compatibility and maturity of the technology proposed to be used and to see the availability of the required technical manpower to develop the system. After the study we came to conclusion that we proceed further with the tools and development environment chosen by us. This was important in our case as we were working on two various phases of the department that will need to be integrated in future to make an extended system. 2) Operational Feasibility: Operational feasibility is all about problems that may arise during operations. There are two aspects related with this issue:
- (24) -
Courier Management System
What is the probability that the solution developed may not be put to use or may not work? What is the inclination of the management and end users towards the solution? Though, there is very least possibility of management being averse to the solution, there is a significant probability that the end users may not be interested in using the solution due to lack of training, insight etc. 3) Economic Feasibility: It is the measure of cost effectiveness of the project. The economic feasibility is nothing but judging whether the possible benefit of solving the problems is worthwhile of not. At the feasibility study level, it is impossible to estimate the cost
because
member’s
requirements
and
alternative
solutions have not been identified at this stage. However, when the specific requirements and solutions have been identified, the analyst weighs the cost and benefits of all solutions, this is called “cost benefit analysis.
- (25) -
Courier Management System
PROJECT PLANNING Software project plan can be viewed as the following: 1) Within the organisation: 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
- (26) -
Courier Management System
Project milestones and deliverables Budget allocation o Exceeding limits within control Project Estimates o Cost o Time o Size of code o Duration Resource Allocation o Hardware o Software o Previous relevant project information o Digital Library Risk Management o Risk avoidance o Risk detection
- (27) -
Courier Management 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 W
W
W
W
W
W
W
W
W
W
W
1
2
3
4
1
2
3
4
1
2
3
Wi‘s are weeks of the months, for i =1, 2, 3, 4
- (28) -
W4
Courier Management 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. 1. Introduction 1.1. Purpose – over come of
The main purpose, to make this software is to problems of data base handling, maintain
registers of members, books, and information about worker which are works at Library etc. 1.2. Intended Audience – This SRS is meant for basically my final semester project report of MCA. Besides, it is obviously targeted for the managers of mentioned center, the client, to get and overall description and advantage of the proposed system over the existing manual system. 1.3. Product Vision and Scope – The proposed system is being developed keeping in mind the requirements/need of the client to automate its existing system for record keeping, report
- (29) -
Courier Management System
generation and
management level information
system.
Keeping in mind the needs, the system has been developed as per guidelines laid by the client’s center. The system is capable enough to handle library records, book’s records, member’s records, visitors records, report generation, and storing other related information. 2. Overall Description 2.1 Product Perspectives: The proposed system falls under RDBMS (Relational Data Base Management System) category. I have adopted PHP as front end for the software and MYSQL as back end. PHP is at present one of the most popular development platform for web based system that is efficient for web programming. MYSQL is at present the most reliable and secure RDBMS tool. MYSQL Server works to efficiently manage its resource, a database of information, among the multiple clients requesting and sending data in the network. MYSQL has many important features
that
make
it
not
only
an
exceptional
database
management system but also an excellent database server choice for client/server database computing.
- (30) -
Courier Management System
So the overall system will prove to reliable, secure and efficient for the organization. 2.2
Product Functions
Functionalities:
2.2.1 Any person can query for books availability according to specified conditions. 2.2.3A Person can book/cancel the book only after he logs in. 2.2.42.2.4 A user can sign up for a profile if he doesn’t have one already. 2.2.5On logging in, the user has options to 1. Book issued . 2. Edit Profile information 3. Cancellation of his booked issued. 4. View all current books booked by him. 5. Logout
2.2.6A person can get all information regarding a library if he keys in it.
- (31) -
Courier Management System
A person can get all information about a books if he keys in the book id. A person can get the availability of all books for the next 20 days. Official members are suppose to do that work which distributed by the administrator Administrator
or
assigned
official
members
can
members
can
add/modify/delete library information. Administrator
or
assigned
official
add/modify/delete seat type according their availability and generate report. Administrator
or
assigned
official
members
can
add/modify/delete library information. Administrator or assigned official members can define and manage charges information. Administrator or assigned official members can define scheme and modify time to time and generate report. Administrator can add/modify/delete official member and generate report.
- (32) -
Courier Management System
Administrator can add/modify/delete user information and generate report.
2.3. Operating Environment – The proposed software is to run on
client/server model network.
A client/server can deliver the better performance than the file server system because a client application and database server work together to split processing load of applications (thus the term distributed processing). The server manages the database among the number of clients, while the client send, request, and analyze the data entry form with small specific data set, such as rows in a table not file as in the file server system. A database server is intelligent enough so that it lock and return only the rows a client request, which ensure concurrency, minimize the network traffic and increase the system performance. 2.4. Assumptions
and
Dependencies
– While cost
estimation of the proposed system it has been assumed that the cost hardware and for license of Operating System and back end will be met by client (the organization). Hence only the cost incurred for the proposed software is included therein.
- (33) -
Courier Management System
The followings are identified as some of the potential risk factors or
dependencies:
(1)
Non-availability of required resources.
(2)
Power cuts.
(3)
Slippage of schedule due to unpredictable holidays, etc.
2.5 Life Cycle Model – I am using SDLC model that begin at system level and progresses through analysis, design, coding, testing, implementation and maintenance. 3.
External Interface Requirements
3.1 User Interfaces – It has been required that every form’s interface should be user friendly and simple to use. Besides, there should be facility of accessing the system through keyboard along with the mouse i.e.
keyboard shortcuts.
3.2 Software Interfaces – It has been required that there could be a necessity of using the stored data for some kind of report that is not supported by proposed system at present. So the proposed system is required to export its data as text file so that some other application software can import the data. 4.
System Future Requirement – Other than descriptions
provided above, the following features were required by the
- (34) -
Courier Management System
client: (1)
The system should be secured enough to rely upon.
(2)
Users should not be allowed to delete/modify any records.
(3)
Users should not be allowed to take financial reports.
(4)
Every users report should keep the tracks of user inputting the record.
(5)
System should provide facility of exporting its data in text format.
(6)
System should be able to integrate with its Phase II developments.
5. Other Nonfunctional Requirements a. Performance Requirements – As it is going to be used by all the concerned employees within the organization, the system should have a good performance in terms of speed and accuracy. The proposed system should be accurate and fast enough to handle huge data. It should provide fast communication between server and clients.
- (35) -
Courier Management System
b. Safety Requirements – As the system is going to handle records for a long run eliminating the manual system, it is supposed to ensure the retaining of data avoiding or eliminating any probable cause for data loss. c. Security Requirements – The software should not allow unauthorized access to any module of the system. Besides, it should maintain the privileges granted to users at various user levels. d. Software Quality Attributes – The prioritization of the software quality attributes are assumed as under: (1)
Accurate and hence reliable.
(2)
Secured.
(3)
Fast speed.
(4)
Compatibility.
(5)
Portability.
- (36) -
Courier Management System
System Design In this phase, a logical system is built which fulfils the given requirements. Design phase of software development deals with transforming the customer’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: I. Design various blocks for overall system processes. II. Design smaller, compact and workable modules in each block.
- (37) -
Courier Management System
III. Design various database structures. IV. Specify
details
of
programs
to
achieve
desired
functionality. V. Design the form of inputs, and outputs of the system. VI. Perform documentation of the design. VII. System reviews.
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.
- (38) -
Courier Management System
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.
- (39) -
Courier Management System
TESTING Testing is the process in which the system is run on manually created input so that the system is correctly working as desired or not. During systems testing, the system is used experimentally to ensure that the software does not fail. In other words, we can say that it will run according to its specifications and in the way users expect. Special test data are input for processing, and the results examined. A limited number of users may be allowed to use the system so that analyst can see whether they try to use it in unforeseen ways. It is desirable to discover any surprises before the organization implements the system and depends on it. Testing of a system is generally done in two phases – One is Unit Testing which is done for each module independently on its completion and the other one is System Testing which is done at the end of a project.
- (40) -
Courier Management System
VALIDATION CRITERIA The validation criteria in this project are as follows... In E-Commerce Portal System also, the user inputs are validated before storing them, and then further for displaying etc. The main validations that are done in E-Commerce Portal System are as follows – All the screens have a similar look and feel. They all have the almost same color combinations in its background. This provides a better user interface to the users. 1) The primary key values cannot be duplicated. 2) All the entries in any combo box have been sorted in alphabetical order. This helps a user while selecting a value from the combo box.
IMPORTANCE OF TESTING During systems testing, the system is used experimentally to ensure that the software does not fail. In other words, we can say that it will run according to its specifications and in the way users expect. Special test data are input for processing, and the results examined. The importance of system testing is that the system is expected to run according to member’s requirement before delivering it to the customer.
- (41) -
Courier Management System
The System is tested on the basis of specification so that it does not fail on user site.
- (42) -
Courier Management System
Implementation and Testing
Implementation 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
- (43) -
Courier Management System
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. 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
- (44) -
Courier Management System
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. 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
- (45) -
Courier Management System
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
- (46) -
Courier Management System
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: i.
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.
ii.
Storage Testing: It determines the capacity of the system to store transaction data on a disk or in other files.
iii.
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.
- (47) -
Courier Management System
iv.
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.
v.
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. vi.
Human Factors Testing: It determines how users will use the system when processing data or preparing reports.
- (48) -
Courier Management System
COST ESTIMATION OF THE PROJECT Software cost comprises a small percentage of overall computerbased 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.
- (49) -
Courier Management System
GANTT CHART
January
February
March
Requirement Gathering Analysis Design Coding Testing Implement W
W
W
W
W
W
W
W
W
W
W
1
2
3
4
1
2
3
4
1
2
3
Wi‘s are weeks of the months, for i =1, 2, 3, 4
- (50) -
W4
Courier Management System
User Screen Desing - (51) -
Courier Management System
and Interface
- (52) -
Courier Management System
- (53) -
Courier Management System
- (54) -
Courier Management System
- (55) -
Courier Management System
- (56) -
Courier Management System
- (57) -
Courier Management System
- (58) -
Courier Management System
- (59) -
Courier Management System
- (60) -
Courier Management System
- (61) -
Courier Management System
- (62) -
Courier Management System
- (63) -
Courier Management System
- (64) -
Courier Management System
- (65) -
Courier Management System
- (66) -
Courier Management System
- (67) -
Courier Management System
- (68) -
Courier Management System
- (69) -
Courier Management System
- (70) -
Courier Management System
- (71) -
Courier Management System
- (72) -
Courier Management System
Code of the Project Courier Management System
- (73) -
Courier Management System
require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); menu_execute_active_handler(); Code of Courier fetch:
- (74) -
Courier Management System
// Sets the page display for standard. define('AUTOASSIGNROLE_PAGE_DISPLAY_STANDARD', 0); // Sets the page display for individual. define('AUTOASSIGNROLE_PAGE_DISPLAY_INDIVIDUAL', 1); /** * Implements hook_permission(). */ function autoassignrole_permission() { return array( 'administer autoassignrole' => array( 'title' => t('Administer auto assign role'), 'description' => t('Perform administration tasks for auto assign role.'), ), ); } /** * Implements hook_menu(). */ function autoassignrole_menu() { $items = array(); $items['admin/config/people/autoassignrole'] = array(
- (75) -
Courier Management System
'title' => 'Auto assign role', 'description' => 'Configure auto role assignment.', 'access arguments' => array('administer autoassignrole'), 'page callback' => 'autoassignrole_admin_block_page', 'file' => 'autoassignrole.admin.inc', ); $items['admin/config/people/autoassignrole/auto'] = array( 'title' => 'Automatic', 'description' => 'Configure which role(s) are automatically assigned on user creation.', 'access arguments' => array('administer autoassignrole'), 'page callback' => 'drupal_get_form', 'page arguments' => array('autoassignrole_auto_settings'), 'file' => 'autoassignrole.admin.inc', ); $items['admin/config/people/autoassignrole/user'] = array( 'title' => 'User choice', 'description' => 'Configure the ability for an end user to choose their own roles during registration.', 'access arguments' => array('administer autoassignrole'), 'page callback' => 'drupal_get_form', 'page arguments' => array('autoassignrole_user_settings'), 'file' => 'autoassignrole.admin.inc', ); $items['admin/config/people/autoassignrole/pages'] = array(
- (76) -
Courier Management System
'title' => 'Per Role Pages', 'description' => 'Configure individual pages to allow user to sign up for a particular role', 'access arguments' => array('administer autoassignrole'), 'page callback' => 'autoassignrole_list_pages', 'file' => 'autoassignrole.admin.inc', ); $items['admin/config/people/autoassignrole/pages/add'] = array( 'title' => 'Add Auto Assign Role Page', 'access arguments' => array('administer autoassignrole'), 'page callback' => 'drupal_get_form', 'page arguments' => array('autoassignrole_page_form', 'add'), 'type' => MENU_LOCAL_ACTION, 'file' => 'autoassignrole.admin.inc', ); $items['admin/config/people/autoassignrole/pages/edit/%']
=
array( 'title' => 'Edit Auto Assign Role Page', 'access arguments' => array('administer autoassignrole'), 'page callback' => 'drupal_get_form', 'page arguments' => array('autoassignrole_page_form', 'edit', 6), 'file' => 'autoassignrole.admin.inc', ); $items['admin/config/people/autoassignrole/pages/delete/%'] =
- (77) -
Courier Management System
array( 'title' => 'Delete Auto Assign Role Page', 'access arguments' => array('administer autoassignrole'), 'page callback' => 'drupal_get_form', 'page
arguments'
array('autoassignrole_page_delete_confirm', 6), 'file' => 'autoassignrole.admin.inc', ); $pages = autoassignrole_get_pages(); foreach ($pages as $page) { $rids = unserialize($page->rids); switch ($page->display) { case AUTOASSIGNROLE_PAGE_DISPLAY_STANDARD: $items[$page->path] = array( 'title' => check_plain($page->title), 'page arguments' => array($rids), 'page callback' => 'autoassignrole_register', 'access callback' => 'user_register_access', 'file' => 'autoassignrole.paths.inc', 'type' => MENU_NORMAL_ITEM, 'menu_name' => $page->menu, ); $items[$page->path . '/register'] = array( 'title' => 'Register',
- (78) -
=>
Courier Management System
'page arguments' => array($rids), 'page callback' => 'autoassignrole_register', 'access callback' => 'user_register_access', 'file' => 'autoassignrole.paths.inc', 'type' => MENU_DEFAULT_LOCAL_TASK, ); $items[$page->path . '/login'] = array( 'title' => 'Log In', 'page callback' => 'autoassignrole_login', 'access callback' => 'user_is_anonymous', 'file' => 'autoassignrole.paths.inc', 'type' => MENU_LOCAL_TASK, ); $items[$page->path . '/password'] = array( 'title' => 'Request New Password', 'page callback' => 'autoassignrole_password', 'access callback' => 'user_is_anonymous', 'file' => 'autoassignrole.paths.inc', 'type' => MENU_LOCAL_TASK, ); break; case AUTOASSIGNROLE_PAGE_DISPLAY_INDIVIDUAL: $items[$page->path] = array( 'title' => check_plain($page->title),
- (79) -
Courier Management System
'page arguments' => array($rids), 'page callback' => 'autoassignrole_register', 'access callback' => 'user_register_access', 'file' => 'autoassignrole.paths.inc', 'type' => MENU_CALLBACK, ); $items[$page->path . '/register'] = array( 'title' => 'Register', 'page arguments' => array($rids), 'page callback' => 'autoassignrole_register', 'access callback' => 'user_register_access', 'file' => 'autoassignrole.paths.inc', 'type' => MENU_CALLBACK, ); $items[$page->path . '/login'] = array( 'title' => 'Log In', 'page callback' => 'autoassignrole_login', 'access callback' => 'user_is_anonymous', 'file' => 'autoassignrole.paths.inc', 'type' => MENU_CALLBACK, ); $items[$page->path . '/password'] = array( 'title' => 'Request New Password', 'page callback' => 'autoassignrole_password', 'access callback' => 'user_is_anonymous',
- (80) -
Courier Management System
'file' => 'autoassignrole.paths.inc', 'type' => MENU_CALLBACK, ); break; } } return $items; } /** * Finds any role ids attached to current page, if any. */ function autoassignrole_get_active_path_rid() { $item = menu_get_item(); if ($item['page_callback'] == 'autoassignrole_register') { return $item['page_arguments'][0]; } return FALSE; } /** * Implements hook_user_presave(). */ function
autoassignrole_user_presave(&$edit,
- (81) -
$account,
Courier Management System
$category) { // Use case http://drupal.org/node/971622 // Make sure we only assign roles automatically when enabled to do so. if
(variable_get('autoassignrole_auto_active',
0)
||
0)
&&
variable_get("autoassignrole_user_active", 0) ||
(variable_get('autoassignrole_admin_active',
user_access('administer users')) || autoassignrole_get_active_path_rid()) { // Use case http://drupal.org/node/944864 // Only assign roles if this is a new account. if (isset($account->is_new) && !empty($account->is_new)) { // Get the existing user roles with the exception of the anonymous role. $user_roles = user_roles(TRUE); $roles_to_add = array(); // Add in automatic roles. if ((variable_get('autoassignrole_auto_active', 0) && ! user_access('administer users')) || (variable_get('autoassignrole_admin_active', 0) && user_access('administer users'))) { $roles_to_add += array_intersect_key($user_roles, array_filter(variable_get('autoassignrole_auto_roles', array()))); }
- (82) -
Courier Management System
// Add in user selected roles if any. if (variable_get("autoassignrole_user_active", 0) && ! empty($edit['user_roles'])) { // Value is a single, convert to array. if (!is_array($edit['user_roles'])) { $edit['user_roles'] = array($edit['user_roles'] => $edit['user_roles']); } $roles_to_add += array_intersect_key($user_roles, array_filter($edit['user_roles'])); } // Add page-specific roles. $page_rids = autoassignrole_get_active_path_rid(); if ($page_rids) { $roles_to_add = array_intersect_key($user_roles, array_filter($page_rids)); } // Make sure the roles key exists. if (!isset($edit['roles'])) { $edit['roles'] = array(); }
- (83) -
Courier Management System
// Add in the new roles to override the current roles. $edit['roles'] = $roles_to_add + $edit['roles']; } } } /** *
Implements
hook_form_FORM_ID_alter()
for
user_register_form(). */ function
autoassignrole_form_user_register_form_alter(&$form,
&$form_state) { if
(variable_get("autoassignrole_user_active",
0)
&&
!
user_access('administer users') && !autoassignrole_get_active_path_rid()) { // Get a list of valid roles that can be selected. $roles
=
array_intersect_key(user_roles(TRUE),
array_filter(variable_get('autoassignrole_user_roles', array()))); if ($roles) { $form['autoassignrole_user'] = array( '#type' => 'fieldset', '#title' filter_xss(variable_get('autoassignrole_user_fieldset_title',
- (84) -
=> t('User
Courier Management System
Roles'))), '#collapsible' => FALSE, '#collapsed' => FALSE, ); // Sort the roles. if (variable_get('autoassignrole_user_sort', 'SORT_ASC') == 'SORT_ASC') { asort($roles); } elseif (variable_get('autoassignrole_user_sort', 'SORT_DESC') == 'SORT_DESC') { arsort($roles); } else { drupal_sort_weight($roles, $roles); } $multiple = variable_get('autoassignrole_user_multiple', 0); $user_selection
=
variable_get('autoassignrole_user_selection', AUTOASSIGNROLE_ELEMENT_RADIO_CHECKBOX); $type = 'select'; if
- (85) -
($user_selection
==
Courier Management System
AUTOASSIGNROLE_ELEMENT_RADIO_CHECKBOX) { $type
=
$user_selection
==
AUTOASSIGNROLE_ELEMENT_RADIO_CHECKBOX && !$multiple ? 'radios' : 'checkboxes'; } // If not multiple + not required + select box, need a none selection. if (!$multiple && !variable_get('autoassignrole_user_required', 0) && $type == 'select') { $roles = array(0 => t('None')) + $roles; } // Add in the element. $form['autoassignrole_user']['user_roles'] = array( '#type' => $type, '#title' => filter_xss(variable_get('autoassignrole_user_title', t('Role'))), '#options' => $roles, '#description'
=>
filter_xss(variable_get('autoassignrole_user_description', t('Select a role'))), '#required' => variable_get('autoassignrole_user_required', 0), '#multiple' => $multiple,
- (86) -
Courier Management System
); } } } /** * Function to retrieve all role-specific pages. * * @return SelectQuery * An array of page objects. */ function autoassignrole_get_pages() { $query = _autoasignrole_get_page_query(); return $query->execute(); } /** * Function to get role-specific page details. * * @param int $id * The id of the page to be updated. * * @return SelectQuery * A query object with all page details. */
- (87) -
Courier Management System
function autoassignrole_get_page($id) { $query = _autoasignrole_get_page_query(); $query->condition('rid_page_id', $id, '='); return $query->execute()->fetchObject(); } /** * Helper method for getting the page query object. * * @return SelectQuery * The query object. */ function _autoasignrole_get_page_query() { return db_select('autoassignrole_page', 'p') ->fields('p', array( 'rids', 'path', 'title', 'menu', 'display', )); } Code of Role Assignment:
- (88) -
Courier Management System
/** * @file * Paths used for autoassignrole created user pages. * * Autoassignrole allows an admin to create specific register, login and reset * password pages for a particular set of roles. The menu callback arguments * for these pages are defined here. * * These functions simply call the standard user forms from Drupal core, the * reason we wrap them like this is so that we can detect when one of our * role-specific pages are being called rather than the default ones. */ //We require this file from the user module to get the user_pass form. require_once drupal_get_path('module', 'user') . '/user.pages.inc'; /** * Loads the user registration form.
- (89) -
Courier Management System
* * $rid is not actually used in the function but by passing it we can find out * which roles are meant to be added to the new user by using * autoassignrole_get_active_path_rid(); * * @see autoassignrole.module * * @param $rid *
$rid is the 'rid_page_id' of the page we are currently
generating. * * @return string * User registration form renderer. */ function autoassignrole_register($rid) { $output = drupal_get_form('user_register_form'); return $output; } /** * Loads the user login form */ function autoassignrole_login() { $output = drupal_get_form('user_login');
- (90) -
Courier Management System
return $output; } /** * Loads the password reset form */ function autoassignrole_password() { $output = drupal_get_form('user_pass'); return $output; } Code of Node Save Redirect:
node_save_redirect_form_alter(&$form,
$form_id) { if (isset($form['#node_type'])) {
- (91) -
&$form_state,
Courier Management System
// ADdd the new radios buttons to the submission vertical tab. $form['submission']['node_save_redirect'] = array( '#type' => 'radios', '#title' => t('Redirect after content creation'), '#options' => array(0 => t('Default'), 1 => t('Return to Edit page after saving.'), 2 => t('Return to Content Overview after saving.'), 4 => t('Re-direct to My Workbench after saving'), 3 => t('Re-direct to another location')), '#description' => t('Choose where the user should be sent after creating new content.'), '#default_value' => variable_get('node_save_redirect_' . $form['#node_type']->type, 0) ); // Add a textfield to the submission vertical tab. $form['submission']['node_save_redirect_location'] = array( '#type' => 'textfield', '#title' => 'Custom Redirect Location', '#default_value' variable_get('node_save_redirect_location_'
=> .
$form['#node_type']->type, ''), '#states' => array( 'visible' => array( ':input[name="node_save_redirect"]' => array('value' =>
- (92) -
Courier Management System
'3'), ), ) ); } // Add a new submit function. if (strstr($form_id, '_node_form')) { $form['actions']['submit']['#submit'][]
=
'node_save_redirect_submit'; } } /** * A function that is called when a node is saved. * * @param array $form * @param array $form_state */ function node_save_redirect_submit($form, &$form_state) { // load settings $node_save_redirect_settings variable_get('node_save_redirect_' NULL);
- (93) -
.
=
$form['type']['#value'],
Courier Management System
$custom_location = variable_get('node_save_redirect_location_' . $form['type']['#value'], ''); if (!is_null($node_save_redirect_settings)) { // A destination in $_GET always overrides the function arguments. @see drupal_goto unset($_GET['destination']); if ($node_save_redirect_settings == '1') { $form_state['redirect'] = 'node/' . $form_state['nid'] . '/edit'; } else
if
($node_save_redirect_settings
==
'2'
&&
==
'4'
&&
user_access('access content overview')) { $form_state['redirect'] = 'admin/content'; } else
if
($node_save_redirect_settings
user_access('access workbench')) { $form_state['redirect'] = 'admin/workbench'; } else if ($node_save_redirect_settings == '3') { $options = drupal_parse_url($custom_location); $form_state['redirect'] = array($options['path'], array( 'query' => $options['query'], 'fragment' => $options['fragment']
- (94) -
Courier Management System
)); } } } Code for Manage Couriers using ctools:
- (95) -
Courier Management System
* create. In a dev format, it should be 7.x-1.(x+1)-dev, which will allow * modules depending on new features in ctools to depend on ctools > 7.x-1.x. * * To define a specific version of CTools as a dependency for another module, * simply include a dependency line in that module's info file, e.g.: * ; Requires CTools v7.x-1.4 or newer. * dependencies[] = ctools (>=1.4) */ define('CTOOLS_MODULE_VERSION', '7.x-1.6'); /** * Test the CTools API version. * * This function can always be used to safely test if CTools has the minimum * API version that your module can use. It can also try to protect you from * running if the CTools API version is too new, but if you do that you need * to be very quick about watching CTools API releases and release new versions * of your software as soon as the new release is made, or people
- (96) -
Courier Management System
might end up * updating CTools and having your module shut down without any recourse. * * It is recommended that every hook of your module that might use CTools or * might lead to a use of CTools be guarded like this: * * @code * if (!module_invoke('ctools', 'api_version', '1.0')) { * return; *} * @endcode * * Note that some hooks such as _menu() or _theme() must return an array(). * * You can use it in your hook_requirements to report this error condition * like this: * * @code * define('MODULENAME_MINIMUM_CTOOLS_API_VERSION', '1.0'); * define('MODULENAME_MAXIMUM_CTOOLS_API_VERSION', '1.1'); *
- (97) -
Courier Management System
* function MODULENAME_requirements($phase) { * $requirements = array(); *
if
(!module_invoke('ctools',
'api_version',
MODULENAME_MINIMUM_CTOOLS_API_VERSION, MODULENAME_MAXIMUM_CTOOLS_API_VERSION)) { *
$requirements['MODULENAME_ctools'] = array(
*
'title' => $t('MODULENAME required Chaos Tool Suite
(CTools) API Version'), *
'value' => t('Between @a and @b', array('@a' =>
MODULENAME_MINIMUM_CTOOLS_API_VERSION,
'@b'
=>
MODULENAME_MAXIMUM_CTOOLS_API_VERSION)), * *
'severity' => REQUIREMENT_ERROR, );
* } * return $requirements; *} * @endcode * * Please note that the version is a string, not an floating point number. * This will matter once CTools reaches version 1.10. * * A CTools API changes history will be kept in API.txt. Not every new * version of CTools will necessarily update the API version.
- (98) -
Courier Management System
* @param $minimum *
The minimum version of CTools necessary for your software to
run with it. * @param $maximum *
The maximum version of CTools allowed for your software to
run with it. */ function ctools_api_version($minimum, $maximum = NULL) { if (version_compare(CTOOLS_API_VERSION, $minimum, '<')) { return FALSE; } if (isset($maximum) && version_compare(CTOOLS_API_VERSION, $maximum, '>')) { return FALSE; } return TRUE; } // ----------------------------------------------------------------------// General utility functions /** * Include .inc files as necessary.
- (99) -
Courier Management System
* * This fuction is helpful for including .inc files for your module. The * general case is including ctools funcitonality like this: * * @code * ctools_include('plugins'); * @endcode * * Similar funcitonality can be used for other modules by providing the $module * and $dir arguments like this: * * @code * // include mymodule/includes/import.inc * ctools_include('import', 'mymodule'); * // include mymodule/plugins/foobar.inc * ctools_include('foobar', 'mymodule', 'plugins'); * @endcode * * @param $file * The base file name to be included. * @param $module * Optional module containing the include. * @param $dir
- (100) -
Courier Management System
* Optional subdirectory containing the include file. */ function ctools_include($file, $module = 'ctools', $dir = 'includes') { static $used = array(); $dir = '/' . ($dir ? $dir . '/' : ''); if (!isset($used[$module][$dir][$file])) { require_once DRUPAL_ROOT . '/' . drupal_get_path('module', $module) . "$dir$file.inc"; $used[$module][$dir][$file] = TRUE; } } /** * Include .inc files in a form context. * * This is a variant of ctools_include that will save information in the * the form_state so that cached forms will properly include things. */ function
ctools_form_include(&$form_state,
'ctools', $dir = 'includes') {
- (101) -
$file,
$module
=
Courier Management System
if (!isset($form_state['build_info']['args'])) { $form_state['build_info']['args'] = array(); } $dir = '/' . ($dir ? $dir . '/' : ''); form_load_include($form_state, 'inc', $module, $dir . $file); } /** * Add an arbitrary path to the $form_state so it can work with form cache. * * module_load_include uses an unfortunately annoying syntax to work, making it * difficult to translate the more simple $path + $file syntax. */ function ctools_form_include_file(&$form_state, $filename) { if (!isset($form_state['build_info']['args'])) { $form_state['build_info']['args'] = array(); } // Now add this to the build info files so that AJAX requests will know to load it. $form_state['build_info']['files']["$filename"] = $filename; require_once DRUPAL_ROOT . '/' . $filename;
- (102) -
Courier Management System
} /** * Provide the proper path to an image as necessary. * * This helper function is used by ctools but can also be used in other * modules in the same way as explained in the comments of ctools_include. * * @param $image *
The base file name (with extension)
of the image to be
included. * @param $module * Optional module containing the include. * @param $dir * Optional subdirectory containing the include file. */ function ctools_image_path($image, $module = 'ctools', $dir = 'images') { return drupal_get_path('module', $module) . "/$dir/" . $image; } /** * Include css files as necessary.
- (103) -
Courier Management System
* * This helper function is used by ctools but can also be used in other * modules in the same way as explained in the comments of ctools_include. * * @param $file * The base file name to be included. * @param $module * Optional module containing the include. * @param $dir * Optional subdirectory containing the include file. */ function ctools_add_css($file, $module = 'ctools', $dir = 'css') { drupal_add_css(drupal_get_path('module', $module) . "/$dir/ $file.css"); } /** * Format a css file name for use with $form['#attached']['css']. * * This helper function is used by ctools but can also be used in other * modules in the same way as explained in the comments of ctools_include.
- (104) -
Courier Management System
* * @code *
$form['#attached']['css']
=
array(ctools_attach_css('collapsible-div')); *
$form['#attached']['css'][ctools_attach_css('collapsible-div')]
= array('preprocess' => FALSE); * @endcode * * @param $file * The base file name to be included. * @param $module * Optional module containing the include. * @param $dir * Optional subdirectory containing the include file. */ function ctools_attach_css($file, $module = 'ctools', $dir = 'css') { return drupal_get_path('module', $module) . "/$dir/$file.css"; } /** * Include js files as necessary. * * This helper function is used by ctools but can also be used in other * modules in the same way as explained in the comments of
- (105) -
Courier Management System
ctools_include. * * @param $file * The base file name to be included. * @param $module * Optional module containing the include. * @param $dir * Optional subdirectory containing the include file. */ function ctools_add_js($file, $module = 'ctools', $dir = 'js') { drupal_add_js(drupal_get_path('module', $module) . "/$dir/ $file.js"); } /** * Format a javascript file name for use with $form['#attached'] ['js']. * * This helper function is used by ctools but can also be used in other * modules in the same way as explained in the comments of ctools_include. * * @code *
$form['#attached']['js']
=
array(ctools_attach_js('auto-
- (106) -
Courier Management System
submit')); * @endcode * * @param $file * The base file name to be included. * @param $module * Optional module containing the include. * @param $dir * Optional subdirectory containing the include file. */ function ctools_attach_js($file, $module = 'ctools', $dir = 'js') { return drupal_get_path('module', $module) . "/$dir/$file.js"; } /** * Get a list of roles in the system. * * @return * An array of role names keyed by role ID. * * @deprecated *
user_roles() should be used instead.
*/ function ctools_get_roles() { return user_roles();
- (107) -
Courier Management System
} /* * Break x,y,z and x+y+z into an array. Numeric only. * * @param $str * The string to parse. * * @return $object * An object containing * - operator: Either 'and' or 'or' * - value: An array of numeric values. */ function ctools_break_phrase($str) { $object = new stdClass(); if (preg_match('/^([0-9]+[+ ])+[0-9]+$/', $str)) { // The '+' character in a query string may be parsed as ' '. $object->operator = 'or'; $object->value = preg_split('/[+ ]/', $str); } else if (preg_match('/^([0-9]+,)*[0-9]+$/', $str)) { $object->operator = 'and'; $object->value = explode(',', $str); }
- (108) -
Courier Management System
// Keep an 'error' value if invalid strings were given. if (!empty($str) && (empty($object->value) || !is_array($object>value))) { $object->value = array(-1); $object->invalid_input = TRUE; return $object; } if (empty($object->value)) { $object->value = array(); } // Doubly ensure that all values are numeric only. foreach ($object->value as $id => $value) { $object->value[$id] = intval($value); } return $object; } /** * Set a token/value pair to be replaced later in the request, specifically in * ctools_page_token_processing().
- (109) -
Courier Management System
* * @param $token *
The token to be replaced later, during page rendering. This
should *
ideally be a string inside of an HTML comment, so that if there
is *
no replacement, the token will not render on the page.
* @param $type *
The type of the token. Can be either 'variable', which will pull
data * directly from the page variables * @param $argument *
If $type == 'variable' then argument should be the key to
fetch from *
the $variables. If $type == 'callback' then it should either be
the * callback, or an array that will be sent to call_user_func_array(). * * @return * A array of token/variable names to be replaced. */ function ctools_set_page_token($token = NULL, $type = NULL, $argument = NULL) { static $tokens = array();
- (110) -
Courier Management System
if (isset($token)) { $tokens[$token] = array($type, $argument); } return $tokens; } /** * Easily set a token from the page variables. * * This function can be used like this: * $token = ctools_set_variable_token('tabs'); * * $token will then be a simple replacement for the 'tabs' about of the * variables available in the page template. */ function ctools_set_variable_token($token) { $string = ''; ctools_set_page_token($string, 'variable', $token); return $string; } /** * Easily set a token from the page variables. *
- (111) -
Courier Management System
* This function can be used like this: *
$token
=
ctools_set_variable_token('id',
'mymodule_myfunction'); */ function ctools_set_callback_token($token, $callback) { // If the callback uses arguments they are considered in the token. if (is_array($callback)) { $token .= '-' . md5(serialize($callback)); } $string = ''; ctools_set_page_token($string, 'callback', $callback); return $string; } /** * Tell CTools that sidebar blocks should not be rendered. * * It is often desirable to not display sidebars when rendering a page, * particularly when using Panels. This informs CTools to alter out any * sidebar regions during block render. */ function ctools_set_no_blocks($blocks = FALSE) {
- (112) -
Courier Management System
$status = &drupal_static(__FUNCTION__, TRUE); $status = $blocks; } /** * Wrapper function to create UUIDs via ctools, falls back on UUID module * if it is enabled. This code is a copy of uuid.inc from the uuid module. * @see http://php.net/uniqid#65879 */ function ctools_uuid_generate() { if (!module_exists('uuid')) { ctools_include('uuid'); $callback = drupal_static(__FUNCTION__); if (empty($callback)) { if
(function_exists('uuid_create')
function_exists('uuid_make')) { $callback = '_ctools_uuid_generate_pecl'; } elseif (function_exists('com_create_guid')) { $callback = '_ctools_uuid_generate_com';
- (113) -
&&
!
Courier Management System
} else { $callback = '_ctools_uuid_generate_php'; } } return $callback(); } else { return uuid_generate(); } } /** * Check that a string appears to be in the format of a UUID. * @see http://drupal.org/project/uuid * * @param $uuid * The string to test. * * @return * TRUE if the string is well formed. */ function ctools_uuid_is_valid($uuid = '') { if (empty($uuid)) { return FALSE;
- (114) -
Courier Management System
} if (function_exists('uuid_is_valid') || module_exists('uuid')) { return uuid_is_valid($uuid); } else { ctools_include('uuid'); return uuid_is_valid($uuid); } } /** * Add an array of classes to the body. * * @param mixed $classes * A string or an array of class strings to add. * @param string $hook * The theme hook to add the class to. The default is 'html' which will * affect the body tag. */ function ctools_class_add($classes, $hook = 'html') { if (!is_array($classes)) { $classes = array($classes); }
- (115) -
Courier Management System
$static = &drupal_static('ctools_process_classes', array()); if (!isset($static[$hook]['add'])) { $static[$hook]['add'] = array(); } foreach ($classes as $class) { $static[$hook]['add'][] = $class; } } /** * Remove an array of classes from the body. * * @param mixed $classes * A string or an array of class strings to remove. * @param string $hook * The theme hook to remove the class from. The default is 'html' which will * affect the body tag. */ function ctools_class_remove($classes, $hook = 'html') { if (!is_array($classes)) { $classes = array($classes); } $static = &drupal_static('ctools_process_classes', array());
- (116) -
Courier Management System
if (!isset($static[$hook]['remove'])) { $static[$hook]['remove'] = array(); } foreach ($classes as $class) { $static[$hook]['remove'][] = $class; } } // ----------------------------------------------------------------------// Drupal core hooks /** * Implement hook_init to keep our global CSS at the ready. */ function ctools_init() { ctools_add_css('ctools'); // If we are sure that CTools' AJAX is in use, change the error handling. if (!empty($_REQUEST['ctools_ajax'])) { ini_set('display_errors', 0); register_shutdown_function('ctools_shutdown_handler'); } // Clear plugin cache on the module page submit. if
($_GET['q']
==
'admin/modules/list/confirm'
- (117) -
&&
!
Courier Management System
empty($_POST)) { cache_clear_all('ctools_plugin_files:', 'cache', TRUE); } } /** * Shutdown handler used during ajax operations to help catch fatal errors. */ function ctools_shutdown_handler() { if
(function_exists('error_get_last')
AND
($error
=
error_get_last())) { switch ($error['type']) { case E_ERROR: case E_CORE_ERROR: case E_COMPILE_ERROR: case E_USER_ERROR: // Do this manually because including files here is dangerous. $commands = array( array( 'command' => 'alert', 'title' => t('Error'), 'text' => t('Unable to complete operation. Fatal error in @file on line @line: @message', array( '@file' => $error['file'],
- (118) -
Courier Management System
'@line' => $error['line'], '@message' => $error['message'], )), ), ); // Change the status code so that the client will read the AJAX returned. header('HTTP/1.1 200 OK'); drupal_json($commands); } } } /** * Implements hook_theme(). */ function ctools_theme() { ctools_include('utility'); $items = array(); ctools_passthrough('ctools', 'theme', $items); return $items; } /**
- (119) -
Courier Management System
* Implements hook_menu(). */ function ctools_menu() { ctools_include('utility'); $items = array(); ctools_passthrough('ctools', 'menu', $items); return $items; } /** * Implements hook_permission(). */ function ctools_permission() { return array( 'use ctools import' => array( 'title' => t('Use CTools importer'), 'description' => t('The import functionality allows users to execute arbitrary PHP code, so extreme caution must be taken.'), 'restrict access' => TRUE, ), ); } /** * Implementation of hook_cron. Clean up old caches.
- (120) -
Courier Management System
*/ function ctools_cron() { ctools_include('utility'); $items = array(); ctools_passthrough('ctools', 'cron', $items); } /** * Implements hook_flush_caches(). */ function ctools_flush_caches() { // Only return the CSS cache bin if it has been activated, to avoid // drupal_flush_all_caches() from trying to truncate a non-existing table. return variable_get('cache_class_cache_ctools_css', FALSE) ? array('cache_ctools_css') : array(); } /** * Implements hook_element_info_alter(). * */ function ctools_element_info_alter(&$type) { ctools_include('dependent'); ctools_dependent_element_info_alter($type);
- (121) -
Courier Management System
} /** * Implementation of hook_file_download() * * When using the private file system, we have to let Drupal know it's ok to * download CSS and image files from our temporary directory. */ function ctools_file_download($filepath) { if (strpos($filepath, 'ctools') === 0) { $mime = file_get_mimetype($filepath); // For safety's sake, we allow only text and images. if (strpos($mime, 'text') === 0 || strpos($mime, 'image') === 0) { return array('Content-type:' . $mime); } } } /** * Implements hook_registry_files_alter(). * * Alter the registry of files to automagically include all classes in * class-based plugins.
- (122) -
Courier Management System
*/ function ctools_registry_files_alter(&$files, $indexed_modules) { ctools_include('registry'); return _ctools_registry_files_alter($files, $indexed_modules); } // ----------------------------------------------------------------------// CTools hook implementations. /** * Implementation of hook_ctools_plugin_directory() to let the system know * where all our own plugins are. */ function ctools_ctools_plugin_directory($owner, $plugin_type) { if ($owner == 'ctools') { return 'plugins/' . $plugin_type; } } /** * Implements hook_ctools_plugin_type(). */ function ctools_ctools_plugin_type() { ctools_include('utility');
- (123) -
Courier Management System
$items = array(); // Add all the plugins that have their own declaration space elsewhere. ctools_passthrough('ctools', 'plugin-type', $items); return $items; } // ----------------------------------------------------------------------// Drupal theme preprocess hooks that must be in the .module file. /** * A theme preprocess function to automatically allow panelsbased node * templates based upon input when the panel was configured. */ function ctools_preprocess_node(&$vars) { // The 'ctools_template_identifier' attribute of the node is added when the pane is // rendered. if (!empty($vars['node']->ctools_template_identifier)) { $vars['ctools_template_identifier'] = check_plain($vars['node']>ctools_template_identifier); $vars['theme_hook_suggestions'][] = 'node__panel__' .
- (124) -
Courier Management System
check_plain($vars['node']->ctools_template_identifier); } }
/** * Implements hook_page_alter(). * * Last ditch attempt to remove sidebar regions if the "no blocks" * functionality has been activated. * * @see ctools_block_list_alter(). */ function ctools_page_alter(&$page) { $check = drupal_static('ctools_set_no_blocks', TRUE); if (!$check) { foreach ($page as $region_id => $region) { // @todo -- possibly we can set configuration for this so that users can // specify which blocks will not get rendered. if (strpos($region_id, 'sidebar') !== FALSE) { unset($page[$region_id]); } } }
- (125) -
Courier Management System
$page['#post_render'][] = 'ctools_page_token_processing'; } /** * A theme post_render callback to allow content type plugins to use page * template variables which are not yet available when the content type is * rendered. */ function ctools_page_token_processing($children, $elements) { $tokens = ctools_set_page_token(); if (!empty($tokens)) { foreach ($tokens as $token => $key) { list($type, $argument) = $key; switch ($type) { case 'variable': $tokens[$token] = isset($elements[$argument]) ? $elements[$argument] : ''; break; case 'callback': if (is_string($argument) && function_exists($argument)) { $tokens[$token] = $argument($elements); } if (is_array($argument) && function_exists($argument[0]))
- (126) -
Courier Management System
{ $function = array_shift($argument); $argument = array_merge(array(&$elements), $argument); $tokens[$token] = call_user_func_array($function, $argument); } break; } } $children = strtr($children, $tokens); } return $children; } /** * Implements hook_process(). * * Add and remove CSS classes from the variables array. We use process so that * we alter anything added in the preprocess hooks. */ function ctools_process(&$variables, $hook) { if (!isset($variables['classes'])) { return;
- (127) -
Courier Management System
} $classes = drupal_static('ctools_process_classes', array()); // Process the classses to add. if (!empty($classes[$hook]['add'])) { $add_classes = array_map('drupal_clean_css_identifier', $classes[$hook]['add']); $variables['classes_array']
=
array_unique(array_merge($variables['classes_array'], $add_classes)); } // Process the classes to remove. if (!empty($classes[$hook]['remove'])) { $remove_classes = array_map('drupal_clean_css_identifier', $classes[$hook]['remove']); $variables['classes_array']
=
array_diff($variables['classes_array'], $remove_classes); } // Since this runs after template_process(), we need to reimplode the // classes array. $variables['classes'] = implode(' ', $variables['classes_array']);
- (128) -
Courier Management System
} // ----------------------------------------------------------------------// Menu callbacks that must be in the .module file. /** * Determine if the current user has access via a plugin. * * This function is meant to be embedded in the Drupal menu system, and * therefore is in the .module file since sub files can't be loaded, and *
takes
arguments
a
little
bit
more
haphazardly
than
ctools_access(). * * @param $access *
An access control array which contains the following
information: *
- 'logic': and or or. Whether all tests must pass or one must
pass. * - 'plugins': An array of access plugins. Each contains: * - - 'name': The name of the plugin * - - 'settings': The settings from the plugin UI. * - - 'context': Which context to use. * @param ...
- (129) -
Courier Management System
*
zero or more context arguments generated from argument
plugins. These *
contexts must have an 'id' attached to them so that they can
be *
properly associated. The argument plugin system should set
this, but *
if the context is coming from elsewhere it will need to be set
manually. * * @return * TRUE if access is granted, false if otherwise. */ function ctools_access_menu($access) { // Short circuit everything if there are no access tests. if (empty($access['plugins'])) { return TRUE; } $contexts = array(); foreach (func_get_args() as $arg) { if (is_object($arg) && get_class($arg) == 'ctools_context') { $contexts[$arg->id] = $arg; } }
- (130) -
Courier Management System
ctools_include('context'); return ctools_access($access, $contexts); } /** * Determine if the current user has access via checks to multiple different * permissions. * * This function is a thin wrapper around user_access that allows multiple * permissions to be easily designated for use on, for example, a menu callback. * * @param ... *
An indexed array of zero or more permission strings to be
checked by * user_access(). * * @return *
Iff all checks pass will this function return TRUE. If an invalid
argument * is passed (e.g., not a string), this function errs on the safe said and * returns FALSE.
- (131) -
Courier Management System
*/ function ctools_access_multiperm() { foreach (func_get_args() as $arg) { if (!is_string($arg) || !user_access($arg)) { return FALSE; } } return TRUE; } /** * Check to see if the incoming menu item is js capable or not. * * This can be used as %ctools_js as part of a path in hook menu. CTools * ajax functions will automatically change the phrase 'nojs' to 'ajax' * when it attaches ajax to a link. This can be used to autodetect if * that happened. */ function ctools_js_load($js) { if ($js == 'ajax') { return TRUE; } return 0;
- (132) -
Courier Management System
} /** * Provides the default value for %ctools_js. * * This allows drupal_valid_path() to work with %ctools_js. */ function ctools_js_to_arg($arg) { return empty($arg) || $arg == '%' ? 'nojs' : $arg; } /** * Menu _load hook. * * This function will be called to load an object as a replacement for * %ctools_export_ui in menu paths. */ function ctools_export_ui_load($item_name, $plugin_name) { $return = &drupal_static(__FUNCTION__, FALSE); if (!$return) { ctools_include('export-ui'); $plugin = ctools_get_export_ui($plugin_name); $handler = ctools_export_ui_get_handler($plugin);
- (133) -
Courier Management System
if ($handler) { return $handler->load_item($item_name); } } return $return; } // ----------------------------------------------------------------------// Caching callbacks on behalf of export-ui. /** * Menu access callback for various tasks of export-ui. */ function ctools_export_ui_task_access($plugin_name, $op, $item = NULL) { ctools_include('export-ui'); $plugin = ctools_get_export_ui($plugin_name); $handler = ctools_export_ui_get_handler($plugin); if ($handler) { return $handler->access($op, $item); }
- (134) -
Courier Management System
// Deny access if the handler cannot be found. return FALSE; } /** * Callback for access control ajax form on behalf of export ui. * * Returns the cached access config and contexts used. * Note that this is assuming that access will be in $item->access -- if it * is not, an export UI plugin will have to make its own callbacks. */ function ctools_export_ui_ctools_access_get($argument) { ctools_include('export-ui'); list($plugin_name, $key) = explode(':', $argument, 2); $plugin = ctools_get_export_ui($plugin_name); $handler = ctools_export_ui_get_handler($plugin); if ($handler) { ctools_include('context'); $item = $handler->edit_cache_get($key); if (!$item) { $item = ctools_export_crud_load($handler->plugin['schema'], $key);
- (135) -
Courier Management System
} $contexts = ctools_context_load_contexts($item); return array($item->access, $contexts); } } /** * Callback for access control ajax form on behalf of export ui * * Returns the cached access config and contexts used. * Note that this is assuming that access will be in $item->access -- if it * is not, an export UI plugin will have to make its own callbacks. */ function ctools_export_ui_ctools_access_set($argument, $access) { ctools_include('export-ui'); list($plugin_name, $key) = explode(':', $argument, 2); $plugin = ctools_get_export_ui($plugin_name); $handler = ctools_export_ui_get_handler($plugin); if ($handler) { ctools_include('context');
- (136) -
Courier Management System
$item = $handler->edit_cache_get($key); if (!$item) { $item = ctools_export_crud_load($handler->plugin['schema'], $key); } $item->access = $access; return $handler->edit_cache_set_key($item, $key); } } /** * Implements hook_menu_local_tasks_alter(). */ function
ctools_menu_local_tasks_alter(&$data,
$router_item,
$root_path) { ctools_include('menu'); _ctools_menu_add_dynamic_items($data,
$router_item,
$root_path); } /** * Implement hook_block_list_alter() to potentially remove blocks. * * This exists in order to replicate Drupal 6's "no blocks" functionality.
- (137) -
Courier Management System
*/ function ctools_block_list_alter(&$blocks) { $check = drupal_static('ctools_set_no_blocks', TRUE); if (!$check) { foreach ($blocks as $block_id => $block) { // @todo -- possibly we can set configuration for this so that users can // specify which blocks will not get rendered. if (strpos($block->region, 'sidebar') !== FALSE) { unset($blocks[$block_id]); } } } } /** * Implements hook_modules_enabled(). * * Clear caches for detecting new plugins. */ function ctools_modules_enabled($modules) { ctools_include('plugins'); ctools_get_plugins_reset(); cache_clear_all('ctools_plugin_files:', 'cache', TRUE); }
- (138) -
Courier Management System
/** * Implements hook_modules_disabled(). * * Clear caches for removing disabled plugins. */ function ctools_modules_disabled($modules) { ctools_include('plugins'); ctools_get_plugins_reset(); cache_clear_all('ctools_plugin_files:', 'cache', TRUE); } /** * Menu theme callback. * * This simply ensures that Panels ajax calls are rendered in the same * theme as the original page to prevent .css file confusion. * * To use this, set this as the theme callback on AJAX related menu * items. Since the ajax page state won't be sent during ajax requests, * it should be safe to use even if ajax isn't invoked. */ function ctools_ajax_theme_callback() {
- (139) -
Courier Management System
if (!empty($_POST['ajax_page_state']['theme'])) { return $_POST['ajax_page_state']['theme']; } } /** * Implements hook_ctools_entity_context_alter(). */ function
ctools_ctools_entity_context_alter(&$plugin,
&$entity,
$plugin_id) { ctools_include('context'); switch ($plugin_id) { case 'entity_id:taxonomy_term': $plugin['no ui'] = TRUE; break; case 'entity:user': $plugin = ctools_get_context('user'); unset($plugin['no ui']); unset($plugin['no required context ui']); break; } // Apply restrictions on taxonomy term reverse relationships whose // restrictions are in the settings on the field.
- (140) -
Courier Management System
if (!empty($plugin['parent']) && $plugin['parent'] == 'entity_from_field' && !empty($plugin['reverse']) && $plugin['to entity'] == 'taxonomy_term') { $field = field_info_field($plugin['field name']); if (isset($field['settings']['allowed_values'][0]['vocabulary'])) { $plugin['required context']->restrictions = array('vocabulary' => array($field['settings']['allowed_values'][0]['vocabulary'])); } } } Code for Installation:
- (141) -
Courier Management System
*/ function ctools_requirements($phase) { $requirements = array(); if ($phase == 'runtime') { $requirements['ctools_css_cache'] = array( 'title' => t('CTools CSS Cache'), 'severity' => REQUIREMENT_OK, 'value' => t('Exists'), ); $path = 'public://ctools/css'; if (!file_prepare_directory($path, FILE_CREATE_DIRECTORY)) { $requirements['ctools_css_cache']['description'] = t('The CTools CSS cache directory, %path could not be created due to a misconfigured files directory. Please ensure that the files directory is correctly configured and that the webserver has permission to create directories.', array('%path' => file_uri_target($path))); $requirements['ctools_css_cache']['severity']
=
REQUIREMENT_ERROR; $requirements['ctools_css_cache']['value'] = t('Unable to create'); } if (!function_exists('error_get_last')) { $requirements['ctools_php_52']['title'] = t('CTools PHP
- (142) -
Courier Management System
requirements'); $requirements['ctools_php_52']['description'] = t('CTools requires certain features only available in PHP 5.2.0 or higher.'); $requirements['ctools_php_52']['severity']
=
REQUIREMENT_WARNING; $requirements['ctools_php_52']['value'] = t('PHP !version', array('!version' => phpversion())); } } return $requirements; } /** * Implements hook_schema(). */ function ctools_schema() { return ctools_schema_3(); } /** * Version 3 of the CTools schema. */ function ctools_schema_3() { $schema = ctools_schema_2();
- (143) -
Courier Management System
// update the 'obj' field to be 128 bytes long: $schema['ctools_object_cache']['fields']['obj']['length'] = 128; return $schema; } /** * Version 2 of the CTools schema. */ function ctools_schema_2() { $schema = ctools_schema_1(); // update the 'name' field to be 128 bytes long: $schema['ctools_object_cache']['fields']['name']['length'] = 128; // Update the 'data' field to be type 'blob'. $schema['ctools_object_cache']['fields']['data'] = array( 'type' => 'blob', 'size' => 'big', 'description' => 'Serialized data being stored.', 'serialize' => TRUE, ); // DO NOT MODIFY THIS TABLE -- this definition is used to create
- (144) -
Courier Management System
the table. // Changes to this table must be made in schema_3 or higher. $schema['ctools_css_cache'] = array( 'description' => 'A special cache used to store CSS that must be non-volatile.', 'fields' => array( 'cid' => array( 'type' => 'varchar', 'length' => '128', 'description' => 'The CSS ID this cache object belongs to.', 'not null' => TRUE, ), 'filename' => array( 'type' => 'varchar', 'length' => '255', 'description' => 'The filename this CSS is stored in.', ), 'css' => array( 'type' => 'text', 'size' => 'big', 'description' => 'CSS being stored.', 'serialize' => TRUE, ), 'filter' => array( 'type' => 'int',
- (145) -
Courier Management System
'size' => 'tiny', 'description' => 'Whether or not this CSS needs to be filtered.', ), ), 'primary key' => array('cid'), ); return $schema; } /** * CTools' initial schema; separated for the purposes of updates. * * DO NOT MAKE CHANGES HERE. This schema version is locked. */ function ctools_schema_1() { $schema['ctools_object_cache'] = array( 'description' => t('A special cache used to store objects that are being edited; it serves to save state in an ordinarily stateless environment.'), 'fields' => array( 'sid' => array( 'type' => 'varchar', 'length' => '64',
- (146) -
Courier Management System
'not null' => TRUE, 'description' => 'The session ID this cache object belongs to.', ), 'name' => array( 'type' => 'varchar', 'length' => '32', 'not null' => TRUE, 'description' => 'The name of the object this cache is attached to.', ), 'obj' => array( 'type' => 'varchar', 'length' => '32', 'not null' => TRUE, 'description' => 'The type of the object this cache is attached to; this essentially represents the owner so that several sub-systems can use this cache.', ), 'updated' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'description' => 'The time this cache was created or
- (147) -
Courier Management System
updated.', ), 'data' => array( 'type' => 'text', 'size' => 'big', 'description' => 'Serialized data being stored.', 'serialize' => TRUE, ), ), 'primary key' => array('sid', 'obj', 'name'), 'indexes' => array('updated' => array('updated')), ); return $schema; } /** * Implements hook_install(). */ function ctools_install() { // Activate our custom cache handler for the CSS cache. variable_set('cache_class_cache_ctools_css', 'CToolsCssCache'); } /** * Implements hook_uninstall().
- (148) -
Courier Management System
*/ function ctools_uninstall() { variable_del('cache_class_cache_ctools_css'); } /** * Enlarge the ctools_object_cache.name column to prevent truncation and weird * errors. */ function ctools_update_6001() { // Perform updates like this to reduce code duplication. $schema = ctools_schema_2(); db_change_field('ctools_object_cache',
'name',
$schema['ctools_object_cache']['fields']['name']); } /** * Add the new css cache table. */ function ctools_update_6002() { // Schema 2 is locked and should not be changed. $schema = ctools_schema_2();
- (149) -
'name',
Courier Management System
db_create_table('ctools_css_cache', $schema['ctools_css_cache']); } /** * Take over for the panels_views module if it was on. */ function ctools_update_6003() { $result = db_query('SELECT status FROM {system} WHERE name = :name', array(':name' => 'panels_views'))->fetchField(); if ($result) { db_delete('system')->condition('name',
'panels_views')-
>execute(); module_enable(array('views_content'), TRUE); } } /** * Add primary key to the ctools_object_cache table. */ function ctools_update_6004() { db_add_primary_key('ctools_object_cache',
array('sid',
'name')); db_drop_index('ctools_object_cache', 'sid_obj_name'); }
- (150) -
'obj',
Courier Management System
/** * Removed update. */ function ctools_update_6005() { return array(); } /** * ctools_custom_content table was originally here, but is now moved to * its own module. */ function ctools_update_6007() { $ret = array(); if (db_table_exists('ctools_custom_content')) { // Enable the module to make everything as seamless as possible. module_enable(array('ctools_custom_content'), TRUE); } return $ret; } /**
- (151) -
Courier Management System
* ctools_object_cache needs to be defined as a blob. */ function ctools_update_6008() { db_delete('ctools_object_cache') ->execute(); db_change_field('ctools_object_cache', 'data', 'data', array( 'type' => 'blob', 'size' => 'big', 'description' => 'Serialized data being stored.', 'serialize' => TRUE, ) ); } /** * Enable the custom CSS cache handler. */ function ctools_update_7000() { variable_set('cache_class_cache_ctools_css', 'CToolsCssCache'); } /** * Increase the length of the ctools_object_cache.obj column. */
- (152) -
Courier Management System
function ctools_update_7001() { db_change_field('ctools_object_cache', 'obj', 'obj', array( 'type' => 'varchar', 'length' => '128', 'not null' => TRUE, 'description' => 'The type of the object this cache is attached to; this essentially represents the owner so that several subsystems can use this cache.', )); } Code of View Content:
- (153) -
Courier Management System
/** * Implements hook_menu(). */ function views_content_menu() { $items = array(); if (!module_exists('panels')) { $items['admin/config/content-views'] = array( 'title' => 'Views panes', 'access arguments' => array('administer views content plugin'), 'page callback' => 'drupal_get_form', 'page arguments' => array('views_content_admin_page'), 'description' => 'Configure Views to be used as CTools content.', 'type' => MENU_NORMAL_ITEM, ); } return $items; } /** * Implementation of hook_ctools_plugin_dierctory() to let the system know
- (154) -
Courier Management System
* where our content_type plugins are. */ function
views_content_ctools_plugin_directory($owner,
$plugin_type) { if ($owner == 'ctools') { return 'plugins/' . $plugin_type; } } /** * Don't show Views' blocks; we expose them already. */ function views_ctools_block_info($module, $delta, &$info) { if (strlen($delta) == 32) { $hashes = variable_get('views_block_hashes', array()); if (!empty($hashes[$delta])) { $delta = $hashes[$delta]; } } if (substr($delta, 0, 1) != '-') { $info = NULL; } else { $info['category'] = t('Views');
- (155) -
Courier Management System
$info['icon'] = 'icon_views_block_legacy.png'; $info['path'] = drupal_get_path('module', 'views_content'); $info['edit form'] = 'views_content_exposed_form_pane_edit'; $info['add form'] = 'views_content_exposed_form_pane_edit'; $info['render
callback']
=
'views_content_exposed_form_pane_render'; } } /** * Add settings to the "exposed form in block" views. */ function
views_content_exposed_form_pane_edit($form,
&$form_state) { // This is a cheesy way to add defaults only to new versions of the block // but leave older blocks without the setting alone. We can tell because // all older content will have something set for override_title which is // the only pre-existing setting. if
(!isset($form_state['conf']['inherit_path'])
isset($form_state['conf']['override_title'])) { $form_state['conf']['inherit_path'] = TRUE; }
- (156) -
&&
!
Courier Management System
$form['inherit_path'] = array( '#type' => 'checkbox', '#title' => t('Inherit path'), '#default_value' => !empty($form_state['conf']['inherit_path']), ); return $form; } /** * Store data for the exposed form in block settings page. */ function
views_content_exposed_form_pane_edit_submit($form,
&$form_state) { $form_state['conf']['inherit_path']
=
$form_state['values']
['inherit_path']; } /** * Render function for 'special' view blocks. * * We took over the render for the special view blocks so that we could * add options to it.
- (157) -
Courier Management System
*/ function
views_content_exposed_form_pane_render($subtype,
$conf, $panel_args, $contexts) { $delta = str_replace('views-', '', $subtype); if (strlen($delta) == 32) { $hashes = variable_get('views_block_hashes', array()); if (!empty($hashes[$delta])) { $delta = $hashes[$delta]; } } list($nothing, $type, $name, $display_id) = explode('-', $delta); // Put the - back on. For views special blocks, the first character is always - but // the explode killed it. Note that this code is mostly copied from views_block(). $type = '-' . $type; if ($view = views_get_view($name)) { if ($view->access($display_id)) { if (!empty($conf['inherit_path'])) { $view->override_path = $_GET['q']; } $view->set_display($display_id);
- (158) -
Courier Management System
if (isset($view->display_handler)) { $block
=
(object)
$view->display_handler-
>view_special_blocks($type); return $block; } } $view->destroy(); } } /** * Implements hook_views_api(). * * This one is used as the base to reduce errors when updating. */ function views_content_views_api() { return array( 'api' => 2, 'path' => drupal_get_path('module', 'views_content') . '/plugins/views', ); } /** * Page callback to provide the basic administration form.
- (159) -
Courier Management System
*/ function views_content_admin_page() { $form = array(); views_content_admin_form($form); return system_settings_form($form); } function views_content_admin_form(&$form) { $form['ctools_content_all_views'] = array( '#type' => 'checkbox', '#title' => t('Make all views available as panes'), '#description' => t("If checked, all views will be made available as content panes to be added to content types. If not checked, only Views that have a 'Content pane' display will be available as content panes. Uncheck this if you want to be able to more carefully control what view content is available to users using the panels layout UI."), '#default_value' => variable_get('ctools_content_all_views', TRUE), ); } /** * API function to get the view.
- (160) -
Courier Management System
*/ function views_content_context_get_view(&$context) { if (empty($context->view) || get_class($context->view) == '__PHP_Incomplete_Class') { $context->view = views_get_view($context->data['name']); if ($context->view) { $context->view->set_display($context->data['display']); $context->view->set_arguments($context->data['args']); } } return $context->view; } /** * API function to get the view. */ function views_content_context_get_output(&$context) { if (empty($context->output)) { $view = views_content_context_get_view($context); $context->output
=
$view->execute_display($context-
>data['display']); } return $context->output;
- (161) -
Courier Management System
} /** * Get the title to display for a views content display for pane or context. */ function
views_content_get_display_title($view,
$display_id,
$option = 'pane_title') { $handler = $view->display[$display_id]->handler; $title = $handler->get_option($option); if (!$title) { if
($handler->display->display_title
==
$handler-
>definition['title']) { $title = t('View: @view', array('@view' => $view>get_human_name())); } else { $title = t('View: @view: @display', array('@view' => $view>get_human_name(),
'@display'
>display_title)); } } return $title; }
- (162) -
=>
$handler->display-
Courier Management System
/** * Get the proper label for a display. * * Views renamed the default to Master, but it can still have a conflicting * display title. Fix that. */ function views_content_get_display_label($view, $display_id) { $title = $display_id == 'default' ? t('Master') : $view>display[$display_id]->display_title; return $title; } /** * Get the child plugin for a view context display. * * This can return both the context and relationship style. The * $required parameter is used to distinguish if context is required * or not, so we know whether we need it suitable as a pure context * (i.e, no context required) or a relationship (i.e, context required). */ function
_views_content_get_context_from_display($view,
- (163) -
$id,
Courier Management System
$parent, $required = TRUE) { $title
=
views_content_get_display_title($view,
$id,
'admin_title'); $description = $view->description; $contexts = array(); $arguments = $view->display_handler->get_argument_input(); ctools_include('views'); foreach ($arguments as $argument) { $argument['label'] = $argument['name'] ? $argument['name'] : ''; $contexts[] = ctools_views_get_argument_context($argument); } $pass = FALSE; if ($required) { // If context is required, make sure we have at least one optional // or required context. foreach ($contexts as $context) { if (is_object($context)) { $pass = TRUE; break; }
- (164) -
Courier Management System
} if (!$pass) { return; } } else { // If context is not required, then having any required context // causes a fail. foreach ($contexts as $context) { if (is_object($context) && get_class($context) == 'ctools_context_required') { return; } } // Since we know we don't want contexts, we an unset this now. $contexts = array(); } if ($required) { $function = 'views_content_view_from_argument_context'; } else { $function = 'views_content_context_view_create';
- (165) -
Courier Management System
} return array( 'title' => $title, 'description' => filter_xss_admin($description), 'required context' => $contexts, 'keyword' => 'view', 'context' => $function, 'context name' => $view->name, 'name' => $parent . ':' . $view->name . '-' . $id, 'view name' => $view->name, 'view display id' => $id, ); } /** * Implements hook_get_pane_links_alter(). */ function
views_content_get_pane_links_alter(&$links,
$pane,
$content_type) { if ($pane->type === 'views_panes') { list($view_name, $display_name) = explode('-', $pane>subtype); $destination = array('destination' => current_path()); $links['top'][] = array(
- (166) -
Courier Management System
'title' => t('Edit view'), 'href' => url('admin/structure/views/view/' . $view_name . '/edit/' . $display_name, array('query' => $destination, 'absolute' => TRUE)), ); } } Code of html.tpl.php
print
$rdf_namespaces; ?>>
>
- (167) -
Courier Management System
Code of Page.tpl.php
- (168) -
Courier Management System
id="divider_wrapper">
id="divider">
- (170) -
Courier Management System
>
- (171) -
Courier Management System
if ($result == 1):$value = "one";endif; if ($result == 2):$value = "two";endif; if ($result == 3):$value = "three";endif; $value_trail1 = "1"; if ($result == 1):$value_trail1 = "last";endif; $value_trail2 = "2"; if ($result == 2):$value_trail2 = "last";endif; $value_trail3 = "3"; if ($result == 3):$value_trail3 = "last";endif; ?>
'_blank'); ?>