Moved the PHP branch into the trunk

git-svn-id: https://rosehill.googlecode.com/svn/trunk@47 100bd78a-fc82-11de-b5bc-ffd2847a4b57
This commit is contained in:
inghamn 2010-01-08 18:04:49 +00:00
commit 2980fed9f1
311 changed files with 10424 additions and 13833 deletions

661
GPL.txt Normal file
View File

@ -0,0 +1,661 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<http://www.gnu.org/licenses/>.

67
LICENSE.txt Normal file
View File

@ -0,0 +1,67 @@
Copyright (C) 2006-2008 City of Bloomington, Indiana. All rights reserved.
This Scaffolding is free software; you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
This Scaffolding is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this scaffolding; if not, you can get a copy at:
http://www.gnu.org/copyleft/gpl.html
Or, write to
Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor
Boston, MA 02110-1301, USA
---------------------------------------------------------------------
Yahoo's YUI Javascript Toolkit
---------------------------------------------------------------------
This scaffolding includes an installation of the YUI Javascript Toolkit
The YUI Toolkit is released under the BSD license
Software License Agreement (BSD License)
Copyright (c) 2008, Yahoo! Inc.
All rights reserved.
Redistribution and use of this software in source and binary forms, with or
without modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
* Neither the name of Yahoo! Inc. nor the names of its contributors may be
used to endorse or promote products derived from this software without specific
prior written permission of Yahoo! Inc.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,275 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<!-- General description of your web application -->
<display-name>Noisy Program</display-name>
<description>
This is version 1. of an application to perform
a wild and wonderful task, based on servlets and
JSP pages. It was written by WS
</description>
<!-- Context initialization parameters that define shared
String constants used within your application, which
can be customized by the system administrator who is
installing your application. The values actually
assigned to these parameters can be retrieved in a
servlet or JSP page by calling:
String value =
getServletContext().getInitParameter("name");
where "name" matches the <param-name> element of
one of these initialization parameters.
You can define any number of context initialization
parameters, including zero.
-->
<!-- No parameters for now WS
<context-param>
<param-name>webmaster</param-name>
<param-value>myaddress@mycompany.com</param-value>
<description>
The EMAIL address of the administrator to whom questions
and comments about this application should be addressed.
</description>
</context-param>
-->
<!-- Servlet definitions for the servlets that make up
your web application, including initialization
parameters. With Tomcat, you can also send requests
to servlets not listed here with a request like this:
http://localhost:8080/{context-path}/servlet/{classname}
but this usage is not guaranteed to be portable. It also
makes relative references to images and other resources
required by your servlet more complicated, so defining
all of your servlets (and defining a mapping to them with
a servlet-mapping element) is recommended.
Servlet initialization parameters can be retrieved in a
servlet or JSP page by calling:
String value =
getServletConfig().getInitParameter("name");
where "name" matches the <param-name> element of
one of these initialization parameters.
You can define any number of servlets, including zero.
-->
<servlet>
<servlet-name>RHUserLogin</servlet-name>
<description>
The User Menu
</description>
<servlet-class>RoseHill.RHUserLogin</servlet-class>
<load-on-startup>5</load-on-startup>
</servlet>
<servlet>
<servlet-name>RHLogout</servlet-name>
<description>
The User Menu
</description>
<servlet-class>RoseHill.RHLogout</servlet-class>
<load-on-startup>5</load-on-startup>
</servlet>
<servlet>
<servlet-name>RHUserMenu</servlet-name>
<description>
The User Menu
</description>
<servlet-class>RoseHill.RHUserMenu</servlet-class>
</servlet>
<servlet>
<servlet-name>RHAdminLogin</servlet-name>
<description>
The User Menu
</description>
<servlet-class>RoseHill.RHAdminLogin</servlet-class>
</servlet>
<servlet>
<servlet-name>RHAdminMenu</servlet-name>
<description>
The User Menu
</description>
<servlet-class>RoseHill.RHAdminMenu</servlet-class>
</servlet>
<servlet>
<servlet-name>RHAddUser</servlet-name>
<description>
The User Menu
</description>
<servlet-class>RoseHill.RHAddUser</servlet-class>
</servlet>
<servlet>
<servlet-name>RHDeleteUser</servlet-name>
<description>
The User Menu
</description>
<servlet-class>RoseHill.RHDeleteUser</servlet-class>
</servlet>
<servlet>
<servlet-name>Deed</servlet-name>
<description>
Add new records
</description>
<servlet-class>RoseHill.Deed</servlet-class>
</servlet>
<servlet>
<servlet-name>DeedBrowse</servlet-name>
<description>
Add new records
</description>
<servlet-class>RoseHill.DeedBrowse</servlet-class>
</servlet>
<servlet>
<servlet-name>DeedZoom</servlet-name>
<description>
Add new records
</description>
<servlet-class>RoseHill.DeedZoom</servlet-class>
</servlet>
<servlet>
<servlet-name>Rose</servlet-name>
<description>
Add new records
</description>
<servlet-class>RoseHill.Rose</servlet-class>
</servlet>
<servlet>
<servlet-name>RoseBrowse</servlet-name>
<description>
Add new records
</description>
<servlet-class>RoseHill.RoseBrowse</servlet-class>
</servlet>
<servlet>
<servlet-name>RoseZoom</servlet-name>
<description>
Add new records
</description>
<servlet-class>RoseHill.RoseZoom</servlet-class>
</servlet>
<servlet>
<servlet-name>showImage</servlet-name>
<description>
Add new records
</description>
<servlet-class>RoseHill.showImage</servlet-class>
</servlet>
<!-- Define mappings that are used by the servlet container to
translate a particular request URI (context-relative) to a
particular servlet. The examples below correspond to the
servlet descriptions above. Thus, a request URI like:
http://localhost:8080/{contextpath}/graph
will be mapped to the "graph" servlet, while a request like:
http://localhost:8080/{contextpath}/saveCustomer.do
will be mapped to the "controller" servlet.
You may define any number of servlet mappings, including zero.
It is also legal to define more than one mapping for the same
servlet, if you wish to.
-->
<servlet-mapping>
<servlet-name>Deed</servlet-name>
<url-pattern>/Deed</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>DeedBrowse</servlet-name>
<url-pattern>/DeedBrowse</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>DeedZoom</servlet-name>
<url-pattern>/DeedZoom</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Rose</servlet-name>
<url-pattern>/Rose</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>RoseBrowse</servlet-name>
<url-pattern>/RoseBrowse</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>RoseZoom</servlet-name>
<url-pattern>/RoseZoom</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>RHUserLogin</servlet-name>
<url-pattern>/RHUserLogin</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>RHUserMenu</servlet-name>
<url-pattern>/RHUserMenu</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>RHLogout</servlet-name>
<url-pattern>/RHLogout</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>RHAdminLogin</servlet-name>
<url-pattern>/AHAdminLogin</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>RHAdminMenu</servlet-name>
<url-pattern>/AHAdminMenu</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>RHAddUser</servlet-name>
<url-pattern>/RHAddUser</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>RHDeleteUser</servlet-name>
<url-pattern>/RHDeleteUser</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>showImage</servlet-name>
<url-pattern>/showImage</url-pattern>
</servlet-mapping>
<!--
<servlet-mapping>
<servlet-name>graph</servlet-name>
<url-pattern>/graph</url-pattern>
</servlet-mapping>
-->
<!-- Define the default session timeout for your application,
in minutes. From a servlet or JSP page, you can modify
the timeout for a particular session dynamically by using
HttpSession.getMaxInactiveInterval(). -->
<session-config>
<session-timeout>120</session-timeout> <!-- 120 minutes -->
</session-config>
</web-app>

34
access_control.inc Normal file
View File

@ -0,0 +1,34 @@
<?php
/**
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
$ZEND_ACL = new Zend_Acl();
/**
* Load the roles from the database
*/
$roles = new RoleList();
$roles->find();
foreach ($roles as $role) {
$ZEND_ACL = $ZEND_ACL->addRole(new Zend_Acl_Role($role->getName()));
}
/**
* Declare all the resources
*/
$ZEND_ACL->add(new Zend_Acl_Resource('Users'));
$ZEND_ACL->add(new Zend_Acl_Resource('Deeds'));
$ZEND_ACL->add(new Zend_Acl_Resource('Interments'));
$ZEND_ACL->add(new Zend_Acl_Resource('Cemeteries'));
$ZEND_ACL->add(new Zend_Acl_Resource('Sections'));
/**
* Assign permissions to the resources
*/
// Administrator is allowed access to everything
$ZEND_ACL->allow('Administrator');
$ZEND_ACL->allow('Editor','Deeds');
$ZEND_ACL->allow('Editor','Interments');

View File

@ -0,0 +1,38 @@
<?php
/**
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
?>
<h2>Add Cemetery</h2>
<form method="post" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" enctype="multipart/form-data">
<fieldset><legend>Cemetery Info</legend>
<table>
<tr><td><label for="cemetery-name" class="required">Name</label></td>
<td><input name="cemetery[name]" id="cemetery-name" />
</td>
</tr>
<tr><td><label for="cemetery-googleMapURL">Google Map URL</label></td>
<td><input name="cemetery[googleMapURL]" id="cemetery-googleMapURL" /></td>
</tr>
</table>
<button type="submit" class="submit">Submit</button>
<button type="button" class="cancel" onclick="document.location.href='<?php echo BASE_URL; ?>/cemeteries';">
Cancel
</button>
</fieldset>
<fieldset><legend>Maps</legend>
<div>
<label for="map">Map</lable>
<input type="file" name="map" id="map" />
</div>
<div>
<label for="thumbnail">Thumbnail</lable>
<input type="file" name="thumbnail" id="thumbnail" />
</div>
</fieldset>
</form>

View File

@ -0,0 +1,58 @@
<?php
/**
* @copyright 2010 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
* @param Cemetery $this->cemetery
*/
$addButton = '';
if (userIsAllowed('Sections')) {
$url = BASE_URL.'/sections/addSection.php?cemetery_id='.$this->cemetery->getId();
$addButton = "
<button type=\"button\" class=\"add\" onclick=\"document.location.href='$url';\">
Add a section
</button>
";
}
$name = View::escape($this->cemetery->getName());
echo "
<h1>$name</h1>
<h2>$addButton Sections
";
include APPLICATION_HOME.'/blocks/html/serviceButtons.inc';
echo "
</h2>
<table>
<thead>
<tr><th></th>
<th>Code</th>
<th>Name</th>
</tr>
</thead>
<tbody>
";
foreach ($this->cemetery->getSections() as $section) {
$editButton = '';
if (userIsAllowed('Sections')) {
$url = BASE_URL.'/sections/updateSection.php?section_id='.$section->getId();
$editButton = "
<button type=\"button\" class=\"edit\" onclick=\"document.location.href='$url';\">
Edit
</button>
";
}
$code = View::escape($section->getCode());
$name = View::escape($section->getName());
echo "
<tr><td>$editButton</td>
<td>$code</td>
<td>$name</td>
<td></td>
</tr>
";
}
echo "
</tbody>
</table>
";

View File

@ -0,0 +1,43 @@
<?php
/**
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
?>
<div class="interfaceBox">
<h2>
<?php
if (userIsAllowed('Cemeteries')) {
echo "
<button type=\"button\" class=\"add\" onclick=\"document.location.href='".BASE_URL."/cemeteries/addCemetery.php';\">
Add
</button>
";
}
?>
Cemeteries
<?php include APPLICATION_HOME.'/blocks/html/serviceButtons.inc'; ?>
</h2>
<ul><?php
foreach ($this->cemeteryList as $cemetery) {
$editButton = '';
if (userIsAllowed('Cemeteries')) {
$url = new URL(BASE_URL.'/cemeteries/updateCemetery.php');
$url->cemetery_id = $cemetery->getId();
$editButton = "
<button type=\"button\" class=\"edit\" onclick=\"document.location.href='$url';\">
Edit
</button>
";
}
$name = View::escape($cemetery->getName());
echo "
<li>$editButton
<a href=\"{$cemetery->getURL()}\">$name</a>
</li>
";
}
?>
</ul>
</div>

View File

@ -0,0 +1,55 @@
<?php
/**
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
* @param Cemetery $this->cemetery
*/
?>
<h2>Update Cemetery</h2>
<form method="post" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" enctype="multipart/form-data">
<fieldset><legend>Cemetery Info</legend>
<input name="cemetery_id" type="hidden" value="<?php echo $this->cemetery->getId(); ?>" />
<table>
<tr><td><label for="cemetery-name" class="required">Name</label></td>
<td><input name="cemetery[name]" id="cemetery-name"
value="<?php echo View::escape($this->cemetery->getName()); ?>" />
</td>
</tr>
<tr><td><label for="cemetery-googleMapURL">Google Map URL</label></td>
<td><input name="cemetery[googleMapURL]" id="cemetery-googleMapURL"
value="<?php echo View::escape($this->cemetery->getGoogleMapURL()); ?>" />
</td>
</tr>
</table>
<button type="submit" class="submit">Submit</button>
<button type="button" class="cancel" onclick="document.location.href='<?php echo BASE_URL; ?>/cemeteries';">
Cancel
</button>
</fieldset>
<fieldset><legend>Maps</legend>
<div>
<label for="map">Map</lable>
<input type="file" name="map" id="map" />
</div>
<?php
$map = $this->cemetery->getMap();
if ($map) {
echo "<div><img src=\"$map\" /></div>";
}
?>
<div>
<label for="thumbnail">Thumbnail</lable>
<input type="file" name="thumbnail" id="thumbnail" />
</div>
<?php
$map = $this->cemetery->getMap('thumbnail');
if ($map) {
echo "<div><img src=\"$map\" /></div>";
}
?>
</fieldset>
</form>

View File

@ -0,0 +1,74 @@
<?php
/**
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
?>
<h2>Add Deed</h2>
<form method="post" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>">
<fieldset><legend>Deed Info</legend>
<table>
<tr><td><label for="deed-section">Section</label></td>
<td><input name="deed[section]" id="deed-section" size="3" />
<label for="deed-lot">Lot</label>
<input name="deed[lot]" id="deed-lot" />
</td>
</tr>
<tr><td><label for="deed-firstname1">Owner 1</label></td>
<td><label for="deed-firstname1">First</label>
<input name="deed[firstname1]" id="deed-firstname1" />
<label for="deed-middleInitial1">MI</label>
<input name="deed[middleInitial1]" id="deed-middleInitial1" size="1" maxlength="1" />
<label for="deed-lastname1">Last</label>
<input name="deed[lastname1]" id="deed-lastname1" />
</td>
</tr>
<tr><td><label for="deed-firstname2">Owner 2</label></td>
<td><label for="deed-firstname2">First</label>
<input name="deed[firstname2]" id="deed-firstname2" />
<label for="deed-middleInitial2">MI</label>
<input name="deed[middleInitial2]" id="deed-middleInitial2" size="1" maxlength="1" />
<label for="deed-lastname2">Last</label>
<input name="deed[lastname2]" id="deed-lastname2" />
</td>
</tr>
<tr><td><label for="deed-issueDate">Date Issued</label></td>
<td><input name="deed[issueDate]" size="10" /></td>
</tr>
<tr><td><label for="deed-cemetery_id">Cemetery</label></td>
<td><select name="deed[cemetery_id]" id="deed-cemetery_id">
<option></option>
<?php
$list = new CemeteryList();
$list->find();
foreach ($list as $cemetery) {
$name = View::escape($cemetery->getName());
echo "<option value=\"{$cemetery->getId()}\">$name</option>";
}
?>
</select>
</td>
</tr>
<tr><td><label for="deed-notes">notes</label></td>
<td><textarea name="deed[notes]" id="deed-notes" rows="3" cols="60"></textarea>
</td>
</tr>
</table>
<button type="submit" class="submit">Submit</button>
<button type="button" class="cancel" onclick="document.location.href='<?php echo BASE_URL; ?>/deeds';">
Cancel
</button>
</fieldset>
</form>

View File

@ -0,0 +1,71 @@
<?php
/**
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
* @param DeedList $this->deedList
*/
?>
<div class="interfaceBox">
<h2>
<?php
if (userIsAllowed('Deeds')) {
echo "
<button type=\"button\" class=\"add\" onclick=\"document.location.href='".BASE_URL."/deeds/addDeed.php';\">
Add
</button>
";
}
?>
Deeds
</h2>
<table>
<thead>
<tr><th></th>
<th>Section, Lot</th>
<th>Owner 1</th>
<th>Owner 2</th>
<th>Issue Date</th>
<th>Cemetery</th>
</tr>
</thead>
<tbody>
<?php
foreach ($this->deedList as $deed) {
$editButton = '';
if (userIsAllowed('Deeds')) {
$url = new URL(BASE_URL.'/deeds/updateDeed.php');
$url->deed_id = $deed->getId();
$editButton = "
<button type=\"button\" class=\"edit\" onclick=\"document.location.href='$url';\">
Edit
</button>
";
}
$section = View::escape($deed->getSection());
$lot = View::escape($deed->getLot());
$owner1 = View::escape($deed->getOwner(1));
$owner2 = View::escape($deed->getOwner(2));
$date = $deed->getIssueDate('n/j/Y');
$cemetery = $deed->getCemetery() ? View::escape($deed->getCemetery()->getName()) : '';
echo "
<tr><td>$editButton</td>
<td>{$deed->getSection()}, {$deed->getLot()}</td>
<td>$owner1</td>
<td>$owner2</td>
<td>$date</td>
<td>$cemetery</td>
</tr>
";
}
?>
</tbody>
</table>
</div>
<?php
if ($this->deedList->getPaginator()) {
$pageNavigation = new Block('pageNavigation.inc',
array('pages'=>$this->deedList->getPaginator()->getPages()));
echo $pageNavigation->render('html');
}
?>

View File

@ -0,0 +1,54 @@
<?php
/**
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
?>
<form method="get" action="<?php echo BASE_URL; ?>/deeds">
<fieldset><legend>Search Deeds</legend>
<table>
<tr><td><label for="section">Section</label></td>
<td><input name="section" id="section" size="3"
value="<?php echo isset($_GET['section']) ? View::escape($_GET['section']) : ''; ?>" />
<label for="lot">Lot</label>
<input name="lot" id="lot" size="3"
value="<?php echo isset($_GET['lot']) ? View::escape($_GET['lot']) : ''; ?>" />
</td>
</tr>
<tr><td><label for="firstname">Owner</label></td>
<td><label for="firstname">Firstname</label>
<input name="firstname" id="firstname"
value="<?php echo isset($_GET['firstname']) ? View::escape($_GET['firstname']) : ''; ?>" />
<label for="lastname">Lastname</label>
<input name="lastname" id="lastname"
value="<?php echo isset($_GET['lastname']) ? View::escape($_GET['lastname']) : ''; ?>" />
</td>
</tr>
<tr><td><label for="cemetery_id">Cemetery</label></td>
<td><select name="cemetery_id" id="cemetery_id">
<option></option>
<?php
$list = new CemeteryList();
$list->find();
foreach ($list as $cemetery) {
$name = View::escape($cemetery->getName());
$selected = (isset($_GET['cemetery']) && $_GET['cemetery']==$name)
? 'selected="selected"'
: '';
echo "<option value=\"{$cemetery->getId()}\">$name</option>";
}
?>
</select>
</td>
</tr>
</table>
<button type="submit" class="search">Search</button>
<button type="button" onclick="document.location.href='<?php echo BASE_URL; ?>/deeds';">
Clear
</button>
</fieldset>
</form>

View File

@ -0,0 +1,87 @@
<?php
/**
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
@param Deed $this->deed
*/
?>
<h2>Update Deed</h2>
<form method="post" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>">
<fieldset><legend>Deed Info</legend>
<input name="deed_id" type="hidden" value="<?php echo $this->deed->getId(); ?>" />
<table>
<tr><td><label for="deed-section">Section</label></td>
<td><input name="deed[section]" id="deed-section" size="3"
value="<?php echo View::escape($this->deed->getSection()); ?>" />
<label for="deed-lot">Lot</label>
<input name="deed[lot]" id="deed-lot" size="3"
value="<?php echo View::escape($this->deed->getLot()); ?>" />
</td>
</tr>
<tr><td><label for="deed-firstname1">Owner 1</label></td>
<td><label for="deed-firstname1">First</label>
<input name="deed[firstname1]" id="deed-firstname1"
value="<?php echo View::escape($this->deed->getFirstname1()); ?>" />
<label for="deed-middleInitial1">MI</label>
<input name="deed[middleInitial1]" id="deed-middleInitial1"
size="1" maxlength="1"
value="<?php echo View::escape($this->deed->getMiddleInitial1()); ?>" />
<label for="deed-lastname1">Last</label>
<input name="deed[lastname1]" id="deed-lastname1"
value="<?php echo View::escape($this->deed->getLastname1()); ?>" />
</td>
</tr>
<tr><td><label for="deed-firstname2">Owner 2</label></td>
<td><label for="deed-firstname2">First</label>
<input name="deed[firstname2]" id="deed-firstname2"
value="<?php echo View::escape($this->deed->getFirstname2()); ?>" />
<label for="deed-middleInitial2">MI</label>
<input name="deed[middleInitial2]" id="deed-middleInitial2"
size="1" maxlength="1"
value="<?php echo View::escape($this->deed->getMiddleInitial2()); ?>" />
<label for="deed-lastname2">Last</label>
<input name="deed[lastname2]" id="deed-lastname2"
value="<?php echo View::escape($this->deed->getLastname2()); ?>" />
</td>
</tr>
<tr><td><label for="deed-issueDate">Date Issued</label></td>
<td><input name="deed[issueDate]" size="10" value="<?php echo $this->deed->getIssueDate('n/j/Y'); ?>" /></td>
</tr>
<tr><td><label for="deed-cemetery_id">Cemetery</label></td>
<td><select name="deed[cemetery_id]" id="deed-cemetery_id">
<option></option>
<?php
$list = new CemeteryList();
$list->find();
foreach ($list as $cemetery) {
$name = View::escape($cemetery->getName());
$selected = $this->deed->getCemetery_id()==$cemetery->getId()
? 'selected="selected"'
: '';
echo "<option value=\"{$cemetery->getId()}\">$name</option>";
}
?>
</select>
</td>
</tr>
<tr><td><label for="deed-notes">notes</label></td>
<td><textarea name="deed[notes]" id="deed-notes" rows="3" cols="60"><?php echo View::escape($this->deed->getNotes()); ?></textarea>
</td>
</tr>
</table>
<button type="submit" class="submit">Submit</button>
<button type="button" class="cancel" onclick="document.location.href='<?php echo BASE_URL; ?>/deeds';">
Cancel
</button>
</fieldset>
</form>

View File

@ -0,0 +1,25 @@
<?php
/**
* @copyright 2007,2008 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
* @param array $this->errorMessages
*/
?>
<div id="errorMessages">
<h1>No That's wrong</h1>
<?php
foreach ($this->errorMessages as $e)
{
$error = $e->getMessage();
if (file_exists(APPLICATION_HOME."/blocks/html/errorMessages/$error.inc"))
{
include APPLICATION_HOME."/blocks/html/errorMessages/$error.inc";
}
else
{
echo "<p>$error</p>";
}
}
?>
</div>

View File

@ -0,0 +1 @@
<p>You provided an invalid date.</p>

View File

@ -0,0 +1 @@
<p>The username and password combination you entered is not correct.</p>

View File

@ -0,0 +1 @@
<p>That username is not in LDAP. You cannot set LDAP authentication if the user is not in LDAP.</p>

View File

@ -0,0 +1 @@
<p>You did not include all the required fields.</p>

View File

@ -0,0 +1 @@
<p>Sorry, you're not allowed to go there.</p>

View File

@ -0,0 +1 @@
<p>You are not logged into this site anymore.</p>

View File

@ -0,0 +1 @@
<p>Your password is corrupted. Please contact a system administrator for help.</p>

View File

@ -0,0 +1 @@
<p>That username is not in our system</p>

View File

@ -0,0 +1 @@
<p>You can only create user accounts for people who are already in the system, or are in LDAP.</p>

View File

@ -0,0 +1 @@
<p>The password you entered is not correct.</p>

View File

@ -0,0 +1,96 @@
<?php
/**
* @copyright 2009-2010 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
* @param URL $this->return_url
*/
$return_url = isset($this->return_url) ? $this->return_url : BASE_URL.'/interments';
?>
<h2>Add Interment</h2>
<form method="post" action="<?php echo BASE_URL; ?>/interments/addInterment.php">
<fieldset>
<input type="hidden" name="return_url" value="<?php echo $return_url; ?>" />
<table>
<tbody>
<tr><td><label for="interment-cemetery_id" class="required">Cemetery</label></td>
<td><select name="interment[cemetery_id]" id="interment-cemetery_id"
onchange="COB.populateSections(this.options[this.selectedIndex].value,'interment-section_id','<?php echo BASE_URL; ?>')">
<option></option>
<?php
$list = new CemeteryList();
$list->find();
foreach ($list as $cemetery) {
$name = View::escape($cemetery->getName());
echo "<option value=\"{$cemetery->getId()}\">$name</option>";
}
?>
</select>
</td>
</tr>
<tr><td><label for="interment-section_id">Section</label></td>
<td><select name="interment[section_id]" id="interment-section_id">
<option></option>
</select>
<label for="interment-lot">Lot</label>
<input name="interment[lot]" id="interment-lot" size="5" maxlength="5" />
</td>
</tr>
<tr><td><label for="interment-book">Book</label></td>
<td><input name="interment[book]" id="interment-book" size="4" maxlength="4" />
<label for="interment-pageNumber">Page</label>
<input name="interment[pageNumber]" id="interment-pageNumber" size="5" maxlength="5" />
</td>
</tr>
<tr><td><label for="interment-firstname">First</label></td>
<td><input name="interment[firstname]" id="interment-firstname" /></td>
</tr>
<tr><td><label for="interment-middleInitial">MI</label></td>
<td><input name="interment[middleInitial]" id="interment-middleInitial" size="1" maxlength="1" />
</td>
</tr>
<tr><td><label for="interment-lastname">Last</label></td>
<td><input name="interment[lastname]" id="interment-lastname" /></td>
</tr>
<tr><td><label for="interment-birthPlace">Place of Birth</label></td>
<td><input name="interment[birthPlace]" id="interment-birthPlace" />
</td>
</tr>
<tr><td><label for="interment-lastResidence">Last Residence</label></td>
<td><input name="interment[lastResidence]" id="interment-lastResidence" />
</td>
</tr>
<tr><td><label for="interment-deceasedDate">Date of Death</label></td>
<td><input name="interment[deceasedDate]" id="interment-deceasedDate" size="10" />
<label for="interment-age">Age</label>
<input name="interment[age]" id="interment-age" size="3" maxlength="3" />
<label for="interment-sex">Gender</label>
<select name="interment[sex]" id="interment-sex">
<option></option>
<option>M</option>
<option>F</option>
</select>
</td>
</tr>
</tbody>
</table>
<div><label for="interment-notes">Notes</label></div>
<div>
<textarea name="interment[notes]" id="interment-notes" rows="3" cols="40"></textarea>
</div>
<button type="submit" class="submit">Submit</button>
<button type="button" class="cancel" onclick="document.location.href='<?php echo $return_url; ?>';">
Cancel
</button>
</fieldset>
</form>

View File

@ -0,0 +1,61 @@
<?php
/**
* @copyright 2009-2010 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
?>
<h2>Search Burial Records</h2>
<form method="get" action="<?php echo BASE_URL; ?>/interments">
<table>
<tr><td><label for="lastname">Last Name</label></td>
<td><input name="lastname" id="lastname"
value="<?php echo isset($_GET['lastname']) ? View::escape($_GET['lastname']) : ''; ?>" />
</td>
<td><label for="firstname">First Name</label></td>
<td><input name="firstname" id="firstname"
value="<?php echo isset($_GET['firstname']) ? View::escape($_GET['firstname']) : ''; ?>" />
</td>
</tr>
<tr><td><label for="cemetery_id">Cemetery</label></td>
<td><select name="cemetery_id" id="cemetery_id"
onchange="COB.populateSections(this.options[this.selectedIndex].value,'section_id','<?php echo BASE_URL; ?>')">
<option value="">Any Cemetery</option>
<?php
$cemeteries = new CemeteryList();
$cemeteries->find();
foreach ($cemeteries as $cemetery) {
$name = View::escape($cemetery->getName());
$selected = (isset($_GET['cemetery_id']) && $_GET['cemetery_id']==$cemetery->getId())
? 'selected="selected"'
: '';
echo "<option value=\"{$cemetery->getId()}\" $selected>$name</option>";
}
?>
</select>
</td>
<td><label for="section_id">Section</label></td>
<td><select name="section_id" id="section_id">
<option value="">Any Section</option>
<?php
if (isset($_GET['cemetery_id'])) {
$sections = new SectionList(array('cemetery_id'=>$_GET['cemetery_id']));
foreach ($sections as $section) {
$name = $section->getName()
? View::escape($section->getName())
: View::escape($section->getCode());
$selected = isset($_GET['section_id']) && $section->getId()==$_GET['section_id']
? 'selected="selected"'
: '';
echo "<option value=\"{$section->getId()}\" $selected>$name</option>";
}
}
?>
</select>
</td>
</tr>
</table>
<div>
<button type="submit" class="search">Search</button>
</div>
</form>

View File

@ -0,0 +1,63 @@
<?php
/**
* @copyright 2009-2010 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
?>
<h2>Search Burial Records</h2>
<form method="get" action="<?php echo BASE_URL; ?>/interments">
<table>
<tr><td><label for="lastname">Last Name</label></td>
<td><input name="lastname" id="lastname"
value="<?php echo isset($_GET['lastname']) ? View::escape($_GET['lastname']) : ''; ?>" />
</td>
</tr>
<tr><td><label for="firstname">First Name</label></td>
<td><input name="firstname" id="firstname"
value="<?php echo isset($_GET['firstname']) ? View::escape($_GET['firstname']) : ''; ?>" />
</td>
</tr>
<tr><td><label for="cemetery_id">Cemetery</label></td>
<td><select name="cemetery_id" id="cemetery_id"
onchange="COB.populateSections(this.options[this.selectedIndex].value,'section_id','<?php echo BASE_URL; ?>')">
<option value="">Any Cemetery</option>
<?php
$cemeteries = new CemeteryList();
$cemeteries->find();
foreach ($cemeteries as $cemetery) {
$name = View::escape($cemetery->getName());
$selected = (isset($_GET['cemetery_id']) && $_GET['cemetery_id']==$cemetery->getId())
? 'selected="selected"'
: '';
echo "<option value=\"{$cemetery->getId()}\" $selected>$name</option>";
}
?>
</select>
</td>
</tr>
<tr><td><label for="section_id">Section</label></td>
<td><select name="section_id" id="section_id">
<option value="">Any Section</option>
<?php
if (isset($_GET['cemetery_id'])) {
$sections = new SectionList(array('cemetery_id'=>$_GET['cemetery_id']));
foreach ($sections as $section) {
$name = $section->getName()
? View::escape($section->getName())
: View::escape($section->getCode());
$selected = isset($_GET['section_id']) && $section->getId()==$_GET['section_id']
? 'selected="selected"'
: '';
echo "<option value=\"{$section->getId()}\" $selected>$name</option>";
}
}
?>
</select>
</td>
</tr>
</table>
<div>
<button type="submit" class="search">Search</button>
</div>
</form>

View File

@ -0,0 +1,55 @@
<?php
/**
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
* @param Interment $this->interment
*/
$fullname = View::escape($this->interment->getFullname());
echo "<h2>$fullname</h2>";
$date = $this->interment->getDeceasedDate('n/j/Y');
$birth = View::escape($this->interment->getBirthPlace());
$residence = View::escape($this->interment->getLastResidence());
$cemetery = View::escape($this->interment->getCemetery());
$age = View::escape($this->interment->getAge());
$gender = View::escape($this->interment->getSex());
$section_lot = array();
if ($this->interment->getSection()) {
$section_lot[] = $this->interment->getSection();
}
if ($this->interment->getLot()) {
$section_lot[] = $this->interment->getLot();
}
$section_lot = View::escape(implode(', ',$section_lot));
?>
<table>
<tr><th>Date of Death </th>
<td><?php echo $date; ?></td>
</tr>
<tr><th>Last Residence </th>
<td><?php echo $residence; ?></td>
</tr>
<tr><th>Place of Birth </th>
<td><?php echo $birth; ?></td>
</tr>
<tr><th>Age </th>
<td><?php echo $age; ?></td>
</tr>
<tr><th>Gender </th>
<td><?php echo $gender; ?></td>
</tr>
<tr><th>Cemetery </th>
<td><?php echo $cemetery; ?></td>
</tr>
<tr><th>Section and Lot </th>
<td><?php echo $section_lot; ?></td>
</tr>
</table>
<?php
if (userIsAllowed('Interments')) {
$notes = View::escape($this->interment->getNotes());
echo "<p>$notes</p>";
}
?>

View File

@ -0,0 +1,100 @@
<?php
/**
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
* @param IntermentList $this->intermentList
* @param GET sort
*/
$previousSort = isset($_GET['sort']) ? $_GET['sort'] : 'deceasedDate';
$url = new URL($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']);
$url->purgeEmptyParameters();
$return_url = $url->__toString();
?>
<div class="interfaceBox">
<h2>
<?php
if (userIsAllowed('Interments')) {
$addURL = new URL(BASE_URL.'/interments/addInterment.php');
$addURL->return_url = $return_url;
echo "
<button type=\"button\" class=\"add\" onclick=\"document.location.href='$addURL';\">
Add
</button>
";
}
?>
Interments
<?php include APPLICATION_HOME.'/blocks/html/serviceButtons.inc'; ?>
</h2>
<table>
<thead>
<tr><th></th>
<th><?php
$url->sort = $previousSort=='lastname' ? 'lastname desc' : 'lastname';
echo "<a href=\"$url\" class=\"sorting\">Last Name</a>";
?>
</th>
<th><?php
$url->sort = $previousSort=='firstname' ? 'firstname desc' : 'firstname';
echo "<a href=\"$url\" class=\"sorting\">First Name</a>";
?>
</th>
<th><?php
$url->sort = $previousSort=='deceasedDate' ? 'deceasedDate desc' : 'deceasedDate';
echo "<a href=\"$url\" class=\"sorting\">Date of Death</a>";
?>
</th>
<th>Cemetery</th>
<th>Section &amp; Lot</th>
</tr>
</thead>
<tbody>
<?php
foreach ($this->intermentList as $interment) {
$editButton = '';
if (userIsAllowed('Interments')) {
$editURL = new URL(BASE_URL.'/interments/updateInterment.php');
$editURL->interment_id = $interment->getId();
$editURL->return_url = $return_url;
$editButton = "
<button type=\"button\" class=\"edit\" onclick=\"document.location.href='$editURL';\">
Edit
</button>
";
}
$last = View::escape($interment->getLastname());
$first = View::escape($interment->getFirstname());
$date = $interment->getDeceasedDate('n/j/Y');
$cemetery = View::escape($interment->getCemetery());
$section_lot = array();
if ($interment->getSection()) {
$section_lot[] = $interment->getSection();
}
if ($interment->getLot()) {
$section_lot[] = $interment->getLot();
}
$section_lot = View::escape(implode(', ',$section_lot));
echo "
<tr><td>$editButton</td>
<td><a href=\"{$interment->getURL()}\">$last</a></td>
<td>$first</td>
<td>$date</td>
<td>$cemetery</td>
<td>$section_lot</td>
</tr>
";
}
?>
</tbody>
</table>
</div>
<?php
if ($this->intermentList->getPaginator()) {
$pageNavigation = new Block('pageNavigation.inc',
array('pages'=>$this->intermentList->getPaginator()->getPages()));
echo $pageNavigation->render('html');
}
?>

View File

@ -0,0 +1,34 @@
<?php
/**
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @param Interment $this->interment
*/
$mapURL = BASE_URL.'/interments/maps.php?interment_id='.$this->interment->getId();
$cemetery = $this->interment->getCemetery();
$name = View::escape($cemetery->getName());
?>
<div id="burialLinks">
<table>
<tr><td><a href="<?php echo $mapURL; ?>">
<img src="<?php echo $cemetery->getMap('thumb'); ?>"
alt="<?php echo $name; ?>" />
</a>
</td>
<td><a href="<?php echo $mapURL; ?>">
View Maps of Cemetery and Section
</a>
</td>
</tr>
<tr><td><a href="<?php echo $cemetery->getGoogleMapURL(); ?>">
<img src="<?php echo BASE_URL; ?>/images/car.png"
alt="Direction map to <?php echo $name ?>" />
</a>
</td>
<td><a href="<?php echo $cemetery->getGoogleMapURL(); ?>">
Get driving directions to <?php echo $name ?>
</a>
</td>
</tr>
</table>
</div>

View File

@ -0,0 +1,46 @@
<?php
/**
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
* @param Interment $this->interment
*/
$highlighted_map = '';
$zoomed_map = '';
if ($this->interment->getSection_id()) {
$highlighted_map = $this->interment->getSection()->getMap();
$zoomed_map = $this->interment->getSection()->getMap('zoom');
}
echo "
<p class=\"back\">
<a href=\"{$this->interment->getURL()}\">Back to Interment Details</a>
</p>
";
if ($highlighted_map) {
echo "
<h2>Entire Cemetery with Section Highlighted</h2>
<div><img src=\"$highlighted_map\" /></div>
";
}
else {
echo "
<h2>Entire Cemetery </h2>
<div><img src=\"{$this->interment->getCemetery()->getMap()}\" /></div>
";
}
if ($zoomed_map) {
echo "
<h2>Close-up of Section</h2>
<div><img src=\"$zoomed_map\" /></div>
";
}
else {
echo "
<h2>Close-up of Section</h2>
<p>
We do not have information for this burial or we do not have the section currently mapped.
</p>
";
}

View File

@ -0,0 +1,130 @@
<?php
/**
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
* @param Interment $this->interment
* @param string $this->return_url
*/
$return_url = $this->return_url ? $this->return_url : BASE_URL.'/interments';
?>
<h2>Update Interment</h2>
<form method="post" action="<?php echo BASE_URL; ?>/interments/updateInterment.php">
<fieldset><legend>Interment Info</legend>
<input name="interment_id" type="hidden" value="<?php echo $this->interment->getId(); ?>" />
<input name="return_url" type="hidden" value="<?php echo $return_url; ?>" />
<table>
<tr><td><label for="interment-cemetery_id" class="required">Cemetery</label></td>
<td><select name="interment[cemetery_id]" id="interment-cemetery_id"
onchange="COB.populateSections(this.options[this.selectedIndex].value,'interment-section_id','<?php echo BASE_URL; ?>')">
<option></option>
<?php
$list = new CemeteryList();
$list->find();
foreach ($list as $cemetery) {
$name = View::escape($cemetery->getName());
$selected = $this->interment->getCemetery_id()==$cemetery->getId()
? 'selected="selected"'
: '';
echo "<option value=\"{$cemetery->getId()}\" $selected>$name</option>";
}
?>
</select>
</td>
</tr>
<tr><td><label for="interment-section_id">Section</label></td>
<td><select name="interment[section_id]" id="interment-section_id">
<option></option>
<?php
if ($this->interment->getSection_id()) {
foreach ($this->interment->getCemetery()->getSections() as $section) {
$name = $section->getName() ? View::escape($section->getName()) : View::escape($section->getCode());
$selected = $section->getId()==$this->interment->getSection_id()
? 'selected="selected"'
: '';
echo "<option value=\"{$section->getId()}\" $selected>$name</option>";
}
}
?>
</select>
<label for="interment-lot">Lot</label>
<input name="interment[lot]" id="interment-lot"
size="5" maxlength="5"
value="<?php echo View::escape($this->interment->getLot()); ?>" />
</td>
</tr>
<tr><td><label for="interment-book">Book</label></td>
<td><input name="interment[book]" id="interment-book"
size="4" maxlength="4"
value="<?php echo View::escape($this->interment->getBook()); ?>" />
<label for="interment-pageNumber">Page</label>
<input name="interment[pageNumber]" id="interment-pageNumber"
size="5" maxlength="5"
value="<?php echo View::escape($this->interment->getPageNumber()); ?>" />
</td>
</tr>
<tr><td><label for="interment-firstname">First</label></td>
<td><input name="interment[firstname]" id="interment-firstname"
value="<?php echo View::escape($this->interment->getFirstname()); ?>" />
</td>
</tr>
<tr><td><label for="interment-middleInitial">MI</label></td>
<td><input name="interment[middleInitial]" id="interment-middleInitial"
size="1" maxlength="1"
value="<?php echo View::escape($this->interment->getMiddleInitial()); ?>" />
</td>
</tr>
<tr><td><label for="interment-lastname">Last</label></td>
<td><input name="interment[lastname]" id="interment-lastname"
value="<?php echo View::escape($this->interment->getLastname()); ?>" />
</td>
</tr>
<tr><td><label for="interment-birthPlace">Place of Birth</label></td>
<td><input name="interment[birthPlace]" id="interment-birthPlace"
value="<?php echo View::escape($this->interment->getBirthPlace()); ?>" />
</td>
</tr>
<tr><td><label for="interment-lastResidence">Last Residence</label></td>
<td><input name="interment[lastResidence]" id="interment-lastResidence"
value="<?php echo View::escape($this->interment->getLastResidence()); ?>" />
</td>
</tr>
<tr><td><label for="interment-deceasedDate">Date of Death</label></td>
<td><input name="interment[deceasedDate]" id="interment-deceasedDate"
size="10" value="<?php echo $this->interment->getDeceasedDate('n/j/Y'); ?>" />
<label for="interment-age">Age</label>
<input name="interment[age]" id="interment-age"
size="3" maxlength="3"
value="<?php echo View::escape($this->interment->getAge()); ?>" />
<label for="interment-sex">Gender</label>
<select name="interment[sex]" id="interment-sex">
<option></option>
<option value="M" <?php echo $this->interment->getSex()=='M' ? 'selected="selected"' : ''; ?>>
M
</option>
<option value="F" <?php echo $this->interment->getSex()=='F' ? 'selected="selected"' : ''; ?>>
F
</option>
</select>
</td>
</tr>
</table>
<div><label for="interment-notes">Notes</label></div>
<div>
<textarea name="interment[notes]" id="interment-notes" rows="3" cols="60"><?php echo View::escape($this->interment->getNotes()); ?></textarea>
</div>
<button type="submit" class="submit">Submit</button>
<button type="button" class="cancel" onclick="document.location.href='<?php echo $return_url; ?>';">
Cancel
</button>
</fieldset>
</form>

15
blocks/html/loginForm.inc Normal file
View File

@ -0,0 +1,15 @@
<form method="post" action="<?php echo BASE_URL; ?>/login/login.php">
<fieldset><legend>Login</legend>
<input name="return_url" type="hidden" value="<?php echo View::escape($_SERVER['REQUEST_URI']); ?>" />
<table>
<tr><th><label for="username">Username:</label></th>
<td><input name="username" id="username" /></td><td></td>
</tr>
<tr><th><label for="password">Password:</label></th>
<td><input type="password" name="password" id="password" /></td>
<td><button type="submit" class="login">Login</button></td>
</tr>
</table>
</fieldset>
</form>

View File

@ -0,0 +1,35 @@
<?php
/**
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
?>
<h2>Add Person</h2>
<form method="post" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>">
<fieldset><legend>Personal Info</legend>
<table>
<tr><td><label for="person-firstname" class="required">Firstname</label></td>
<td><input name="person[firstname]" id="person-firstname" />
</td>
</tr>
<tr><td><label for="person-lastname" class="required">Lastname</label></td>
<td><input name="person[lastname]" id="person-lastname" />
</td>
</tr>
<tr><td><label for="person-email">Email</label></td>
<td><input name="person[email]" id="person-email" />
</td>
</tr>
</table>
<button type="submit" class="submit">Submit</button>
<button type="button" class="cancel" onclick="document.location.href='<?php echo BASE_URL; ?>/people';">
Cancel
</button>
</fieldset>
</form>

View File

@ -0,0 +1,29 @@
<?php
/**
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
* @param Person $this->person
*/
$username = $this->person->getUsername();
if (!$username && userIsAllowed('Users')) {
$url = BASE_URL.'/users/addUser.php?person_id='.$this->person->getId();
$username = "
<button type=\"button\" onclick=\"document.location.href='$url';\">
Create Account
</button>";
}
$name = View::escape($this->person->getFullname());
echo "
<h2>$name</h2>
<table>
<tr><th>Username</th>
<td>$username</td>
</tr>
<tr><th>Email</th>
<td>{$this->person->getEmail()}</td>
</tr>
</table>
";

View File

@ -0,0 +1,46 @@
<?php
/**
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
* @param PersonList $this->personList
*/
?>
<div class="interfaceBox">
<h2><?php
if (userIsAllowed('Users')) {
echo "
<button type=\"button\" class=\"add\" onclick=\"document.location.href='".BASE_URL."/people/addPerson.php';\">
Add A Person
</button>
";
}
?>
People
</h2>
<table>
<?php
foreach ($this->personList as $person) {
$editButton = '';
if (userIsAllowed('Users')) {
$editButton = "
<button type=\"button\" class=\"edit\" onclick=\"document.location.href='".BASE_URL."/people/updatePerson.php?person_id={$person->getId()}';\">
Edit
</button>
";
}
$name = View::escape($person->getFullname());
echo "
<tr><td>$editButton</td>
<td>{$person->getUsername()}</td>
<td><a href=\"{$person->getURL()}\">$name</a></td>
<td>{$person->getEmail()}</td>
</tr>
";
}
?>
</table>
</div>

View File

@ -0,0 +1,37 @@
<?php
/**
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
* @param Person $this->person
*/
?>
<h2>Update Person</h2>
<form method="post" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>">
<fieldset><legend>Person Info</legend>
<input name="person_id" type="hidden" value="<?php echo $this->person->getId(); ?>" />
<table>
<tr><td><label for="person-firstname" class="required">Firstname</label></td>
<td><input name="person[firstname]" id="person-firstname" value="<?php echo View::escape($this->person->getFirstname()); ?>" />
</td>
</tr>
<tr><td><label for="person-lastname" class="required">Lastname</label></td>
<td><input name="person[lastname]" id="person-lastname" value="<?php echo View::escape($this->person->getLastname()); ?>" />
</td>
</tr>
<tr><td><label for="person-email">Email</label></td>
<td><input name="person[email]" id="person-email" value="<?php echo View::escape($this->person->getEmail()); ?>" />
</td>
</tr>
</table>
<button type="submit" class="submit">Submit</button>
<button type="button" class="cancel" onclick="document.location.href='<?php echo BASE_URL; ?>/people';">
Cancel
</button>
</fieldset>
</form>

View File

@ -0,0 +1,42 @@
<?php
/**
* @copyright 2010 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
* @param Cemetery $this->cemetery
*/
?>
<h2>Add Section</h2>
<form method="post" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" enctype="multipart/form-data">
<fieldset><legend>Section Info</legend>
<input type="hidden" name="cemetery_id" value="<?php echo $this->cemetery->getId(); ?>" />
<table>
<tr><td><label for="code" class="required">Code</label></td>
<td><input name="code" id="code" size="5" maxlength="5" /></td>
</tr>
<tr><td><label for="name">Name</label></td>
<td><input name="name" id="name" /></td>
</tr>
</table>
<button type="submit" class="submit">Submit</button>
<button type="button" class="cancel"
onclick="document.location.href='<?php echo $this->cemetery->getURL(); ?>';">
Cancel
</button>
</fieldset>
<fieldset><legend>Maps</legend>
<div>
<label for="highlight_map">Highlight Map</lable>
<input type="file" name="highlight_map" id="highlight_map" />
</div>
<div>
<label for="zoom_map">Zoomed Map</lable>
<input type="file" name="zoom_map" id="zoom_map" />
</div>
</fieldset>
</form>

View File

@ -0,0 +1,56 @@
<?php
/**
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
* @param Section $this->section
*/
?>
<h2>Update Section</h2>
<form method="post" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" enctype="multipart/form-data">
<fieldset><legend>Section Info</legend>
<input name="section_id" type="hidden" value="<?php echo $this->section->getId(); ?>" />
<table>
<tr><td><label for="code" class="required">Code</label></td>
<td><input name="code" id="code" value="<?php echo View::escape($this->section->getCode()); ?>" />
</td>
</tr>
<tr><td><label for="name">Name</label></td>
<td><input name="name" id="name" value="<?php echo View::escape($this->section->getName()); ?>" />
</td>
</tr>
</table>
<button type="submit" class="submit">Submit</button>
<button type="button" class="cancel"
onclick="document.location.href='<?php echo $this->section->getCemetery()->getURL(); ?>';">
Cancel
</button>
</fieldset>
<fieldset><legend>Maps</legend>
<div>
<label for="highlight_map">Highlight Map</lable>
<input type="file" name="highlight_map" id="highlight_map" />
</div>
<?php
$highlight = $this->section->getMap('highlight');
if ($highlight) {
echo "<div><img src=\"$highlight\" /></div>";
}
?>
<div>
<label for="zoom_map">Zoomed Map</lable>
<input type="file" name="zoom_map" id="zoom_map" />
</div>
<?php
$zoom = $this->section->getMap('zoom');
if ($zoom) {
echo "<div><img src=\"$zoom\" /></div>";
}
?>
</fieldset>
</form>

View File

@ -0,0 +1,22 @@
<?php
/**
* Renders buttons for each of the known output formats, pointing to the current URL
*
* @copyright 2010 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
$serviceURL = new URL($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']);
$serviceURL->purgeEmptyParameters();
$serviceURL->format = 'xml';
echo "
<button type=\"button\" class=\"xml\" onclick=\"window.open('$serviceURL');\">
XML
</button>
";
$serviceURL->format = 'json';
echo "
<button type=\"button\" class=\"json\" onclick=\"window.open('$serviceURL');\">
JSON
</button>
";

View File

@ -0,0 +1,52 @@
<?php
/**
* @copyright 2006-2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
?>
<h2>New User Account</h2>
<form method="post" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>">
<fieldset><legend>Login Info</legend>
<table>
<tr><td><label for="user-authenticationMethod">Authentication</label></td>
<td><select name="user[authenticationMethod]" id="user-authenticationMethod">
<option <?php if(isset($_POST['user']['authenticationMethod']) && $_POST['user']['authenticationMethod']=="LDAP") echo "selected=\"selected\""; ?>>
LDAP
</option>
<option <?php if(isset($_POST['user']['authenticationMethod']) && $_POST['user']['authenticationMethod']=="local") echo "selected=\"selected\""; ?>>
local
</option>
</select>
</td>
</tr>
<tr><td><label for="user-username">Username</label></td>
<td><input name="user[username]" id="user-username" value="<?php if(isset($_POST['user']['username'])) echo View::escape($_POST['user']['username']); ?>" />
</td>
</tr>
<tr><td><label for="user-password">Password</label></td>
<td><input name="user[password]" id="user-password" /></td>
</tr>
<tr><td><label for="user[roles]">Roles</label></td>
<td><select name="user[roles][]" id="user-roles" size="5" multiple="multiple">
<?php
$roles = new RoleList();
$roles->find();
foreach ($roles as $role) {
$selected = (isset($_POST['user']['roles']) && in_array($role,$_POST['user']['roles']))
? 'selected="selected"'
: '';
echo "<option $selected>$role</option>";
}
?>
</select>
</td>
</tr>
</table>
<button type="submit" class="submit">Submit</button>
<button type="button" class="cancel" onclick="document.location.href='<?php echo BASE_URL; ?>/users';">
Cancel
</button>
</fieldset>
</form>

View File

@ -0,0 +1,53 @@
<?php
/**
* @copyright 2006-2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
* @param User $this->user
*/
?>
<h2>Edit <?php echo $this->user->getUsername(); ?></h2>
<form method="post" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>">
<fieldset><legend>Login Info</legend>
<input name="user_id" type="hidden" value="<?php echo $this->user->getId(); ?>" />
<table>
<tr><td><label for="user-authenticationMethod">Authentication</label></td>
<td><select name="user[authenticationMethod]" id="user-authenticationMethod">
<option <?php if ($this->user->getAuthenticationMethod()=='LDAP') echo "selected=\"selected\""; ?>>
LDAP
</option>
<option <?php if ($this->user->getAuthenticationMethod()=='local') echo "selected=\"selected\""; ?>>
local
</option>
</select>
</td>
</tr>
<tr><td><label for="user-username">Username</label></td>
<td><input name="user[username]" id="user-username" value="<?php echo View::escape($this->user->getUsername()); ?>" />
</td>
</tr>
<tr><td><label for="user-password">Password</label></td>
<td><input name="user[password]" id="user-password" /></td>
</tr>
<tr><td><label for="user-roles">Roles</label></td>
<td><select name="user[roles][]" id="user-roles" size="5" multiple="multiple">
<?php
$roles = new RoleList();
$roles->find();
foreach ($roles as $role) {
$selected = in_array($role,$this->user->getRoles())
? 'selected="selected"'
: '';
echo "<option $selected>$role</option>";
}
?>
</select>
</td>
</tr>
</table>
<button type="submit" class="submit">Submit</button>
<button type="button" class="cancel" onclick="document.location.href='<?php echo BASE_URL; ?>/users';">
Cancel
</button>
</fieldset>
</form>

View File

@ -0,0 +1,57 @@
<?php
/**
* @copyright 2007-2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
* @param UserList $this->userList
*/
?>
<div class="interfaceBox">
<h2><?php
if (userIsAllowed('Users')) {
echo "
<button type=\"button\" class=\"add\" onclick=\"document.location.href='".BASE_URL."/users/addUser.php';\">
Add User Account
</button>
";
}
?>
User Accounts
</h2>
<table>
<?php
foreach ($this->userList as $user) {
$editButton = '';
$deleteButton = '';
if (userIsAllowed('Users')) {
$editButton = "
<button type=\"button\" class=\"edit\" onclick=\"document.location.href='".BASE_URL."/users/updateUser.php?user_id={$user->getId()}';\">
Edit User Account
</button>
";
$deleteButton = "
<button type=\"button\" class=\"delete\" onclick=\"document.location.href='".BASE_URL."/users/deleteUser.php?user_id={$user->getId()}';\">
Delete User Account
</button>
";
}
echo "
<tr><td>$editButton</td>
<td>{$user->getUsername()}</td>
<td>{$user->getFirstname()} {$user->getLastname()}</td>
<td>{$user->getAuthenticationMethod()}</td>
<td>
";
foreach ($user->getRoles() as $role) {
echo "$role ";
}
echo "
</td>
</tr>
";
}
?>
</table>
</div>

View File

@ -0,0 +1,50 @@
<h1>Web Service API</h1>
<p>
Cemetery provides read-only, RESTful style web services in XML and JSON.
The idea is to provide all the information in output formats other than HTML.
For example, adding format=XML to certain URLs will give you an XML version
of the data.
</p>
<h2>Interment Data</h2>
<p><a href="<?php echo BASE_URL; ?>/interments"><?php echo BASE_URL; ?>/interments</a></p>
<p>
Cemetery allows you to search for interments and receive the data as XML or JSON.
The default is the HTML view, but adding a format parameter will give you data in the requested
format. (assuming that format is one we support)
</p>
<p>
An easy way to see it work, is to do a search as you normally would; then, add a 'format'
parameter to the URL.
Right now we support format=xml and format=json.
We'll add more output formats as time goes on.
</p>
<p>The search parameters we currently support are:</p>
<ul><li>lastname</li>
<li>firstname</li>
<li>cemetery_id</li>
<li>section_id</li>
</ul>
<p>
Cemetery and Section require sending the ID number for the cemetery or section
you're looking for.
An easy way to discover the ID numbers is to view source on the search form,
or look at the query strings of other searches.
</p>
<p>You can also get this information by looking at the cemetery information.</p>
<h2>Cemetery Information</h2>
<p><a href="<?php echo BASE_URL; ?>/cemeteries"><?php echo BASE_URL; ?>/cemeteries</a></p>
<p>
We also provide this data in XML and JSON format.
A list of the cemeteries is at:
<a href="<?php echo BASE_URL; ?>/cemeteries"><?php echo BASE_URL; ?>/cemeteries</a>.
</p>
<p>
You can find out the sections for a cemetery on it's detail view.
</p>

View File

@ -0,0 +1,22 @@
<?php
/**
* @copyright 2010 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
* @param Cemetery $this->cemetery
*/
$sections = array();
foreach ($this->cemetery->getSections() as $section) {
$code = addslashes($section->getCode());
$name = addslashes($section->getName());
$sections[] = "{\"id\":{$section->getId()},\"code\":\"$code\",\"name\":\"$name\"}";
}
$sections = implode(',',$sections);
$name = addslashes($this->cemetery->getName());
echo "
{ \"id\":{$this->cemetery->getId()},
\"name\":\"$name\",
\"sections\":[$sections]
}
";

View File

@ -0,0 +1,21 @@
<?php
/**
* @copyright 2010 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
$cemeteries = array();
foreach ($this->cemeteryList as $cemetery) {
$name = addslashes($cemetery->getName());
$url = addslashes($cemetery->getURL());
$googleMapUrl = addslashes($cemetery->getGoogleMapURL());
$cemeteries[] = "
{ \"id\":\"{$cemetery->getId()}\",
\"name\":\"$name\",
\"url\":\"$url\",
\"googleMapUrl\":\"$googleMapUrl\"
}
";
}
$cemeteries = implode(',',$cemeteries);
echo "[$cemeteries]";

View File

@ -0,0 +1,27 @@
<?php
/**
* @copyright 2010 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
* @param Cemetery $this->cemetery
*/
$name = View::escape($this->cemetery->getName());
echo "
<cemetery id=\"{$this->cemetery->getId()}\">
<name>$name</name>
<sections>
";
foreach ($this->cemetery->getSections() as $section) {
$code = View::escape($section->getCode());
$name = View::escape($section->getName());
echo "
<section id=\"{$section->getId()}\">
<code>$code</code>
<name>$name</name>
</section>
";
}
echo "
</sections>
</cemetery>
";

View File

@ -0,0 +1,21 @@
<cemeteries>
<?php
/**
* @copyright 2010 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
foreach ($this->cemeteryList as $cemetery) {
$name = View::escape($cemetery->getName());
$url = View::escape($cemetery->getURL());
$googleMapUrl = View::escape($cemetery->getGoogleMapURL());
echo "
<cemetery id=\"{$cemetery->getId()}\">
<name>$name</name>
<url>$url</url>
<googleMapUrl>$googleMapUrl</googleMapUrl>
</cemetery>
";
}
?>
</cemeteries>

View File

@ -0,0 +1,44 @@
<interments>
<?php
/**
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
* @param IntermentList $this->intermentList
* @param GET sort
*/
foreach ($this->intermentList as $interment) {
$last = View::escape($interment->getLastname());
$first = View::escape($interment->getFirstname());
$date = $interment->getDeceasedDate('Y-m-d');
$lot = View::escape($interment->getLot());
$cemetery_name = '';
if ($interment->getCemetery_id()) {
$cemetery_name = View::escape($interment->getCemetery()->getName());
}
$section_code = '';
$section_name = '';
if ($interment->getSection_id()) {
$section_code = View::escape($interment->getSection()->getCode());
$section_name = View::escape($interment->getSection()->getName());
}
echo "
<interment id=\"{$interment->getId()}\">
<lastname>$last</lastname>
<firstname>$first</firstname>
<deceasedDate>$date</deceasedDate>
<cemetery id=\"{$interment->getCemetery_id()}\">
<name>$cemetery_name</name>
</cemetery>
<section id=\"{$interment->getSection_id()}\">
<code>$section_code</code>
<name>$section_name</name>
</section>
<lot>$lot</lot>
</interment>
";
}
?>
</interments>

476
build.xml
View File

@ -1,476 +0,0 @@
<!--
General purpose build script for web applications and web services,
including enhanced support for deploying directly to a Tomcat 4
based server.
This build script assumes that the source code of your web application
is organized into the following subdirectories underneath the source
code directory from which you execute the build script:
docs Static documentation files to be copied to
the "docs" subdirectory of your distribution.
src Java source code (and associated resource files)
to be compiled to the "WEB-INF/classes"
subdirectory of your web applicaiton.
web Static HTML, JSP, and other content (such as
image files), including the WEB-INF subdirectory
and its configuration file contents.
$Id: build.xml.txt,v 1.5 2002/02/14 07:06:36 craigmcc Exp $
-->
<!-- A "project" describes a set of targets that may be requested
when Ant is executed. The "default" attribute defines the
target which is executed if no specific target is requested,
and the "basedir" attribute defines the current working directory
from which Ant executes the requested task. This is normally
set to the current working directory.
-->
<project name="RoseHill" default="compile" basedir=".">
<!-- ===================== Property Definitions =========================== -->
<!--
Each of the following properties are used in the build script.
Values for these properties are set by the first place they are
defined, from the following list:
* Definitions on the "ant" command line (ant -Dfoo=bar compile).
* Definitions from a "build.properties" file in the top level
source directory of this application.
* Definitions from a "build.properties" file in the developer's
home directory.
* Default definitions in this build.xml file.
You will note below that property values can be composed based on the
contents of previously defined properties. This is a powerful technique
that helps you minimize the number of changes required when your development
environment is modified. Note that property composition is allowed within
"build.properties" files as well as in the "build.xml" script.
-->
<property file="build.properties"/>
<property file="${user.home}/build.properties"/>
<!-- ==================== File and Directory Names ======================== -->
<!--
These properties generally define file and directory names (or paths) that
affect where the build process stores its outputs.
app.name Base name of this application, used to
construct filenames and directories.
Defaults to "myapp".
app.path Context path to which this application should be
deployed (defaults to "/" plus the value of the
"app.name" property).
app.version Version number of this iteration of the application.
build.home The directory into which the "prepare" and
"compile" targets will generate their output.
Defaults to "build".
catalina.home The directory in which you have installed
a binary distribution of Tomcat 4. This will
be used by the "deploy" target.
dist.home The name of the base directory in which
distribution files are created.
Defaults to "dist".
manager.password The login password of a user that is assigned the
"manager" role (so that he or she can execute
commands via the "/manager" web application)
manager.url The URL of the "/manager" web application on the
Tomcat installation to which we will deploy web
applications and web services.
manager.username The login username of a user that is assigned the
"manager" role (so that he or she can execute
commands via the "/manager" web application)
-->
<property name="app.name" value="RoseHill"/>
<property name="app.path" value="/${app.name}"/>
<property name="app.version" value="0.1-dev"/>
<property name="build.home" value="${basedir}/build"/>
<property name="catalina.home" value="../../"/> <!-- UPDATE THIS! -->
<property name="dist.home" value="${basedir}/dist"/>
<property name="docs.home" value="${basedir}/docs"/>
<!--
<property name="manager.url" value="http://localhost:8080/manager"/>
-->
<property name="src.home" value="${basedir}/src"/>
<property name="web.home" value="${basedir}/web"/>
<!-- ================== Custom Ant Task Definitions ======================= -->
<!--
These properties define custom tasks for the Ant build tool that interact
with the "/manager" web application installed with Tomcat 4. Before they
can be successfully utilized, you must perform the following steps:
- Copy the file "server/lib/catalina-ant.jar" from your Tomcat 4
installation into the "lib" directory of your Ant installation.
- Create a "build.properties" file in your application's top-level
source directory (or your user login home directory) that defines
appropriate values for the "manager.password", "manager.url", and
"manager.username" properties described above.
For more information about the Manager web application, and the functionality
of these tasks, see <http://localhost:8080/tomcat-docs/manager-howto.html>.
-->
<taskdef name="install" classname="org.apache.catalina.ant.InstallTask"/>
<taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"/>
<taskdef name="remove" classname="org.apache.catalina.ant.RemoveTask"/>
<!-- ==================== Compilation Control Options ==================== -->
<!--
These properties control option settings on the Javac compiler when it
is invoked using the <javac> task.
compile.debug Should compilation include the debug option?
compile.deprecation Should compilation include the deprecation option?
compile.optimize Should compilation include the optimize option?
-->
<property name="compile.debug" value="true"/>
<property name="compile.deprecation" value="false"/>
<property name="compile.optimize" value="true"/>
<!-- ==================== External Dependencies =========================== -->
<!--
Use property values to define the locations of external JAR files on which
your application will depend. In general, these values will be used for
two purposes:
* Inclusion on the classpath that is passed to the Javac compiler
* Being copied into the "/WEB-INF/lib" directory during execution
of the "deploy" target.
Because we will automatically include all of the Java classes that Tomcat 4
exposes to web applications, we will not need to explicitly list any of those
dependencies. You only need to worry about external dependencies for JAR
files that you are going to include inside your "/WEB-INF/lib" directory.
-->
<!-- Dummy external dependency -->
<!--
<property name="foo.jar"
value="/path/to/foo.jar"/>
-->
<!-- ==================== Compilation Classpath =========================== -->
<!--
Rather than relying on the CLASSPATH environment variable, Ant includes
features that makes it easy to dynamically construct the classpath you
need for each compilation. The example below constructs the compile
classpath to include the servlet.jar file, as well as the other components
that Tomcat makes available to web applications automatically, plus anything
that you explicitly added.
-->
<path id="compile.classpath">
<!-- Include all JAR files that will be included in /WEB-INF/lib -->
<!-- *** CUSTOMIZE HERE AS REQUIRED BY YOUR APPLICATION *** -->
<!--
<pathelement location="${foo.jar}"/>
-->
<!-- Include all elements that Tomcat exposes to applications -->
<pathelement location="${catalina.home}/common/classes"/>
<fileset dir="${catalina.home}/common/endorsed">
<include name="*.jar"/>
</fileset>
<fileset dir="${catalina.home}/common/lib">
<include name="*.jar"/>
</fileset>
<pathelement location="${catalina.home}/shared/classes"/>
<fileset dir="${catalina.home}/shared/lib">
<include name="*.jar"/>
</fileset>
<pathelement location="${catalina.home}/shared/classes"/>
<fileset dir="${catalina.home}/shared/lib">
<include name="*.zip"/>
</fileset>
</path>
<!-- ==================== All Target ====================================== -->
<!--
The "all" target is a shortcut for running the "clean" target followed
by the "compile" target, to force a complete recompile.
-->
<target name="all" depends="clean,compile"
description="Clean build and dist directories, then compile"/>
<!-- ==================== Clean Target ==================================== -->
<!--
The "clean" target deletes any previous "build" and "dist" directory,
so that you can be ensured the application can be built from scratch.
-->
<target name="clean"
description="Delete old build and dist directories">
<delete dir="${build.home}"/>
<delete dir="${dist.home}"/>
</target>
<!-- ==================== Compile Target ================================== -->
<!--
The "compile" target transforms source files (from your "src" directory)
into object files in the appropriate location in the build directory.
This example assumes that you will be including your classes in an
unpacked directory hierarchy under "/WEB-INF/classes".
-->
<target name="compile" depends="prepare"
description="Compile Java sources">
<!-- Compile Java classes as necessary -->
<mkdir dir="${build.home}/WEB-INF/classes"/>
<javac srcdir="${src.home}"
destdir="${build.home}/WEB-INF/classes"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}">
<classpath refid="compile.classpath"/>
</javac>
<!-- Copy application resources -->
<copy todir="${build.home}/WEB-INF/classes">
<fileset dir="${src.home}" excludes="**/*.java"/>
</copy>
</target>
<!-- ==================== Dist Target ===================================== -->
<!--
The "dist" target creates a binary distribution of your application
in a directory structure ready to be archived in a tar.gz or zip file.
Note that this target depends on two others:
* "compile" so that the entire web application (including external
dependencies) will have been assembled
* "javadoc" so that the application Javadocs will have been created
-->
<target name="dist" depends="compile,javadoc"
description="Create binary distribution">
<!-- Copy documentation subdirectories -->
<mkdir todir="${dist.home}/docs"/>
<copy todir="${dist.home}/docs">
<fileset dir="${docs.home}"/>
</copy>
<!-- Create application JAR file -->
<jar jarfile="${dist.home}/${app.name}-${app.version}.war"
basedir="${build.home}"/>
<!-- Copy additional files to ${dist.home} as necessary -->
</target>
<!-- ==================== Install Target ================================== -->
<!--
The "install" target tells the specified Tomcat 4 installation to dynamically
install this web application and make it available for execution. It does
*not* cause the existence of this web application to be remembered across
Tomcat restarts; if you restart the server, you will need to re-install all
this web application.
If you have already installed this application, and simply want Tomcat to
recognize that you have updated Java classes (or the web.xml file), use the
"reload" target instead.
NOTE: This target will only succeed if it is run from the same server that
Tomcat is running on.
NOTE: This is the logical opposite of the "remove" target.
-->
<target name="install" depends="compile"
description="Install application to servlet container">
<install url="${manager.url}"
username="${manager.username}"
password="${manager.password}"
path="${app.path}"
war="file://${build.home}"/>
</target>
<!-- ==================== Javadoc Target ================================== -->
<!--
The "javadoc" target creates Javadoc API documentation for the Java
classes included in your application. Normally, this is only required
when preparing a distribution release, but is available as a separate
target in case the developer wants to create Javadocs independently.
-->
<target name="javadoc" depends="compile"
description="Create Javadoc API documentation">
<mkdir dir="${dist.home}/docs/api"/>
<javadoc sourcepath="${src.home}"
destdir="${dist.home}/docs/api"
packagenames="*">
<classpath refid="compile.classpath"/>
</javadoc>
</target>
<!-- ==================== Prepare Target ================================== -->
<!--
The "prepare" target is used to create the "build" destination directory,
and copy the static contents of your web application to it. If you need
to copy static files from external dependencies, you can customize the
contents of this task.
Normally, this task is executed indirectly when needed.
-->
<target name="prepare">
<!-- Create build directories as needed -->
<mkdir dir="${build.home}"/>
<mkdir dir="${build.home}/WEB-INF"/>
<mkdir dir="${build.home}/WEB-INF/classes"/>
<!-- Copy static content of this web application -->
<copy todir="${build.home}">
<fileset dir="${web.home}"/>
</copy>
<!-- Copy external dependencies as required -->
<!-- *** CUSTOMIZE HERE AS REQUIRED BY YOUR APPLICATION *** -->
<mkdir dir="${build.home}/WEB-INF/lib"/>
<!--
<copy todir="${build.home}/WEB-INF/lib" file="${foo.jar}"/>
-->
<!-- Copy static files from external dependencies as needed -->
<!-- *** CUSTOMIZE HERE AS REQUIRED BY YOUR APPLICATION *** -->
</target>
<!-- ==================== Reload Target =================================== -->
<!--
The "reload" target tells the specified Tomcat 4 installation to dynamically
reload this web application, to reflect changes in the underlying classes or
the "web.xml" deployment descriptor.
-->
<target name="reload"
description="Reload application on servlet container">
<reload url="${manager.url}"
username="${manager.username}"
password="${manager.password}"
path="${app.path}"/>
</target>
<!-- ==================== Remove Target =================================== -->
<!--
The "remove" target tells the specified Tomcat 4 installation to dynamically
remove this web application from service.
NOTE: This is the logical opposite of the "install" target.
-->
<target name="remove"
description="Remove application on servlet container">
<remove url="${manager.url}"
username="${manager.username}"
password="${manager.password}"
path="${app.path}"/>
</target>
</project>

Binary file not shown.

213
classes/Cemetery.php Normal file
View File

@ -0,0 +1,213 @@
<?php
/**
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
class Cemetery
{
private $id;
private $name;
private $googleMapURL;
/**
* Populates the object with data
*
* Passing in an associative array of data will populate this object without
* hitting the database.
*
* Passing in a scalar will load the data from the database.
* This will load all fields in the table as properties of this class.
* You may want to replace this with, or add your own extra, custom loading
*
* @param int|array $id
*/
public function __construct($id=null)
{
if ($id) {
if (is_array($id)) {
$result = $id;
}
else {
$zend_db = Database::getConnection();
if (ctype_digit($id)) {
$sql = 'select * from cemeteries where id=?';
}
else {
$sql = 'select * from cemeteries where name=?';
}
$result = $zend_db->fetchRow($sql,array($id));
}
if ($result) {
foreach ($result as $field=>$value) {
if ($value) {
$this->$field = $value;
}
}
}
else {
throw new Exception('cemeteries/unknownCemetery');
}
}
else {
// This is where the code goes to generate a new, empty instance.
// Set any default values for properties that need it here
}
}
/**
* Throws an exception if anything's wrong
* @throws Exception $e
*/
public function validate()
{
// Check for required fields here. Throw an exception if anything is missing.
if (!$this->name) {
throw new Exception('missingName');
}
}
/**
* Saves this record back to the database
*/
public function save()
{
$this->validate();
$data = array();
$data['name'] = $this->name;
$data['googleMapURL'] = $this->googleMapURL ? $this->googleMapURL : null;
if ($this->id) {
$this->update($data);
}
else {
$this->insert($data);
}
}
private function update($data)
{
$zend_db = Database::getConnection();
$zend_db->update('cemeteries',$data,"id='{$this->id}'");
}
private function insert($data)
{
$zend_db = Database::getConnection();
$zend_db->insert('cemeteries',$data);
$this->id = $zend_db->lastInsertId('cemeteries','id');
}
//----------------------------------------------------------------
// Generic Getters
//----------------------------------------------------------------
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @return string
*/
public function getGoogleMapURL()
{
return $this->googleMapURL;
}
//----------------------------------------------------------------
// Generic Setters
//----------------------------------------------------------------
/**
* @param string $string
*/
public function setName($string)
{
$this->name = trim($string);
}
/**
* @param string $string
*/
public function setGoogleMapURL($string)
{
$this->googleMapURL = trim($string);
}
//----------------------------------------------------------------
// Custom Functions
// We recommend adding all your custom code down here at the bottom
//----------------------------------------------------------------
public function __toString()
{
return $this->name;
}
/**
* Returns all the available sections for this cemetery
*
* @return array
*/
public function getSections()
{
return new SectionList(array('cemetery_id'=>$this->id));
}
/**
* @return URL
*/
public function getURL()
{
return new URL(BASE_URL.'/cemeteries/viewCemetery.php?cemetery_id='.$this->id);
}
private function getMapDirectory()
{
return 'images/cemeteries/'.$this->id;
}
/**
* Returns the URL to the map image for this cemetery
*
* Available map types are:
* full, thumb - for the main map
*
* @return string
*/
public function getMap($type="full")
{
$imageDir = "images/cemeteries/{$this->id}";
$filename = $type=='full' ? 'map' : 'map_thumb';
$glob = glob(APPLICATION_HOME."/html/$imageDir/$filename.*");
if (count($glob)) {
$filename = basename($glob[0]);
return BASE_URL."/$imageDir/$filename";
}
}
/**
* @param array|string $file Either an entry from $_FILES or a path to a file
*/
public function saveMap($file,$type)
{
$imageDir = $this->getMapDirectory();
$name = $type=='full' ? 'map' : 'map_thumb';
$directory = APPLICATION_HOME."/html/$imageDir";
Map::saveFile($directory,$file,$name);
}
}

87
classes/CemeteryList.php Normal file
View File

@ -0,0 +1,87 @@
<?php
/**
* A collection class for Cemetery objects
*
* This class creates a zend_db select statement.
* ZendDbResultIterator handles iterating and paginating those results.
* As the results are iterated over, ZendDbResultIterator will pass each desired
* row back to this class's loadResult() which will be responsible for hydrating
* each Cemetery object
*
* Beyond the basic $fields handled, you will need to write your own handling
* of whatever extra $fields you need
*/
/**
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
class CemeteryList extends ZendDbResultIterator
{
/**
* Creates a basic select statement for the collection.
*
* Populates the collection if you pass in $fields
* Setting itemsPerPage turns on pagination mode
* In pagination mode, this will only load the results for one page
*
* @param array $fields
* @param int $itemsPerPage Turns on Pagination
* @param int $currentPage
*/
public function __construct($fields=null,$itemsPerPage=null,$currentPage=null)
{
parent::__construct($itemsPerPage,$currentPage);
if (is_array($fields)) {
$this->find($fields);
}
}
/**
* Populates the collection
*
* @param array $fields
* @param string|array $order Multi-column sort should be given as an array
* @param int $limit
* @param string|array $groupBy Multi-column group by should be given as an array
*/
public function find($fields=null,$order='name',$limit=null,$groupBy=null)
{
$this->select->from('cemeteries');
// Finding on fields from the cemeteries table is handled here
if (count($fields)) {
foreach ($fields as $key=>$value) {
$this->select->where("$key=?",$value);
}
}
// Finding on fields from other tables requires joining those tables.
// You can handle fields from other tables by adding the joins here
// If you add more joins you probably want to make sure that the
// above foreach only handles fields from the cemeteries table.
$this->select->order($order);
if ($limit) {
$this->select->limit($limit);
}
if ($groupBy) {
$this->select->group($groupBy);
}
$this->populateList();
}
/**
* Hydrates all the Cemetery objects from a database result set
*
* This is a callback function, called from ZendDbResultIterator. It is
* called once per row of the result.
*
* @param int $key The index of the result row to load
* @return Cemetery
*/
protected function loadResult($key)
{
return new Cemetery($this->result[$key]);
}
}

405
classes/Deed.php Normal file
View File

@ -0,0 +1,405 @@
<?php
/**
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
class Deed
{
private $id;
private $section;
private $lot;
private $lastname1;
private $firstname1;
private $middleInitial1;
private $lastname2;
private $firstname2;
private $middleInitial2;
private $issueDate;
private $notes;
private $lot2;
private $cemetery_id;
private $cemetery;
/**
* Populates the object with data
*
* Passing in an associative array of data will populate this object without
* hitting the database.
*
* Passing in a scalar will load the data from the database.
* This will load all fields in the table as properties of this class.
* You may want to replace this with, or add your own extra, custom loading
*
* @param int|array $id
*/
public function __construct($id=null)
{
if ($id) {
if (is_array($id)) {
$result = $id;
}
else {
$zend_db = Database::getConnection();
$sql = 'select * from deeds where id=?';
$result = $zend_db->fetchRow($sql,array($id));
}
if ($result) {
foreach ($result as $field=>$value) {
if ($value) {
if ($field == 'issueDate') {
$value = (false === strpos($value,'0000')) ? new Date($value) : null;
}
$this->$field = $value;
}
}
}
else {
throw new Exception('deeds/unknownDeed');
}
}
else {
// This is where the code goes to generate a new, empty instance.
// Set any default values for properties that need it here
}
}
/**
* Throws an exception if anything's wrong
* @throws Exception $e
*/
public function validate()
{
// Check for required fields here. Throw an exception if anything is missing.
}
/**
* Saves this record back to the database
*/
public function save()
{
$this->validate();
$data = array();
$data['section'] = $this->section ? $this->section : null;
$data['lot'] = $this->lot ? $this->lot : null;
$data['lastname1'] = $this->lastname1 ? $this->lastname1 : null;
$data['firstname1'] = $this->firstname1 ? $this->firstname1 : null;
$data['middleInitial1'] = $this->middleInitial1 ? $this->middleInitial1 : null;
$data['lastname2'] = $this->lastname2 ? $this->lastname2 : null;
$data['firstname2'] = $this->firstname2 ? $this->firstname2 : null;
$data['middleInitial2'] = $this->middleInitial2 ? $this->middleInitial2 : null;
$data['issueDate'] = $this->issueDate ? $this->issueDate->format('Y-m-d') : null;
$data['notes'] = $this->notes ? $this->notes : null;
$data['lot2'] = $this->lot2 ? $this->lot2 : null;
$data['cemetery_id'] = $this->cemetery_id ? $this->cemetery_id : null;
if ($this->id) {
$this->update($data);
}
else {
$this->insert($data);
}
}
private function update($data)
{
$zend_db = Database::getConnection();
$zend_db->update('deeds',$data,"id='{$this->id}'");
}
private function insert($data)
{
$zend_db = Database::getConnection();
$zend_db->insert('deeds',$data);
$this->id = $zend_db->lastInsertId('deeds','id');
}
//----------------------------------------------------------------
// Generic Getters
//----------------------------------------------------------------
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @return string
*/
public function getSection()
{
return $this->section;
}
/**
* @return string
*/
public function getLot()
{
return $this->lot;
}
/**
* @return string
*/
public function getLastname1()
{
return $this->lastname1;
}
/**
* @return string
*/
public function getFirstname1()
{
return $this->firstname1;
}
/**
* @return char
*/
public function getMiddleInitial1()
{
return $this->middleInitial1;
}
/**
* @return string
*/
public function getLastname2()
{
return $this->lastname2;
}
/**
* @return string
*/
public function getFirstname2()
{
return $this->firstname2;
}
/**
* @return char
*/
public function getMiddleInitial2()
{
return $this->middleInitial2;
}
/**
* Returns the date/time in the desired format
*
* Format is specified using PHP's date() syntax
* http://www.php.net/manual/en/function.date.php
* If no format is given, the Date object is returned
*
* @param string $format
* @return string|DateTime
*/
public function getIssueDate($format=null)
{
if ($format && $this->issueDate) {
return $this->issueDate->format($format);
}
else {
return $this->issueDate;
}
}
/**
* @return text
*/
public function getNotes()
{
return $this->notes;
}
/**
* @return char
*/
public function getLot2()
{
return $this->lot2;
}
/**
* @return int
*/
public function getCemetery_id()
{
return $this->cemetery_id;
}
/**
* @return Cemetery
*/
public function getCemetery()
{
if ($this->cemetery_id) {
if (!$this->cemetery) {
$this->cemetery = new Cemetery($this->cemetery_id);
}
return $this->cemetery;
}
return null;
}
//----------------------------------------------------------------
// Generic Setters
//----------------------------------------------------------------
/**
* @param string $string
*/
public function setSection($string)
{
$this->section = trim($string);
}
/**
* @param string $string
*/
public function setLot($string)
{
$this->lot = trim($string);
}
/**
* @param string $string
*/
public function setLastname1($string)
{
$this->lastname1 = trim($string);
}
/**
* @param string $string
*/
public function setFirstname1($string)
{
$this->firstname1 = trim($string);
}
/**
* @param char $char
*/
public function setMiddleInitial1($char)
{
$this->middleInitial1 = $char;
}
/**
* @param string $string
*/
public function setLastname2($string)
{
$this->lastname2 = trim($string);
}
/**
* @param string $string
*/
public function setFirstname2($string)
{
$this->firstname2 = trim($string);
}
/**
* @param char $char
*/
public function setMiddleInitial2($char)
{
$this->middleInitial2 = $char;
}
/**
* Sets the date
*
* Date arrays should match arrays produced by getdate()
*
* Date string formats should be in something strtotime() understands
* http://www.php.net/manual/en/function.strtotime.php
*
* @param int|string|array $date
*/
public function setIssueDate($date)
{
if ($date) {
$this->issueDate = new Date($date);
}
else {
$this->issueDate = null;
}
}
/**
* @param text $text
*/
public function setNotes($text)
{
$this->notes = $text;
}
/**
* @param char $char
*/
public function setLot2($char)
{
$this->lot2 = $char;
}
/**
* @param int $int
*/
public function setCemetery_id($int)
{
$this->cemetery = new Cemetery($int);
$this->cemetery_id = $int;
}
/**
* @param Cemetery $cemetery
*/
public function setCemetery($cemetery)
{
$this->cemetery_id = $cemetery->getId();
$this->cemetery = $cemetery;
}
//----------------------------------------------------------------
// Custom Functions
// We recommend adding all your custom code down here at the bottom
//----------------------------------------------------------------
/**
* Returns the full name of the owner
*
* @return string
*/
public function getOwner($number=1)
{
$first = "firstname$number";
$middle = "middleInitial$number";
$last = "lastname$number";
$name = array();
if ($this->$first) {
$name[] = $this->$first;
}
if ($this->$middle) {
$name[] = $this->$middle;
}
if ($this->$last) {
$name[] = $this->$last;
}
return implode(' ',$name);
}
}

112
classes/DeedList.php Normal file
View File

@ -0,0 +1,112 @@
<?php
/**
* A collection class for Deed objects
*
* This class creates a zend_db select statement.
* ZendDbResultIterator handles iterating and paginating those results.
* As the results are iterated over, ZendDbResultIterator will pass each desired
* row back to this class's loadResult() which will be responsible for hydrating
* each Deed object
*
* Beyond the basic $fields handled, you will need to write your own handling
* of whatever extra $fields you need
*/
/**
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
class DeedList extends ZendDbResultIterator
{
private $columns = array(
'id','section','lot','lot2','cemetery_id',
'lastname1','firstname1','middleInitial1',
'lastname2','firstname2','middleInitial2',
'issueDate','notes'
);
/**
* Creates a basic select statement for the collection.
*
* Populates the collection if you pass in $fields
* Setting itemsPerPage turns on pagination mode
* In pagination mode, this will only load the results for one page
*
* @param array $fields
* @param int $itemsPerPage Turns on Pagination
* @param int $currentPage
*/
public function __construct($fields=null,$itemsPerPage=null,$currentPage=null)
{
parent::__construct($itemsPerPage,$currentPage);
if (is_array($fields)) {
$this->find($fields);
}
}
/**
* Populates the collection
*
* @param array $fields
* @param string|array $order Multi-column sort should be given as an array
* @param int $limit
* @param string|array $groupBy Multi-column group by should be given as an array
*/
public function find($fields=null,$order='id',$limit=null,$groupBy=null)
{
$this->select->from('deeds');
// Finding on fields from the deed table is handled here
if (count($fields)) {
foreach ($fields as $key=>$value) {
if ($value) {
if (in_array($key,$this->columns)) {
$this->select->where("$key=?",$value);
}
}
}
if (isset($fields['lastname']) && $fields['lastname']) {
$this->select->where("(lastname1 like ? or lastname2 like ?)",
array("$fields[lastname]%"));
}
if (isset($fields['firstname']) && $fields['firstname']) {
$this->select->where("(firstname1 like ? or firstname2 like ?)",
array("$fields[firstname]%"));
}
if (isset($fields['middleInitial']) && $fields['middleInitial']) {
$this->select->where("(middleInitial1 like ? or middleInitial2 like ?)",
array("$fields[middleInitial]%"));
}
}
// Finding on fields from other tables requires joining those tables.
// You can handle fields from other tables by adding the joins here
// If you add more joins you probably want to make sure that the
// above foreach only handles fields from the deed table.
$this->select->order($order);
if ($limit) {
$this->select->limit($limit);
}
if ($groupBy) {
$this->select->group($groupBy);
}
$this->populateList();
}
/**
* Hydrates all the Deed objects from a database result set
*
* This is a callback function, called from ZendDbResultIterator. It is
* called once per row of the result.
*
* @param int $key The index of the result row to load
* @return Deed
*/
protected function loadResult($key)
{
return new Deed($this->result[$key]);
}
}

485
classes/Interment.php Normal file
View File

@ -0,0 +1,485 @@
<?php
/**
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
class Interment
{
private $id;
private $section_id;
private $lot;
private $book;
private $pageNumber;
private $deceasedDate;
private $lastname;
private $firstname;
private $middleInitial;
private $birthPlace;
private $lastResidence;
private $age;
private $sex;
private $cemetery_id;
private $notes;
private $lot2;
private $section;
private $cemetery;
/**
* Populates the object with data
*
* Passing in an associative array of data will populate this object without
* hitting the database.
*
* Passing in a scalar will load the data from the database.
* This will load all fields in the table as properties of this class.
* You may want to replace this with, or add your own extra, custom loading
*
* @param int|array $id
*/
public function __construct($id=null)
{
if ($id) {
if (is_array($id)) {
$result = $id;
}
else {
$zend_db = Database::getConnection();
$sql = 'select * from interments where id=?';
$result = $zend_db->fetchRow($sql,array($id));
}
if ($result) {
foreach ($result as $field=>$value) {
if ($value) {
if ($field == 'deceasedDate') {
$value = (false === strpos($value,'0000')) ? new Date($value) : null;
}
$this->$field = $value;
}
}
}
else {
throw new Exception('interments/unknownInterment');
}
}
else {
// This is where the code goes to generate a new, empty instance.
// Set any default values for properties that need it here
}
}
/**
* Throws an exception if anything's wrong
* @throws Exception $e
*/
public function validate()
{
// Check for required fields here. Throw an exception if anything is missing.
if (!$this->cemetery_id) {
throw new Exception('missingRequiredFields');
}
}
/**
* Saves this record back to the database
*/
public function save()
{
$this->validate();
$data = array();
$data['section_id'] = $this->section_id ? $this->section_id : null;
$data['lot'] = $this->lot ? $this->lot : null;
$data['book'] = $this->book ? $this->book : null;
$data['pageNumber'] = $this->pageNumber ? $this->pageNumber : null;
$data['deceasedDate'] = $this->deceasedDate ? $this->deceasedDate->format('Y-m-d') : null;
$data['lastname'] = $this->lastname ? $this->lastname : null;
$data['firstname'] = $this->firstname ? $this->firstname : null;
$data['middleInitial'] = $this->middleInitial ? $this->middleInitial : null;
$data['birthPlace'] = $this->birthPlace ? $this->birthPlace : null;
$data['lastResidence'] = $this->lastResidence ? $this->lastResidence : null;
$data['age'] = $this->age ? $this->age : null;
$data['sex'] = $this->sex ? $this->sex : null;
$data['cemetery_id'] = $this->cemetery_id;
$data['notes'] = $this->notes ? $this->notes : null;
$data['lot2'] = $this->lot2 ? $this->lot2 : null;
if ($this->id) {
$this->update($data);
}
else {
$this->insert($data);
}
}
private function update($data)
{
$zend_db = Database::getConnection();
$zend_db->update('interments',$data,"id='{$this->id}'");
}
private function insert($data)
{
$zend_db = Database::getConnection();
$zend_db->insert('interments',$data);
$this->id = $zend_db->lastInsertId('interments','id');
}
//----------------------------------------------------------------
// Generic Getters
//----------------------------------------------------------------
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @return int
*/
public function getSection_id()
{
return $this->section_id;
}
/**
* @return string
*/
public function getLot()
{
return $this->lot;
}
/**
* @return string
*/
public function getBook()
{
return $this->book;
}
/**
* @return string
*/
public function getPageNumber()
{
return $this->pageNumber;
}
/**
* Returns the date/time in the desired format
*
* Format is specified using PHP's date() syntax
* http://www.php.net/manual/en/function.date.php
* If no format is given, the Date object is returned
*
* @param string $format
* @return string|DateTime
*/
public function getDeceasedDate($format=null)
{
if ($format && $this->deceasedDate) {
return $this->deceasedDate->format($format);
}
else {
return $this->deceasedDate;
}
}
/**
* @return string
*/
public function getLastname()
{
return $this->lastname;
}
/**
* @return string
*/
public function getFirstname()
{
return $this->firstname;
}
/**
* @return char
*/
public function getMiddleInitial()
{
return $this->middleInitial;
}
/**
* @return string
*/
public function getBirthPlace()
{
return $this->birthPlace;
}
/**
* @return string
*/
public function getLastResidence()
{
return $this->lastResidence;
}
/**
* @return int
*/
public function getAge()
{
return $this->age;
}
/**
* @return string
*/
public function getSex()
{
return $this->sex;
}
/**
* @return text
*/
public function getNotes()
{
return $this->notes;
}
/**
* @return string
*/
public function getLot2()
{
return $this->lot2;
}
/**
* @return int
*/
public function getCemetery_id()
{
return $this->cemetery_id;
}
/**
* @return Cemetery
*/
public function getCemetery()
{
if ($this->cemetery_id) {
if (!$this->cemetery) {
$this->cemetery = new Cemetery($this->cemetery_id);
}
return $this->cemetery;
}
return null;
}
/**
* @return Section
*/
public function getSection()
{
if ($this->section_id) {
if (!$this->section) {
$this->section = new Section($this->section_id);
}
return $this->section;
}
return null;
}
//----------------------------------------------------------------
// Generic Setters
//----------------------------------------------------------------
/**
* @param int $int
*/
public function setSection_id($int)
{
$this->section = new Section($int);
$this->section_id = $int;
}
/**
* @param Section $section
*/
public function setSection($section)
{
$this->section_id = $section->getId();
$this->section = $section;
}
/**
* @param string $string
*/
public function setLot($string)
{
$this->lot = trim($string);
}
/**
* @param string $string
*/
public function setBook($string)
{
$this->book = trim($string);
}
/**
* @param string $string
*/
public function setPageNumber($string)
{
$this->pageNumber = trim($string);
}
/**
* Sets the date
*
* Date arrays should match arrays produced by getdate()
*
* Date string formats should be in something strtotime() understands
* http://www.php.net/manual/en/function.strtotime.php
*
* @param int|string|array $date
*/
public function setDeceasedDate($date)
{
if ($date) {
$this->deceasedDate = new Date($date);
}
else {
$this->deceasedDate = null;
}
}
/**
* @param string $string
*/
public function setLastname($string)
{
$this->lastname = trim($string);
}
/**
* @param string $string
*/
public function setFirstname($string)
{
$this->firstname = trim($string);
}
/**
* @param char $char
*/
public function setMiddleInitial($char)
{
$this->middleInitial = $char;
}
/**
* @param string $string
*/
public function setBirthPlace($string)
{
$this->birthPlace = trim($string);
}
/**
* @param string $string
*/
public function setLastResidence($string)
{
$this->lastResidence = trim($string);
}
/**
* @param int $int
*/
public function setAge($int)
{
$this->age = preg_replace("/[^0-9]/","",$int);
}
/**
* @param string $string
*/
public function setSex($string)
{
$this->sex = trim($string);
}
/**
* @param int $int
*/
public function setCemetery_id($int)
{
$this->cemetery = new Cemetery($int);
$this->cemetery_id = $int;
}
/**
* @param Cemetery $cemetery
*/
public function setCemetery($cemetery)
{
$this->cemetery_id = $cemetery->getId();
$this->cemetery = $cemetery;
}
/**
* @param text $text
*/
public function setNotes($text)
{
$this->notes = $text;
}
/**
* @param string $string
*/
public function setLot2($string)
{
$this->lot2 = trim($string);
}
//----------------------------------------------------------------
// Custom Functions
// We recommend adding all your custom code down here at the bottom
//----------------------------------------------------------------
/**
* @return string
*/
public function getURL()
{
return BASE_URL.'/interments/viewInterment.php?interment_id='.$this->id;
}
/**
* @return string
*/
public function getFullname()
{
$name = array();
if ($this->firstname) {
$name[] = $this->firstname;
}
if ($this->middleInitial) {
$name[] = $this->middleInitial;
}
if ($this->lastname) {
$name[] = $this->lastname;
}
return implode(' ',$name);
}
}

98
classes/IntermentList.php Normal file
View File

@ -0,0 +1,98 @@
<?php
/**
* A collection class for Interment objects
*
* This class creates a zend_db select statement.
* ZendDbResultIterator handles iterating and paginating those results.
* As the results are iterated over, ZendDbResultIterator will pass each desired
* row back to this class's loadResult() which will be responsible for hydrating
* each Interment object
*
* Beyond the basic $fields handled, you will need to write your own handling
* of whatever extra $fields you need
*
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
class IntermentList extends ZendDbResultIterator
{
/**
* Creates a basic select statement for the collection.
*
* Populates the collection if you pass in $fields
* Setting itemsPerPage turns on pagination mode
* In pagination mode, this will only load the results for one page
*
* @param array $fields
* @param int $itemsPerPage Turns on Pagination
* @param int $currentPage
*/
public function __construct($fields=null,$order=null,$itemsPerPage=null,$currentPage=null)
{
parent::__construct($itemsPerPage,$currentPage);
if (is_array($fields)) {
if ($order) {
$this->find($fields,$order);
}
else {
$this->find($fields);
}
}
}
/**
* Populates the collection
*
* @param array $fields
* @param string|array $order Multi-column sort should be given as an array
* @param int $limit
* @param string|array $groupBy Multi-column group by should be given as an array
*/
public function find($fields=null,$order='deceasedDate',$limit=null,$groupBy=null)
{
$this->select->from('interments');
// Finding on fields from the interments table is handled here
if (count($fields)) {
foreach ($fields as $key=>$value) {
switch ($key) {
case 'lastname':
case 'firstname':
$this->select->where("$key like ?","$value%");
break;
default:
$this->select->where("$key=?",$value);
}
}
}
// Finding on fields from other tables requires joining those tables.
// You can handle fields from other tables by adding the joins here
// If you add more joins you probably want to make sure that the
// above foreach only handles fields from the interments table.
$this->select->order($order);
if ($limit) {
$this->select->limit($limit);
}
if ($groupBy) {
$this->select->group($groupBy);
}
$this->populateList();
}
/**
* Hydrates all the Interment objects from a database result set
*
* This is a callback function, called from ZendDbResultIterator. It is
* called once per row of the result.
*
* @param int $key The index of the result row to load
* @return Interment
*/
protected function loadResult($key)
{
return new Interment($this->result[$key]);
}
}

56
classes/Map.php Normal file
View File

@ -0,0 +1,56 @@
<?php
/**
* @copyright 2010 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
class Map
{
public static $extensions = array(
'jpg'=>array('mime_type'=>'image/jpeg','media_type'=>'image'),
'gif'=>array('mime_type'=>'image/gif','media_type'=>'image'),
'png'=>array('mime_type'=>'image/png','media_type'=>'image'),
'tiff'=>array('mime_type'=>'image/tiff','media_type'=>'image')
);
/**
* @param string $directory Where to store the file
* @param array|string $file Either an entry from $_FILES or a path to a file
* @param string $newName The filename to use
*/
public static function saveFile($directory,$file,$newName)
{
// Handle passing in either a $_FILES array or just a path to a file
$tempFile = is_array($file) ? $file['tmp_name'] : $file;
if (!$tempFile) {
throw new Exception('media/uploadFailed');
}
# Find out the mime type for this file
$filename = is_array($file) ? basename($file['name']) : basename($file);
preg_match("/[^.]+$/",$filename,$matches);
$extension = strtolower($matches[0]);
// Make sure it's a known file type
if (!array_key_exists(strtolower($extension),self::$extensions)) {
throw new Exception('unknownFileType');
}
// Clean out any previous version of the file
foreach(glob("$directory/$newName.*") as $file) {
unlink($file);
}
// Move the file where it's supposed to go
if (!is_dir($directory)) {
mkdir($directory,0777,true);
}
$newFile = "$directory/$newName.$extension";
rename($tempFile,$newFile);
chmod($newFile,0666);
if (!is_file($newFile)) {
throw new Exception('media/uploadFailed');
}
}
}

226
classes/Person.php Normal file
View File

@ -0,0 +1,226 @@
<?php
/**
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
class Person
{
private $id;
private $firstname;
private $lastname;
private $email;
private $user_id;
private $user;
/**
* Populates the object with data
*
* Passing in an associative array of data will populate this object without
* hitting the database.
*
* Passing in a scalar will load the data from the database.
* This will load all fields in the table as properties of this class.
* You may want to replace this with, or add your own extra, custom loading
*
* @param int|string|array $id (ID, email, username)
*/
public function __construct($id=null)
{
if ($id) {
if (is_array($id)) {
$result = $id;
}
else {
$zend_db = Database::getConnection();
if (ctype_digit($id)) {
$sql = 'select * from people where id=?';
}
elseif (false !== strpos($id,'@')) {
$sql = 'select * from people where email=?';
}
else {
$sql = 'select p.* from people p left join users on p.id=person_id where username=?';
}
$result = $zend_db->fetchRow($sql,array($id));
}
if ($result) {
foreach ($result as $field=>$value) {
if ($value) {
$this->$field = $value;
}
}
}
else {
throw new Exception('people/unknownPerson');
}
}
else {
// This is where the code goes to generate a new, empty instance.
// Set any default values for properties that need it here
}
}
/**
* Throws an exception if anything's wrong
* @throws Exception $e
*/
public function validate()
{
// Check for required fields here. Throw an exception if anything is missing.
if (!$this->firstname || !$this->lastname) {
throw new Exception('missingRequiredFields');
}
}
/**
* Saves this record back to the database
*/
public function save()
{
$this->validate();
$data = array();
$data['firstname'] = $this->firstname;
$data['lastname'] = $this->lastname;
$data['email'] = $this->email ? $this->email : null;
if ($this->id) {
$this->update($data);
}
else {
$this->insert($data);
}
}
private function update($data)
{
$zend_db = Database::getConnection();
$zend_db->update('people',$data,"id={$this->id}");
}
private function insert($data)
{
$zend_db = Database::getConnection();
$zend_db->insert('people',$data);
$this->id = $zend_db->lastInsertId('people','id');
}
//----------------------------------------------------------------
// Generic Getters
//----------------------------------------------------------------
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @return string
*/
public function getFirstname()
{
return $this->firstname;
}
/**
* @return string
*/
public function getLastname()
{
return $this->lastname;
}
/**
* @return string
*/
public function getEmail()
{
return $this->email;
}
//----------------------------------------------------------------
// Generic Setters
//----------------------------------------------------------------
/**
* @param string $string
*/
public function setFirstname($string)
{
$this->firstname = trim($string);
}
/**
* @param string $string
*/
public function setLastname($string)
{
$this->lastname = trim($string);
}
/**
* @param string $string
*/
public function setEmail($string)
{
$this->email = trim($string);
}
//----------------------------------------------------------------
// Custom Functions
// We recommend adding all your custom code down here at the bottom
//----------------------------------------------------------------
/**
* @return string
*/
public function getFullname()
{
return "{$this->firstname} {$this->lastname}";
}
/**
* @return string
*/
public function getURL()
{
return BASE_URL.'/people/viewPerson.php?person_id='.$this->id;
}
/**
* @return int
*/
public function getUser_id()
{
if (!$this->user_id) {
$zend_db = Database::getConnection();
$this->user_id = $zend_db->fetchOne('select id from users where person_id=?',$this->id);
}
return $this->user_id;
}
/**
* @return User
*/
public function getUser() {
if (!$this->user) {
if ($this->getUser_id()) {
$this->user = new User($this->getUser_id());
}
}
return $this->user;
}
/**
* @return string
*/
public function getUsername() {
if ($this->getUser()) {
return $this->getUser()->getUsername();
}
}
}

59
classes/PersonList.php Normal file
View File

@ -0,0 +1,59 @@
<?php
/**
* A collection class for Person objects
*
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
class PersonList extends ZendDbResultIterator
{
/**
* @param array $fields
*/
public function __construct($fields=null)
{
parent::__construct();
if (is_array($fields)) {
$this->find($fields);
}
}
/**
* Populates the collection
*
* @param array $fields
* @param string|array $order Multi-column sort should be given as an array
* @param int $limit
* @param string|array $groupBy Multi-column group by should be given as an array
*/
public function find($fields=null,$order='lastname',$limit=null,$groupBy=null)
{
$this->select->from('people');
if (count($fields)) {
foreach ($fields as $key=>$value) {
$this->select->where("$key=?",$value);
}
}
$this->select->order($order);
if ($limit) {
$this->select->limit($limit);
}
if ($groupBy) {
$this->select->group($groupBy);
}
$this->populateList();
}
/**
* Loads a single Person object for the row returned from ZendDbResultIterator
*
* @param array $key
*/
protected function loadResult($key)
{
return new Person($this->result[$key]);
}
}

142
classes/Role.php Normal file
View File

@ -0,0 +1,142 @@
<?php
/**
* @copyright 2006-2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
class Role
{
private $id;
private $name;
/**
* Passing in an associative array of data will populate this object without
* hitting the database.
*
* Passing in an int will load the data from the database for the given ID.
*
* This will load all fields in the table as properties of this class.
* You may want to replace this with, or add your own extra, custom loading
*
* @param int|string|array $id
*/
public function __construct($id=null)
{
if ($id) {
if (is_array($id)) {
$result = $id;
}
else {
$zend_db = Database::getConnection();
if (is_int($id) || ctype_digit($id)) {
$sql = 'select * from roles where id=?';
}
else {
$sql = 'select * from roles where name=?';
}
$result = $zend_db->fetchRow($sql,array($id));
}
if ($result) {
foreach ($result as $field=>$value) {
if ($value) {
$this->$field = $value;
}
}
}
else {
throw new Exception('roles/unknownRole');
}
}
else {
// This is where the code goes to generate a new, empty instance.
// Set any default values for properties that need it here
}
}
/**
* Throws an exception if theres anything wrong
* @throws Exception
*/
public function validate()
{
if (!$this->name) {
throw new Exception('missingName');
}
}
/**
* This generates generic SQL that should work right away.
* You can replace this $fields code with your own custom SQL
* for each property of this class,
*/
public function save()
{
$this->validate();
$data = array();
$data['name'] = $this->name;
if ($this->id) {
$this->update($data);
}
else {
$this->insert($data);
}
}
private function update($data)
{
$zend_db = Database::getConnection();
$zend_db->update('roles',$data,"id={$this->id}");
}
private function insert($data)
{
$zend_db = Database::getConnection();
$zend_db->insert('roles',$data);
$this->id = $zend_db->lastInsertId('roles','id');
}
//----------------------------------------------------------------
// Generic Getters
//----------------------------------------------------------------
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
//----------------------------------------------------------------
// Generic Setters
//----------------------------------------------------------------
/**
* @param string $string
*/
public function setName($string)
{
$this->name = trim($string);
}
//----------------------------------------------------------------
// Custom Functions
// We recommend adding all your custom code down here at the bottom
//----------------------------------------------------------------
/**
* @return string
*/
public function __toString()
{
return $this->name;
}
}

58
classes/RoleList.php Normal file
View File

@ -0,0 +1,58 @@
<?php
/**
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
class RoleList extends ZendDbResultIterator
{
/**
* @param array $fields
*/
public function __construct($fields=null)
{
parent::__construct();
if (is_array($fields)) {
$this->find($fields);
}
}
/**
* Populates the collection
*
* @param array $fields
* @param string|array $order Multi-column sort should be given as an array
* @param int $limit
* @param string|array $groupBy Multi-column group by should be given as an array
*/
public function find($fields=null,$order='name',$limit=null,$groupBy=null)
{
$this->select->from('roles');
if (count($fields)) {
foreach ($fields as $key=>$value) {
$this->select->where("$key=?",$value);
}
}
$this->select->order($order);
if ($limit) {
$this->select->limit($limit);
}
if ($groupBy) {
$this->select->group($groupBy);
}
$this->populateList();
}
/**
* Load each Role object as we iterate through the results
*
* @return array An array of Role objects
*/
protected function loadResult($key)
{
return new Role($this->result[$key]);
}
}

235
classes/Section.php Normal file
View File

@ -0,0 +1,235 @@
<?php
/**
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
class Section
{
private $id;
private $cemetery_id;
private $code;
private $name;
private $cemetery;
/**
* Populates the object with data
*
* Passing in an associative array of data will populate this object without
* hitting the database.
*
* Passing in a scalar will load the data from the database.
* This will load all fields in the table as properties of this class.
* You may want to replace this with, or add your own extra, custom loading
*
* @param int|array $id
*/
public function __construct($id=null)
{
if ($id) {
if (is_array($id)) {
$result = $id;
}
else {
$zend_db = Database::getConnection();
$sql = 'select * from sections where id=?';
$result = $zend_db->fetchRow($sql,array($id));
}
if ($result) {
foreach ($result as $field=>$value) {
if ($value) {
$this->$field = $value;
}
}
}
else {
throw new Exception('sections/unknownSection');
}
}
else {
// This is where the code goes to generate a new, empty instance.
// Set any default values for properties that need it here
}
}
/**
* Throws an exception if anything's wrong
* @throws Exception $e
*/
public function validate()
{
// Check for required fields here. Throw an exception if anything is missing.
if (!$this->cemetery_id || !$this->code) {
throw new Excepction('missingRequiredFields');
}
}
/**
* Saves this record back to the database
*/
public function save()
{
$this->validate();
$data = array();
$data['cemetery_id'] = $this->cemetery_id;
$data['code'] = $this->code;
$data['name'] = $this->name ? $this->name : null;
if ($this->id) {
$this->update($data);
}
else {
$this->insert($data);
}
}
private function update($data)
{
$zend_db = Database::getConnection();
$zend_db->update('sections',$data,"id='{$this->id}'");
}
private function insert($data)
{
$zend_db = Database::getConnection();
$zend_db->insert('sections',$data);
$this->id = $zend_db->lastInsertId('sections','id');
}
//----------------------------------------------------------------
// Generic Getters
//----------------------------------------------------------------
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @return int
*/
public function getCemetery_id()
{
return $this->cemetery_id;
}
/**
* @return string
*/
public function getCode()
{
return $this->code;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @return Cemetery
*/
public function getCemetery()
{
if ($this->cemetery_id) {
if (!$this->cemetery) {
$this->cemetery = new Cemetery($this->cemetery_id);
}
return $this->cemetery;
}
return null;
}
//----------------------------------------------------------------
// Generic Setters
//----------------------------------------------------------------
/**
* @param int $int
*/
public function setCemetery_id($int)
{
$this->cemetery = new Cemetery($int);
$this->cemetery_id = $int;
}
/**
* @param string $string
*/
public function setCode($string)
{
$this->code = trim($string);
}
/**
* @param string $string
*/
public function setName($string)
{
$this->name = trim($string);
}
/**
* @param Cemetery $cemetery
*/
public function setCemetery($cemetery)
{
$this->cemetery_id = $cemetery->getId();
$this->cemetery = $cemetery;
}
//----------------------------------------------------------------
// Custom Functions
// We recommend adding all your custom code down here at the bottom
//----------------------------------------------------------------
public function __toString()
{
return $this->name ? $this->name : $this->code;
}
private function getMapDirectory()
{
return 'images/cemeteries/'.$this->cemetery_id;
}
/**
* Returns the URL to the map image
*
* @param string $type Either 'highlight' or 'zoom'
* @return string
*/
public function getMap($type='highlight')
{
$imageDir = $this->getMapDirectory();
$type = $type=='highlight' ? 'highlight' : 'zoom';
$glob = glob(APPLICATION_HOME."/html/$imageDir/$type/{$this->id}.*");
if (count($glob)) {
$filename = basename($glob[0]);
return BASE_URL."/$imageDir/$type/$filename";
}
}
/**
* @param array|string $file Either an entry from $_FILES or a path to a file
*/
public function saveMap($file,$type)
{
$imageDir = $this->getMapDirectory();
$type = $type=='highlight' ? 'highlight' : 'zoom';
$directory = APPLICATION_HOME."/html/$imageDir/$type";
Map::saveFile($directory,$file,$this->id);
}
}

86
classes/SectionList.php Normal file
View File

@ -0,0 +1,86 @@
<?php
/**
* A collection class for Section objects
*
* This class creates a zend_db select statement.
* ZendDbResultIterator handles iterating and paginating those results.
* As the results are iterated over, ZendDbResultIterator will pass each desired
* row back to this class's loadResult() which will be responsible for hydrating
* each Section object
*
* Beyond the basic $fields handled, you will need to write your own handling
* of whatever extra $fields you need
*
* @copyright 2010 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
class SectionList extends ZendDbResultIterator
{
/**
* Creates a basic select statement for the collection.
*
* Populates the collection if you pass in $fields
* Setting itemsPerPage turns on pagination mode
* In pagination mode, this will only load the results for one page
*
* @param array $fields
* @param int $itemsPerPage Turns on Pagination
* @param int $currentPage
*/
public function __construct($fields=null,$itemsPerPage=null,$currentPage=null)
{
parent::__construct($itemsPerPage,$currentPage);
if (is_array($fields)) {
$this->find($fields);
}
}
/**
* Populates the collection
*
* @param array $fields
* @param string|array $order Multi-column sort should be given as an array
* @param int $limit
* @param string|array $groupBy Multi-column group by should be given as an array
*/
public function find($fields=null,$order='code',$limit=null,$groupBy=null)
{
$this->select->from('sections');
// Finding on fields from the sections table is handled here
if (count($fields)) {
foreach ($fields as $key=>$value) {
$this->select->where("$key=?",$value);
}
}
// Finding on fields from other tables requires joining those tables.
// You can handle fields from other tables by adding the joins here
// If you add more joins you probably want to make sure that the
// above foreach only handles fields from the sections table.
$this->select->order($order);
if ($limit) {
$this->select->limit($limit);
}
if ($groupBy) {
$this->select->group($groupBy);
}
$this->populateList();
}
/**
* Hydrates all the Section objects from a database result set
*
* This is a callback function, called from ZendDbResultIterator. It is
* called once per row of the result.
*
* @param int $key The index of the result row to load
* @return Section
*/
protected function loadResult($key)
{
return new Section($this->result[$key]);
}
}

373
classes/User.php Normal file
View File

@ -0,0 +1,373 @@
<?php
/**
* @copyright 2006-2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
class User extends SystemUser
{
private $id;
private $person_id;
private $username;
private $password;
private $authenticationMethod;
private $person;
private $roles = array();
private $newPassword; // the User's new password, unencrypted
/**
* @param int|string $id
*/
public function __construct($id = null)
{
if ($id) {
if (is_array($id)) {
$result = $id;
}
else {
if (ctype_digit($id)) {
$sql = 'select * from users where id=?';
}
else {
$sql = 'select * from users where username=?';
}
$zend_db = Database::getConnection();
$result = $zend_db->fetchRow($sql,array($id));
}
if ($result) {
foreach ($result as $field=>$value) {
if ($value) {
$this->$field = $value;
}
}
}
else {
throw new Exception('users/unknownUser');
}
}
else {
// This is where the code goes to generate a new, empty instance.
// Set any default values for properties that need it here
}
}
/**
* Throws an exception if anything's wrong
* @throws Exception $e
*/
public function validate()
{
if (!$this->person_id) {
throw new Exception('users/missingPerson_id');
}
if (!$this->username) {
throw new Exception('users/missingUsername');
}
}
/**
* Saves this record back to the database
*
* This generates generic SQL that should work right away.
* You can replace this $fields code with your own custom SQL
* for each property of this class,
*/
public function save()
{
$this->validate();
$data = array();
$data['person_id'] = $this->person_id;
$data['username'] = $this->username;
// Passwords should not be updated by default. Use the savePassword() function
$data['authenticationMethod'] = $this->authenticationMethod
? $this->authenticationMethod
: null;
// Do the database calls
if ($this->id) {
$this->update($data);
}
else {
$this->insert($data);
}
// Save the password only if it's changed
if ($this->passwordHasChanged()) {
$this->savePassword();
}
$this->updateRoles();
}
private function update($data)
{
$zend_db = Database::getConnection();
$zend_db->update('users',$data,"id={$this->id}");
}
private function insert($data)
{
$zend_db = Database::getConnection();
$zend_db->insert('users',$data);
$this->id = $zend_db->lastInsertId('users','id');
}
/**
* Removes this object from the database
*/
public function delete()
{
$zend_db = Database::getConnection();
$zend_db->delete('user_roles',"user_id={$this->id}");
$zend_db->delete('users',"id={$this->id}");
}
//----------------------------------------------------------------
// Generic Getters
//----------------------------------------------------------------
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @return int
*/
public function getPerson_id()
{
return $this->person_id;
}
/**
* @return string
*/
public function getUsername()
{
return $this->username;
}
/**
* @return string
*/
public function getAuthenticationMethod()
{
return $this->authenticationMethod;
}
/**
* @return Person
*/
public function getPerson()
{
if ($this->person_id) {
if (!$this->person) {
$this->person = new Person($this->person_id);
}
return $this->person;
}
return null;
}
//----------------------------------------------------------------
// Generic Setters
//----------------------------------------------------------------
/**
* @param int $int
*/
public function setPerson_id($int)
{
$this->person = new Person($int);
$this->person_id = $int;
}
/**
* @param string $string
*/
public function setUsername($string)
{
$this->username = trim($string);
}
/**
* Takes a user-given password and converts it to an MD5 Hash
* @param String $string
*/
public function setPassword($string)
{
// Save the user given password, so we can update it externally, if needed
$this->newPassword = trim($string);
$this->password = md5(trim($string));
}
/**
* Takes a pre-existing MD5 hash
* @param MD5 $hash
*/
public function setPasswordHash($hash)
{
$this->password = trim($hash);
}
/**
* @param string $authenticationMethod
*/
public function setAuthenticationMethod($string)
{
$this->authenticationMethod = $string;
if ($this->authenticationMethod != 'local') {
$this->password = null;
$this->saveLocalPassword();
}
}
/**
* @param Person $person
*/
public function setPerson($person)
{
$this->person_id = $person->getId();
$this->person = $person;
}
//----------------------------------------------------------------
// Custom Functions
// We recommend adding all your custom code down here at the bottom
//----------------------------------------------------------------
/**
* @return string
*/
public function getFirstname()
{
return $this->getPerson()->getFirstname();
}
/**
* @return string
*/
public function getLastname()
{
return $this->getPerson()->getLastname();
}
/**
* @return string
*/
public function getEmail()
{
return $this->getPerson()->getEmail();
}
/**
* Returns an array of Role names with the role id as the array index
*
* @return array
*/
public function getRoles()
{
if (!count($this->roles)) {
if ($this->id) {
$zend_db = Database::getConnection();
$select = new Zend_Db_Select($zend_db);
$select->from('user_roles','role_id')
->joinLeft('roles','role_id=id','name')
->where('user_id=?');
$result = $zend_db->fetchAll($select,$this->id);
foreach ($result as $row) {
$this->roles[$row['role_id']] = $row['name'];
}
}
}
return $this->roles;
}
/**
* Takes an array of role names. Loads the Roles from the database
*
* @param array $roleNames An array of names
*/
public function setRoles($roleNames)
{
$this->roles = array();
foreach ($roleNames as $name) {
$role = new Role($name);
$this->roles[$role->getId()] = $role->getName();
}
}
/**
* Takes a string or an array of strings and checks if the user has that role
*
* @param Array|String $roles
* @return boolean
*/
public function hasRole($roles)
{
if (is_array($roles)) {
foreach ($roles as $roleName) {
if (in_array($roleName,$this->getRoles())) {
return true;
}
}
return false;
}
else {
return in_array($roles,$this->getRoles());
}
}
/**
* Saves the current roles back to the database
*/
private function updateRoles()
{
$zend_db = Database::getConnection();
$roles = $this->getRoles();
$zend_db->delete('user_roles',"user_id={$this->id}");
foreach ($roles as $id=>$name) {
$data = array('user_id'=>$this->id,'role_id'=>$id);
$zend_db->insert('user_roles',$data);
}
}
/**
* Since passwords can be stored externally, we only want to bother trying
* to save them when they've actually changed
* @return boolean
*/
public function passwordHasChanged()
{
return $this->newPassword ? true : false;
}
/**
* Callback function from the SystemUser class
* The SystemUser will determine where the password should be stored.
* If the password is stored locally, it will call this function
*/
protected function saveLocalPassword()
{
if ($this->id) {
$zend_db = Database::getConnection();
// Passwords in the class should already be MD5 hashed
$zend_db->update('users',array('password'=>$this->password),"id={$this->id}");
}
}
/**
* Callback function from the SystemUser class
*
* The SystemUser class will determine where the authentication
* should occur. If the user should be authenticated locally,
* this function will be called.
*
* @param string $password
* @return boolean
*/
protected function authenticateDatabase($password)
{
$zend_db = Database::getConnection();
$md5 = md5($password);
$id = $zend_db->fetchOne('select id from users where username=? and password=?',
array($this->username,$md5));
return $id ? true : false;
}
}

112
classes/UserList.php Normal file
View File

@ -0,0 +1,112 @@
<?php
/**
* A collection class for User objects
*
* This class creates a zend_db select statement.
* ZendDbResultIterator handles iterating and paginating those results.
* As the results are iterated over, ZendDbResultIterator will pass each desired
* row back to this class's loadResult() which will be responsible for hydrating
* each User object
*
* Beyond the basic $fields handled, you will need to write your own handling
* of whatever extra $fields you need
*
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
class UserList extends ZendDbResultIterator
{
private $columns = array('id','person_id','username','password','authenticationMethod');
/**
* @param array $fields
*/
public function __construct($fields=null)
{
parent::__construct();
if (is_array($fields)) {
$this->find($fields);
}
}
/**
* Populates the collection
*
* @param array $fields
* @param string|array $order Multi-column sort should be given as an array
* @param int $limit
* @param string|array $groupBy Multi-column group by should be given as an array
*/
public function find($fields=null,$order='username',$limit=null,$groupBy=null)
{
$this->select->from(array('u'=>'users'));
// Finding on fields from the Users table is handled here
if (count($fields)) {
foreach ($fields as $key=>$value) {
if (array_key_exists($key,$this->columns)) {
$this->select->where("u.$key=?",$value);
}
}
}
// Finding on fields from other tables requires joining those tables.
// You can handle fields from other tables by adding the joins here
// If you add more joins you probably want to make sure that the
// above foreach only handles fields from the users table.
$joins = array();
// Firstname, lastname, and email come from the People table
if (isset($fields['firstname'])) {
$joins['p'] = array('table'=>'people','condition'=>'u.id=p.user_id');
$this->select->where('p.firstname=?',$fields['firstname']);
}
if (isset($fields['lastname'])) {
$joins['p'] = array('table'=>'people','condition'=>'u.id=p.user_id');
$this->select->where('p.lastname=?',$fields['lastname']);
}
if (isset($fields['email'])) {
$joins['p'] = array('table'=>'people','condition'=>'u.id=p.user_id');
$this->select->where('p.email=?',$fields['email']);
}
// To get the Role, we have to join the user_roles and roles tables
if (isset($fields['role'])) {
$joins['ur'] = array('table'=>'user_roles','condition'=>'u.id=ur.user_id');
$joins['r'] = array('table'=>'roles','condition'=>'ur.role_id=r.id');
$this->select->where('r.name=?',$fields['role']);
}
// Add all the joins we've created to the select
foreach ($joins as $key=>$join) {
$this->select->joinLeft(array($key=>$join['table']),$join['condition']);
}
$this->select->order($order);
if ($limit) {
$this->select->limit($limit);
}
if ($groupBy) {
$this->select->group($groupBy);
}
$this->populateList();
}
/**
* Hydrates all the objects from a database result set
*
* This is a callback function, called from ZendDbResultIterator. It is
* called once per row of the result.
*
* @param int $key The index of the result row to load
* @return User
*/
protected function loadResult($key)
{
return new User($this->result[$key]);
}
}

124
configuration.inc.default Normal file
View File

@ -0,0 +1,124 @@
<?php
/**
* Replace this copyright statement with your own. All the generated code
* will include this copyright statement
*/
define('COPYRIGHT',"/**
* @copyright 2007-2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/");
/**
* Used to keep sessions on the same webserver seperate;
*/
define('APPLICATION_NAME','application_name');
/**
* Where on the filesystem this application is installed
*/
define('APPLICATION_HOME','/var/www/sites/application_name');
/**
* Where on the filesystem the framework is installed.
*/
define('FRAMEWORK',APPLICATION_HOME.'/libraries/framework');
/**
* This needs to point to the library directory inside your
* installation of the ZendFramework
* http://framework.zend.com
*/
define('ZEND',APPLICATION_HOME.'/libraries/ZendFramework/library');
ini_set('include_path','.'.PATH_SEPARATOR.ZEND);
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();
/**
* The URL to get to this site
* Do NOT use a trailing slash
*/
define('BASE_URL','http://localhost');
/**
* Used when there's an error on the site. The Framework will
* print out a nice error message, encouraging users to report any problems
* See: FRAMEWORK/ITSFunctions.inc
*
* This is also the default Admin user information that gets added to the database
*/
define('ADMINISTRATOR_NAME','Site Admin');
define('ADMINISTRATOR_EMAIL','admin@servername.com');
/**
* Set how we want to handle errors
* PHP_DEFAULT - do whatever's configured in php.ini
*
* If you do not define error handling to PHP_DEFAULT
* the custom error handlers kick in. All of the custom error display
* frunctions are in FRAMEWORK/globalFunctions.inc. The custom error
* function decide what to do based on $ERROR_REPORING array values
*
* PRETTY_PRINT - Display a message in the browser
* EMAIL_ADMIN - email the Administrator
* EMAIL_USER - email the logged in user
* SKIDDER - post errors to a Skidder server (see config below)
*/
define('ERROR_REPORTING','PHP_DEFAULT');
//define('ERROR_REPORTING','CUSTOM');
//$ERROR_REPORTING = array('PRETTY_PRINT','SKIDDER');
/**
* Skidder is a web service for error notifications. Error reporting supports
* posting errors to a Skidder server. You must register for an application_id
* on the skidder server you want to post errors to.
*/
//define('SKIDDER_URL','http://localhost/skidder/home.php');
//define('SKIDDER_APPLICATION_ID',);
/**
* Database Setup
* Refer to the PDO documentation for DSN sytnax for your database type
* http://www.php.net/manual/en/pdo.drivers.php
*/
define('DB_ADAPTER','Pdo_Mysql');
define('DB_HOST','localhost');
define('DB_NAME',APPLICATION_NAME);
define('DB_USER',APPLICATION_NAME);
define('DB_PASS','password');
/**
* LDAP Configuration
* This is required in order to use the LDAP authentication
* If you do not want to use LDAP authentication, you can comment this out
*/
define('LDAP_DOMAIN','ldap.domain.somewhere');
define('LDAP_DN','ou=people,o='.LDAP_DOMAIN);
define('LDAP_USERNAME_ATTRIBUTE','uid');
define('LDAP_ADMIN_USER','username');
define('LDAP_ADMIN_PASS','password');
define('LDAP_SERVER','ldap.somewhere.com');
define('LDAP_PASSWORD_ATTRIBUTE','userpassword');
/**
* Import global functions that we use for many applications we write
*/
include FRAMEWORK.'/globalFunctions.php';
spl_autoload_register('autoload');
/**
* Session Startup
* Don't start a session for CLI usage.
* We only want sessions when PHP code is executed from the webserver
*/
if (!defined('STDIN')) {
ini_set('session.save_path',APPLICATION_HOME.'/data/sessions');
session_start();
}
/**
* Load the Zend_Acl
* Access control is going to handled using the Zend_Acl
* We only need to load it, if someone is logged in
*/
if (isset($_SESSION['USER'])) {
include APPLICATION_HOME.'/access_control.inc';
}

View File

@ -1,7 +0,0 @@
@echo off
if ""%1""=="""" goto usage
copy .\build\WEB-INF\classes\%1\*.class .\WEB-INf\classes\%1\.
goto done
:usage
echo " need to pass an argument to cpc "
:done

8
cpc.sh
View File

@ -1,8 +0,0 @@
#!/bin/sh
/bin/cp ./build/WEB-INF/classes/$1/*.class ./WEB-INF/classes/$1/.

BIN
docs.tar

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More