first commit
340
LICENSE.txt
Normal file
@ -0,0 +1,340 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||||
|
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Library General Public License instead.) You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
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
|
||||||
|
this service 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.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. You must make sure that they, too, receive or can get the
|
||||||
|
source code. And you must show them these terms so they know their
|
||||||
|
rights.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
|
refers to any such program or work, and a "work based on the Program"
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
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
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the 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 a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.
|
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE 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.
|
||||||
|
|
||||||
|
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
|
||||||
|
convey 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 General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 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 General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) year name of author
|
||||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
This General Public License does not permit incorporating your program into
|
||||||
|
proprietary programs. If your program is a subroutine library, you may
|
||||||
|
consider it more useful to permit linking proprietary applications with the
|
||||||
|
library. If this is what you want to do, use the GNU Library General
|
||||||
|
Public License instead of this License.
|
59
README.md
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
# Sermon Distributor (1.2.9)
|
||||||
|
|
||||||
|
![Sermon Distributor image](https://raw.githubusercontent.com/SermonDistributor/Joomla-3-Component/master/admin/assets/images/component-300.jpg "The Sermon Distributor")
|
||||||
|
|
||||||
|
Distributor is a highly advanced sermon distributor that runs on the [Joomla] (http://www.joomla.org) framework. You can link a shared folder from Dropbox to the component and use Dropbox as your file host, not to mention the advanced auto builder that gives you the ability to simply load sermons to your website by only adding them to Dropbox.
|
||||||
|
|
||||||
|
The best way to see all your options is to install this component on you Joomla website and test all features yourself. Here is a [direct download link] (https://github.com/SermonDistributor/Joomla-3-Component/archive/master.zip)
|
||||||
|
|
||||||
|
### Example Website, That Has Over 6000 Audio Files
|
||||||
|
|
||||||
|
[LoudVoice.org] (http://www.loudvoice.org)
|
||||||
|
|
||||||
|
### Some Video Demonstrations
|
||||||
|
|
||||||
|
+ [Setup overview] (https://youtu.be/yMPp1Cp3W_0?t=20m)
|
||||||
|
+ [Setup Dropbox] (https://youtu.be/btpKFDk0-dI)
|
||||||
|
+ [Component Build] (https://youtu.be/yMPp1Cp3W_0)
|
||||||
|
|
||||||
|
# Build Details
|
||||||
|
|
||||||
|
+ *Company*: [Vast Development Method] (https://www.vdm.io/)
|
||||||
|
+ *Author*: [Llewellyn van der Merwe] (mailto:llewellyn@vdm.io)
|
||||||
|
+ *Name*: [Sermon Distributor] (https://www.vdm.io/)
|
||||||
|
+ *Created*: 22nd October, 2015
|
||||||
|
+ *Build*: 30th November, 2015
|
||||||
|
+ *Version*: 1.2.9
|
||||||
|
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
|
||||||
|
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
|
||||||
|
## Build Time
|
||||||
|
|
||||||
|
**126 Hours** or **16 Eight Hour Days** (actual time the author saved -
|
||||||
|
due to [Automated Component Builder] (https://www.vdm.io/joomla-component-builder))
|
||||||
|
|
||||||
|
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
|
||||||
|
> never making one mistake or taking any coffee break.)
|
||||||
|
|
||||||
|
+ *Line count*: **45140**
|
||||||
|
+ *File count*: **347**
|
||||||
|
+ *Folder count*: **79**
|
||||||
|
|
||||||
|
**83 Hours** or **10 Eight Hour Days** (the actual time the author spent)
|
||||||
|
|
||||||
|
> (with the following break down:
|
||||||
|
> **debugging @31hours** = codingtime / 4;
|
||||||
|
> **planning @18hours** = codingtime / 7;
|
||||||
|
> **mapping @13hours** = codingtime / 10;
|
||||||
|
> **office @21hours** = codingtime / 6;)
|
||||||
|
|
||||||
|
**209 Hours** or **26 Eight Hour Days**
|
||||||
|
(a total of the realistic time frame for this project)
|
||||||
|
|
||||||
|
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
|
||||||
|
> with the normal everyday realities at the office, that includes the component planning, mapping & debugging.)
|
||||||
|
|
||||||
|
Project duration: **5.2 weeks** or **1.1 months**
|
||||||
|
|
||||||
|
> This **component** was build with a Joomla [Automated Component Builder] (https://www.vdm.io/joomla-component-builder).
|
||||||
|
> Developed by [Llewellyn van der Merwe] (mailto:joomla@vdm.io)
|
157
admin/access.xml
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<access component="com_sermondistributor">
|
||||||
|
<section name="component">
|
||||||
|
<action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" />
|
||||||
|
<action name="core.options" title="JACTION_OPTIONS" description="JACTION_OPTIONS_COMPONENT_DESC" />
|
||||||
|
<action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_COMPONENT_DESC" />
|
||||||
|
<action name="core.export" title="COM_SERMONDISTRIBUTOR_EXPORT_DATA" description="COM_SERMONDISTRIBUTOR_EXPORT_DATA_DESC" />
|
||||||
|
<action name="core.import" title="COM_SERMONDISTRIBUTOR_IMPORT_DATA" description="COM_SERMONDISTRIBUTOR_IMPORT_DATA_DESC" />
|
||||||
|
<action name="core.batch" title="COM_SERMONDISTRIBUTOR_USE_BATCH" description="COM_SERMONDISTRIBUTOR_USE_BATCH_DESC" />
|
||||||
|
<action name="core.version" title="COM_SERMONDISTRIBUTOR_EDIT_VERSIONS" description="COM_SERMONDISTRIBUTOR_EDIT_VERSIONS_DESC" />
|
||||||
|
<action name="core.create" title="JACTION_CREATE" description="JACTION_CREATE_COMPONENT_DESC" />
|
||||||
|
<action name="core.delete" title="JACTION_DELETE" description="JACTION_DELETE_COMPONENT_DESC" />
|
||||||
|
<action name="core.edit" title="JACTION_EDIT" description="JACTION_EDIT_COMPONENT_DESC" />
|
||||||
|
<action name="core.edit.state" title="JACTION_EDITSTATE" description="JACTION_ACCESS_EDITSTATE_DESC" />
|
||||||
|
<action name="core.edit.own" title="JACTION_EDITOWN" description="JACTION_EDITOWN_COMPONENT_DESC" />
|
||||||
|
<action name="core.edit.created_by" title="COM_SERMONDISTRIBUTOR_EDIT_CREATED_BY" description="COM_SERMONDISTRIBUTOR_EDIT_CREATED_BY_DESC" />
|
||||||
|
<action name="core.edit.created" title="COM_SERMONDISTRIBUTOR_EDIT_CREATED_DATE" description="COM_SERMONDISTRIBUTOR_EDIT_CREATED_DATE_DESC" />
|
||||||
|
<action name="site.categories.access" title="COM_SERMONDISTRIBUTOR_CATEGORIES_ACCESS_SITE" description="COM_SERMONDISTRIBUTOR_CATEGORIES_ACCESS_SITE_DESC" />
|
||||||
|
<action name="site.category.access" title="COM_SERMONDISTRIBUTOR_CATEGORY_ACCESS_SITE" description="COM_SERMONDISTRIBUTOR_CATEGORY_ACCESS_SITE_DESC" />
|
||||||
|
<action name="help_document.access" title="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_ACCESS" description="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_ACCESS_DESC" />
|
||||||
|
<action name="help_document.batch" title="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_BATCH_USE" description="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_BATCH_USE_DESC" />
|
||||||
|
<action name="help_document.create" title="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_CREATE" description="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_CREATE_DESC" />
|
||||||
|
<action name="help_document.dashboard_list" title="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_DASHBOARD_LIST" description="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_DASHBOARD_LIST_DESC" />
|
||||||
|
<action name="help_document.delete" title="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_DELETE" description="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_DELETE_DESC" />
|
||||||
|
<action name="help_document.edit" title="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EDIT" description="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EDIT_DESC" />
|
||||||
|
<action name="help_document.edit.own" title="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EDIT_OWN" description="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EDIT_OWN_DESC" />
|
||||||
|
<action name="help_document.edit.state" title="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EDIT_STATE" description="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EDIT_STATE_DESC" />
|
||||||
|
<action name="help_document.version" title="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EDIT_VERSION" description="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EDIT_VERSION_DESC" />
|
||||||
|
<action name="help_document.export" title="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EXPORT" description="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EXPORT_DESC" />
|
||||||
|
<action name="help_document.import" title="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_IMPORT" description="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_IMPORT_DESC" />
|
||||||
|
<action name="help_document.submenu" title="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_SUBMENU" description="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_SUBMENU_DESC" />
|
||||||
|
<action name="site.preacher.access" title="COM_SERMONDISTRIBUTOR_PREACHER_ACCESS_SITE" description="COM_SERMONDISTRIBUTOR_PREACHER_ACCESS_SITE_DESC" />
|
||||||
|
<action name="preacher.access" title="COM_SERMONDISTRIBUTOR_PREACHERS_ACCESS" description="COM_SERMONDISTRIBUTOR_PREACHERS_ACCESS_DESC" />
|
||||||
|
<action name="site.preachers.access" title="COM_SERMONDISTRIBUTOR_PREACHERS_ACCESS_SITE" description="COM_SERMONDISTRIBUTOR_PREACHERS_ACCESS_SITE_DESC" />
|
||||||
|
<action name="preacher.batch" title="COM_SERMONDISTRIBUTOR_PREACHERS_BATCH_USE" description="COM_SERMONDISTRIBUTOR_PREACHERS_BATCH_USE_DESC" />
|
||||||
|
<action name="preacher.create" title="COM_SERMONDISTRIBUTOR_PREACHERS_CREATE" description="COM_SERMONDISTRIBUTOR_PREACHERS_CREATE_DESC" />
|
||||||
|
<action name="preacher.dashboard_add" title="COM_SERMONDISTRIBUTOR_PREACHERS_DASHBOARD_ADD" description="COM_SERMONDISTRIBUTOR_PREACHERS_DASHBOARD_ADD_DESC" />
|
||||||
|
<action name="preacher.dashboard_list" title="COM_SERMONDISTRIBUTOR_PREACHERS_DASHBOARD_LIST" description="COM_SERMONDISTRIBUTOR_PREACHERS_DASHBOARD_LIST_DESC" />
|
||||||
|
<action name="preacher.delete" title="COM_SERMONDISTRIBUTOR_PREACHERS_DELETE" description="COM_SERMONDISTRIBUTOR_PREACHERS_DELETE_DESC" />
|
||||||
|
<action name="preacher.edit" title="COM_SERMONDISTRIBUTOR_PREACHERS_EDIT" description="COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_DESC" />
|
||||||
|
<action name="preacher.edit.created_by" title="COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_CREATED_BY" description="COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_CREATED_BY_DESC" />
|
||||||
|
<action name="preacher.edit.created" title="COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_CREATED_DATE" description="COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_CREATED_DATE_DESC" />
|
||||||
|
<action name="preacher.edit.own" title="COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_OWN" description="COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_OWN_DESC" />
|
||||||
|
<action name="preacher.edit.state" title="COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_STATE" description="COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_STATE_DESC" />
|
||||||
|
<action name="preacher.version" title="COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_VERSION" description="COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_VERSION_DESC" />
|
||||||
|
<action name="preacher.export" title="COM_SERMONDISTRIBUTOR_PREACHERS_EXPORT" description="COM_SERMONDISTRIBUTOR_PREACHERS_EXPORT_DESC" />
|
||||||
|
<action name="preacher.import" title="COM_SERMONDISTRIBUTOR_PREACHERS_IMPORT" description="COM_SERMONDISTRIBUTOR_PREACHERS_IMPORT_DESC" />
|
||||||
|
<action name="preacher.submenu" title="COM_SERMONDISTRIBUTOR_PREACHERS_SUBMENU" description="COM_SERMONDISTRIBUTOR_PREACHERS_SUBMENU_DESC" />
|
||||||
|
<action name="site.series.access" title="COM_SERMONDISTRIBUTOR_SERIES_ACCESS_SITE" description="COM_SERMONDISTRIBUTOR_SERIES_ACCESS_SITE_DESC" />
|
||||||
|
<action name="series.access" title="COM_SERMONDISTRIBUTOR_SERIES_LIST_ACCESS" description="COM_SERMONDISTRIBUTOR_SERIES_LIST_ACCESS_DESC" />
|
||||||
|
<action name="site.serieslist.access" title="COM_SERMONDISTRIBUTOR_SERIES_LIST_ACCESS_SITE" description="COM_SERMONDISTRIBUTOR_SERIES_LIST_ACCESS_SITE_DESC" />
|
||||||
|
<action name="series.batch" title="COM_SERMONDISTRIBUTOR_SERIES_LIST_BATCH_USE" description="COM_SERMONDISTRIBUTOR_SERIES_LIST_BATCH_USE_DESC" />
|
||||||
|
<action name="series.create" title="COM_SERMONDISTRIBUTOR_SERIES_LIST_CREATE" description="COM_SERMONDISTRIBUTOR_SERIES_LIST_CREATE_DESC" />
|
||||||
|
<action name="series.dashboard_add" title="COM_SERMONDISTRIBUTOR_SERIES_LIST_DASHBOARD_ADD" description="COM_SERMONDISTRIBUTOR_SERIES_LIST_DASHBOARD_ADD_DESC" />
|
||||||
|
<action name="series.dashboard_list" title="COM_SERMONDISTRIBUTOR_SERIES_LIST_DASHBOARD_LIST" description="COM_SERMONDISTRIBUTOR_SERIES_LIST_DASHBOARD_LIST_DESC" />
|
||||||
|
<action name="series.delete" title="COM_SERMONDISTRIBUTOR_SERIES_LIST_DELETE" description="COM_SERMONDISTRIBUTOR_SERIES_LIST_DELETE_DESC" />
|
||||||
|
<action name="series.edit" title="COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT" description="COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_DESC" />
|
||||||
|
<action name="series.edit.created_by" title="COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_CREATED_BY" description="COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_CREATED_BY_DESC" />
|
||||||
|
<action name="series.edit.created" title="COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_CREATED_DATE" description="COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_CREATED_DATE_DESC" />
|
||||||
|
<action name="series.edit.own" title="COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_OWN" description="COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_OWN_DESC" />
|
||||||
|
<action name="series.edit.state" title="COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_STATE" description="COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_STATE_DESC" />
|
||||||
|
<action name="series.version" title="COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_VERSION" description="COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_VERSION_DESC" />
|
||||||
|
<action name="series.export" title="COM_SERMONDISTRIBUTOR_SERIES_LIST_EXPORT" description="COM_SERMONDISTRIBUTOR_SERIES_LIST_EXPORT_DESC" />
|
||||||
|
<action name="series.import" title="COM_SERMONDISTRIBUTOR_SERIES_LIST_IMPORT" description="COM_SERMONDISTRIBUTOR_SERIES_LIST_IMPORT_DESC" />
|
||||||
|
<action name="series.submenu" title="COM_SERMONDISTRIBUTOR_SERIES_LIST_SUBMENU" description="COM_SERMONDISTRIBUTOR_SERIES_LIST_SUBMENU_DESC" />
|
||||||
|
<action name="site.sermon.access" title="COM_SERMONDISTRIBUTOR_SERMON_ACCESS_SITE" description="COM_SERMONDISTRIBUTOR_SERMON_ACCESS_SITE_DESC" />
|
||||||
|
<action name="sermon.access" title="COM_SERMONDISTRIBUTOR_SERMONS_ACCESS" description="COM_SERMONDISTRIBUTOR_SERMONS_ACCESS_DESC" />
|
||||||
|
<action name="sermon.batch" title="COM_SERMONDISTRIBUTOR_SERMONS_BATCH_USE" description="COM_SERMONDISTRIBUTOR_SERMONS_BATCH_USE_DESC" />
|
||||||
|
<action name="sermon.create" title="COM_SERMONDISTRIBUTOR_SERMONS_CREATE" description="COM_SERMONDISTRIBUTOR_SERMONS_CREATE_DESC" />
|
||||||
|
<action name="sermon.dashboard_add" title="COM_SERMONDISTRIBUTOR_SERMONS_DASHBOARD_ADD" description="COM_SERMONDISTRIBUTOR_SERMONS_DASHBOARD_ADD_DESC" />
|
||||||
|
<action name="sermon.dashboard_list" title="COM_SERMONDISTRIBUTOR_SERMONS_DASHBOARD_LIST" description="COM_SERMONDISTRIBUTOR_SERMONS_DASHBOARD_LIST_DESC" />
|
||||||
|
<action name="sermon.delete" title="COM_SERMONDISTRIBUTOR_SERMONS_DELETE" description="COM_SERMONDISTRIBUTOR_SERMONS_DELETE_DESC" />
|
||||||
|
<action name="sermon.edit" title="COM_SERMONDISTRIBUTOR_SERMONS_EDIT" description="COM_SERMONDISTRIBUTOR_SERMONS_EDIT_DESC" />
|
||||||
|
<action name="sermon.edit.created_by" title="COM_SERMONDISTRIBUTOR_SERMONS_EDIT_CREATED_BY" description="COM_SERMONDISTRIBUTOR_SERMONS_EDIT_CREATED_BY_DESC" />
|
||||||
|
<action name="sermon.edit.created" title="COM_SERMONDISTRIBUTOR_SERMONS_EDIT_CREATED_DATE" description="COM_SERMONDISTRIBUTOR_SERMONS_EDIT_CREATED_DATE_DESC" />
|
||||||
|
<action name="sermon.edit.own" title="COM_SERMONDISTRIBUTOR_SERMONS_EDIT_OWN" description="COM_SERMONDISTRIBUTOR_SERMONS_EDIT_OWN_DESC" />
|
||||||
|
<action name="sermon.edit.state" title="COM_SERMONDISTRIBUTOR_SERMONS_EDIT_STATE" description="COM_SERMONDISTRIBUTOR_SERMONS_EDIT_STATE_DESC" />
|
||||||
|
<action name="sermon.version" title="COM_SERMONDISTRIBUTOR_SERMONS_EDIT_VERSION" description="COM_SERMONDISTRIBUTOR_SERMONS_EDIT_VERSION_DESC" />
|
||||||
|
<action name="sermon.export" title="COM_SERMONDISTRIBUTOR_SERMONS_EXPORT" description="COM_SERMONDISTRIBUTOR_SERMONS_EXPORT_DESC" />
|
||||||
|
<action name="sermon.import" title="COM_SERMONDISTRIBUTOR_SERMONS_IMPORT" description="COM_SERMONDISTRIBUTOR_SERMONS_IMPORT_DESC" />
|
||||||
|
<action name="sermon.submenu" title="COM_SERMONDISTRIBUTOR_SERMONS_SUBMENU" description="COM_SERMONDISTRIBUTOR_SERMONS_SUBMENU_DESC" />
|
||||||
|
<action name="statistic.access" title="COM_SERMONDISTRIBUTOR_STATISTICS_ACCESS" description="COM_SERMONDISTRIBUTOR_STATISTICS_ACCESS_DESC" />
|
||||||
|
<action name="statistic.batch" title="COM_SERMONDISTRIBUTOR_STATISTICS_BATCH_USE" description="COM_SERMONDISTRIBUTOR_STATISTICS_BATCH_USE_DESC" />
|
||||||
|
<action name="statistic.create" title="COM_SERMONDISTRIBUTOR_STATISTICS_CREATE" description="COM_SERMONDISTRIBUTOR_STATISTICS_CREATE_DESC" />
|
||||||
|
<action name="statistic.dashboard_list" title="COM_SERMONDISTRIBUTOR_STATISTICS_DASHBOARD_LIST" description="COM_SERMONDISTRIBUTOR_STATISTICS_DASHBOARD_LIST_DESC" />
|
||||||
|
<action name="statistic.delete" title="COM_SERMONDISTRIBUTOR_STATISTICS_DELETE" description="COM_SERMONDISTRIBUTOR_STATISTICS_DELETE_DESC" />
|
||||||
|
<action name="statistic.edit" title="COM_SERMONDISTRIBUTOR_STATISTICS_EDIT" description="COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_DESC" />
|
||||||
|
<action name="statistic.edit.created_by" title="COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_CREATED_BY" description="COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_CREATED_BY_DESC" />
|
||||||
|
<action name="statistic.edit.created" title="COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_CREATED_DATE" description="COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_CREATED_DATE_DESC" />
|
||||||
|
<action name="statistic.edit.own" title="COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_OWN" description="COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_OWN_DESC" />
|
||||||
|
<action name="statistic.edit.state" title="COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_STATE" description="COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_STATE_DESC" />
|
||||||
|
<action name="statistic.version" title="COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_VERSION" description="COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_VERSION_DESC" />
|
||||||
|
<action name="statistic.export" title="COM_SERMONDISTRIBUTOR_STATISTICS_EXPORT" description="COM_SERMONDISTRIBUTOR_STATISTICS_EXPORT_DESC" />
|
||||||
|
<action name="statistic.import" title="COM_SERMONDISTRIBUTOR_STATISTICS_IMPORT" description="COM_SERMONDISTRIBUTOR_STATISTICS_IMPORT_DESC" />
|
||||||
|
<action name="statistic.submenu" title="COM_SERMONDISTRIBUTOR_STATISTICS_SUBMENU" description="COM_SERMONDISTRIBUTOR_STATISTICS_SUBMENU_DESC" />
|
||||||
|
</section>
|
||||||
|
<section name="preacher">
|
||||||
|
<action name="preacher.edit" title="COM_SERMONDISTRIBUTOR_PREACHERS_EDIT" description="COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_DESC" />
|
||||||
|
<action name="preacher.edit.own" title="COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_OWN" description="COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_OWN_DESC" />
|
||||||
|
<action name="preacher.edit.state" title="COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_STATE" description="COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_STATE_DESC" />
|
||||||
|
<action name="preacher.edit.created_by" title="COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_CREATED_BY" description="COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_CREATED_BY_DESC" />
|
||||||
|
<action name="preacher.edit.created" title="COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_CREATED_DATE" description="COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_CREATED_DATE_DESC" />
|
||||||
|
<action name="preacher.create" title="COM_SERMONDISTRIBUTOR_PREACHERS_CREATE" description="COM_SERMONDISTRIBUTOR_PREACHERS_CREATE_DESC" />
|
||||||
|
<action name="preacher.delete" title="COM_SERMONDISTRIBUTOR_PREACHERS_DELETE" description="COM_SERMONDISTRIBUTOR_PREACHERS_DELETE_DESC" />
|
||||||
|
<action name="preacher.access" title="COM_SERMONDISTRIBUTOR_PREACHERS_ACCESS" description="COM_SERMONDISTRIBUTOR_PREACHERS_ACCESS_DESC" />
|
||||||
|
<action name="preacher.version" title="COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_VERSION" description="COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_VERSION_DESC" />
|
||||||
|
</section>
|
||||||
|
<section name="sermon">
|
||||||
|
<action name="sermon.edit" title="COM_SERMONDISTRIBUTOR_SERMONS_EDIT" description="COM_SERMONDISTRIBUTOR_SERMONS_EDIT_DESC" />
|
||||||
|
<action name="sermon.edit.own" title="COM_SERMONDISTRIBUTOR_SERMONS_EDIT_OWN" description="COM_SERMONDISTRIBUTOR_SERMONS_EDIT_OWN_DESC" />
|
||||||
|
<action name="sermon.edit.state" title="COM_SERMONDISTRIBUTOR_SERMONS_EDIT_STATE" description="COM_SERMONDISTRIBUTOR_SERMONS_EDIT_STATE_DESC" />
|
||||||
|
<action name="sermon.edit.created_by" title="COM_SERMONDISTRIBUTOR_SERMONS_EDIT_CREATED_BY" description="COM_SERMONDISTRIBUTOR_SERMONS_EDIT_CREATED_BY_DESC" />
|
||||||
|
<action name="sermon.edit.created" title="COM_SERMONDISTRIBUTOR_SERMONS_EDIT_CREATED_DATE" description="COM_SERMONDISTRIBUTOR_SERMONS_EDIT_CREATED_DATE_DESC" />
|
||||||
|
<action name="sermon.create" title="COM_SERMONDISTRIBUTOR_SERMONS_CREATE" description="COM_SERMONDISTRIBUTOR_SERMONS_CREATE_DESC" />
|
||||||
|
<action name="sermon.delete" title="COM_SERMONDISTRIBUTOR_SERMONS_DELETE" description="COM_SERMONDISTRIBUTOR_SERMONS_DELETE_DESC" />
|
||||||
|
<action name="sermon.access" title="COM_SERMONDISTRIBUTOR_SERMONS_ACCESS" description="COM_SERMONDISTRIBUTOR_SERMONS_ACCESS_DESC" />
|
||||||
|
<action name="sermon.version" title="COM_SERMONDISTRIBUTOR_SERMONS_EDIT_VERSION" description="COM_SERMONDISTRIBUTOR_SERMONS_EDIT_VERSION_DESC" />
|
||||||
|
</section>
|
||||||
|
<section name="series">
|
||||||
|
<action name="series.edit" title="COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT" description="COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_DESC" />
|
||||||
|
<action name="series.edit.own" title="COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_OWN" description="COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_OWN_DESC" />
|
||||||
|
<action name="series.edit.state" title="COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_STATE" description="COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_STATE_DESC" />
|
||||||
|
<action name="series.edit.created_by" title="COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_CREATED_BY" description="COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_CREATED_BY_DESC" />
|
||||||
|
<action name="series.edit.created" title="COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_CREATED_DATE" description="COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_CREATED_DATE_DESC" />
|
||||||
|
<action name="series.create" title="COM_SERMONDISTRIBUTOR_SERIES_LIST_CREATE" description="COM_SERMONDISTRIBUTOR_SERIES_LIST_CREATE_DESC" />
|
||||||
|
<action name="series.delete" title="COM_SERMONDISTRIBUTOR_SERIES_LIST_DELETE" description="COM_SERMONDISTRIBUTOR_SERIES_LIST_DELETE_DESC" />
|
||||||
|
<action name="series.access" title="COM_SERMONDISTRIBUTOR_SERIES_LIST_ACCESS" description="COM_SERMONDISTRIBUTOR_SERIES_LIST_ACCESS_DESC" />
|
||||||
|
<action name="series.version" title="COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_VERSION" description="COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_VERSION_DESC" />
|
||||||
|
</section>
|
||||||
|
<section name="statistic">
|
||||||
|
<action name="statistic.edit" title="COM_SERMONDISTRIBUTOR_STATISTICS_EDIT" description="COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_DESC" />
|
||||||
|
<action name="statistic.edit.own" title="COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_OWN" description="COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_OWN_DESC" />
|
||||||
|
<action name="statistic.edit.state" title="COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_STATE" description="COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_STATE_DESC" />
|
||||||
|
<action name="statistic.edit.created_by" title="COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_CREATED_BY" description="COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_CREATED_BY_DESC" />
|
||||||
|
<action name="statistic.edit.created" title="COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_CREATED_DATE" description="COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_CREATED_DATE_DESC" />
|
||||||
|
<action name="statistic.create" title="COM_SERMONDISTRIBUTOR_STATISTICS_CREATE" description="COM_SERMONDISTRIBUTOR_STATISTICS_CREATE_DESC" />
|
||||||
|
<action name="statistic.delete" title="COM_SERMONDISTRIBUTOR_STATISTICS_DELETE" description="COM_SERMONDISTRIBUTOR_STATISTICS_DELETE_DESC" />
|
||||||
|
<action name="statistic.access" title="COM_SERMONDISTRIBUTOR_STATISTICS_ACCESS" description="COM_SERMONDISTRIBUTOR_STATISTICS_ACCESS_DESC" />
|
||||||
|
<action name="statistic.version" title="COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_VERSION" description="COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_VERSION_DESC" />
|
||||||
|
</section>
|
||||||
|
<section name="help_document">
|
||||||
|
<action name="help_document.edit" title="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EDIT" description="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EDIT_DESC" />
|
||||||
|
<action name="help_document.edit.own" title="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EDIT_OWN" description="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EDIT_OWN_DESC" />
|
||||||
|
<action name="help_document.edit.state" title="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EDIT_STATE" description="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EDIT_STATE_DESC" />
|
||||||
|
<action name="help_document.create" title="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_CREATE" description="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_CREATE_DESC" />
|
||||||
|
<action name="help_document.delete" title="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_DELETE" description="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_DELETE_DESC" />
|
||||||
|
<action name="help_document.access" title="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_ACCESS" description="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_ACCESS_DESC" />
|
||||||
|
<action name="help_document.version" title="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EDIT_VERSION" description="COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EDIT_VERSION_DESC" />
|
||||||
|
</section>
|
||||||
|
<section name="category.sermons">
|
||||||
|
<action name="core.create" title="JACTION_CREATE" description="JACTION_CREATE_COMPONENT_DESC" />
|
||||||
|
<action name="core.delete" title="JACTION_DELETE" description="COM_CATEGORIES_ACCESS_DELETE_DESC" />
|
||||||
|
<action name="core.edit" title="JACTION_EDIT" description="COM_CATEGORIES_ACCESS_EDIT_DESC" />
|
||||||
|
<action name="core.edit.state" title="JACTION_EDITSTATE" description="COM_CATEGORIES_ACCESS_EDITSTATE_DESC" />
|
||||||
|
<action name="core.edit.own" title="JACTION_EDITOWN" description="COM_CATEGORIES_ACCESS_EDITOWN_DESC" />
|
||||||
|
</section>
|
||||||
|
</access>
|
24
admin/assets/css/admin.css
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||||
|
Vast Development Method
|
||||||
|
/-------------------------------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
@version 1.2.9
|
||||||
|
@build 30th November, 2015
|
||||||
|
@created 22nd October, 2015
|
||||||
|
@package Sermon Distributor
|
||||||
|
@subpackage admin.css
|
||||||
|
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||||
|
@copyright Copyright (C) 2015. All Rights Reserved
|
||||||
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||||
|
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||||
|
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||||
|
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* CSS Document */
|
||||||
|
.no-click {
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
172
admin/assets/css/dashboard.css
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||||
|
Vast Development Method
|
||||||
|
/-------------------------------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
@version 1.2.9
|
||||||
|
@build 30th November, 2015
|
||||||
|
@created 22nd October, 2015
|
||||||
|
@package Sermon Distributor
|
||||||
|
@subpackage dashboard.css
|
||||||
|
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||||
|
@copyright Copyright (C) 2015. All Rights Reserved
|
||||||
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||||
|
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||||
|
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||||
|
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* CSS Document */
|
||||||
|
|
||||||
|
.dashboard-container {
|
||||||
|
margin-left: 10px;
|
||||||
|
margin-top: 10px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.dashboard-container [class*="span"] {
|
||||||
|
display: block;
|
||||||
|
float: none;
|
||||||
|
margin-left: 0;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
.dashboard-container:before, .dashboard-container:after {
|
||||||
|
content: "";
|
||||||
|
display: table;
|
||||||
|
}
|
||||||
|
.dashboard-container:after {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
.dashboard-container [class*="span"] {
|
||||||
|
box-sizing: border-box;
|
||||||
|
display: block;
|
||||||
|
float: left;
|
||||||
|
min-height: 145px;
|
||||||
|
min-width: 96px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.dashboard-container [class*="span"]:first-child {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
.dashboard-wraper {
|
||||||
|
background: none repeat scroll 0 0 hsl(0, 0%, 93%);
|
||||||
|
border-radius: 5px;
|
||||||
|
float: left;
|
||||||
|
margin: 1%;
|
||||||
|
padding: 3px;
|
||||||
|
width: 17%;
|
||||||
|
min-height: 194px;
|
||||||
|
min-width: 96px;
|
||||||
|
}
|
||||||
|
.dashboard-content a {
|
||||||
|
background: linear-gradient(to bottom, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 96%) 47%, hsl(0, 0%, 93%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0);
|
||||||
|
border: 1px solid hsl(0, 0%, 85%);
|
||||||
|
border-radius: 4px;
|
||||||
|
box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset;
|
||||||
|
color: hsl(0, 0%, 20%);
|
||||||
|
display: block;
|
||||||
|
min-height: 89px;
|
||||||
|
padding: 10px;
|
||||||
|
text-align: center;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.dashboard-content a:hover {
|
||||||
|
background: linear-gradient(to bottom, hsl(0, 0%, 90%) 0%, hsl(0, 0%, 100%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0);
|
||||||
|
color: hsl(200, 100%, 30%);
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.dashboard-title {
|
||||||
|
display: block;
|
||||||
|
padding-top: 5px;
|
||||||
|
}
|
||||||
|
.dashboard-info {
|
||||||
|
background: linear-gradient(to bottom, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 96%) 47%, hsl(0, 0%, 93%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0);
|
||||||
|
border: 1px solid hsl(0, 0%, 85%);
|
||||||
|
border-radius: 4px;
|
||||||
|
box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset;
|
||||||
|
color: hsl(0, 0%, 20%);
|
||||||
|
display: block;
|
||||||
|
font-size: 12px;
|
||||||
|
padding: 10px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.dashboard-info span {
|
||||||
|
display: block;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.dashboard-info img {
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
.dashboard-table {
|
||||||
|
border-top: 1px solid hsl(0, 0%, 87%);
|
||||||
|
margin-top: 5px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.dashboard-info h5 {
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.dashboard-block {
|
||||||
|
background: linear-gradient(to bottom, hsl(0, 0%, 95%) 0%, hsl(0, 0%, 86%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0);
|
||||||
|
border: 1px solid hsl(0, 0%, 76%);
|
||||||
|
border-radius: 3px;
|
||||||
|
box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
.dashboard-block .dashboard-block-head {
|
||||||
|
background: linear-gradient(to bottom, hsl(0, 0%, 95%) 0%, hsl(0, 0%, 86%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0);
|
||||||
|
border-bottom: 1px solid hsl(0, 0%, 76%);
|
||||||
|
border-radius: 3px 3px 0 0;
|
||||||
|
box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset, 0 0 3px hsl(0, 0%, 87%);
|
||||||
|
height: 40px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.dashboard-block .dashboard-block-head h5 {
|
||||||
|
font-size: 12px;
|
||||||
|
margin: 0;
|
||||||
|
padding-left: 10px;
|
||||||
|
padding-top: 11px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
.dashboard-block .dashboard-block-content {
|
||||||
|
background: none repeat scroll 0 0 hsl(0, 0%, 93%);
|
||||||
|
border-radius: 0 0 3px 3px;
|
||||||
|
}
|
||||||
|
.dashboard-block .dashboard-block-box {
|
||||||
|
background: none repeat scroll 0 0 hsl(0, 0%, 100%);
|
||||||
|
border-top: 1px solid hsl(0, 0%, 82%);
|
||||||
|
box-shadow: 0 0 5px hsl(0, 0%, 87%) inset;
|
||||||
|
}
|
||||||
|
.dashboard-block .dashboard-block-content .dashboard-block-box {
|
||||||
|
margin-top: 0 !important;
|
||||||
|
}
|
||||||
|
.dashboard-block .dashboard-block-content .dashboard-block-box .dashboard-block-table {
|
||||||
|
margin-bottom: 0 !important;
|
||||||
|
}
|
||||||
|
.dashboard-block-table {
|
||||||
|
background-color: hsla(0, 0%, 0%, 0);
|
||||||
|
border-collapse: collapse;
|
||||||
|
border-spacing: 0;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
max-width: 100%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.dashboard-block-table th, .dashboard-block-table td {
|
||||||
|
border-top: 1px solid hsl(0, 0%, 87%);
|
||||||
|
line-height: 20px;
|
||||||
|
padding: 5px;
|
||||||
|
text-align: left;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
.dashboard-badge {
|
||||||
|
background-color: hsl(0, 0%, 60%);
|
||||||
|
border-radius: 9px;
|
||||||
|
color: hsl(0, 0%, 100%);
|
||||||
|
font-size: 11.844px;
|
||||||
|
font-weight: bold;
|
||||||
|
line-height: 14px;
|
||||||
|
padding: 1px 9px 2px;
|
||||||
|
text-shadow: 0 -1px 0 hsla(0, 0%, 0%, 0.25);
|
||||||
|
vertical-align: baseline;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
22
admin/assets/css/help_document.css
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||||
|
Vast Development Method
|
||||||
|
/-------------------------------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
@version 1.2.9
|
||||||
|
@build 30th November, 2015
|
||||||
|
@created 22nd October, 2015
|
||||||
|
@package Sermon Distributor
|
||||||
|
@subpackage help_document.css
|
||||||
|
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||||
|
@copyright Copyright (C) 2015. All Rights Reserved
|
||||||
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||||
|
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||||
|
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||||
|
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* CSS Document */
|
||||||
|
|
||||||
|
|
22
admin/assets/css/help_documents.css
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||||
|
Vast Development Method
|
||||||
|
/-------------------------------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
@version 1.2.9
|
||||||
|
@build 30th November, 2015
|
||||||
|
@created 22nd October, 2015
|
||||||
|
@package Sermon Distributor
|
||||||
|
@subpackage help_documents.css
|
||||||
|
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||||
|
@copyright Copyright (C) 2015. All Rights Reserved
|
||||||
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||||
|
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||||
|
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||||
|
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* CSS Document */
|
||||||
|
|
||||||
|
|
1
admin/assets/css/index.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
22
admin/assets/css/preacher.css
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||||
|
Vast Development Method
|
||||||
|
/-------------------------------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
@version 1.2.9
|
||||||
|
@build 30th November, 2015
|
||||||
|
@created 22nd October, 2015
|
||||||
|
@package Sermon Distributor
|
||||||
|
@subpackage preacher.css
|
||||||
|
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||||
|
@copyright Copyright (C) 2015. All Rights Reserved
|
||||||
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||||
|
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||||
|
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||||
|
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* CSS Document */
|
||||||
|
|
||||||
|
|
22
admin/assets/css/preachers.css
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||||
|
Vast Development Method
|
||||||
|
/-------------------------------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
@version 1.2.9
|
||||||
|
@build 30th November, 2015
|
||||||
|
@created 22nd October, 2015
|
||||||
|
@package Sermon Distributor
|
||||||
|
@subpackage preachers.css
|
||||||
|
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||||
|
@copyright Copyright (C) 2015. All Rights Reserved
|
||||||
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||||
|
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||||
|
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||||
|
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* CSS Document */
|
||||||
|
|
||||||
|
|
22
admin/assets/css/series.css
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||||
|
Vast Development Method
|
||||||
|
/-------------------------------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
@version 1.2.9
|
||||||
|
@build 30th November, 2015
|
||||||
|
@created 22nd October, 2015
|
||||||
|
@package Sermon Distributor
|
||||||
|
@subpackage series.css
|
||||||
|
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||||
|
@copyright Copyright (C) 2015. All Rights Reserved
|
||||||
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||||
|
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||||
|
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||||
|
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* CSS Document */
|
||||||
|
|
||||||
|
|
22
admin/assets/css/series_list.css
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||||
|
Vast Development Method
|
||||||
|
/-------------------------------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
@version 1.2.9
|
||||||
|
@build 30th November, 2015
|
||||||
|
@created 22nd October, 2015
|
||||||
|
@package Sermon Distributor
|
||||||
|
@subpackage series_list.css
|
||||||
|
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||||
|
@copyright Copyright (C) 2015. All Rights Reserved
|
||||||
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||||
|
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||||
|
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||||
|
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* CSS Document */
|
||||||
|
|
||||||
|
|
22
admin/assets/css/sermon.css
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||||
|
Vast Development Method
|
||||||
|
/-------------------------------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
@version 1.2.9
|
||||||
|
@build 30th November, 2015
|
||||||
|
@created 22nd October, 2015
|
||||||
|
@package Sermon Distributor
|
||||||
|
@subpackage sermon.css
|
||||||
|
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||||
|
@copyright Copyright (C) 2015. All Rights Reserved
|
||||||
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||||
|
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||||
|
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||||
|
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* CSS Document */
|
||||||
|
|
||||||
|
|
22
admin/assets/css/sermons.css
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||||
|
Vast Development Method
|
||||||
|
/-------------------------------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
@version 1.2.9
|
||||||
|
@build 30th November, 2015
|
||||||
|
@created 22nd October, 2015
|
||||||
|
@package Sermon Distributor
|
||||||
|
@subpackage sermons.css
|
||||||
|
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||||
|
@copyright Copyright (C) 2015. All Rights Reserved
|
||||||
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||||
|
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||||
|
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||||
|
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* CSS Document */
|
||||||
|
|
||||||
|
|
22
admin/assets/css/statistic.css
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||||
|
Vast Development Method
|
||||||
|
/-------------------------------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
@version 1.2.9
|
||||||
|
@build 30th November, 2015
|
||||||
|
@created 22nd October, 2015
|
||||||
|
@package Sermon Distributor
|
||||||
|
@subpackage statistic.css
|
||||||
|
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||||
|
@copyright Copyright (C) 2015. All Rights Reserved
|
||||||
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||||
|
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||||
|
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||||
|
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* CSS Document */
|
||||||
|
|
||||||
|
|
22
admin/assets/css/statistics.css
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||||
|
Vast Development Method
|
||||||
|
/-------------------------------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
@version 1.2.9
|
||||||
|
@build 30th November, 2015
|
||||||
|
@created 22nd October, 2015
|
||||||
|
@package Sermon Distributor
|
||||||
|
@subpackage statistics.css
|
||||||
|
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||||
|
@copyright Copyright (C) 2015. All Rights Reserved
|
||||||
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||||
|
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||||
|
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||||
|
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* CSS Document */
|
||||||
|
|
||||||
|
|
BIN
admin/assets/images/component-300.jpg
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
admin/assets/images/icons/help_documents.png
Normal file
After Width: | Height: | Size: 26 KiB |
1
admin/assets/images/icons/index.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
BIN
admin/assets/images/icons/preacher_add.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
admin/assets/images/icons/preachers.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
admin/assets/images/icons/series_add.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
admin/assets/images/icons/series_list.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
admin/assets/images/icons/sermon_add.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
admin/assets/images/icons/sermons.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
admin/assets/images/icons/sermons_catid.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
admin/assets/images/icons/statistics.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
admin/assets/images/import.gif
Normal file
After Width: | Height: | Size: 64 KiB |
1
admin/assets/images/index.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
1
admin/assets/index.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
0
admin/assets/js/admin.js
Normal file
1
admin/assets/js/index.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
2286
admin/config.xml
Normal file
105
admin/controller.php
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
<?php
|
||||||
|
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||||
|
Vast Development Method
|
||||||
|
/-------------------------------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
@version 1.2.9
|
||||||
|
@build 30th November, 2015
|
||||||
|
@created 22nd October, 2015
|
||||||
|
@package Sermon Distributor
|
||||||
|
@subpackage controller.php
|
||||||
|
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||||
|
@copyright Copyright (C) 2015. All Rights Reserved
|
||||||
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||||
|
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||||
|
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||||
|
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
// import Joomla controller library
|
||||||
|
jimport('joomla.application.component.controller');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* General Controller of Sermondistributor component
|
||||||
|
*/
|
||||||
|
class SermondistributorController extends JControllerLegacy
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* display task
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function display($cachable = false, $urlparams = false)
|
||||||
|
{
|
||||||
|
// set default view if not set
|
||||||
|
$view = $this->input->getCmd('view', 'Sermondistributor');
|
||||||
|
$data = $this->getViewRelation($view);
|
||||||
|
$layout = $this->input->get('layout', null, 'WORD');
|
||||||
|
$id = $this->input->getInt('id');
|
||||||
|
|
||||||
|
// Check for edit form.
|
||||||
|
if(SermondistributorHelper::checkArray($data))
|
||||||
|
{
|
||||||
|
if ($data['edit'] && $layout == 'edit' && !$this->checkEditId('com_sermondistributor.edit.'.$data['view'], $id))
|
||||||
|
{
|
||||||
|
// Somehow the person just went to the form - we don't allow that.
|
||||||
|
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
|
||||||
|
$this->setMessage($this->getError(), 'error');
|
||||||
|
// check if item was opend from other then its own list view
|
||||||
|
$ref = $this->input->getCmd('ref', 0);
|
||||||
|
$refid = $this->input->getInt('refid', 0);
|
||||||
|
// set redirect
|
||||||
|
if ($refid > 0 && SermondistributorHelper::checkString($ref))
|
||||||
|
{
|
||||||
|
// redirect to item of ref
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false));
|
||||||
|
}
|
||||||
|
elseif (SermondistributorHelper::checkString($ref))
|
||||||
|
{
|
||||||
|
|
||||||
|
// redirect to ref
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view='.(string)$ref, false));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// normal redirect back to the list view
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view='.$data['views'], false));
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::display($cachable, $urlparams);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getViewRelation($view)
|
||||||
|
{
|
||||||
|
if (SermondistributorHelper::checkString($view))
|
||||||
|
{
|
||||||
|
$views = array(
|
||||||
|
'preacher' => 'preachers',
|
||||||
|
'sermon' => 'sermons',
|
||||||
|
'series' => 'series_list',
|
||||||
|
'statistic' => 'statistics',
|
||||||
|
'help_document' => 'help_documents'
|
||||||
|
);
|
||||||
|
// check if this is a list view
|
||||||
|
if (in_array($view,$views))
|
||||||
|
{
|
||||||
|
return array('edit' => false, 'view' => array_search($view,$views), 'views' => $view);
|
||||||
|
}
|
||||||
|
// check if it is an edit view
|
||||||
|
elseif (array_key_exists($view,$views))
|
||||||
|
{
|
||||||
|
return array('edit' => true, 'view' => $view, 'views' => $views[$view]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
170
admin/controllers/ajax.json.php
Normal file
@ -0,0 +1,170 @@
|
|||||||
|
<?php
|
||||||
|
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||||
|
Vast Development Method
|
||||||
|
/-------------------------------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
@version 1.2.9
|
||||||
|
@build 30th November, 2015
|
||||||
|
@created 22nd October, 2015
|
||||||
|
@package Sermon Distributor
|
||||||
|
@subpackage ajax.json.php
|
||||||
|
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||||
|
@copyright Copyright (C) 2015. All Rights Reserved
|
||||||
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||||
|
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||||
|
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||||
|
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
// import Joomla controllerform library
|
||||||
|
jimport('joomla.application.component.controller');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sermondistributor Ajax Controller
|
||||||
|
*/
|
||||||
|
class SermondistributorControllerAjax extends JControllerLegacy
|
||||||
|
{
|
||||||
|
public function __construct($config)
|
||||||
|
{
|
||||||
|
parent::__construct($config);
|
||||||
|
// make sure all json stuff are set
|
||||||
|
JFactory::getDocument()->setMimeEncoding( 'application/json' );
|
||||||
|
JResponse::setHeader('Content-Disposition','attachment;filename="getajax.json"');
|
||||||
|
JResponse::setHeader("Access-Control-Allow-Origin", "*");
|
||||||
|
// load the tasks
|
||||||
|
$this->registerTask('checkDropboxListing', 'ajax');
|
||||||
|
$this->registerTask('updateDropboxListing', 'ajax');
|
||||||
|
$this->registerTask('getUpdateProgress', 'ajax');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function ajax()
|
||||||
|
{
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$jinput = JFactory::getApplication()->input;
|
||||||
|
// Check Token!
|
||||||
|
$token = JSession::getFormToken();
|
||||||
|
$call_token = $jinput->get('token', 0, 'ALNUM');
|
||||||
|
if($token == $call_token)
|
||||||
|
{
|
||||||
|
$task = $this->getTask();
|
||||||
|
switch($task)
|
||||||
|
{
|
||||||
|
case 'checkDropboxListing':
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$viewValue = $jinput->get('view', NULL, 'INT');
|
||||||
|
if($viewValue && $user->id != 0)
|
||||||
|
{
|
||||||
|
$result = $this->getModel('ajax')->dropbox($viewValue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$result = false;
|
||||||
|
}
|
||||||
|
if(array_key_exists('callback',$_GET))
|
||||||
|
{
|
||||||
|
echo $_GET['callback'] . "(".json_encode($result).");";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo "(".json_encode($result).");";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception $e)
|
||||||
|
{
|
||||||
|
if(array_key_exists('callback',$_GET))
|
||||||
|
{
|
||||||
|
echo $_GET['callback']."(".json_encode($e).");";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo "(".json_encode($e).");";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'updateDropboxListing':
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$typeValue = $jinput->get('type', NULL, 'INT');
|
||||||
|
if($typeValue && $user->id != 0)
|
||||||
|
{
|
||||||
|
$result = $this->getModel('ajax')->updateDropbox($typeValue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$result = false;
|
||||||
|
}
|
||||||
|
if(array_key_exists('callback',$_GET))
|
||||||
|
{
|
||||||
|
echo $_GET['callback'] . "(".json_encode($result).");";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo "(".json_encode($result).");";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception $e)
|
||||||
|
{
|
||||||
|
if(array_key_exists('callback',$_GET))
|
||||||
|
{
|
||||||
|
echo $_GET['callback']."(".json_encode($e).");";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo "(".json_encode($e).");";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'getUpdateProgress':
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$typeValue = $jinput->get('type', NULL, 'INT');
|
||||||
|
if($typeValue && $user->id != 0)
|
||||||
|
{
|
||||||
|
$result = $this->getModel('ajax')->updateProgress($typeValue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$result = false;
|
||||||
|
}
|
||||||
|
if(array_key_exists('callback',$_GET))
|
||||||
|
{
|
||||||
|
echo $_GET['callback'] . "(".json_encode($result).");";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo "(".json_encode($result).");";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception $e)
|
||||||
|
{
|
||||||
|
if(array_key_exists('callback',$_GET))
|
||||||
|
{
|
||||||
|
echo $_GET['callback']."(".json_encode($e).");";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo "(".json_encode($e).");";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(array_key_exists('callback',$_GET))
|
||||||
|
{
|
||||||
|
echo $_GET['callback']."(".json_encode(false).");";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo "(".json_encode(false).");";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
124
admin/controllers/help.php
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
<?php
|
||||||
|
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||||
|
Vast Development Method
|
||||||
|
/-------------------------------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
@version 1.2.9
|
||||||
|
@build 30th November, 2015
|
||||||
|
@created 22nd October, 2015
|
||||||
|
@package Sermon Distributor
|
||||||
|
@subpackage help.php
|
||||||
|
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||||
|
@copyright Copyright (C) 2015. All Rights Reserved
|
||||||
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||||
|
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||||
|
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||||
|
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
// import Joomla controllerform library
|
||||||
|
jimport('joomla.application.component.controller');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sermondistributor Help Controller
|
||||||
|
*/
|
||||||
|
class SermondistributorControllerHelp extends JControllerLegacy
|
||||||
|
{
|
||||||
|
public function __construct($config)
|
||||||
|
{
|
||||||
|
parent::__construct($config);
|
||||||
|
// load the tasks
|
||||||
|
$this->registerTask('getText', 'help');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function help()
|
||||||
|
{
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$jinput = JFactory::getApplication()->input;
|
||||||
|
// Check Token!
|
||||||
|
$token = JSession::getFormToken();
|
||||||
|
$call_token = $jinput->get('token', 0, 'ALNUM');
|
||||||
|
if($user->id != 0 && $token == $call_token){
|
||||||
|
$task = $this->getTask();
|
||||||
|
switch($task){
|
||||||
|
case 'getText':
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$idValue = $jinput->get('id', 0, 'INT');
|
||||||
|
if($idValue)
|
||||||
|
{
|
||||||
|
$result = $this->getHelpDocumentText($idValue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$result = '';
|
||||||
|
}
|
||||||
|
echo $result;
|
||||||
|
// stop execution gracefully
|
||||||
|
jexit();
|
||||||
|
}
|
||||||
|
catch(Exception $e)
|
||||||
|
{
|
||||||
|
// stop execution gracefully
|
||||||
|
jexit();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// stop execution gracefully
|
||||||
|
jexit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getHelpDocumentText($id)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = $db->getQuery(true);
|
||||||
|
$query->select(array('a.title','a.content'));
|
||||||
|
$query->from('#__sermondistributor_help_document AS a');
|
||||||
|
$query->where('a.id = '.(int) $id);
|
||||||
|
$query->where('a.published = 1');
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
if($db->getNumRows())
|
||||||
|
{
|
||||||
|
$text = array();
|
||||||
|
$document = $db->loadObject();
|
||||||
|
// fix image issue
|
||||||
|
$images['src="images'] = 'src="'.JURI::root().'images';
|
||||||
|
$images["src='images"] = "src='".JURI::root()."images";
|
||||||
|
$images['src="/images'] = 'src="'.JURI::root().'images';
|
||||||
|
$images["src='/images"] = "src='".JURI::root()."images";
|
||||||
|
// set document template
|
||||||
|
$text[] = "<!doctype html>";
|
||||||
|
$text[] = '<html>';
|
||||||
|
$text[] = "<head>";
|
||||||
|
$text[] = '<meta charset="utf-8">';
|
||||||
|
$text[] = "<title>".$document->title."</title>";
|
||||||
|
$text[] = '<link type="text/css" href="'.JURI::root().'media/com_sermondistributor/uikit/css/uikit.gradient.min.css" rel="stylesheet"></link>';
|
||||||
|
$text[] = '<script type="text/javascript" src="'.JURI::root().'media/com_sermondistributor/uikit/js/uikit.min.js"></script>';
|
||||||
|
$text[] = "</head>";
|
||||||
|
$text[] = '<body><br />';
|
||||||
|
$text[] = '<div class="uk-container uk-container-center uk-grid-collapse">';
|
||||||
|
$text[] = '<div class="uk-panel uk-width-1-1 uk-panel-box uk-panel-box-primary">';
|
||||||
|
// build the help text
|
||||||
|
$text[] = '<h3 class="uk-panel-title">'.$document->title."</h3>";
|
||||||
|
$text[] = str_replace(array_keys($images),array_values($images),$document->content);
|
||||||
|
// end template
|
||||||
|
$text[] = '</div>';
|
||||||
|
$text[] = '</div>';
|
||||||
|
$text[] = "</body>";
|
||||||
|
$text[] = "</html>";
|
||||||
|
|
||||||
|
return implode("\n",$text);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
321
admin/controllers/help_document.php
Normal file
@ -0,0 +1,321 @@
|
|||||||
|
<?php
|
||||||
|
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||||
|
Vast Development Method
|
||||||
|
/-------------------------------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
@version 1.2.9
|
||||||
|
@build 30th November, 2015
|
||||||
|
@created 22nd October, 2015
|
||||||
|
@package Sermon Distributor
|
||||||
|
@subpackage help_document.php
|
||||||
|
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||||
|
@copyright Copyright (C) 2015. All Rights Reserved
|
||||||
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||||
|
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||||
|
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||||
|
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
// import Joomla controllerform library
|
||||||
|
jimport('joomla.application.component.controllerform');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Help_document Controller
|
||||||
|
*/
|
||||||
|
class SermondistributorControllerHelp_document extends JControllerForm
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Current or most recently performed task.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 12.2
|
||||||
|
* @note Replaces _task.
|
||||||
|
*/
|
||||||
|
protected $task;
|
||||||
|
|
||||||
|
public function __construct($config = array())
|
||||||
|
{
|
||||||
|
$this->view_list = 'Help_documents'; // safeguard for setting the return view listing to the main view.
|
||||||
|
parent::__construct($config);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method override to check if you can add a new record.
|
||||||
|
*
|
||||||
|
* @param array $data An array of input data.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected function allowAdd($data = array())
|
||||||
|
{
|
||||||
|
// [9285] Access check.
|
||||||
|
$access = JFactory::getUser()->authorise('help_document.access', 'com_sermondistributor');
|
||||||
|
if (!$access)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// [9296] In the absense of better information, revert to the component permissions.
|
||||||
|
return JFactory::getUser()->authorise('help_document.create', $this->option);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method override to check if you can edit an existing record.
|
||||||
|
*
|
||||||
|
* @param array $data An array of input data.
|
||||||
|
* @param string $key The name of the key for the primary key.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected function allowEdit($data = array(), $key = 'id')
|
||||||
|
{
|
||||||
|
// [9439] get user object.
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
// [9441] get record id.
|
||||||
|
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
|
||||||
|
|
||||||
|
|
||||||
|
// [9448] Access check.
|
||||||
|
$access = ($user->authorise('help_document.access', 'com_sermondistributor.help_document.' . (int) $recordId) && $user->authorise('help_document.access', 'com_sermondistributor'));
|
||||||
|
if (!$access)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($recordId)
|
||||||
|
{
|
||||||
|
// [9457] The record has been set. Check the record permissions.
|
||||||
|
$permission = $user->authorise('help_document.edit', 'com_sermondistributor.help_document.' . (int) $recordId);
|
||||||
|
if (!$permission && !is_null($permission))
|
||||||
|
{
|
||||||
|
if ($user->authorise('help_document.edit.own', 'com_sermondistributor.help_document.' . $recordId))
|
||||||
|
{
|
||||||
|
// [9479] Now test the owner is the user.
|
||||||
|
$ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
|
||||||
|
if (empty($ownerId))
|
||||||
|
{
|
||||||
|
// [9483] Need to do a lookup from the model.
|
||||||
|
$record = $this->getModel()->getItem($recordId);
|
||||||
|
|
||||||
|
if (empty($record))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$ownerId = $record->created_by;
|
||||||
|
}
|
||||||
|
|
||||||
|
// [9491] If the owner matches 'me' then allow.
|
||||||
|
if ($ownerId == $user->id)
|
||||||
|
{
|
||||||
|
if ($user->authorise('help_document.edit.own', 'com_sermondistributor'))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// [9513] Since there is no permission, revert to the component permissions.
|
||||||
|
return $user->authorise('help_document.edit', $this->option);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the URL arguments to append to an item redirect.
|
||||||
|
*
|
||||||
|
* @param integer $recordId The primary key id for the item.
|
||||||
|
* @param string $urlVar The name of the URL variable for the id.
|
||||||
|
*
|
||||||
|
* @return string The arguments to append to the redirect URL.
|
||||||
|
*
|
||||||
|
* @since 12.2
|
||||||
|
*/
|
||||||
|
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
|
||||||
|
{
|
||||||
|
$tmpl = $this->input->get('tmpl');
|
||||||
|
$layout = $this->input->get('layout', 'edit', 'string');
|
||||||
|
|
||||||
|
$ref = $this->input->get('ref', 0, 'string');
|
||||||
|
$refid = $this->input->get('refid', 0, 'int');
|
||||||
|
|
||||||
|
// Setup redirect info.
|
||||||
|
|
||||||
|
$append = '';
|
||||||
|
|
||||||
|
if ($refid)
|
||||||
|
{
|
||||||
|
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid;
|
||||||
|
}
|
||||||
|
elseif ($ref)
|
||||||
|
{
|
||||||
|
$append .= '&ref='.(string)$ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($tmpl)
|
||||||
|
{
|
||||||
|
$append .= '&tmpl=' . $tmpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($layout)
|
||||||
|
{
|
||||||
|
$append .= '&layout=' . $layout;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($recordId)
|
||||||
|
{
|
||||||
|
$append .= '&' . $urlVar . '=' . $recordId;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $append;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to run batch operations.
|
||||||
|
*
|
||||||
|
* @param object $model The model.
|
||||||
|
*
|
||||||
|
* @return boolean True if successful, false otherwise and internal error is set.
|
||||||
|
*
|
||||||
|
* @since 2.5
|
||||||
|
*/
|
||||||
|
public function batch($model = null)
|
||||||
|
{
|
||||||
|
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||||
|
|
||||||
|
// Set the model
|
||||||
|
$model = $this->getModel('Help_document', '', array());
|
||||||
|
|
||||||
|
// Preset the redirect
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=help_documents' . $this->getRedirectToListAppend(), false));
|
||||||
|
|
||||||
|
return parent::batch($model);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to cancel an edit.
|
||||||
|
*
|
||||||
|
* @param string $key The name of the primary key of the URL variable.
|
||||||
|
*
|
||||||
|
* @return boolean True if access level checks pass, false otherwise.
|
||||||
|
*
|
||||||
|
* @since 12.2
|
||||||
|
*/
|
||||||
|
public function cancel($key = null)
|
||||||
|
{
|
||||||
|
// get the referal details
|
||||||
|
$this->ref = $this->input->get('ref', 0, 'word');
|
||||||
|
$this->refid = $this->input->get('refid', 0, 'int');
|
||||||
|
|
||||||
|
$cancel = parent::cancel($key);
|
||||||
|
|
||||||
|
if ($cancel)
|
||||||
|
{
|
||||||
|
if ($this->refid)
|
||||||
|
{
|
||||||
|
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid;
|
||||||
|
|
||||||
|
// Redirect to the item screen.
|
||||||
|
$this->setRedirect(
|
||||||
|
JRoute::_(
|
||||||
|
'index.php?option=' . $this->option . $redirect, false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
elseif ($this->ref)
|
||||||
|
{
|
||||||
|
$redirect = '&view='.(string)$this->ref;
|
||||||
|
|
||||||
|
// Redirect to the list screen.
|
||||||
|
$this->setRedirect(
|
||||||
|
JRoute::_(
|
||||||
|
'index.php?option=' . $this->option . $redirect, false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Redirect to the items screen.
|
||||||
|
$this->setRedirect(
|
||||||
|
JRoute::_(
|
||||||
|
'index.php?option=' . $this->option . '&view=' . $this->view_list, false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return $cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to save a record.
|
||||||
|
*
|
||||||
|
* @param string $key The name of the primary key of the URL variable.
|
||||||
|
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
|
||||||
|
*
|
||||||
|
* @return boolean True if successful, false otherwise.
|
||||||
|
*
|
||||||
|
* @since 12.2
|
||||||
|
*/
|
||||||
|
public function save($key = null, $urlVar = null)
|
||||||
|
{
|
||||||
|
// get the referal details
|
||||||
|
$this->ref = $this->input->get('ref', 0, 'word');
|
||||||
|
$this->refid = $this->input->get('refid', 0, 'int');
|
||||||
|
|
||||||
|
if ($this->ref || $this->refid)
|
||||||
|
{
|
||||||
|
// to make sure the item is checkedin on redirect
|
||||||
|
$this->task = 'save';
|
||||||
|
}
|
||||||
|
|
||||||
|
$saved = parent::save($key, $urlVar);
|
||||||
|
|
||||||
|
if ($this->refid && $saved)
|
||||||
|
{
|
||||||
|
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid;
|
||||||
|
|
||||||
|
// Redirect to the item screen.
|
||||||
|
$this->setRedirect(
|
||||||
|
JRoute::_(
|
||||||
|
'index.php?option=' . $this->option . $redirect, false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
elseif ($this->ref && $saved)
|
||||||
|
{
|
||||||
|
$redirect = '&view='.(string)$this->ref;
|
||||||
|
|
||||||
|
// Redirect to the list screen.
|
||||||
|
$this->setRedirect(
|
||||||
|
JRoute::_(
|
||||||
|
'index.php?option=' . $this->option . $redirect, false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return $saved;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function that allows child controller access to model data
|
||||||
|
* after the data has been saved.
|
||||||
|
*
|
||||||
|
* @param JModel &$model The data model object.
|
||||||
|
* @param array $validData The validated data.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
protected function postSaveHook(JModelLegacy &$model, $validData = array())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
106
admin/controllers/help_documents.php
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
<?php
|
||||||
|
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||||
|
Vast Development Method
|
||||||
|
/-------------------------------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
@version 1.2.9
|
||||||
|
@build 30th November, 2015
|
||||||
|
@created 22nd October, 2015
|
||||||
|
@package Sermon Distributor
|
||||||
|
@subpackage help_documents.php
|
||||||
|
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||||
|
@copyright Copyright (C) 2015. All Rights Reserved
|
||||||
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||||
|
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||||
|
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||||
|
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
// import Joomla controlleradmin library
|
||||||
|
jimport('joomla.application.component.controlleradmin');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Help_documents Controller
|
||||||
|
*/
|
||||||
|
class SermondistributorControllerHelp_documents extends JControllerAdmin
|
||||||
|
{
|
||||||
|
protected $text_prefix = 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS';
|
||||||
|
/**
|
||||||
|
* Proxy for getModel.
|
||||||
|
* @since 2.5
|
||||||
|
*/
|
||||||
|
public function getModel($name = 'Help_document', $prefix = 'SermondistributorModel', $config = array())
|
||||||
|
{
|
||||||
|
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
|
||||||
|
|
||||||
|
return $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function exportData()
|
||||||
|
{
|
||||||
|
// [7235] Check for request forgeries
|
||||||
|
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||||
|
// [7237] check if export is allowed for this user.
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
if ($user->authorise('help_document.export', 'com_sermondistributor') && $user->authorise('core.export', 'com_sermondistributor'))
|
||||||
|
{
|
||||||
|
// [7241] Get the input
|
||||||
|
$input = JFactory::getApplication()->input;
|
||||||
|
$pks = $input->post->get('cid', array(), 'array');
|
||||||
|
// [7244] Sanitize the input
|
||||||
|
JArrayHelper::toInteger($pks);
|
||||||
|
// [7246] Get the model
|
||||||
|
$model = $this->getModel('Help_documents');
|
||||||
|
// [7248] get the data to export
|
||||||
|
$data = $model->getExportData($pks);
|
||||||
|
if (SermondistributorHelper::checkArray($data))
|
||||||
|
{
|
||||||
|
// [7252] now set the data to the spreadsheet
|
||||||
|
$date = JFactory::getDate();
|
||||||
|
SermondistributorHelper::xls($data,'Help_documents_'.$date->format('jS_F_Y'),'Help documents exported ('.$date->format('jS F, Y').')','help documents');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// [7257] Redirect to the list screen with error.
|
||||||
|
$message = JText::_('COM_SERMONDISTRIBUTOR_EXPORT_FAILED');
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=help_documents', false), $message, 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function importData()
|
||||||
|
{
|
||||||
|
// [7266] Check for request forgeries
|
||||||
|
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||||
|
// [7268] check if import is allowed for this user.
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
if ($user->authorise('help_document.import', 'com_sermondistributor') && $user->authorise('core.import', 'com_sermondistributor'))
|
||||||
|
{
|
||||||
|
// [7272] Get the import model
|
||||||
|
$model = $this->getModel('Help_documents');
|
||||||
|
// [7274] get the headers to import
|
||||||
|
$headers = $model->getExImPortHeaders();
|
||||||
|
if (SermondistributorHelper::checkObject($headers))
|
||||||
|
{
|
||||||
|
// [7278] Load headers to session.
|
||||||
|
$session = JFactory::getSession();
|
||||||
|
$headers = json_encode($headers);
|
||||||
|
$session->set('help_document_VDM_IMPORTHEADERS', $headers);
|
||||||
|
$session->set('backto_VDM_IMPORT', 'help_documents');
|
||||||
|
$session->set('dataType_VDM_IMPORTINTO', 'help_document');
|
||||||
|
// [7284] Redirect to import view.
|
||||||
|
$message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_HELP_DOCUMENTS');
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=import', false), $message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// [7296] Redirect to the list screen with error.
|
||||||
|
$message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_FAILED');
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=help_documents', false), $message, 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
62
admin/controllers/import.php
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
<?php
|
||||||
|
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||||
|
Vast Development Method
|
||||||
|
/-------------------------------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
@version 1.2.9
|
||||||
|
@build 30th November, 2015
|
||||||
|
@created 22nd October, 2015
|
||||||
|
@package Sermon Distributor
|
||||||
|
@subpackage import.php
|
||||||
|
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||||
|
@copyright Copyright (C) 2015. All Rights Reserved
|
||||||
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||||
|
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||||
|
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||||
|
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sermondistributor Import Controller
|
||||||
|
*/
|
||||||
|
class SermondistributorControllerImport extends JControllerLegacy
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Import an spreadsheet.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function import()
|
||||||
|
{
|
||||||
|
// Check for request forgeries
|
||||||
|
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||||
|
|
||||||
|
$model = $this->getModel('import');
|
||||||
|
if ($model->import())
|
||||||
|
{
|
||||||
|
$cache = JFactory::getCache('mod_menu');
|
||||||
|
$cache->clean();
|
||||||
|
// TODO: Reset the users acl here as well to kill off any missing bits
|
||||||
|
}
|
||||||
|
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$redirect_url = $app->getUserState('com_sermondistributor.redirect_url');
|
||||||
|
if (empty($redirect_url))
|
||||||
|
{
|
||||||
|
$redirect_url = JRoute::_('index.php?option=com_sermondistributor&view=import', false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// wipe out the user state when we're going to redirect
|
||||||
|
$app->setUserState('com_sermondistributor.redirect_url', '');
|
||||||
|
$app->setUserState('com_sermondistributor.message', '');
|
||||||
|
$app->setUserState('com_sermondistributor.extension_message', '');
|
||||||
|
}
|
||||||
|
$this->setRedirect($redirect_url);
|
||||||
|
}
|
||||||
|
}
|
1
admin/controllers/index.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
321
admin/controllers/preacher.php
Normal file
@ -0,0 +1,321 @@
|
|||||||
|
<?php
|
||||||
|
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||||
|
Vast Development Method
|
||||||
|
/-------------------------------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
@version 1.2.9
|
||||||
|
@build 30th November, 2015
|
||||||
|
@created 22nd October, 2015
|
||||||
|
@package Sermon Distributor
|
||||||
|
@subpackage preacher.php
|
||||||
|
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||||
|
@copyright Copyright (C) 2015. All Rights Reserved
|
||||||
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||||
|
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||||
|
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||||
|
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
// import Joomla controllerform library
|
||||||
|
jimport('joomla.application.component.controllerform');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Preacher Controller
|
||||||
|
*/
|
||||||
|
class SermondistributorControllerPreacher extends JControllerForm
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Current or most recently performed task.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 12.2
|
||||||
|
* @note Replaces _task.
|
||||||
|
*/
|
||||||
|
protected $task;
|
||||||
|
|
||||||
|
public function __construct($config = array())
|
||||||
|
{
|
||||||
|
$this->view_list = 'Preachers'; // safeguard for setting the return view listing to the main view.
|
||||||
|
parent::__construct($config);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method override to check if you can add a new record.
|
||||||
|
*
|
||||||
|
* @param array $data An array of input data.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected function allowAdd($data = array())
|
||||||
|
{
|
||||||
|
// [9285] Access check.
|
||||||
|
$access = JFactory::getUser()->authorise('preacher.access', 'com_sermondistributor');
|
||||||
|
if (!$access)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// [9296] In the absense of better information, revert to the component permissions.
|
||||||
|
return JFactory::getUser()->authorise('preacher.create', $this->option);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method override to check if you can edit an existing record.
|
||||||
|
*
|
||||||
|
* @param array $data An array of input data.
|
||||||
|
* @param string $key The name of the key for the primary key.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected function allowEdit($data = array(), $key = 'id')
|
||||||
|
{
|
||||||
|
// [9439] get user object.
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
// [9441] get record id.
|
||||||
|
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
|
||||||
|
|
||||||
|
|
||||||
|
// [9448] Access check.
|
||||||
|
$access = ($user->authorise('preacher.access', 'com_sermondistributor.preacher.' . (int) $recordId) && $user->authorise('preacher.access', 'com_sermondistributor'));
|
||||||
|
if (!$access)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($recordId)
|
||||||
|
{
|
||||||
|
// [9457] The record has been set. Check the record permissions.
|
||||||
|
$permission = $user->authorise('preacher.edit', 'com_sermondistributor.preacher.' . (int) $recordId);
|
||||||
|
if (!$permission && !is_null($permission))
|
||||||
|
{
|
||||||
|
if ($user->authorise('preacher.edit.own', 'com_sermondistributor.preacher.' . $recordId))
|
||||||
|
{
|
||||||
|
// [9479] Now test the owner is the user.
|
||||||
|
$ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
|
||||||
|
if (empty($ownerId))
|
||||||
|
{
|
||||||
|
// [9483] Need to do a lookup from the model.
|
||||||
|
$record = $this->getModel()->getItem($recordId);
|
||||||
|
|
||||||
|
if (empty($record))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$ownerId = $record->created_by;
|
||||||
|
}
|
||||||
|
|
||||||
|
// [9491] If the owner matches 'me' then allow.
|
||||||
|
if ($ownerId == $user->id)
|
||||||
|
{
|
||||||
|
if ($user->authorise('preacher.edit.own', 'com_sermondistributor'))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// [9513] Since there is no permission, revert to the component permissions.
|
||||||
|
return $user->authorise('preacher.edit', $this->option);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the URL arguments to append to an item redirect.
|
||||||
|
*
|
||||||
|
* @param integer $recordId The primary key id for the item.
|
||||||
|
* @param string $urlVar The name of the URL variable for the id.
|
||||||
|
*
|
||||||
|
* @return string The arguments to append to the redirect URL.
|
||||||
|
*
|
||||||
|
* @since 12.2
|
||||||
|
*/
|
||||||
|
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
|
||||||
|
{
|
||||||
|
$tmpl = $this->input->get('tmpl');
|
||||||
|
$layout = $this->input->get('layout', 'edit', 'string');
|
||||||
|
|
||||||
|
$ref = $this->input->get('ref', 0, 'string');
|
||||||
|
$refid = $this->input->get('refid', 0, 'int');
|
||||||
|
|
||||||
|
// Setup redirect info.
|
||||||
|
|
||||||
|
$append = '';
|
||||||
|
|
||||||
|
if ($refid)
|
||||||
|
{
|
||||||
|
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid;
|
||||||
|
}
|
||||||
|
elseif ($ref)
|
||||||
|
{
|
||||||
|
$append .= '&ref='.(string)$ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($tmpl)
|
||||||
|
{
|
||||||
|
$append .= '&tmpl=' . $tmpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($layout)
|
||||||
|
{
|
||||||
|
$append .= '&layout=' . $layout;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($recordId)
|
||||||
|
{
|
||||||
|
$append .= '&' . $urlVar . '=' . $recordId;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $append;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to run batch operations.
|
||||||
|
*
|
||||||
|
* @param object $model The model.
|
||||||
|
*
|
||||||
|
* @return boolean True if successful, false otherwise and internal error is set.
|
||||||
|
*
|
||||||
|
* @since 2.5
|
||||||
|
*/
|
||||||
|
public function batch($model = null)
|
||||||
|
{
|
||||||
|
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||||
|
|
||||||
|
// Set the model
|
||||||
|
$model = $this->getModel('Preacher', '', array());
|
||||||
|
|
||||||
|
// Preset the redirect
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=preachers' . $this->getRedirectToListAppend(), false));
|
||||||
|
|
||||||
|
return parent::batch($model);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to cancel an edit.
|
||||||
|
*
|
||||||
|
* @param string $key The name of the primary key of the URL variable.
|
||||||
|
*
|
||||||
|
* @return boolean True if access level checks pass, false otherwise.
|
||||||
|
*
|
||||||
|
* @since 12.2
|
||||||
|
*/
|
||||||
|
public function cancel($key = null)
|
||||||
|
{
|
||||||
|
// get the referal details
|
||||||
|
$this->ref = $this->input->get('ref', 0, 'word');
|
||||||
|
$this->refid = $this->input->get('refid', 0, 'int');
|
||||||
|
|
||||||
|
$cancel = parent::cancel($key);
|
||||||
|
|
||||||
|
if ($cancel)
|
||||||
|
{
|
||||||
|
if ($this->refid)
|
||||||
|
{
|
||||||
|
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid;
|
||||||
|
|
||||||
|
// Redirect to the item screen.
|
||||||
|
$this->setRedirect(
|
||||||
|
JRoute::_(
|
||||||
|
'index.php?option=' . $this->option . $redirect, false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
elseif ($this->ref)
|
||||||
|
{
|
||||||
|
$redirect = '&view='.(string)$this->ref;
|
||||||
|
|
||||||
|
// Redirect to the list screen.
|
||||||
|
$this->setRedirect(
|
||||||
|
JRoute::_(
|
||||||
|
'index.php?option=' . $this->option . $redirect, false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Redirect to the items screen.
|
||||||
|
$this->setRedirect(
|
||||||
|
JRoute::_(
|
||||||
|
'index.php?option=' . $this->option . '&view=' . $this->view_list, false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return $cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to save a record.
|
||||||
|
*
|
||||||
|
* @param string $key The name of the primary key of the URL variable.
|
||||||
|
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
|
||||||
|
*
|
||||||
|
* @return boolean True if successful, false otherwise.
|
||||||
|
*
|
||||||
|
* @since 12.2
|
||||||
|
*/
|
||||||
|
public function save($key = null, $urlVar = null)
|
||||||
|
{
|
||||||
|
// get the referal details
|
||||||
|
$this->ref = $this->input->get('ref', 0, 'word');
|
||||||
|
$this->refid = $this->input->get('refid', 0, 'int');
|
||||||
|
|
||||||
|
if ($this->ref || $this->refid)
|
||||||
|
{
|
||||||
|
// to make sure the item is checkedin on redirect
|
||||||
|
$this->task = 'save';
|
||||||
|
}
|
||||||
|
|
||||||
|
$saved = parent::save($key, $urlVar);
|
||||||
|
|
||||||
|
if ($this->refid && $saved)
|
||||||
|
{
|
||||||
|
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid;
|
||||||
|
|
||||||
|
// Redirect to the item screen.
|
||||||
|
$this->setRedirect(
|
||||||
|
JRoute::_(
|
||||||
|
'index.php?option=' . $this->option . $redirect, false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
elseif ($this->ref && $saved)
|
||||||
|
{
|
||||||
|
$redirect = '&view='.(string)$this->ref;
|
||||||
|
|
||||||
|
// Redirect to the list screen.
|
||||||
|
$this->setRedirect(
|
||||||
|
JRoute::_(
|
||||||
|
'index.php?option=' . $this->option . $redirect, false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return $saved;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function that allows child controller access to model data
|
||||||
|
* after the data has been saved.
|
||||||
|
*
|
||||||
|
* @param JModel &$model The data model object.
|
||||||
|
* @param array $validData The validated data.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
protected function postSaveHook(JModelLegacy &$model, $validData = array())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
106
admin/controllers/preachers.php
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
<?php
|
||||||
|
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||||
|
Vast Development Method
|
||||||
|
/-------------------------------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
@version 1.2.9
|
||||||
|
@build 30th November, 2015
|
||||||
|
@created 22nd October, 2015
|
||||||
|
@package Sermon Distributor
|
||||||
|
@subpackage preachers.php
|
||||||
|
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||||
|
@copyright Copyright (C) 2015. All Rights Reserved
|
||||||
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||||
|
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||||
|
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||||
|
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
// import Joomla controlleradmin library
|
||||||
|
jimport('joomla.application.component.controlleradmin');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Preachers Controller
|
||||||
|
*/
|
||||||
|
class SermondistributorControllerPreachers extends JControllerAdmin
|
||||||
|
{
|
||||||
|
protected $text_prefix = 'COM_SERMONDISTRIBUTOR_PREACHERS';
|
||||||
|
/**
|
||||||
|
* Proxy for getModel.
|
||||||
|
* @since 2.5
|
||||||
|
*/
|
||||||
|
public function getModel($name = 'Preacher', $prefix = 'SermondistributorModel', $config = array())
|
||||||
|
{
|
||||||
|
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
|
||||||
|
|
||||||
|
return $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function exportData()
|
||||||
|
{
|
||||||
|
// [7235] Check for request forgeries
|
||||||
|
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||||
|
// [7237] check if export is allowed for this user.
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
if ($user->authorise('preacher.export', 'com_sermondistributor') && $user->authorise('core.export', 'com_sermondistributor'))
|
||||||
|
{
|
||||||
|
// [7241] Get the input
|
||||||
|
$input = JFactory::getApplication()->input;
|
||||||
|
$pks = $input->post->get('cid', array(), 'array');
|
||||||
|
// [7244] Sanitize the input
|
||||||
|
JArrayHelper::toInteger($pks);
|
||||||
|
// [7246] Get the model
|
||||||
|
$model = $this->getModel('Preachers');
|
||||||
|
// [7248] get the data to export
|
||||||
|
$data = $model->getExportData($pks);
|
||||||
|
if (SermondistributorHelper::checkArray($data))
|
||||||
|
{
|
||||||
|
// [7252] now set the data to the spreadsheet
|
||||||
|
$date = JFactory::getDate();
|
||||||
|
SermondistributorHelper::xls($data,'Preachers_'.$date->format('jS_F_Y'),'Preachers exported ('.$date->format('jS F, Y').')','preachers');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// [7257] Redirect to the list screen with error.
|
||||||
|
$message = JText::_('COM_SERMONDISTRIBUTOR_EXPORT_FAILED');
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=preachers', false), $message, 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function importData()
|
||||||
|
{
|
||||||
|
// [7266] Check for request forgeries
|
||||||
|
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||||
|
// [7268] check if import is allowed for this user.
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
if ($user->authorise('preacher.import', 'com_sermondistributor') && $user->authorise('core.import', 'com_sermondistributor'))
|
||||||
|
{
|
||||||
|
// [7272] Get the import model
|
||||||
|
$model = $this->getModel('Preachers');
|
||||||
|
// [7274] get the headers to import
|
||||||
|
$headers = $model->getExImPortHeaders();
|
||||||
|
if (SermondistributorHelper::checkObject($headers))
|
||||||
|
{
|
||||||
|
// [7278] Load headers to session.
|
||||||
|
$session = JFactory::getSession();
|
||||||
|
$headers = json_encode($headers);
|
||||||
|
$session->set('preacher_VDM_IMPORTHEADERS', $headers);
|
||||||
|
$session->set('backto_VDM_IMPORT', 'preachers');
|
||||||
|
$session->set('dataType_VDM_IMPORTINTO', 'preacher');
|
||||||
|
// [7284] Redirect to import view.
|
||||||
|
$message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_PREACHERS');
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=import', false), $message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// [7296] Redirect to the list screen with error.
|
||||||
|
$message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_FAILED');
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=preachers', false), $message, 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
321
admin/controllers/series.php
Normal file
@ -0,0 +1,321 @@
|
|||||||
|
<?php
|
||||||
|
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||||
|
Vast Development Method
|
||||||
|
/-------------------------------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
@version 1.2.9
|
||||||
|
@build 30th November, 2015
|
||||||
|
@created 22nd October, 2015
|
||||||
|
@package Sermon Distributor
|
||||||
|
@subpackage series.php
|
||||||
|
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||||
|
@copyright Copyright (C) 2015. All Rights Reserved
|
||||||
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||||
|
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||||
|
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||||
|
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
// import Joomla controllerform library
|
||||||
|
jimport('joomla.application.component.controllerform');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Series Controller
|
||||||
|
*/
|
||||||
|
class SermondistributorControllerSeries extends JControllerForm
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Current or most recently performed task.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 12.2
|
||||||
|
* @note Replaces _task.
|
||||||
|
*/
|
||||||
|
protected $task;
|
||||||
|
|
||||||
|
public function __construct($config = array())
|
||||||
|
{
|
||||||
|
$this->view_list = 'Series_list'; // safeguard for setting the return view listing to the main view.
|
||||||
|
parent::__construct($config);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method override to check if you can add a new record.
|
||||||
|
*
|
||||||
|
* @param array $data An array of input data.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected function allowAdd($data = array())
|
||||||
|
{
|
||||||
|
// [9285] Access check.
|
||||||
|
$access = JFactory::getUser()->authorise('series.access', 'com_sermondistributor');
|
||||||
|
if (!$access)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// [9296] In the absense of better information, revert to the component permissions.
|
||||||
|
return JFactory::getUser()->authorise('series.create', $this->option);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method override to check if you can edit an existing record.
|
||||||
|
*
|
||||||
|
* @param array $data An array of input data.
|
||||||
|
* @param string $key The name of the key for the primary key.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected function allowEdit($data = array(), $key = 'id')
|
||||||
|
{
|
||||||
|
// [9439] get user object.
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
// [9441] get record id.
|
||||||
|
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
|
||||||
|
|
||||||
|
|
||||||
|
// [9448] Access check.
|
||||||
|
$access = ($user->authorise('series.access', 'com_sermondistributor.series.' . (int) $recordId) && $user->authorise('series.access', 'com_sermondistributor'));
|
||||||
|
if (!$access)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($recordId)
|
||||||
|
{
|
||||||
|
// [9457] The record has been set. Check the record permissions.
|
||||||
|
$permission = $user->authorise('series.edit', 'com_sermondistributor.series.' . (int) $recordId);
|
||||||
|
if (!$permission && !is_null($permission))
|
||||||
|
{
|
||||||
|
if ($user->authorise('series.edit.own', 'com_sermondistributor.series.' . $recordId))
|
||||||
|
{
|
||||||
|
// [9479] Now test the owner is the user.
|
||||||
|
$ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
|
||||||
|
if (empty($ownerId))
|
||||||
|
{
|
||||||
|
// [9483] Need to do a lookup from the model.
|
||||||
|
$record = $this->getModel()->getItem($recordId);
|
||||||
|
|
||||||
|
if (empty($record))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$ownerId = $record->created_by;
|
||||||
|
}
|
||||||
|
|
||||||
|
// [9491] If the owner matches 'me' then allow.
|
||||||
|
if ($ownerId == $user->id)
|
||||||
|
{
|
||||||
|
if ($user->authorise('series.edit.own', 'com_sermondistributor'))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// [9513] Since there is no permission, revert to the component permissions.
|
||||||
|
return $user->authorise('series.edit', $this->option);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the URL arguments to append to an item redirect.
|
||||||
|
*
|
||||||
|
* @param integer $recordId The primary key id for the item.
|
||||||
|
* @param string $urlVar The name of the URL variable for the id.
|
||||||
|
*
|
||||||
|
* @return string The arguments to append to the redirect URL.
|
||||||
|
*
|
||||||
|
* @since 12.2
|
||||||
|
*/
|
||||||
|
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
|
||||||
|
{
|
||||||
|
$tmpl = $this->input->get('tmpl');
|
||||||
|
$layout = $this->input->get('layout', 'edit', 'string');
|
||||||
|
|
||||||
|
$ref = $this->input->get('ref', 0, 'string');
|
||||||
|
$refid = $this->input->get('refid', 0, 'int');
|
||||||
|
|
||||||
|
// Setup redirect info.
|
||||||
|
|
||||||
|
$append = '';
|
||||||
|
|
||||||
|
if ($refid)
|
||||||
|
{
|
||||||
|
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid;
|
||||||
|
}
|
||||||
|
elseif ($ref)
|
||||||
|
{
|
||||||
|
$append .= '&ref='.(string)$ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($tmpl)
|
||||||
|
{
|
||||||
|
$append .= '&tmpl=' . $tmpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($layout)
|
||||||
|
{
|
||||||
|
$append .= '&layout=' . $layout;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($recordId)
|
||||||
|
{
|
||||||
|
$append .= '&' . $urlVar . '=' . $recordId;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $append;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to run batch operations.
|
||||||
|
*
|
||||||
|
* @param object $model The model.
|
||||||
|
*
|
||||||
|
* @return boolean True if successful, false otherwise and internal error is set.
|
||||||
|
*
|
||||||
|
* @since 2.5
|
||||||
|
*/
|
||||||
|
public function batch($model = null)
|
||||||
|
{
|
||||||
|
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||||
|
|
||||||
|
// Set the model
|
||||||
|
$model = $this->getModel('Series', '', array());
|
||||||
|
|
||||||
|
// Preset the redirect
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=series_list' . $this->getRedirectToListAppend(), false));
|
||||||
|
|
||||||
|
return parent::batch($model);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to cancel an edit.
|
||||||
|
*
|
||||||
|
* @param string $key The name of the primary key of the URL variable.
|
||||||
|
*
|
||||||
|
* @return boolean True if access level checks pass, false otherwise.
|
||||||
|
*
|
||||||
|
* @since 12.2
|
||||||
|
*/
|
||||||
|
public function cancel($key = null)
|
||||||
|
{
|
||||||
|
// get the referal details
|
||||||
|
$this->ref = $this->input->get('ref', 0, 'word');
|
||||||
|
$this->refid = $this->input->get('refid', 0, 'int');
|
||||||
|
|
||||||
|
$cancel = parent::cancel($key);
|
||||||
|
|
||||||
|
if ($cancel)
|
||||||
|
{
|
||||||
|
if ($this->refid)
|
||||||
|
{
|
||||||
|
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid;
|
||||||
|
|
||||||
|
// Redirect to the item screen.
|
||||||
|
$this->setRedirect(
|
||||||
|
JRoute::_(
|
||||||
|
'index.php?option=' . $this->option . $redirect, false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
elseif ($this->ref)
|
||||||
|
{
|
||||||
|
$redirect = '&view='.(string)$this->ref;
|
||||||
|
|
||||||
|
// Redirect to the list screen.
|
||||||
|
$this->setRedirect(
|
||||||
|
JRoute::_(
|
||||||
|
'index.php?option=' . $this->option . $redirect, false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Redirect to the items screen.
|
||||||
|
$this->setRedirect(
|
||||||
|
JRoute::_(
|
||||||
|
'index.php?option=' . $this->option . '&view=' . $this->view_list, false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return $cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to save a record.
|
||||||
|
*
|
||||||
|
* @param string $key The name of the primary key of the URL variable.
|
||||||
|
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
|
||||||
|
*
|
||||||
|
* @return boolean True if successful, false otherwise.
|
||||||
|
*
|
||||||
|
* @since 12.2
|
||||||
|
*/
|
||||||
|
public function save($key = null, $urlVar = null)
|
||||||
|
{
|
||||||
|
// get the referal details
|
||||||
|
$this->ref = $this->input->get('ref', 0, 'word');
|
||||||
|
$this->refid = $this->input->get('refid', 0, 'int');
|
||||||
|
|
||||||
|
if ($this->ref || $this->refid)
|
||||||
|
{
|
||||||
|
// to make sure the item is checkedin on redirect
|
||||||
|
$this->task = 'save';
|
||||||
|
}
|
||||||
|
|
||||||
|
$saved = parent::save($key, $urlVar);
|
||||||
|
|
||||||
|
if ($this->refid && $saved)
|
||||||
|
{
|
||||||
|
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid;
|
||||||
|
|
||||||
|
// Redirect to the item screen.
|
||||||
|
$this->setRedirect(
|
||||||
|
JRoute::_(
|
||||||
|
'index.php?option=' . $this->option . $redirect, false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
elseif ($this->ref && $saved)
|
||||||
|
{
|
||||||
|
$redirect = '&view='.(string)$this->ref;
|
||||||
|
|
||||||
|
// Redirect to the list screen.
|
||||||
|
$this->setRedirect(
|
||||||
|
JRoute::_(
|
||||||
|
'index.php?option=' . $this->option . $redirect, false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return $saved;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function that allows child controller access to model data
|
||||||
|
* after the data has been saved.
|
||||||
|
*
|
||||||
|
* @param JModel &$model The data model object.
|
||||||
|
* @param array $validData The validated data.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
protected function postSaveHook(JModelLegacy &$model, $validData = array())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
106
admin/controllers/series_list.php
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
<?php
|
||||||
|
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||||
|
Vast Development Method
|
||||||
|
/-------------------------------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
@version 1.2.9
|
||||||
|
@build 30th November, 2015
|
||||||
|
@created 22nd October, 2015
|
||||||
|
@package Sermon Distributor
|
||||||
|
@subpackage series_list.php
|
||||||
|
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||||
|
@copyright Copyright (C) 2015. All Rights Reserved
|
||||||
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||||
|
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||||
|
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||||
|
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
// import Joomla controlleradmin library
|
||||||
|
jimport('joomla.application.component.controlleradmin');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Series_list Controller
|
||||||
|
*/
|
||||||
|
class SermondistributorControllerSeries_list extends JControllerAdmin
|
||||||
|
{
|
||||||
|
protected $text_prefix = 'COM_SERMONDISTRIBUTOR_SERIES_LIST';
|
||||||
|
/**
|
||||||
|
* Proxy for getModel.
|
||||||
|
* @since 2.5
|
||||||
|
*/
|
||||||
|
public function getModel($name = 'Series', $prefix = 'SermondistributorModel', $config = array())
|
||||||
|
{
|
||||||
|
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
|
||||||
|
|
||||||
|
return $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function exportData()
|
||||||
|
{
|
||||||
|
// [7235] Check for request forgeries
|
||||||
|
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||||
|
// [7237] check if export is allowed for this user.
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
if ($user->authorise('series.export', 'com_sermondistributor') && $user->authorise('core.export', 'com_sermondistributor'))
|
||||||
|
{
|
||||||
|
// [7241] Get the input
|
||||||
|
$input = JFactory::getApplication()->input;
|
||||||
|
$pks = $input->post->get('cid', array(), 'array');
|
||||||
|
// [7244] Sanitize the input
|
||||||
|
JArrayHelper::toInteger($pks);
|
||||||
|
// [7246] Get the model
|
||||||
|
$model = $this->getModel('Series_list');
|
||||||
|
// [7248] get the data to export
|
||||||
|
$data = $model->getExportData($pks);
|
||||||
|
if (SermondistributorHelper::checkArray($data))
|
||||||
|
{
|
||||||
|
// [7252] now set the data to the spreadsheet
|
||||||
|
$date = JFactory::getDate();
|
||||||
|
SermondistributorHelper::xls($data,'Series_list_'.$date->format('jS_F_Y'),'Series list exported ('.$date->format('jS F, Y').')','series list');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// [7257] Redirect to the list screen with error.
|
||||||
|
$message = JText::_('COM_SERMONDISTRIBUTOR_EXPORT_FAILED');
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=series_list', false), $message, 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function importData()
|
||||||
|
{
|
||||||
|
// [7266] Check for request forgeries
|
||||||
|
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||||
|
// [7268] check if import is allowed for this user.
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
if ($user->authorise('series.import', 'com_sermondistributor') && $user->authorise('core.import', 'com_sermondistributor'))
|
||||||
|
{
|
||||||
|
// [7272] Get the import model
|
||||||
|
$model = $this->getModel('Series_list');
|
||||||
|
// [7274] get the headers to import
|
||||||
|
$headers = $model->getExImPortHeaders();
|
||||||
|
if (SermondistributorHelper::checkObject($headers))
|
||||||
|
{
|
||||||
|
// [7278] Load headers to session.
|
||||||
|
$session = JFactory::getSession();
|
||||||
|
$headers = json_encode($headers);
|
||||||
|
$session->set('series_VDM_IMPORTHEADERS', $headers);
|
||||||
|
$session->set('backto_VDM_IMPORT', 'series_list');
|
||||||
|
$session->set('dataType_VDM_IMPORTINTO', 'series');
|
||||||
|
// [7284] Redirect to import view.
|
||||||
|
$message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_SERIES_LIST');
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=import', false), $message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// [7296] Redirect to the list screen with error.
|
||||||
|
$message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_FAILED');
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=series_list', false), $message, 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
351
admin/controllers/sermon.php
Normal file
@ -0,0 +1,351 @@
|
|||||||
|
<?php
|
||||||
|
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||||
|
Vast Development Method
|
||||||
|
/-------------------------------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
@version 1.2.9
|
||||||
|
@build 30th November, 2015
|
||||||
|
@created 22nd October, 2015
|
||||||
|
@package Sermon Distributor
|
||||||
|
@subpackage sermon.php
|
||||||
|
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||||
|
@copyright Copyright (C) 2015. All Rights Reserved
|
||||||
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||||
|
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||||
|
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||||
|
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
// import Joomla controllerform library
|
||||||
|
jimport('joomla.application.component.controllerform');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sermon Controller
|
||||||
|
*/
|
||||||
|
class SermondistributorControllerSermon extends JControllerForm
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Current or most recently performed task.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 12.2
|
||||||
|
* @note Replaces _task.
|
||||||
|
*/
|
||||||
|
protected $task;
|
||||||
|
|
||||||
|
public function __construct($config = array())
|
||||||
|
{
|
||||||
|
$this->view_list = 'Sermons'; // safeguard for setting the return view listing to the main view.
|
||||||
|
parent::__construct($config);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method override to check if you can add a new record.
|
||||||
|
*
|
||||||
|
* @param array $data An array of input data.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected function allowAdd($data = array())
|
||||||
|
{
|
||||||
|
// [9240] get the user object
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
|
||||||
|
// [9245] Access check.
|
||||||
|
$access = $user->authorise('sermon.access', 'com_sermondistributor');
|
||||||
|
if (!$access)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$categoryId = JArrayHelper::getValue($data, 'catid', $this->input->getInt('filter_category_id'), 'int');
|
||||||
|
$allow = null;
|
||||||
|
|
||||||
|
if ($categoryId)
|
||||||
|
{
|
||||||
|
// [9256] If the category has been passed in the URL check it.
|
||||||
|
$allow = $user->authorise('core.create', $this->option . '.sermons.category.' . $categoryId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($allow === null)
|
||||||
|
{
|
||||||
|
// [9265] In the absense of better information, revert to the component permissions.
|
||||||
|
return $user->authorise('sermon.create', $this->option);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return $allow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method override to check if you can edit an existing record.
|
||||||
|
*
|
||||||
|
* @param array $data An array of input data.
|
||||||
|
* @param string $key The name of the key for the primary key.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected function allowEdit($data = array(), $key = 'id')
|
||||||
|
{ // [9343] get user object.
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
// [9345] get record id.
|
||||||
|
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
|
||||||
|
|
||||||
|
|
||||||
|
// [9352] Access check.
|
||||||
|
$access = ($user->authorise('sermon.access', 'com_sermondistributor.sermon.' . (int) $recordId) && $user->authorise('sermon.access', 'com_sermondistributor'));
|
||||||
|
if (!$access)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($recordId)
|
||||||
|
{
|
||||||
|
// [9361] The record has been set. Check the record permissions.
|
||||||
|
$permission = $user->authorise('sermon.edit', 'com_sermondistributor.sermon.' . (int) $recordId);
|
||||||
|
if (!$permission && !is_null($permission))
|
||||||
|
{
|
||||||
|
if ($user->authorise('sermon.edit.own', 'com_sermondistributor.sermon.' . $recordId))
|
||||||
|
{
|
||||||
|
// [9383] Fallback on edit.own. Now test the owner is the user.
|
||||||
|
$ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
|
||||||
|
if (empty($ownerId))
|
||||||
|
{
|
||||||
|
// [9387] Need to do a lookup from the model.
|
||||||
|
$record = $this->getModel()->getItem($recordId);
|
||||||
|
|
||||||
|
if (empty($record))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$ownerId = $record->created_by;
|
||||||
|
}
|
||||||
|
|
||||||
|
// [9395] If the owner matches 'me' then do the test.
|
||||||
|
if ($ownerId == $user->id)
|
||||||
|
{
|
||||||
|
if ($user->authorise('sermon.edit.own', 'com_sermondistributor'))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$categoryId = (int) isset($data['catid']) ? $data['catid']: $this->getModel()->getItem($recordId)->catid;
|
||||||
|
|
||||||
|
if ($categoryId)
|
||||||
|
{
|
||||||
|
// [9417] The category has been set. Check the category permissions.
|
||||||
|
$catpermission = $user->authorise('core.edit', $this->option . '.sermons.category.' . $categoryId);
|
||||||
|
if (!$catpermission && !is_null($catpermission))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// [9427] Since there is no permission, revert to the component permissions.
|
||||||
|
return $user->authorise('sermon.edit', $this->option);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the URL arguments to append to an item redirect.
|
||||||
|
*
|
||||||
|
* @param integer $recordId The primary key id for the item.
|
||||||
|
* @param string $urlVar The name of the URL variable for the id.
|
||||||
|
*
|
||||||
|
* @return string The arguments to append to the redirect URL.
|
||||||
|
*
|
||||||
|
* @since 12.2
|
||||||
|
*/
|
||||||
|
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
|
||||||
|
{
|
||||||
|
$tmpl = $this->input->get('tmpl');
|
||||||
|
$layout = $this->input->get('layout', 'edit', 'string');
|
||||||
|
|
||||||
|
$ref = $this->input->get('ref', 0, 'string');
|
||||||
|
$refid = $this->input->get('refid', 0, 'int');
|
||||||
|
|
||||||
|
// Setup redirect info.
|
||||||
|
|
||||||
|
$append = '';
|
||||||
|
|
||||||
|
if ($refid)
|
||||||
|
{
|
||||||
|
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid;
|
||||||
|
}
|
||||||
|
elseif ($ref)
|
||||||
|
{
|
||||||
|
$append .= '&ref='.(string)$ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($tmpl)
|
||||||
|
{
|
||||||
|
$append .= '&tmpl=' . $tmpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($layout)
|
||||||
|
{
|
||||||
|
$append .= '&layout=' . $layout;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($recordId)
|
||||||
|
{
|
||||||
|
$append .= '&' . $urlVar . '=' . $recordId;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $append;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to run batch operations.
|
||||||
|
*
|
||||||
|
* @param object $model The model.
|
||||||
|
*
|
||||||
|
* @return boolean True if successful, false otherwise and internal error is set.
|
||||||
|
*
|
||||||
|
* @since 2.5
|
||||||
|
*/
|
||||||
|
public function batch($model = null)
|
||||||
|
{
|
||||||
|
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||||
|
|
||||||
|
// Set the model
|
||||||
|
$model = $this->getModel('Sermon', '', array());
|
||||||
|
|
||||||
|
// Preset the redirect
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=sermons' . $this->getRedirectToListAppend(), false));
|
||||||
|
|
||||||
|
return parent::batch($model);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to cancel an edit.
|
||||||
|
*
|
||||||
|
* @param string $key The name of the primary key of the URL variable.
|
||||||
|
*
|
||||||
|
* @return boolean True if access level checks pass, false otherwise.
|
||||||
|
*
|
||||||
|
* @since 12.2
|
||||||
|
*/
|
||||||
|
public function cancel($key = null)
|
||||||
|
{
|
||||||
|
// get the referal details
|
||||||
|
$this->ref = $this->input->get('ref', 0, 'word');
|
||||||
|
$this->refid = $this->input->get('refid', 0, 'int');
|
||||||
|
|
||||||
|
$cancel = parent::cancel($key);
|
||||||
|
|
||||||
|
if ($cancel)
|
||||||
|
{
|
||||||
|
if ($this->refid)
|
||||||
|
{
|
||||||
|
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid;
|
||||||
|
|
||||||
|
// Redirect to the item screen.
|
||||||
|
$this->setRedirect(
|
||||||
|
JRoute::_(
|
||||||
|
'index.php?option=' . $this->option . $redirect, false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
elseif ($this->ref)
|
||||||
|
{
|
||||||
|
$redirect = '&view='.(string)$this->ref;
|
||||||
|
|
||||||
|
// Redirect to the list screen.
|
||||||
|
$this->setRedirect(
|
||||||
|
JRoute::_(
|
||||||
|
'index.php?option=' . $this->option . $redirect, false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Redirect to the items screen.
|
||||||
|
$this->setRedirect(
|
||||||
|
JRoute::_(
|
||||||
|
'index.php?option=' . $this->option . '&view=' . $this->view_list, false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return $cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to save a record.
|
||||||
|
*
|
||||||
|
* @param string $key The name of the primary key of the URL variable.
|
||||||
|
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
|
||||||
|
*
|
||||||
|
* @return boolean True if successful, false otherwise.
|
||||||
|
*
|
||||||
|
* @since 12.2
|
||||||
|
*/
|
||||||
|
public function save($key = null, $urlVar = null)
|
||||||
|
{
|
||||||
|
// get the referal details
|
||||||
|
$this->ref = $this->input->get('ref', 0, 'word');
|
||||||
|
$this->refid = $this->input->get('refid', 0, 'int');
|
||||||
|
|
||||||
|
if ($this->ref || $this->refid)
|
||||||
|
{
|
||||||
|
// to make sure the item is checkedin on redirect
|
||||||
|
$this->task = 'save';
|
||||||
|
}
|
||||||
|
|
||||||
|
$saved = parent::save($key, $urlVar);
|
||||||
|
|
||||||
|
if ($this->refid && $saved)
|
||||||
|
{
|
||||||
|
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid;
|
||||||
|
|
||||||
|
// Redirect to the item screen.
|
||||||
|
$this->setRedirect(
|
||||||
|
JRoute::_(
|
||||||
|
'index.php?option=' . $this->option . $redirect, false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
elseif ($this->ref && $saved)
|
||||||
|
{
|
||||||
|
$redirect = '&view='.(string)$this->ref;
|
||||||
|
|
||||||
|
// Redirect to the list screen.
|
||||||
|
$this->setRedirect(
|
||||||
|
JRoute::_(
|
||||||
|
'index.php?option=' . $this->option . $redirect, false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return $saved;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function that allows child controller access to model data
|
||||||
|
* after the data has been saved.
|
||||||
|
*
|
||||||
|
* @param JModel &$model The data model object.
|
||||||
|
* @param array $validData The validated data.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
protected function postSaveHook(JModelLegacy &$model, $validData = array())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
33
admin/controllers/sermondistributor.php
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||||
|
Vast Development Method
|
||||||
|
/-------------------------------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
@version 1.2.9
|
||||||
|
@build 30th November, 2015
|
||||||
|
@created 22nd October, 2015
|
||||||
|
@package Sermon Distributor
|
||||||
|
@subpackage sermondistributor.php
|
||||||
|
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||||
|
@copyright Copyright (C) 2015. All Rights Reserved
|
||||||
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||||
|
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||||
|
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||||
|
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
// import Joomla controlleradmin library
|
||||||
|
jimport('joomla.application.component.controlleradmin');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sermondistributor Controller
|
||||||
|
*/
|
||||||
|
class SermondistributorControllerSermondistributor extends JControllerAdmin
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
106
admin/controllers/sermons.php
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
<?php
|
||||||
|
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||||
|
Vast Development Method
|
||||||
|
/-------------------------------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
@version 1.2.9
|
||||||
|
@build 30th November, 2015
|
||||||
|
@created 22nd October, 2015
|
||||||
|
@package Sermon Distributor
|
||||||
|
@subpackage sermons.php
|
||||||
|
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||||
|
@copyright Copyright (C) 2015. All Rights Reserved
|
||||||
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||||
|
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||||
|
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||||
|
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
// import Joomla controlleradmin library
|
||||||
|
jimport('joomla.application.component.controlleradmin');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sermons Controller
|
||||||
|
*/
|
||||||
|
class SermondistributorControllerSermons extends JControllerAdmin
|
||||||
|
{
|
||||||
|
protected $text_prefix = 'COM_SERMONDISTRIBUTOR_SERMONS';
|
||||||
|
/**
|
||||||
|
* Proxy for getModel.
|
||||||
|
* @since 2.5
|
||||||
|
*/
|
||||||
|
public function getModel($name = 'Sermon', $prefix = 'SermondistributorModel', $config = array())
|
||||||
|
{
|
||||||
|
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
|
||||||
|
|
||||||
|
return $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function exportData()
|
||||||
|
{
|
||||||
|
// [7235] Check for request forgeries
|
||||||
|
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||||
|
// [7237] check if export is allowed for this user.
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
if ($user->authorise('sermon.export', 'com_sermondistributor') && $user->authorise('core.export', 'com_sermondistributor'))
|
||||||
|
{
|
||||||
|
// [7241] Get the input
|
||||||
|
$input = JFactory::getApplication()->input;
|
||||||
|
$pks = $input->post->get('cid', array(), 'array');
|
||||||
|
// [7244] Sanitize the input
|
||||||
|
JArrayHelper::toInteger($pks);
|
||||||
|
// [7246] Get the model
|
||||||
|
$model = $this->getModel('Sermons');
|
||||||
|
// [7248] get the data to export
|
||||||
|
$data = $model->getExportData($pks);
|
||||||
|
if (SermondistributorHelper::checkArray($data))
|
||||||
|
{
|
||||||
|
// [7252] now set the data to the spreadsheet
|
||||||
|
$date = JFactory::getDate();
|
||||||
|
SermondistributorHelper::xls($data,'Sermons_'.$date->format('jS_F_Y'),'Sermons exported ('.$date->format('jS F, Y').')','sermons');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// [7257] Redirect to the list screen with error.
|
||||||
|
$message = JText::_('COM_SERMONDISTRIBUTOR_EXPORT_FAILED');
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=sermons', false), $message, 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function importData()
|
||||||
|
{
|
||||||
|
// [7266] Check for request forgeries
|
||||||
|
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||||
|
// [7268] check if import is allowed for this user.
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
if ($user->authorise('sermon.import', 'com_sermondistributor') && $user->authorise('core.import', 'com_sermondistributor'))
|
||||||
|
{
|
||||||
|
// [7272] Get the import model
|
||||||
|
$model = $this->getModel('Sermons');
|
||||||
|
// [7274] get the headers to import
|
||||||
|
$headers = $model->getExImPortHeaders();
|
||||||
|
if (SermondistributorHelper::checkObject($headers))
|
||||||
|
{
|
||||||
|
// [7278] Load headers to session.
|
||||||
|
$session = JFactory::getSession();
|
||||||
|
$headers = json_encode($headers);
|
||||||
|
$session->set('sermon_VDM_IMPORTHEADERS', $headers);
|
||||||
|
$session->set('backto_VDM_IMPORT', 'sermons');
|
||||||
|
$session->set('dataType_VDM_IMPORTINTO', 'sermon');
|
||||||
|
// [7284] Redirect to import view.
|
||||||
|
$message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_SERMONS');
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=import', false), $message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// [7296] Redirect to the list screen with error.
|
||||||
|
$message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_FAILED');
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=sermons', false), $message, 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
321
admin/controllers/statistic.php
Normal file
@ -0,0 +1,321 @@
|
|||||||
|
<?php
|
||||||
|
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||||
|
Vast Development Method
|
||||||
|
/-------------------------------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
@version 1.2.9
|
||||||
|
@build 30th November, 2015
|
||||||
|
@created 22nd October, 2015
|
||||||
|
@package Sermon Distributor
|
||||||
|
@subpackage statistic.php
|
||||||
|
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||||
|
@copyright Copyright (C) 2015. All Rights Reserved
|
||||||
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||||
|
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||||
|
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||||
|
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
// import Joomla controllerform library
|
||||||
|
jimport('joomla.application.component.controllerform');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Statistic Controller
|
||||||
|
*/
|
||||||
|
class SermondistributorControllerStatistic extends JControllerForm
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Current or most recently performed task.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 12.2
|
||||||
|
* @note Replaces _task.
|
||||||
|
*/
|
||||||
|
protected $task;
|
||||||
|
|
||||||
|
public function __construct($config = array())
|
||||||
|
{
|
||||||
|
$this->view_list = 'Statistics'; // safeguard for setting the return view listing to the main view.
|
||||||
|
parent::__construct($config);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method override to check if you can add a new record.
|
||||||
|
*
|
||||||
|
* @param array $data An array of input data.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected function allowAdd($data = array())
|
||||||
|
{
|
||||||
|
// [9285] Access check.
|
||||||
|
$access = JFactory::getUser()->authorise('statistic.access', 'com_sermondistributor');
|
||||||
|
if (!$access)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// [9296] In the absense of better information, revert to the component permissions.
|
||||||
|
return JFactory::getUser()->authorise('statistic.create', $this->option);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method override to check if you can edit an existing record.
|
||||||
|
*
|
||||||
|
* @param array $data An array of input data.
|
||||||
|
* @param string $key The name of the key for the primary key.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected function allowEdit($data = array(), $key = 'id')
|
||||||
|
{
|
||||||
|
// [9439] get user object.
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
// [9441] get record id.
|
||||||
|
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
|
||||||
|
|
||||||
|
|
||||||
|
// [9448] Access check.
|
||||||
|
$access = ($user->authorise('statistic.access', 'com_sermondistributor.statistic.' . (int) $recordId) && $user->authorise('statistic.access', 'com_sermondistributor'));
|
||||||
|
if (!$access)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($recordId)
|
||||||
|
{
|
||||||
|
// [9457] The record has been set. Check the record permissions.
|
||||||
|
$permission = $user->authorise('statistic.edit', 'com_sermondistributor.statistic.' . (int) $recordId);
|
||||||
|
if (!$permission && !is_null($permission))
|
||||||
|
{
|
||||||
|
if ($user->authorise('statistic.edit.own', 'com_sermondistributor.statistic.' . $recordId))
|
||||||
|
{
|
||||||
|
// [9479] Now test the owner is the user.
|
||||||
|
$ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
|
||||||
|
if (empty($ownerId))
|
||||||
|
{
|
||||||
|
// [9483] Need to do a lookup from the model.
|
||||||
|
$record = $this->getModel()->getItem($recordId);
|
||||||
|
|
||||||
|
if (empty($record))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$ownerId = $record->created_by;
|
||||||
|
}
|
||||||
|
|
||||||
|
// [9491] If the owner matches 'me' then allow.
|
||||||
|
if ($ownerId == $user->id)
|
||||||
|
{
|
||||||
|
if ($user->authorise('statistic.edit.own', 'com_sermondistributor'))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// [9513] Since there is no permission, revert to the component permissions.
|
||||||
|
return $user->authorise('statistic.edit', $this->option);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the URL arguments to append to an item redirect.
|
||||||
|
*
|
||||||
|
* @param integer $recordId The primary key id for the item.
|
||||||
|
* @param string $urlVar The name of the URL variable for the id.
|
||||||
|
*
|
||||||
|
* @return string The arguments to append to the redirect URL.
|
||||||
|
*
|
||||||
|
* @since 12.2
|
||||||
|
*/
|
||||||
|
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
|
||||||
|
{
|
||||||
|
$tmpl = $this->input->get('tmpl');
|
||||||
|
$layout = $this->input->get('layout', 'edit', 'string');
|
||||||
|
|
||||||
|
$ref = $this->input->get('ref', 0, 'string');
|
||||||
|
$refid = $this->input->get('refid', 0, 'int');
|
||||||
|
|
||||||
|
// Setup redirect info.
|
||||||
|
|
||||||
|
$append = '';
|
||||||
|
|
||||||
|
if ($refid)
|
||||||
|
{
|
||||||
|
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid;
|
||||||
|
}
|
||||||
|
elseif ($ref)
|
||||||
|
{
|
||||||
|
$append .= '&ref='.(string)$ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($tmpl)
|
||||||
|
{
|
||||||
|
$append .= '&tmpl=' . $tmpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($layout)
|
||||||
|
{
|
||||||
|
$append .= '&layout=' . $layout;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($recordId)
|
||||||
|
{
|
||||||
|
$append .= '&' . $urlVar . '=' . $recordId;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $append;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to run batch operations.
|
||||||
|
*
|
||||||
|
* @param object $model The model.
|
||||||
|
*
|
||||||
|
* @return boolean True if successful, false otherwise and internal error is set.
|
||||||
|
*
|
||||||
|
* @since 2.5
|
||||||
|
*/
|
||||||
|
public function batch($model = null)
|
||||||
|
{
|
||||||
|
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||||
|
|
||||||
|
// Set the model
|
||||||
|
$model = $this->getModel('Statistic', '', array());
|
||||||
|
|
||||||
|
// Preset the redirect
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=statistics' . $this->getRedirectToListAppend(), false));
|
||||||
|
|
||||||
|
return parent::batch($model);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to cancel an edit.
|
||||||
|
*
|
||||||
|
* @param string $key The name of the primary key of the URL variable.
|
||||||
|
*
|
||||||
|
* @return boolean True if access level checks pass, false otherwise.
|
||||||
|
*
|
||||||
|
* @since 12.2
|
||||||
|
*/
|
||||||
|
public function cancel($key = null)
|
||||||
|
{
|
||||||
|
// get the referal details
|
||||||
|
$this->ref = $this->input->get('ref', 0, 'word');
|
||||||
|
$this->refid = $this->input->get('refid', 0, 'int');
|
||||||
|
|
||||||
|
$cancel = parent::cancel($key);
|
||||||
|
|
||||||
|
if ($cancel)
|
||||||
|
{
|
||||||
|
if ($this->refid)
|
||||||
|
{
|
||||||
|
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid;
|
||||||
|
|
||||||
|
// Redirect to the item screen.
|
||||||
|
$this->setRedirect(
|
||||||
|
JRoute::_(
|
||||||
|
'index.php?option=' . $this->option . $redirect, false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
elseif ($this->ref)
|
||||||
|
{
|
||||||
|
$redirect = '&view='.(string)$this->ref;
|
||||||
|
|
||||||
|
// Redirect to the list screen.
|
||||||
|
$this->setRedirect(
|
||||||
|
JRoute::_(
|
||||||
|
'index.php?option=' . $this->option . $redirect, false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Redirect to the items screen.
|
||||||
|
$this->setRedirect(
|
||||||
|
JRoute::_(
|
||||||
|
'index.php?option=' . $this->option . '&view=' . $this->view_list, false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return $cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to save a record.
|
||||||
|
*
|
||||||
|
* @param string $key The name of the primary key of the URL variable.
|
||||||
|
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
|
||||||
|
*
|
||||||
|
* @return boolean True if successful, false otherwise.
|
||||||
|
*
|
||||||
|
* @since 12.2
|
||||||
|
*/
|
||||||
|
public function save($key = null, $urlVar = null)
|
||||||
|
{
|
||||||
|
// get the referal details
|
||||||
|
$this->ref = $this->input->get('ref', 0, 'word');
|
||||||
|
$this->refid = $this->input->get('refid', 0, 'int');
|
||||||
|
|
||||||
|
if ($this->ref || $this->refid)
|
||||||
|
{
|
||||||
|
// to make sure the item is checkedin on redirect
|
||||||
|
$this->task = 'save';
|
||||||
|
}
|
||||||
|
|
||||||
|
$saved = parent::save($key, $urlVar);
|
||||||
|
|
||||||
|
if ($this->refid && $saved)
|
||||||
|
{
|
||||||
|
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid;
|
||||||
|
|
||||||
|
// Redirect to the item screen.
|
||||||
|
$this->setRedirect(
|
||||||
|
JRoute::_(
|
||||||
|
'index.php?option=' . $this->option . $redirect, false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
elseif ($this->ref && $saved)
|
||||||
|
{
|
||||||
|
$redirect = '&view='.(string)$this->ref;
|
||||||
|
|
||||||
|
// Redirect to the list screen.
|
||||||
|
$this->setRedirect(
|
||||||
|
JRoute::_(
|
||||||
|
'index.php?option=' . $this->option . $redirect, false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return $saved;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function that allows child controller access to model data
|
||||||
|
* after the data has been saved.
|
||||||
|
*
|
||||||
|
* @param JModel &$model The data model object.
|
||||||
|
* @param array $validData The validated data.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
protected function postSaveHook(JModelLegacy &$model, $validData = array())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
106
admin/controllers/statistics.php
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
<?php
|
||||||
|
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||||
|
Vast Development Method
|
||||||
|
/-------------------------------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
@version 1.2.9
|
||||||
|
@build 30th November, 2015
|
||||||
|
@created 22nd October, 2015
|
||||||
|
@package Sermon Distributor
|
||||||
|
@subpackage statistics.php
|
||||||
|
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||||
|
@copyright Copyright (C) 2015. All Rights Reserved
|
||||||
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||||
|
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||||
|
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||||
|
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
// import Joomla controlleradmin library
|
||||||
|
jimport('joomla.application.component.controlleradmin');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Statistics Controller
|
||||||
|
*/
|
||||||
|
class SermondistributorControllerStatistics extends JControllerAdmin
|
||||||
|
{
|
||||||
|
protected $text_prefix = 'COM_SERMONDISTRIBUTOR_STATISTICS';
|
||||||
|
/**
|
||||||
|
* Proxy for getModel.
|
||||||
|
* @since 2.5
|
||||||
|
*/
|
||||||
|
public function getModel($name = 'Statistic', $prefix = 'SermondistributorModel', $config = array())
|
||||||
|
{
|
||||||
|
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
|
||||||
|
|
||||||
|
return $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function exportData()
|
||||||
|
{
|
||||||
|
// [7235] Check for request forgeries
|
||||||
|
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||||
|
// [7237] check if export is allowed for this user.
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
if ($user->authorise('statistic.export', 'com_sermondistributor') && $user->authorise('core.export', 'com_sermondistributor'))
|
||||||
|
{
|
||||||
|
// [7241] Get the input
|
||||||
|
$input = JFactory::getApplication()->input;
|
||||||
|
$pks = $input->post->get('cid', array(), 'array');
|
||||||
|
// [7244] Sanitize the input
|
||||||
|
JArrayHelper::toInteger($pks);
|
||||||
|
// [7246] Get the model
|
||||||
|
$model = $this->getModel('Statistics');
|
||||||
|
// [7248] get the data to export
|
||||||
|
$data = $model->getExportData($pks);
|
||||||
|
if (SermondistributorHelper::checkArray($data))
|
||||||
|
{
|
||||||
|
// [7252] now set the data to the spreadsheet
|
||||||
|
$date = JFactory::getDate();
|
||||||
|
SermondistributorHelper::xls($data,'Statistics_'.$date->format('jS_F_Y'),'Statistics exported ('.$date->format('jS F, Y').')','statistics');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// [7257] Redirect to the list screen with error.
|
||||||
|
$message = JText::_('COM_SERMONDISTRIBUTOR_EXPORT_FAILED');
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=statistics', false), $message, 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function importData()
|
||||||
|
{
|
||||||
|
// [7266] Check for request forgeries
|
||||||
|
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||||
|
// [7268] check if import is allowed for this user.
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
if ($user->authorise('statistic.import', 'com_sermondistributor') && $user->authorise('core.import', 'com_sermondistributor'))
|
||||||
|
{
|
||||||
|
// [7272] Get the import model
|
||||||
|
$model = $this->getModel('Statistics');
|
||||||
|
// [7274] get the headers to import
|
||||||
|
$headers = $model->getExImPortHeaders();
|
||||||
|
if (SermondistributorHelper::checkObject($headers))
|
||||||
|
{
|
||||||
|
// [7278] Load headers to session.
|
||||||
|
$session = JFactory::getSession();
|
||||||
|
$headers = json_encode($headers);
|
||||||
|
$session->set('statistic_VDM_IMPORTHEADERS', $headers);
|
||||||
|
$session->set('backto_VDM_IMPORT', 'statistics');
|
||||||
|
$session->set('dataType_VDM_IMPORTINTO', 'statistic');
|
||||||
|
// [7284] Redirect to import view.
|
||||||
|
$message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_STATISTICS');
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=import', false), $message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// [7296] Redirect to the list screen with error.
|
||||||
|
$message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_FAILED');
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=statistics', false), $message, 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
1139
admin/helpers/PHPExcel.php
Normal file
89
admin/helpers/PHPExcel/Autoloader.php
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
PHPExcel_Autoloader::Register();
|
||||||
|
// As we always try to run the autoloader before anything else, we can use it to do a few
|
||||||
|
// simple checks and initialisations
|
||||||
|
//PHPExcel_Shared_ZipStreamWrapper::register();
|
||||||
|
// check mbstring.func_overload
|
||||||
|
if (ini_get('mbstring.func_overload') & 2) {
|
||||||
|
throw new PHPExcel_Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
|
||||||
|
}
|
||||||
|
PHPExcel_Shared_String::buildCharacterSets();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Autoloader
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_Autoloader
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Register the Autoloader with SPL
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function Register() {
|
||||||
|
if (function_exists('__autoload')) {
|
||||||
|
// Register any existing autoloader function with SPL, so we don't get any clashes
|
||||||
|
spl_autoload_register('__autoload');
|
||||||
|
}
|
||||||
|
// Register ourselves with SPL
|
||||||
|
if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
|
||||||
|
return spl_autoload_register(array('PHPExcel_Autoloader', 'Load'), true, true);
|
||||||
|
} else {
|
||||||
|
return spl_autoload_register(array('PHPExcel_Autoloader', 'Load'));
|
||||||
|
}
|
||||||
|
} // function Register()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Autoload a class identified by name
|
||||||
|
*
|
||||||
|
* @param string $pClassName Name of the object to load
|
||||||
|
*/
|
||||||
|
public static function Load($pClassName){
|
||||||
|
if ((class_exists($pClassName,FALSE)) || (strpos($pClassName, 'PHPExcel') !== 0)) {
|
||||||
|
// Either already loaded, or not a PHPExcel class request
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
$pClassFilePath = PHPEXCEL_ROOT .
|
||||||
|
str_replace('_',DIRECTORY_SEPARATOR,$pClassName) .
|
||||||
|
'.php';
|
||||||
|
|
||||||
|
if ((file_exists($pClassFilePath) === FALSE) || (is_readable($pClassFilePath) === FALSE)) {
|
||||||
|
// Can't load
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
require($pClassFilePath);
|
||||||
|
} // function Load()
|
||||||
|
|
||||||
|
}
|
295
admin/helpers/PHPExcel/CachedObjectStorage/APC.php
Normal file
@ -0,0 +1,295 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_CachedObjectStorage
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_CachedObjectStorage_APC
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_CachedObjectStorage
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prefix used to uniquely identify cache data for this worksheet
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_cachePrefix = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache timeout
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
private $_cacheTime = 600;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store cell data in cache for the current cell object if it's "dirty",
|
||||||
|
* and the 'nullify' the current cell object
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @return void
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
protected function _storeData() {
|
||||||
|
if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
|
||||||
|
$this->_currentObject->detach();
|
||||||
|
|
||||||
|
if (!apc_store($this->_cachePrefix.$this->_currentObjectID.'.cache',serialize($this->_currentObject),$this->_cacheTime)) {
|
||||||
|
$this->__destruct();
|
||||||
|
throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in APC');
|
||||||
|
}
|
||||||
|
$this->_currentCellIsDirty = false;
|
||||||
|
}
|
||||||
|
$this->_currentObjectID = $this->_currentObject = null;
|
||||||
|
} // function _storeData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add or Update a cell in cache identified by coordinate address
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
|
* @param PHPExcel_Cell $cell Cell to update
|
||||||
|
* @return PHPExcel_Cell
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||||
|
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
||||||
|
$this->_storeData();
|
||||||
|
}
|
||||||
|
$this->_cellCache[$pCoord] = true;
|
||||||
|
|
||||||
|
$this->_currentObjectID = $pCoord;
|
||||||
|
$this->_currentObject = $cell;
|
||||||
|
$this->_currentCellIsDirty = true;
|
||||||
|
|
||||||
|
return $cell;
|
||||||
|
} // function addCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @param string $pCoord Coordinate address of the cell to check
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isDataSet($pCoord) {
|
||||||
|
// Check if the requested entry is the current object, or exists in the cache
|
||||||
|
if (parent::isDataSet($pCoord)) {
|
||||||
|
if ($this->_currentObjectID == $pCoord) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// Check if the requested entry still exists in apc
|
||||||
|
$success = apc_fetch($this->_cachePrefix.$pCoord.'.cache');
|
||||||
|
if ($success === FALSE) {
|
||||||
|
// Entry no longer exists in APC, so clear it from the cache array
|
||||||
|
parent::deleteCacheData($pCoord);
|
||||||
|
throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in APC cache');
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
} // function isDataSet()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get cell at a specific coordinate
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @param string $pCoord Coordinate of the cell
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||||
|
*/
|
||||||
|
public function getCacheData($pCoord) {
|
||||||
|
if ($pCoord === $this->_currentObjectID) {
|
||||||
|
return $this->_currentObject;
|
||||||
|
}
|
||||||
|
$this->_storeData();
|
||||||
|
|
||||||
|
// Check if the entry that has been requested actually exists
|
||||||
|
if (parent::isDataSet($pCoord)) {
|
||||||
|
$obj = apc_fetch($this->_cachePrefix.$pCoord.'.cache');
|
||||||
|
if ($obj === FALSE) {
|
||||||
|
// Entry no longer exists in APC, so clear it from the cache array
|
||||||
|
parent::deleteCacheData($pCoord);
|
||||||
|
throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in APC cache');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Return null if requested entry doesn't exist in cache
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set current entry to the requested entry
|
||||||
|
$this->_currentObjectID = $pCoord;
|
||||||
|
$this->_currentObject = unserialize($obj);
|
||||||
|
// Re-attach this as the cell's parent
|
||||||
|
$this->_currentObject->attach($this);
|
||||||
|
|
||||||
|
// Return requested entry
|
||||||
|
return $this->_currentObject;
|
||||||
|
} // function getCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of all cell addresses currently held in cache
|
||||||
|
*
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function getCellList() {
|
||||||
|
if ($this->_currentObjectID !== null) {
|
||||||
|
$this->_storeData();
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::getCellList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a cell in cache identified by coordinate address
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @param string $pCoord Coordinate address of the cell to delete
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
public function deleteCacheData($pCoord) {
|
||||||
|
// Delete the entry from APC
|
||||||
|
apc_delete($this->_cachePrefix.$pCoord.'.cache');
|
||||||
|
|
||||||
|
// Delete the entry from our cell address array
|
||||||
|
parent::deleteCacheData($pCoord);
|
||||||
|
} // function deleteCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clone the cell collection
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @param PHPExcel_Worksheet $parent The new worksheet
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function copyCellCollection(PHPExcel_Worksheet $parent) {
|
||||||
|
parent::copyCellCollection($parent);
|
||||||
|
// Get a new id for the new file name
|
||||||
|
$baseUnique = $this->_getUniqueID();
|
||||||
|
$newCachePrefix = substr(md5($baseUnique),0,8).'.';
|
||||||
|
$cacheList = $this->getCellList();
|
||||||
|
foreach($cacheList as $cellID) {
|
||||||
|
if ($cellID != $this->_currentObjectID) {
|
||||||
|
$obj = apc_fetch($this->_cachePrefix.$cellID.'.cache');
|
||||||
|
if ($obj === FALSE) {
|
||||||
|
// Entry no longer exists in APC, so clear it from the cache array
|
||||||
|
parent::deleteCacheData($cellID);
|
||||||
|
throw new PHPExcel_Exception('Cell entry '.$cellID.' no longer exists in APC');
|
||||||
|
}
|
||||||
|
if (!apc_store($newCachePrefix.$cellID.'.cache',$obj,$this->_cacheTime)) {
|
||||||
|
$this->__destruct();
|
||||||
|
throw new PHPExcel_Exception('Failed to store cell '.$cellID.' in APC');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->_cachePrefix = $newCachePrefix;
|
||||||
|
} // function copyCellCollection()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the cell collection and disconnect from our parent
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function unsetWorksheetCells() {
|
||||||
|
if ($this->_currentObject !== NULL) {
|
||||||
|
$this->_currentObject->detach();
|
||||||
|
$this->_currentObject = $this->_currentObjectID = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Flush the APC cache
|
||||||
|
$this->__destruct();
|
||||||
|
|
||||||
|
$this->_cellCache = array();
|
||||||
|
|
||||||
|
// detach ourself from the worksheet, so that it can then delete this object successfully
|
||||||
|
$this->_parent = null;
|
||||||
|
} // function unsetWorksheetCells()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialise this new cell collection
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Worksheet $parent The worksheet for this cell collection
|
||||||
|
* @param array of mixed $arguments Additional initialisation arguments
|
||||||
|
*/
|
||||||
|
public function __construct(PHPExcel_Worksheet $parent, $arguments) {
|
||||||
|
$cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600;
|
||||||
|
|
||||||
|
if ($this->_cachePrefix === NULL) {
|
||||||
|
$baseUnique = $this->_getUniqueID();
|
||||||
|
$this->_cachePrefix = substr(md5($baseUnique),0,8).'.';
|
||||||
|
$this->_cacheTime = $cacheTime;
|
||||||
|
|
||||||
|
parent::__construct($parent);
|
||||||
|
}
|
||||||
|
} // function __construct()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroy this cell collection
|
||||||
|
*/
|
||||||
|
public function __destruct() {
|
||||||
|
$cacheList = $this->getCellList();
|
||||||
|
foreach($cacheList as $cellID) {
|
||||||
|
apc_delete($this->_cachePrefix.$cellID.'.cache');
|
||||||
|
}
|
||||||
|
} // function __destruct()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Identify whether the caching method is currently available
|
||||||
|
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function cacheMethodIsAvailable() {
|
||||||
|
if (!function_exists('apc_store')) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if (apc_sma_info() === FALSE) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
347
admin/helpers/PHPExcel/CachedObjectStorage/CacheBase.php
Normal file
@ -0,0 +1,347 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_CachedObjectStorage
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_CachedObjectStorage_CacheBase
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_CachedObjectStorage
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
abstract class PHPExcel_CachedObjectStorage_CacheBase {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parent worksheet
|
||||||
|
*
|
||||||
|
* @var PHPExcel_Worksheet
|
||||||
|
*/
|
||||||
|
protected $_parent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The currently active Cell
|
||||||
|
*
|
||||||
|
* @var PHPExcel_Cell
|
||||||
|
*/
|
||||||
|
protected $_currentObject = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Coordinate address of the currently active Cell
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $_currentObjectID = null;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flag indicating whether the currently active Cell requires saving
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
protected $_currentCellIsDirty = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of cells or cell pointers for the worksheet cells held in this cache,
|
||||||
|
* and indexed by their coordinate address within the worksheet
|
||||||
|
*
|
||||||
|
* @var array of mixed
|
||||||
|
*/
|
||||||
|
protected $_cellCache = array();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialise this new cell collection
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Worksheet $parent The worksheet for this cell collection
|
||||||
|
*/
|
||||||
|
public function __construct(PHPExcel_Worksheet $parent) {
|
||||||
|
// Set our parent worksheet.
|
||||||
|
// This is maintained within the cache controller to facilitate re-attaching it to PHPExcel_Cell objects when
|
||||||
|
// they are woken from a serialized state
|
||||||
|
$this->_parent = $parent;
|
||||||
|
} // function __construct()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the parent worksheet for this cell collection
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Worksheet
|
||||||
|
*/
|
||||||
|
public function getParent()
|
||||||
|
{
|
||||||
|
return $this->_parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate address of the cell to check
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isDataSet($pCoord) {
|
||||||
|
if ($pCoord === $this->_currentObjectID) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// Check if the requested entry exists in the cache
|
||||||
|
return isset($this->_cellCache[$pCoord]);
|
||||||
|
} // function isDataSet()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move a cell object from one address to another
|
||||||
|
*
|
||||||
|
* @param string $fromAddress Current address of the cell to move
|
||||||
|
* @param string $toAddress Destination address of the cell to move
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function moveCell($fromAddress, $toAddress) {
|
||||||
|
if ($fromAddress === $this->_currentObjectID) {
|
||||||
|
$this->_currentObjectID = $toAddress;
|
||||||
|
}
|
||||||
|
$this->_currentCellIsDirty = true;
|
||||||
|
if (isset($this->_cellCache[$fromAddress])) {
|
||||||
|
$this->_cellCache[$toAddress] = &$this->_cellCache[$fromAddress];
|
||||||
|
unset($this->_cellCache[$fromAddress]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
} // function moveCell()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add or Update a cell in cache
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Cell $cell Cell to update
|
||||||
|
* @return PHPExcel_Cell
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
public function updateCacheData(PHPExcel_Cell $cell) {
|
||||||
|
return $this->addCacheData($cell->getCoordinate(),$cell);
|
||||||
|
} // function updateCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a cell in cache identified by coordinate address
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate address of the cell to delete
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
public function deleteCacheData($pCoord) {
|
||||||
|
if ($pCoord === $this->_currentObjectID) {
|
||||||
|
$this->_currentObject->detach();
|
||||||
|
$this->_currentObjectID = $this->_currentObject = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_object($this->_cellCache[$pCoord])) {
|
||||||
|
$this->_cellCache[$pCoord]->detach();
|
||||||
|
unset($this->_cellCache[$pCoord]);
|
||||||
|
}
|
||||||
|
$this->_currentCellIsDirty = false;
|
||||||
|
} // function deleteCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of all cell addresses currently held in cache
|
||||||
|
*
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function getCellList() {
|
||||||
|
return array_keys($this->_cellCache);
|
||||||
|
} // function getCellList()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort the list of all cell addresses currently held in cache by row and column
|
||||||
|
*
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function getSortedCellList() {
|
||||||
|
$sortKeys = array();
|
||||||
|
foreach ($this->getCellList() as $coord) {
|
||||||
|
sscanf($coord,'%[A-Z]%d', $column, $row);
|
||||||
|
$sortKeys[sprintf('%09d%3s',$row,$column)] = $coord;
|
||||||
|
}
|
||||||
|
ksort($sortKeys);
|
||||||
|
|
||||||
|
return array_values($sortKeys);
|
||||||
|
} // function sortCellList()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get highest worksheet column and highest row that have cell records
|
||||||
|
*
|
||||||
|
* @return array Highest column name and highest row number
|
||||||
|
*/
|
||||||
|
public function getHighestRowAndColumn()
|
||||||
|
{
|
||||||
|
// Lookup highest column and highest row
|
||||||
|
$col = array('A' => '1A');
|
||||||
|
$row = array(1);
|
||||||
|
foreach ($this->getCellList() as $coord) {
|
||||||
|
sscanf($coord,'%[A-Z]%d', $c, $r);
|
||||||
|
$row[$r] = $r;
|
||||||
|
$col[$c] = strlen($c).$c;
|
||||||
|
}
|
||||||
|
if (!empty($row)) {
|
||||||
|
// Determine highest column and row
|
||||||
|
$highestRow = max($row);
|
||||||
|
$highestColumn = substr(max($col),1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return array( 'row' => $highestRow,
|
||||||
|
'column' => $highestColumn
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the cell address of the currently active cell object
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getCurrentAddress()
|
||||||
|
{
|
||||||
|
return $this->_currentObjectID;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the column address of the currently active cell object
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getCurrentColumn()
|
||||||
|
{
|
||||||
|
sscanf($this->_currentObjectID, '%[A-Z]%d', $column, $row);
|
||||||
|
return $column;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the row address of the currently active cell object
|
||||||
|
*
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public function getCurrentRow()
|
||||||
|
{
|
||||||
|
sscanf($this->_currentObjectID, '%[A-Z]%d', $column, $row);
|
||||||
|
return (integer) $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get highest worksheet column
|
||||||
|
*
|
||||||
|
* @param string $row Return the highest column for the specified row,
|
||||||
|
* or the highest column of any row if no row number is passed
|
||||||
|
* @return string Highest column name
|
||||||
|
*/
|
||||||
|
public function getHighestColumn($row = null)
|
||||||
|
{
|
||||||
|
if ($row == null) {
|
||||||
|
$colRow = $this->getHighestRowAndColumn();
|
||||||
|
return $colRow['column'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$columnList = array(1);
|
||||||
|
foreach ($this->getCellList() as $coord) {
|
||||||
|
sscanf($coord,'%[A-Z]%d', $c, $r);
|
||||||
|
if ($r != $row) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$columnList[] = PHPExcel_Cell::columnIndexFromString($c);
|
||||||
|
}
|
||||||
|
return PHPExcel_Cell::stringFromColumnIndex(max($columnList) - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get highest worksheet row
|
||||||
|
*
|
||||||
|
* @param string $column Return the highest row for the specified column,
|
||||||
|
* or the highest row of any column if no column letter is passed
|
||||||
|
* @return int Highest row number
|
||||||
|
*/
|
||||||
|
public function getHighestRow($column = null)
|
||||||
|
{
|
||||||
|
if ($column == null) {
|
||||||
|
$colRow = $this->getHighestRowAndColumn();
|
||||||
|
return $colRow['row'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$rowList = array(0);
|
||||||
|
foreach ($this->getCellList() as $coord) {
|
||||||
|
sscanf($coord,'%[A-Z]%d', $c, $r);
|
||||||
|
if ($c != $column) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$rowList[] = $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
return max($rowList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a unique ID for cache referencing
|
||||||
|
*
|
||||||
|
* @return string Unique Reference
|
||||||
|
*/
|
||||||
|
protected function _getUniqueID() {
|
||||||
|
if (function_exists('posix_getpid')) {
|
||||||
|
$baseUnique = posix_getpid();
|
||||||
|
} else {
|
||||||
|
$baseUnique = mt_rand();
|
||||||
|
}
|
||||||
|
return uniqid($baseUnique,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clone the cell collection
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Worksheet $parent The new worksheet
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function copyCellCollection(PHPExcel_Worksheet $parent) {
|
||||||
|
$this->_currentCellIsDirty;
|
||||||
|
$this->_storeData();
|
||||||
|
|
||||||
|
$this->_parent = $parent;
|
||||||
|
if (($this->_currentObject !== NULL) && (is_object($this->_currentObject))) {
|
||||||
|
$this->_currentObject->attach($this);
|
||||||
|
}
|
||||||
|
} // function copyCellCollection()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Identify whether the caching method is currently available
|
||||||
|
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function cacheMethodIsAvailable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
219
admin/helpers/PHPExcel/CachedObjectStorage/DiscISAM.php
Normal file
@ -0,0 +1,219 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_CachedObjectStorage
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_CachedObjectStorage_DiscISAM
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_CachedObjectStorage
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of the file for this cache
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_fileName = NULL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* File handle for this cache file
|
||||||
|
*
|
||||||
|
* @var resource
|
||||||
|
*/
|
||||||
|
private $_fileHandle = NULL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Directory/Folder where the cache file is located
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_cacheDirectory = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store cell data in cache for the current cell object if it's "dirty",
|
||||||
|
* and the 'nullify' the current cell object
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
protected function _storeData() {
|
||||||
|
if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
|
||||||
|
$this->_currentObject->detach();
|
||||||
|
|
||||||
|
fseek($this->_fileHandle,0,SEEK_END);
|
||||||
|
|
||||||
|
$this->_cellCache[$this->_currentObjectID] = array(
|
||||||
|
'ptr' => ftell($this->_fileHandle),
|
||||||
|
'sz' => fwrite($this->_fileHandle, serialize($this->_currentObject))
|
||||||
|
);
|
||||||
|
$this->_currentCellIsDirty = false;
|
||||||
|
}
|
||||||
|
$this->_currentObjectID = $this->_currentObject = null;
|
||||||
|
} // function _storeData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add or Update a cell in cache identified by coordinate address
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
|
* @param PHPExcel_Cell $cell Cell to update
|
||||||
|
* @return PHPExcel_Cell
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||||
|
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
||||||
|
$this->_storeData();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_currentObjectID = $pCoord;
|
||||||
|
$this->_currentObject = $cell;
|
||||||
|
$this->_currentCellIsDirty = true;
|
||||||
|
|
||||||
|
return $cell;
|
||||||
|
} // function addCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get cell at a specific coordinate
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate of the cell
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||||
|
*/
|
||||||
|
public function getCacheData($pCoord) {
|
||||||
|
if ($pCoord === $this->_currentObjectID) {
|
||||||
|
return $this->_currentObject;
|
||||||
|
}
|
||||||
|
$this->_storeData();
|
||||||
|
|
||||||
|
// Check if the entry that has been requested actually exists
|
||||||
|
if (!isset($this->_cellCache[$pCoord])) {
|
||||||
|
// Return null if requested entry doesn't exist in cache
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set current entry to the requested entry
|
||||||
|
$this->_currentObjectID = $pCoord;
|
||||||
|
fseek($this->_fileHandle, $this->_cellCache[$pCoord]['ptr']);
|
||||||
|
$this->_currentObject = unserialize(fread($this->_fileHandle, $this->_cellCache[$pCoord]['sz']));
|
||||||
|
// Re-attach this as the cell's parent
|
||||||
|
$this->_currentObject->attach($this);
|
||||||
|
|
||||||
|
// Return requested entry
|
||||||
|
return $this->_currentObject;
|
||||||
|
} // function getCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of all cell addresses currently held in cache
|
||||||
|
*
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function getCellList() {
|
||||||
|
if ($this->_currentObjectID !== null) {
|
||||||
|
$this->_storeData();
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::getCellList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clone the cell collection
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Worksheet $parent The new worksheet
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function copyCellCollection(PHPExcel_Worksheet $parent) {
|
||||||
|
parent::copyCellCollection($parent);
|
||||||
|
// Get a new id for the new file name
|
||||||
|
$baseUnique = $this->_getUniqueID();
|
||||||
|
$newFileName = $this->_cacheDirectory.'/PHPExcel.'.$baseUnique.'.cache';
|
||||||
|
// Copy the existing cell cache file
|
||||||
|
copy ($this->_fileName,$newFileName);
|
||||||
|
$this->_fileName = $newFileName;
|
||||||
|
// Open the copied cell cache file
|
||||||
|
$this->_fileHandle = fopen($this->_fileName,'a+');
|
||||||
|
} // function copyCellCollection()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the cell collection and disconnect from our parent
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function unsetWorksheetCells() {
|
||||||
|
if(!is_null($this->_currentObject)) {
|
||||||
|
$this->_currentObject->detach();
|
||||||
|
$this->_currentObject = $this->_currentObjectID = null;
|
||||||
|
}
|
||||||
|
$this->_cellCache = array();
|
||||||
|
|
||||||
|
// detach ourself from the worksheet, so that it can then delete this object successfully
|
||||||
|
$this->_parent = null;
|
||||||
|
|
||||||
|
// Close down the temporary cache file
|
||||||
|
$this->__destruct();
|
||||||
|
} // function unsetWorksheetCells()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialise this new cell collection
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Worksheet $parent The worksheet for this cell collection
|
||||||
|
* @param array of mixed $arguments Additional initialisation arguments
|
||||||
|
*/
|
||||||
|
public function __construct(PHPExcel_Worksheet $parent, $arguments) {
|
||||||
|
$this->_cacheDirectory = ((isset($arguments['dir'])) && ($arguments['dir'] !== NULL))
|
||||||
|
? $arguments['dir']
|
||||||
|
: PHPExcel_Shared_File::sys_get_temp_dir();
|
||||||
|
|
||||||
|
parent::__construct($parent);
|
||||||
|
if (is_null($this->_fileHandle)) {
|
||||||
|
$baseUnique = $this->_getUniqueID();
|
||||||
|
$this->_fileName = $this->_cacheDirectory.'/PHPExcel.'.$baseUnique.'.cache';
|
||||||
|
$this->_fileHandle = fopen($this->_fileName,'a+');
|
||||||
|
}
|
||||||
|
} // function __construct()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroy this cell collection
|
||||||
|
*/
|
||||||
|
public function __destruct() {
|
||||||
|
if (!is_null($this->_fileHandle)) {
|
||||||
|
fclose($this->_fileHandle);
|
||||||
|
unlink($this->_fileName);
|
||||||
|
}
|
||||||
|
$this->_fileHandle = null;
|
||||||
|
} // function __destruct()
|
||||||
|
|
||||||
|
}
|
112
admin/helpers/PHPExcel/CachedObjectStorage/ICache.php
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_CachedObjectStorage
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_CachedObjectStorage_ICache
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_CachedObjectStorage
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
interface PHPExcel_CachedObjectStorage_ICache
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Add or Update a cell in cache identified by coordinate address
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
|
* @param PHPExcel_Cell $cell Cell to update
|
||||||
|
* @return PHPExcel_Cell
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
public function addCacheData($pCoord, PHPExcel_Cell $cell);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add or Update a cell in cache
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Cell $cell Cell to update
|
||||||
|
* @return PHPExcel_Cell
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
public function updateCacheData(PHPExcel_Cell $cell);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch a cell from cache identified by coordinate address
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate address of the cell to retrieve
|
||||||
|
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
public function getCacheData($pCoord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a cell in cache identified by coordinate address
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate address of the cell to delete
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
public function deleteCacheData($pCoord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate address of the cell to check
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isDataSet($pCoord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of all cell addresses currently held in cache
|
||||||
|
*
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function getCellList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of all cell addresses currently held in cache sorted by column and row
|
||||||
|
*
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function getSortedCellList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clone the cell collection
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Worksheet $parent The new worksheet
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function copyCellCollection(PHPExcel_Worksheet $parent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Identify whether the caching method is currently available
|
||||||
|
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function cacheMethodIsAvailable();
|
||||||
|
|
||||||
|
}
|
152
admin/helpers/PHPExcel/CachedObjectStorage/Igbinary.php
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_CachedObjectStorage
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_CachedObjectStorage_Igbinary
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_CachedObjectStorage
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store cell data in cache for the current cell object if it's "dirty",
|
||||||
|
* and the 'nullify' the current cell object
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
protected function _storeData() {
|
||||||
|
if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
|
||||||
|
$this->_currentObject->detach();
|
||||||
|
|
||||||
|
$this->_cellCache[$this->_currentObjectID] = igbinary_serialize($this->_currentObject);
|
||||||
|
$this->_currentCellIsDirty = false;
|
||||||
|
}
|
||||||
|
$this->_currentObjectID = $this->_currentObject = null;
|
||||||
|
} // function _storeData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add or Update a cell in cache identified by coordinate address
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
|
* @param PHPExcel_Cell $cell Cell to update
|
||||||
|
* @return PHPExcel_Cell
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||||
|
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
||||||
|
$this->_storeData();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_currentObjectID = $pCoord;
|
||||||
|
$this->_currentObject = $cell;
|
||||||
|
$this->_currentCellIsDirty = true;
|
||||||
|
|
||||||
|
return $cell;
|
||||||
|
} // function addCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get cell at a specific coordinate
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate of the cell
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||||
|
*/
|
||||||
|
public function getCacheData($pCoord) {
|
||||||
|
if ($pCoord === $this->_currentObjectID) {
|
||||||
|
return $this->_currentObject;
|
||||||
|
}
|
||||||
|
$this->_storeData();
|
||||||
|
|
||||||
|
// Check if the entry that has been requested actually exists
|
||||||
|
if (!isset($this->_cellCache[$pCoord])) {
|
||||||
|
// Return null if requested entry doesn't exist in cache
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set current entry to the requested entry
|
||||||
|
$this->_currentObjectID = $pCoord;
|
||||||
|
$this->_currentObject = igbinary_unserialize($this->_cellCache[$pCoord]);
|
||||||
|
// Re-attach this as the cell's parent
|
||||||
|
$this->_currentObject->attach($this);
|
||||||
|
|
||||||
|
// Return requested entry
|
||||||
|
return $this->_currentObject;
|
||||||
|
} // function getCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of all cell addresses currently held in cache
|
||||||
|
*
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function getCellList() {
|
||||||
|
if ($this->_currentObjectID !== null) {
|
||||||
|
$this->_storeData();
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::getCellList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the cell collection and disconnect from our parent
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function unsetWorksheetCells() {
|
||||||
|
if(!is_null($this->_currentObject)) {
|
||||||
|
$this->_currentObject->detach();
|
||||||
|
$this->_currentObject = $this->_currentObjectID = null;
|
||||||
|
}
|
||||||
|
$this->_cellCache = array();
|
||||||
|
|
||||||
|
// detach ourself from the worksheet, so that it can then delete this object successfully
|
||||||
|
$this->_parent = null;
|
||||||
|
} // function unsetWorksheetCells()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Identify whether the caching method is currently available
|
||||||
|
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function cacheMethodIsAvailable() {
|
||||||
|
if (!function_exists('igbinary_serialize')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
312
admin/helpers/PHPExcel/CachedObjectStorage/Memcache.php
Normal file
@ -0,0 +1,312 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_CachedObjectStorage
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_CachedObjectStorage_Memcache
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_CachedObjectStorage
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prefix used to uniquely identify cache data for this worksheet
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_cachePrefix = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache timeout
|
||||||
|
*
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
private $_cacheTime = 600;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Memcache interface
|
||||||
|
*
|
||||||
|
* @var resource
|
||||||
|
*/
|
||||||
|
private $_memcache = null;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store cell data in cache for the current cell object if it's "dirty",
|
||||||
|
* and the 'nullify' the current cell object
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
protected function _storeData() {
|
||||||
|
if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
|
||||||
|
$this->_currentObject->detach();
|
||||||
|
|
||||||
|
$obj = serialize($this->_currentObject);
|
||||||
|
if (!$this->_memcache->replace($this->_cachePrefix.$this->_currentObjectID.'.cache',$obj,NULL,$this->_cacheTime)) {
|
||||||
|
if (!$this->_memcache->add($this->_cachePrefix.$this->_currentObjectID.'.cache',$obj,NULL,$this->_cacheTime)) {
|
||||||
|
$this->__destruct();
|
||||||
|
throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in MemCache');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->_currentCellIsDirty = false;
|
||||||
|
}
|
||||||
|
$this->_currentObjectID = $this->_currentObject = null;
|
||||||
|
} // function _storeData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add or Update a cell in cache identified by coordinate address
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
|
* @param PHPExcel_Cell $cell Cell to update
|
||||||
|
* @return PHPExcel_Cell
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||||
|
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
||||||
|
$this->_storeData();
|
||||||
|
}
|
||||||
|
$this->_cellCache[$pCoord] = true;
|
||||||
|
|
||||||
|
$this->_currentObjectID = $pCoord;
|
||||||
|
$this->_currentObject = $cell;
|
||||||
|
$this->_currentCellIsDirty = true;
|
||||||
|
|
||||||
|
return $cell;
|
||||||
|
} // function addCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate address of the cell to check
|
||||||
|
* @return boolean
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isDataSet($pCoord) {
|
||||||
|
// Check if the requested entry is the current object, or exists in the cache
|
||||||
|
if (parent::isDataSet($pCoord)) {
|
||||||
|
if ($this->_currentObjectID == $pCoord) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// Check if the requested entry still exists in Memcache
|
||||||
|
$success = $this->_memcache->get($this->_cachePrefix.$pCoord.'.cache');
|
||||||
|
if ($success === false) {
|
||||||
|
// Entry no longer exists in Memcache, so clear it from the cache array
|
||||||
|
parent::deleteCacheData($pCoord);
|
||||||
|
throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in MemCache');
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
} // function isDataSet()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get cell at a specific coordinate
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate of the cell
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||||
|
*/
|
||||||
|
public function getCacheData($pCoord) {
|
||||||
|
if ($pCoord === $this->_currentObjectID) {
|
||||||
|
return $this->_currentObject;
|
||||||
|
}
|
||||||
|
$this->_storeData();
|
||||||
|
|
||||||
|
// Check if the entry that has been requested actually exists
|
||||||
|
if (parent::isDataSet($pCoord)) {
|
||||||
|
$obj = $this->_memcache->get($this->_cachePrefix.$pCoord.'.cache');
|
||||||
|
if ($obj === false) {
|
||||||
|
// Entry no longer exists in Memcache, so clear it from the cache array
|
||||||
|
parent::deleteCacheData($pCoord);
|
||||||
|
throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in MemCache');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Return null if requested entry doesn't exist in cache
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set current entry to the requested entry
|
||||||
|
$this->_currentObjectID = $pCoord;
|
||||||
|
$this->_currentObject = unserialize($obj);
|
||||||
|
// Re-attach this as the cell's parent
|
||||||
|
$this->_currentObject->attach($this);
|
||||||
|
|
||||||
|
// Return requested entry
|
||||||
|
return $this->_currentObject;
|
||||||
|
} // function getCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of all cell addresses currently held in cache
|
||||||
|
*
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function getCellList() {
|
||||||
|
if ($this->_currentObjectID !== null) {
|
||||||
|
$this->_storeData();
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::getCellList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a cell in cache identified by coordinate address
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate address of the cell to delete
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
public function deleteCacheData($pCoord) {
|
||||||
|
// Delete the entry from Memcache
|
||||||
|
$this->_memcache->delete($this->_cachePrefix.$pCoord.'.cache');
|
||||||
|
|
||||||
|
// Delete the entry from our cell address array
|
||||||
|
parent::deleteCacheData($pCoord);
|
||||||
|
} // function deleteCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clone the cell collection
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Worksheet $parent The new worksheet
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function copyCellCollection(PHPExcel_Worksheet $parent) {
|
||||||
|
parent::copyCellCollection($parent);
|
||||||
|
// Get a new id for the new file name
|
||||||
|
$baseUnique = $this->_getUniqueID();
|
||||||
|
$newCachePrefix = substr(md5($baseUnique),0,8).'.';
|
||||||
|
$cacheList = $this->getCellList();
|
||||||
|
foreach($cacheList as $cellID) {
|
||||||
|
if ($cellID != $this->_currentObjectID) {
|
||||||
|
$obj = $this->_memcache->get($this->_cachePrefix.$cellID.'.cache');
|
||||||
|
if ($obj === false) {
|
||||||
|
// Entry no longer exists in Memcache, so clear it from the cache array
|
||||||
|
parent::deleteCacheData($cellID);
|
||||||
|
throw new PHPExcel_Exception('Cell entry '.$cellID.' no longer exists in MemCache');
|
||||||
|
}
|
||||||
|
if (!$this->_memcache->add($newCachePrefix.$cellID.'.cache',$obj,NULL,$this->_cacheTime)) {
|
||||||
|
$this->__destruct();
|
||||||
|
throw new PHPExcel_Exception('Failed to store cell '.$cellID.' in MemCache');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->_cachePrefix = $newCachePrefix;
|
||||||
|
} // function copyCellCollection()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the cell collection and disconnect from our parent
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function unsetWorksheetCells() {
|
||||||
|
if(!is_null($this->_currentObject)) {
|
||||||
|
$this->_currentObject->detach();
|
||||||
|
$this->_currentObject = $this->_currentObjectID = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Flush the Memcache cache
|
||||||
|
$this->__destruct();
|
||||||
|
|
||||||
|
$this->_cellCache = array();
|
||||||
|
|
||||||
|
// detach ourself from the worksheet, so that it can then delete this object successfully
|
||||||
|
$this->_parent = null;
|
||||||
|
} // function unsetWorksheetCells()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialise this new cell collection
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Worksheet $parent The worksheet for this cell collection
|
||||||
|
* @param array of mixed $arguments Additional initialisation arguments
|
||||||
|
*/
|
||||||
|
public function __construct(PHPExcel_Worksheet $parent, $arguments) {
|
||||||
|
$memcacheServer = (isset($arguments['memcacheServer'])) ? $arguments['memcacheServer'] : 'localhost';
|
||||||
|
$memcachePort = (isset($arguments['memcachePort'])) ? $arguments['memcachePort'] : 11211;
|
||||||
|
$cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600;
|
||||||
|
|
||||||
|
if (is_null($this->_cachePrefix)) {
|
||||||
|
$baseUnique = $this->_getUniqueID();
|
||||||
|
$this->_cachePrefix = substr(md5($baseUnique),0,8).'.';
|
||||||
|
|
||||||
|
// Set a new Memcache object and connect to the Memcache server
|
||||||
|
$this->_memcache = new Memcache();
|
||||||
|
if (!$this->_memcache->addServer($memcacheServer, $memcachePort, false, 50, 5, 5, true, array($this, 'failureCallback'))) {
|
||||||
|
throw new PHPExcel_Exception('Could not connect to MemCache server at '.$memcacheServer.':'.$memcachePort);
|
||||||
|
}
|
||||||
|
$this->_cacheTime = $cacheTime;
|
||||||
|
|
||||||
|
parent::__construct($parent);
|
||||||
|
}
|
||||||
|
} // function __construct()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Memcache error handler
|
||||||
|
*
|
||||||
|
* @param string $host Memcache server
|
||||||
|
* @param integer $port Memcache port
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
public function failureCallback($host, $port) {
|
||||||
|
throw new PHPExcel_Exception('memcache '.$host.':'.$port.' failed');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroy this cell collection
|
||||||
|
*/
|
||||||
|
public function __destruct() {
|
||||||
|
$cacheList = $this->getCellList();
|
||||||
|
foreach($cacheList as $cellID) {
|
||||||
|
$this->_memcache->delete($this->_cachePrefix.$cellID.'.cache');
|
||||||
|
}
|
||||||
|
} // function __destruct()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Identify whether the caching method is currently available
|
||||||
|
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function cacheMethodIsAvailable() {
|
||||||
|
if (!function_exists('memcache_add')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
125
admin/helpers/PHPExcel/CachedObjectStorage/Memory.php
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_CachedObjectStorage
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_CachedObjectStorage_Memory
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_CachedObjectStorage
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dummy method callable from CacheBase, but unused by Memory cache
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function _storeData() {
|
||||||
|
} // function _storeData()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add or Update a cell in cache identified by coordinate address
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
|
* @param PHPExcel_Cell $cell Cell to update
|
||||||
|
* @return PHPExcel_Cell
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||||
|
$this->_cellCache[$pCoord] = $cell;
|
||||||
|
|
||||||
|
// Set current entry to the new/updated entry
|
||||||
|
$this->_currentObjectID = $pCoord;
|
||||||
|
|
||||||
|
return $cell;
|
||||||
|
} // function addCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get cell at a specific coordinate
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate of the cell
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||||
|
*/
|
||||||
|
public function getCacheData($pCoord) {
|
||||||
|
// Check if the entry that has been requested actually exists
|
||||||
|
if (!isset($this->_cellCache[$pCoord])) {
|
||||||
|
$this->_currentObjectID = NULL;
|
||||||
|
// Return null if requested entry doesn't exist in cache
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set current entry to the requested entry
|
||||||
|
$this->_currentObjectID = $pCoord;
|
||||||
|
|
||||||
|
// Return requested entry
|
||||||
|
return $this->_cellCache[$pCoord];
|
||||||
|
} // function getCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clone the cell collection
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Worksheet $parent The new worksheet
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function copyCellCollection(PHPExcel_Worksheet $parent) {
|
||||||
|
parent::copyCellCollection($parent);
|
||||||
|
|
||||||
|
$newCollection = array();
|
||||||
|
foreach($this->_cellCache as $k => &$cell) {
|
||||||
|
$newCollection[$k] = clone $cell;
|
||||||
|
$newCollection[$k]->attach($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_cellCache = $newCollection;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the cell collection and disconnect from our parent
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function unsetWorksheetCells() {
|
||||||
|
// Because cells are all stored as intact objects in memory, we need to detach each one from the parent
|
||||||
|
foreach($this->_cellCache as $k => &$cell) {
|
||||||
|
$cell->detach();
|
||||||
|
$this->_cellCache[$k] = null;
|
||||||
|
}
|
||||||
|
unset($cell);
|
||||||
|
|
||||||
|
$this->_cellCache = array();
|
||||||
|
|
||||||
|
// detach ourself from the worksheet, so that it can then delete this object successfully
|
||||||
|
$this->_parent = null;
|
||||||
|
} // function unsetWorksheetCells()
|
||||||
|
|
||||||
|
}
|
137
admin/helpers/PHPExcel/CachedObjectStorage/MemoryGZip.php
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_CachedObjectStorage
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_CachedObjectStorage_MemoryGZip
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_CachedObjectStorage
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store cell data in cache for the current cell object if it's "dirty",
|
||||||
|
* and the 'nullify' the current cell object
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
protected function _storeData() {
|
||||||
|
if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
|
||||||
|
$this->_currentObject->detach();
|
||||||
|
|
||||||
|
$this->_cellCache[$this->_currentObjectID] = gzdeflate(serialize($this->_currentObject));
|
||||||
|
$this->_currentCellIsDirty = false;
|
||||||
|
}
|
||||||
|
$this->_currentObjectID = $this->_currentObject = null;
|
||||||
|
} // function _storeData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add or Update a cell in cache identified by coordinate address
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
|
* @param PHPExcel_Cell $cell Cell to update
|
||||||
|
* @return PHPExcel_Cell
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||||
|
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
||||||
|
$this->_storeData();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_currentObjectID = $pCoord;
|
||||||
|
$this->_currentObject = $cell;
|
||||||
|
$this->_currentCellIsDirty = true;
|
||||||
|
|
||||||
|
return $cell;
|
||||||
|
} // function addCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get cell at a specific coordinate
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate of the cell
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||||
|
*/
|
||||||
|
public function getCacheData($pCoord) {
|
||||||
|
if ($pCoord === $this->_currentObjectID) {
|
||||||
|
return $this->_currentObject;
|
||||||
|
}
|
||||||
|
$this->_storeData();
|
||||||
|
|
||||||
|
// Check if the entry that has been requested actually exists
|
||||||
|
if (!isset($this->_cellCache[$pCoord])) {
|
||||||
|
// Return null if requested entry doesn't exist in cache
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set current entry to the requested entry
|
||||||
|
$this->_currentObjectID = $pCoord;
|
||||||
|
$this->_currentObject = unserialize(gzinflate($this->_cellCache[$pCoord]));
|
||||||
|
// Re-attach this as the cell's parent
|
||||||
|
$this->_currentObject->attach($this);
|
||||||
|
|
||||||
|
// Return requested entry
|
||||||
|
return $this->_currentObject;
|
||||||
|
} // function getCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of all cell addresses currently held in cache
|
||||||
|
*
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function getCellList() {
|
||||||
|
if ($this->_currentObjectID !== null) {
|
||||||
|
$this->_storeData();
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::getCellList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the cell collection and disconnect from our parent
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function unsetWorksheetCells() {
|
||||||
|
if(!is_null($this->_currentObject)) {
|
||||||
|
$this->_currentObject->detach();
|
||||||
|
$this->_currentObject = $this->_currentObjectID = null;
|
||||||
|
}
|
||||||
|
$this->_cellCache = array();
|
||||||
|
|
||||||
|
// detach ourself from the worksheet, so that it can then delete this object successfully
|
||||||
|
$this->_parent = null;
|
||||||
|
} // function unsetWorksheetCells()
|
||||||
|
|
||||||
|
}
|
137
admin/helpers/PHPExcel/CachedObjectStorage/MemorySerialized.php
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_CachedObjectStorage
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_CachedObjectStorage_MemorySerialized
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_CachedObjectStorage
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store cell data in cache for the current cell object if it's "dirty",
|
||||||
|
* and the 'nullify' the current cell object
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
protected function _storeData() {
|
||||||
|
if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
|
||||||
|
$this->_currentObject->detach();
|
||||||
|
|
||||||
|
$this->_cellCache[$this->_currentObjectID] = serialize($this->_currentObject);
|
||||||
|
$this->_currentCellIsDirty = false;
|
||||||
|
}
|
||||||
|
$this->_currentObjectID = $this->_currentObject = null;
|
||||||
|
} // function _storeData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add or Update a cell in cache identified by coordinate address
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
|
* @param PHPExcel_Cell $cell Cell to update
|
||||||
|
* @return PHPExcel_Cell
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||||
|
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
||||||
|
$this->_storeData();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_currentObjectID = $pCoord;
|
||||||
|
$this->_currentObject = $cell;
|
||||||
|
$this->_currentCellIsDirty = true;
|
||||||
|
|
||||||
|
return $cell;
|
||||||
|
} // function addCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get cell at a specific coordinate
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate of the cell
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||||
|
*/
|
||||||
|
public function getCacheData($pCoord) {
|
||||||
|
if ($pCoord === $this->_currentObjectID) {
|
||||||
|
return $this->_currentObject;
|
||||||
|
}
|
||||||
|
$this->_storeData();
|
||||||
|
|
||||||
|
// Check if the entry that has been requested actually exists
|
||||||
|
if (!isset($this->_cellCache[$pCoord])) {
|
||||||
|
// Return null if requested entry doesn't exist in cache
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set current entry to the requested entry
|
||||||
|
$this->_currentObjectID = $pCoord;
|
||||||
|
$this->_currentObject = unserialize($this->_cellCache[$pCoord]);
|
||||||
|
// Re-attach this as the cell's parent
|
||||||
|
$this->_currentObject->attach($this);
|
||||||
|
|
||||||
|
// Return requested entry
|
||||||
|
return $this->_currentObject;
|
||||||
|
} // function getCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of all cell addresses currently held in cache
|
||||||
|
*
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function getCellList() {
|
||||||
|
if ($this->_currentObjectID !== null) {
|
||||||
|
$this->_storeData();
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::getCellList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the cell collection and disconnect from our parent
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function unsetWorksheetCells() {
|
||||||
|
if(!is_null($this->_currentObject)) {
|
||||||
|
$this->_currentObject->detach();
|
||||||
|
$this->_currentObject = $this->_currentObjectID = null;
|
||||||
|
}
|
||||||
|
$this->_cellCache = array();
|
||||||
|
|
||||||
|
// detach ourself from the worksheet, so that it can then delete this object successfully
|
||||||
|
$this->_parent = null;
|
||||||
|
} // function unsetWorksheetCells()
|
||||||
|
|
||||||
|
}
|
206
admin/helpers/PHPExcel/CachedObjectStorage/PHPTemp.php
Normal file
@ -0,0 +1,206 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_CachedObjectStorage
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_CachedObjectStorage_PHPTemp
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_CachedObjectStorage
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of the file for this cache
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_fileHandle = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Memory limit to use before reverting to file cache
|
||||||
|
*
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
private $_memoryCacheSize = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store cell data in cache for the current cell object if it's "dirty",
|
||||||
|
* and the 'nullify' the current cell object
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
protected function _storeData() {
|
||||||
|
if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
|
||||||
|
$this->_currentObject->detach();
|
||||||
|
|
||||||
|
fseek($this->_fileHandle,0,SEEK_END);
|
||||||
|
|
||||||
|
$this->_cellCache[$this->_currentObjectID] = array(
|
||||||
|
'ptr' => ftell($this->_fileHandle),
|
||||||
|
'sz' => fwrite($this->_fileHandle, serialize($this->_currentObject))
|
||||||
|
);
|
||||||
|
$this->_currentCellIsDirty = false;
|
||||||
|
}
|
||||||
|
$this->_currentObjectID = $this->_currentObject = null;
|
||||||
|
} // function _storeData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add or Update a cell in cache identified by coordinate address
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
|
* @param PHPExcel_Cell $cell Cell to update
|
||||||
|
* @return PHPExcel_Cell
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||||
|
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
||||||
|
$this->_storeData();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_currentObjectID = $pCoord;
|
||||||
|
$this->_currentObject = $cell;
|
||||||
|
$this->_currentCellIsDirty = true;
|
||||||
|
|
||||||
|
return $cell;
|
||||||
|
} // function addCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get cell at a specific coordinate
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate of the cell
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||||
|
*/
|
||||||
|
public function getCacheData($pCoord) {
|
||||||
|
if ($pCoord === $this->_currentObjectID) {
|
||||||
|
return $this->_currentObject;
|
||||||
|
}
|
||||||
|
$this->_storeData();
|
||||||
|
|
||||||
|
// Check if the entry that has been requested actually exists
|
||||||
|
if (!isset($this->_cellCache[$pCoord])) {
|
||||||
|
// Return null if requested entry doesn't exist in cache
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set current entry to the requested entry
|
||||||
|
$this->_currentObjectID = $pCoord;
|
||||||
|
fseek($this->_fileHandle,$this->_cellCache[$pCoord]['ptr']);
|
||||||
|
$this->_currentObject = unserialize(fread($this->_fileHandle,$this->_cellCache[$pCoord]['sz']));
|
||||||
|
// Re-attach this as the cell's parent
|
||||||
|
$this->_currentObject->attach($this);
|
||||||
|
|
||||||
|
// Return requested entry
|
||||||
|
return $this->_currentObject;
|
||||||
|
} // function getCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of all cell addresses currently held in cache
|
||||||
|
*
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function getCellList() {
|
||||||
|
if ($this->_currentObjectID !== null) {
|
||||||
|
$this->_storeData();
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::getCellList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clone the cell collection
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Worksheet $parent The new worksheet
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function copyCellCollection(PHPExcel_Worksheet $parent) {
|
||||||
|
parent::copyCellCollection($parent);
|
||||||
|
// Open a new stream for the cell cache data
|
||||||
|
$newFileHandle = fopen('php://temp/maxmemory:'.$this->_memoryCacheSize,'a+');
|
||||||
|
// Copy the existing cell cache data to the new stream
|
||||||
|
fseek($this->_fileHandle,0);
|
||||||
|
while (!feof($this->_fileHandle)) {
|
||||||
|
fwrite($newFileHandle,fread($this->_fileHandle, 1024));
|
||||||
|
}
|
||||||
|
$this->_fileHandle = $newFileHandle;
|
||||||
|
} // function copyCellCollection()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the cell collection and disconnect from our parent
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function unsetWorksheetCells() {
|
||||||
|
if(!is_null($this->_currentObject)) {
|
||||||
|
$this->_currentObject->detach();
|
||||||
|
$this->_currentObject = $this->_currentObjectID = null;
|
||||||
|
}
|
||||||
|
$this->_cellCache = array();
|
||||||
|
|
||||||
|
// detach ourself from the worksheet, so that it can then delete this object successfully
|
||||||
|
$this->_parent = null;
|
||||||
|
|
||||||
|
// Close down the php://temp file
|
||||||
|
$this->__destruct();
|
||||||
|
} // function unsetWorksheetCells()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialise this new cell collection
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Worksheet $parent The worksheet for this cell collection
|
||||||
|
* @param array of mixed $arguments Additional initialisation arguments
|
||||||
|
*/
|
||||||
|
public function __construct(PHPExcel_Worksheet $parent, $arguments) {
|
||||||
|
$this->_memoryCacheSize = (isset($arguments['memoryCacheSize'])) ? $arguments['memoryCacheSize'] : '1MB';
|
||||||
|
|
||||||
|
parent::__construct($parent);
|
||||||
|
if (is_null($this->_fileHandle)) {
|
||||||
|
$this->_fileHandle = fopen('php://temp/maxmemory:'.$this->_memoryCacheSize,'a+');
|
||||||
|
}
|
||||||
|
} // function __construct()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroy this cell collection
|
||||||
|
*/
|
||||||
|
public function __destruct() {
|
||||||
|
if (!is_null($this->_fileHandle)) {
|
||||||
|
fclose($this->_fileHandle);
|
||||||
|
}
|
||||||
|
$this->_fileHandle = null;
|
||||||
|
} // function __destruct()
|
||||||
|
|
||||||
|
}
|
306
admin/helpers/PHPExcel/CachedObjectStorage/SQLite.php
Normal file
@ -0,0 +1,306 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_CachedObjectStorage
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_CachedObjectStorage_SQLite
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_CachedObjectStorage
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Database table name
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_TableName = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Database handle
|
||||||
|
*
|
||||||
|
* @var resource
|
||||||
|
*/
|
||||||
|
private $_DBHandle = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store cell data in cache for the current cell object if it's "dirty",
|
||||||
|
* and the 'nullify' the current cell object
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
protected function _storeData() {
|
||||||
|
if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
|
||||||
|
$this->_currentObject->detach();
|
||||||
|
|
||||||
|
if (!$this->_DBHandle->queryExec("INSERT OR REPLACE INTO kvp_".$this->_TableName." VALUES('".$this->_currentObjectID."','".sqlite_escape_string(serialize($this->_currentObject))."')"))
|
||||||
|
throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
||||||
|
$this->_currentCellIsDirty = false;
|
||||||
|
}
|
||||||
|
$this->_currentObjectID = $this->_currentObject = null;
|
||||||
|
} // function _storeData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add or Update a cell in cache identified by coordinate address
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
|
* @param PHPExcel_Cell $cell Cell to update
|
||||||
|
* @return PHPExcel_Cell
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||||
|
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
||||||
|
$this->_storeData();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_currentObjectID = $pCoord;
|
||||||
|
$this->_currentObject = $cell;
|
||||||
|
$this->_currentCellIsDirty = true;
|
||||||
|
|
||||||
|
return $cell;
|
||||||
|
} // function addCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get cell at a specific coordinate
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate of the cell
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||||
|
*/
|
||||||
|
public function getCacheData($pCoord) {
|
||||||
|
if ($pCoord === $this->_currentObjectID) {
|
||||||
|
return $this->_currentObject;
|
||||||
|
}
|
||||||
|
$this->_storeData();
|
||||||
|
|
||||||
|
$query = "SELECT value FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'";
|
||||||
|
$cellResultSet = $this->_DBHandle->query($query,SQLITE_ASSOC);
|
||||||
|
if ($cellResultSet === false) {
|
||||||
|
throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
||||||
|
} elseif ($cellResultSet->numRows() == 0) {
|
||||||
|
// Return null if requested entry doesn't exist in cache
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set current entry to the requested entry
|
||||||
|
$this->_currentObjectID = $pCoord;
|
||||||
|
|
||||||
|
$cellResult = $cellResultSet->fetchSingle();
|
||||||
|
$this->_currentObject = unserialize($cellResult);
|
||||||
|
// Re-attach this as the cell's parent
|
||||||
|
$this->_currentObject->attach($this);
|
||||||
|
|
||||||
|
// Return requested entry
|
||||||
|
return $this->_currentObject;
|
||||||
|
} // function getCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is a value set for an indexed cell?
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate address of the cell to check
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isDataSet($pCoord) {
|
||||||
|
if ($pCoord === $this->_currentObjectID) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the requested entry exists in the cache
|
||||||
|
$query = "SELECT id FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'";
|
||||||
|
$cellResultSet = $this->_DBHandle->query($query,SQLITE_ASSOC);
|
||||||
|
if ($cellResultSet === false) {
|
||||||
|
throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
||||||
|
} elseif ($cellResultSet->numRows() == 0) {
|
||||||
|
// Return null if requested entry doesn't exist in cache
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} // function isDataSet()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a cell in cache identified by coordinate address
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate address of the cell to delete
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
public function deleteCacheData($pCoord) {
|
||||||
|
if ($pCoord === $this->_currentObjectID) {
|
||||||
|
$this->_currentObject->detach();
|
||||||
|
$this->_currentObjectID = $this->_currentObject = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the requested entry exists in the cache
|
||||||
|
$query = "DELETE FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'";
|
||||||
|
if (!$this->_DBHandle->queryExec($query))
|
||||||
|
throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
||||||
|
|
||||||
|
$this->_currentCellIsDirty = false;
|
||||||
|
} // function deleteCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move a cell object from one address to another
|
||||||
|
*
|
||||||
|
* @param string $fromAddress Current address of the cell to move
|
||||||
|
* @param string $toAddress Destination address of the cell to move
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function moveCell($fromAddress, $toAddress) {
|
||||||
|
if ($fromAddress === $this->_currentObjectID) {
|
||||||
|
$this->_currentObjectID = $toAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = "DELETE FROM kvp_".$this->_TableName." WHERE id='".$toAddress."'";
|
||||||
|
$result = $this->_DBHandle->exec($query);
|
||||||
|
if ($result === false)
|
||||||
|
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||||
|
|
||||||
|
$query = "UPDATE kvp_".$this->_TableName." SET id='".$toAddress."' WHERE id='".$fromAddress."'";
|
||||||
|
$result = $this->_DBHandle->exec($query);
|
||||||
|
if ($result === false)
|
||||||
|
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
} // function moveCell()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of all cell addresses currently held in cache
|
||||||
|
*
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function getCellList() {
|
||||||
|
if ($this->_currentObjectID !== null) {
|
||||||
|
$this->_storeData();
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = "SELECT id FROM kvp_".$this->_TableName;
|
||||||
|
$cellIdsResult = $this->_DBHandle->unbufferedQuery($query,SQLITE_ASSOC);
|
||||||
|
if ($cellIdsResult === false)
|
||||||
|
throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
||||||
|
|
||||||
|
$cellKeys = array();
|
||||||
|
foreach($cellIdsResult as $row) {
|
||||||
|
$cellKeys[] = $row['id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $cellKeys;
|
||||||
|
} // function getCellList()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clone the cell collection
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Worksheet $parent The new worksheet
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function copyCellCollection(PHPExcel_Worksheet $parent) {
|
||||||
|
$this->_currentCellIsDirty;
|
||||||
|
$this->_storeData();
|
||||||
|
|
||||||
|
// Get a new id for the new table name
|
||||||
|
$tableName = str_replace('.','_',$this->_getUniqueID());
|
||||||
|
if (!$this->_DBHandle->queryExec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)
|
||||||
|
AS SELECT * FROM kvp_'.$this->_TableName))
|
||||||
|
throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
||||||
|
|
||||||
|
// Copy the existing cell cache file
|
||||||
|
$this->_TableName = $tableName;
|
||||||
|
} // function copyCellCollection()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the cell collection and disconnect from our parent
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function unsetWorksheetCells() {
|
||||||
|
if(!is_null($this->_currentObject)) {
|
||||||
|
$this->_currentObject->detach();
|
||||||
|
$this->_currentObject = $this->_currentObjectID = null;
|
||||||
|
}
|
||||||
|
// detach ourself from the worksheet, so that it can then delete this object successfully
|
||||||
|
$this->_parent = null;
|
||||||
|
|
||||||
|
// Close down the temporary cache file
|
||||||
|
$this->__destruct();
|
||||||
|
} // function unsetWorksheetCells()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialise this new cell collection
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Worksheet $parent The worksheet for this cell collection
|
||||||
|
*/
|
||||||
|
public function __construct(PHPExcel_Worksheet $parent) {
|
||||||
|
parent::__construct($parent);
|
||||||
|
if (is_null($this->_DBHandle)) {
|
||||||
|
$this->_TableName = str_replace('.','_',$this->_getUniqueID());
|
||||||
|
$_DBName = ':memory:';
|
||||||
|
|
||||||
|
$this->_DBHandle = new SQLiteDatabase($_DBName);
|
||||||
|
if ($this->_DBHandle === false)
|
||||||
|
throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
||||||
|
if (!$this->_DBHandle->queryExec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)'))
|
||||||
|
throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError()));
|
||||||
|
}
|
||||||
|
} // function __construct()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroy this cell collection
|
||||||
|
*/
|
||||||
|
public function __destruct() {
|
||||||
|
if (!is_null($this->_DBHandle)) {
|
||||||
|
$this->_DBHandle->queryExec('DROP TABLE kvp_'.$this->_TableName);
|
||||||
|
}
|
||||||
|
$this->_DBHandle = null;
|
||||||
|
} // function __destruct()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Identify whether the caching method is currently available
|
||||||
|
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function cacheMethodIsAvailable() {
|
||||||
|
if (!function_exists('sqlite_open')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
345
admin/helpers/PHPExcel/CachedObjectStorage/SQLite3.php
Normal file
@ -0,0 +1,345 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_CachedObjectStorage
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_CachedObjectStorage_SQLite3
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_CachedObjectStorage
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Database table name
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_TableName = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Database handle
|
||||||
|
*
|
||||||
|
* @var resource
|
||||||
|
*/
|
||||||
|
private $_DBHandle = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepared statement for a SQLite3 select query
|
||||||
|
*
|
||||||
|
* @var SQLite3Stmt
|
||||||
|
*/
|
||||||
|
private $_selectQuery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepared statement for a SQLite3 insert query
|
||||||
|
*
|
||||||
|
* @var SQLite3Stmt
|
||||||
|
*/
|
||||||
|
private $_insertQuery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepared statement for a SQLite3 update query
|
||||||
|
*
|
||||||
|
* @var SQLite3Stmt
|
||||||
|
*/
|
||||||
|
private $_updateQuery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepared statement for a SQLite3 delete query
|
||||||
|
*
|
||||||
|
* @var SQLite3Stmt
|
||||||
|
*/
|
||||||
|
private $_deleteQuery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store cell data in cache for the current cell object if it's "dirty",
|
||||||
|
* and the 'nullify' the current cell object
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
protected function _storeData() {
|
||||||
|
if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
|
||||||
|
$this->_currentObject->detach();
|
||||||
|
|
||||||
|
$this->_insertQuery->bindValue('id',$this->_currentObjectID,SQLITE3_TEXT);
|
||||||
|
$this->_insertQuery->bindValue('data',serialize($this->_currentObject),SQLITE3_BLOB);
|
||||||
|
$result = $this->_insertQuery->execute();
|
||||||
|
if ($result === false)
|
||||||
|
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||||
|
$this->_currentCellIsDirty = false;
|
||||||
|
}
|
||||||
|
$this->_currentObjectID = $this->_currentObject = null;
|
||||||
|
} // function _storeData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add or Update a cell in cache identified by coordinate address
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
|
* @param PHPExcel_Cell $cell Cell to update
|
||||||
|
* @return PHPExcel_Cell
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||||
|
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
||||||
|
$this->_storeData();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_currentObjectID = $pCoord;
|
||||||
|
$this->_currentObject = $cell;
|
||||||
|
$this->_currentCellIsDirty = true;
|
||||||
|
|
||||||
|
return $cell;
|
||||||
|
} // function addCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get cell at a specific coordinate
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate of the cell
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||||
|
*/
|
||||||
|
public function getCacheData($pCoord) {
|
||||||
|
if ($pCoord === $this->_currentObjectID) {
|
||||||
|
return $this->_currentObject;
|
||||||
|
}
|
||||||
|
$this->_storeData();
|
||||||
|
|
||||||
|
$this->_selectQuery->bindValue('id',$pCoord,SQLITE3_TEXT);
|
||||||
|
$cellResult = $this->_selectQuery->execute();
|
||||||
|
if ($cellResult === FALSE) {
|
||||||
|
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||||
|
}
|
||||||
|
$cellData = $cellResult->fetchArray(SQLITE3_ASSOC);
|
||||||
|
if ($cellData === FALSE) {
|
||||||
|
// Return null if requested entry doesn't exist in cache
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set current entry to the requested entry
|
||||||
|
$this->_currentObjectID = $pCoord;
|
||||||
|
|
||||||
|
$this->_currentObject = unserialize($cellData['value']);
|
||||||
|
// Re-attach this as the cell's parent
|
||||||
|
$this->_currentObject->attach($this);
|
||||||
|
|
||||||
|
// Return requested entry
|
||||||
|
return $this->_currentObject;
|
||||||
|
} // function getCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is a value set for an indexed cell?
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate address of the cell to check
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isDataSet($pCoord) {
|
||||||
|
if ($pCoord === $this->_currentObjectID) {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the requested entry exists in the cache
|
||||||
|
$this->_selectQuery->bindValue('id',$pCoord,SQLITE3_TEXT);
|
||||||
|
$cellResult = $this->_selectQuery->execute();
|
||||||
|
if ($cellResult === FALSE) {
|
||||||
|
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||||
|
}
|
||||||
|
$cellData = $cellResult->fetchArray(SQLITE3_ASSOC);
|
||||||
|
|
||||||
|
return ($cellData === FALSE) ? FALSE : TRUE;
|
||||||
|
} // function isDataSet()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a cell in cache identified by coordinate address
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate address of the cell to delete
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
public function deleteCacheData($pCoord) {
|
||||||
|
if ($pCoord === $this->_currentObjectID) {
|
||||||
|
$this->_currentObject->detach();
|
||||||
|
$this->_currentObjectID = $this->_currentObject = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the requested entry exists in the cache
|
||||||
|
$this->_deleteQuery->bindValue('id',$pCoord,SQLITE3_TEXT);
|
||||||
|
$result = $this->_deleteQuery->execute();
|
||||||
|
if ($result === FALSE)
|
||||||
|
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||||
|
|
||||||
|
$this->_currentCellIsDirty = FALSE;
|
||||||
|
} // function deleteCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move a cell object from one address to another
|
||||||
|
*
|
||||||
|
* @param string $fromAddress Current address of the cell to move
|
||||||
|
* @param string $toAddress Destination address of the cell to move
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function moveCell($fromAddress, $toAddress) {
|
||||||
|
if ($fromAddress === $this->_currentObjectID) {
|
||||||
|
$this->_currentObjectID = $toAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_deleteQuery->bindValue('id',$toAddress,SQLITE3_TEXT);
|
||||||
|
$result = $this->_deleteQuery->execute();
|
||||||
|
if ($result === false)
|
||||||
|
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||||
|
|
||||||
|
$this->_updateQuery->bindValue('toid',$toAddress,SQLITE3_TEXT);
|
||||||
|
$this->_updateQuery->bindValue('fromid',$fromAddress,SQLITE3_TEXT);
|
||||||
|
$result = $this->_updateQuery->execute();
|
||||||
|
if ($result === false)
|
||||||
|
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
} // function moveCell()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of all cell addresses currently held in cache
|
||||||
|
*
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function getCellList() {
|
||||||
|
if ($this->_currentObjectID !== null) {
|
||||||
|
$this->_storeData();
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = "SELECT id FROM kvp_".$this->_TableName;
|
||||||
|
$cellIdsResult = $this->_DBHandle->query($query);
|
||||||
|
if ($cellIdsResult === false)
|
||||||
|
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||||
|
|
||||||
|
$cellKeys = array();
|
||||||
|
while ($row = $cellIdsResult->fetchArray(SQLITE3_ASSOC)) {
|
||||||
|
$cellKeys[] = $row['id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $cellKeys;
|
||||||
|
} // function getCellList()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clone the cell collection
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Worksheet $parent The new worksheet
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function copyCellCollection(PHPExcel_Worksheet $parent) {
|
||||||
|
$this->_currentCellIsDirty;
|
||||||
|
$this->_storeData();
|
||||||
|
|
||||||
|
// Get a new id for the new table name
|
||||||
|
$tableName = str_replace('.','_',$this->_getUniqueID());
|
||||||
|
if (!$this->_DBHandle->exec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)
|
||||||
|
AS SELECT * FROM kvp_'.$this->_TableName))
|
||||||
|
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||||
|
|
||||||
|
// Copy the existing cell cache file
|
||||||
|
$this->_TableName = $tableName;
|
||||||
|
} // function copyCellCollection()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the cell collection and disconnect from our parent
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function unsetWorksheetCells() {
|
||||||
|
if(!is_null($this->_currentObject)) {
|
||||||
|
$this->_currentObject->detach();
|
||||||
|
$this->_currentObject = $this->_currentObjectID = null;
|
||||||
|
}
|
||||||
|
// detach ourself from the worksheet, so that it can then delete this object successfully
|
||||||
|
$this->_parent = null;
|
||||||
|
|
||||||
|
// Close down the temporary cache file
|
||||||
|
$this->__destruct();
|
||||||
|
} // function unsetWorksheetCells()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialise this new cell collection
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Worksheet $parent The worksheet for this cell collection
|
||||||
|
*/
|
||||||
|
public function __construct(PHPExcel_Worksheet $parent) {
|
||||||
|
parent::__construct($parent);
|
||||||
|
if (is_null($this->_DBHandle)) {
|
||||||
|
$this->_TableName = str_replace('.','_',$this->_getUniqueID());
|
||||||
|
$_DBName = ':memory:';
|
||||||
|
|
||||||
|
$this->_DBHandle = new SQLite3($_DBName);
|
||||||
|
if ($this->_DBHandle === false)
|
||||||
|
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||||
|
if (!$this->_DBHandle->exec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)'))
|
||||||
|
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_selectQuery = $this->_DBHandle->prepare("SELECT value FROM kvp_".$this->_TableName." WHERE id = :id");
|
||||||
|
$this->_insertQuery = $this->_DBHandle->prepare("INSERT OR REPLACE INTO kvp_".$this->_TableName." VALUES(:id,:data)");
|
||||||
|
$this->_updateQuery = $this->_DBHandle->prepare("UPDATE kvp_".$this->_TableName." SET id=:toId WHERE id=:fromId");
|
||||||
|
$this->_deleteQuery = $this->_DBHandle->prepare("DELETE FROM kvp_".$this->_TableName." WHERE id = :id");
|
||||||
|
} // function __construct()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroy this cell collection
|
||||||
|
*/
|
||||||
|
public function __destruct() {
|
||||||
|
if (!is_null($this->_DBHandle)) {
|
||||||
|
$this->_DBHandle->exec('DROP TABLE kvp_'.$this->_TableName);
|
||||||
|
$this->_DBHandle->close();
|
||||||
|
}
|
||||||
|
$this->_DBHandle = null;
|
||||||
|
} // function __destruct()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Identify whether the caching method is currently available
|
||||||
|
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function cacheMethodIsAvailable() {
|
||||||
|
if (!class_exists('SQLite3',FALSE)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
294
admin/helpers/PHPExcel/CachedObjectStorage/Wincache.php
Normal file
@ -0,0 +1,294 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_CachedObjectStorage
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_CachedObjectStorage_Wincache
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_CachedObjectStorage
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prefix used to uniquely identify cache data for this worksheet
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_cachePrefix = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache timeout
|
||||||
|
*
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
private $_cacheTime = 600;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store cell data in cache for the current cell object if it's "dirty",
|
||||||
|
* and the 'nullify' the current cell object
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
protected function _storeData() {
|
||||||
|
if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
|
||||||
|
$this->_currentObject->detach();
|
||||||
|
|
||||||
|
$obj = serialize($this->_currentObject);
|
||||||
|
if (wincache_ucache_exists($this->_cachePrefix.$this->_currentObjectID.'.cache')) {
|
||||||
|
if (!wincache_ucache_set($this->_cachePrefix.$this->_currentObjectID.'.cache', $obj, $this->_cacheTime)) {
|
||||||
|
$this->__destruct();
|
||||||
|
throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in WinCache');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!wincache_ucache_add($this->_cachePrefix.$this->_currentObjectID.'.cache', $obj, $this->_cacheTime)) {
|
||||||
|
$this->__destruct();
|
||||||
|
throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in WinCache');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->_currentCellIsDirty = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_currentObjectID = $this->_currentObject = null;
|
||||||
|
} // function _storeData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add or Update a cell in cache identified by coordinate address
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
|
* @param PHPExcel_Cell $cell Cell to update
|
||||||
|
* @return PHPExcel_Cell
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
|
||||||
|
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
|
||||||
|
$this->_storeData();
|
||||||
|
}
|
||||||
|
$this->_cellCache[$pCoord] = true;
|
||||||
|
|
||||||
|
$this->_currentObjectID = $pCoord;
|
||||||
|
$this->_currentObject = $cell;
|
||||||
|
$this->_currentCellIsDirty = true;
|
||||||
|
|
||||||
|
return $cell;
|
||||||
|
} // function addCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate address of the cell to check
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isDataSet($pCoord) {
|
||||||
|
// Check if the requested entry is the current object, or exists in the cache
|
||||||
|
if (parent::isDataSet($pCoord)) {
|
||||||
|
if ($this->_currentObjectID == $pCoord) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// Check if the requested entry still exists in cache
|
||||||
|
$success = wincache_ucache_exists($this->_cachePrefix.$pCoord.'.cache');
|
||||||
|
if ($success === false) {
|
||||||
|
// Entry no longer exists in Wincache, so clear it from the cache array
|
||||||
|
parent::deleteCacheData($pCoord);
|
||||||
|
throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in WinCache');
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
} // function isDataSet()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get cell at a specific coordinate
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate of the cell
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||||
|
*/
|
||||||
|
public function getCacheData($pCoord) {
|
||||||
|
if ($pCoord === $this->_currentObjectID) {
|
||||||
|
return $this->_currentObject;
|
||||||
|
}
|
||||||
|
$this->_storeData();
|
||||||
|
|
||||||
|
// Check if the entry that has been requested actually exists
|
||||||
|
$obj = null;
|
||||||
|
if (parent::isDataSet($pCoord)) {
|
||||||
|
$success = false;
|
||||||
|
$obj = wincache_ucache_get($this->_cachePrefix.$pCoord.'.cache', $success);
|
||||||
|
if ($success === false) {
|
||||||
|
// Entry no longer exists in WinCache, so clear it from the cache array
|
||||||
|
parent::deleteCacheData($pCoord);
|
||||||
|
throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in WinCache');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Return null if requested entry doesn't exist in cache
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set current entry to the requested entry
|
||||||
|
$this->_currentObjectID = $pCoord;
|
||||||
|
$this->_currentObject = unserialize($obj);
|
||||||
|
// Re-attach this as the cell's parent
|
||||||
|
$this->_currentObject->attach($this);
|
||||||
|
|
||||||
|
// Return requested entry
|
||||||
|
return $this->_currentObject;
|
||||||
|
} // function getCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of all cell addresses currently held in cache
|
||||||
|
*
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function getCellList() {
|
||||||
|
if ($this->_currentObjectID !== null) {
|
||||||
|
$this->_storeData();
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::getCellList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a cell in cache identified by coordinate address
|
||||||
|
*
|
||||||
|
* @param string $pCoord Coordinate address of the cell to delete
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
|
*/
|
||||||
|
public function deleteCacheData($pCoord) {
|
||||||
|
// Delete the entry from Wincache
|
||||||
|
wincache_ucache_delete($this->_cachePrefix.$pCoord.'.cache');
|
||||||
|
|
||||||
|
// Delete the entry from our cell address array
|
||||||
|
parent::deleteCacheData($pCoord);
|
||||||
|
} // function deleteCacheData()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clone the cell collection
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Worksheet $parent The new worksheet
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function copyCellCollection(PHPExcel_Worksheet $parent) {
|
||||||
|
parent::copyCellCollection($parent);
|
||||||
|
// Get a new id for the new file name
|
||||||
|
$baseUnique = $this->_getUniqueID();
|
||||||
|
$newCachePrefix = substr(md5($baseUnique),0,8).'.';
|
||||||
|
$cacheList = $this->getCellList();
|
||||||
|
foreach($cacheList as $cellID) {
|
||||||
|
if ($cellID != $this->_currentObjectID) {
|
||||||
|
$success = false;
|
||||||
|
$obj = wincache_ucache_get($this->_cachePrefix.$cellID.'.cache', $success);
|
||||||
|
if ($success === false) {
|
||||||
|
// Entry no longer exists in WinCache, so clear it from the cache array
|
||||||
|
parent::deleteCacheData($cellID);
|
||||||
|
throw new PHPExcel_Exception('Cell entry '.$cellID.' no longer exists in Wincache');
|
||||||
|
}
|
||||||
|
if (!wincache_ucache_add($newCachePrefix.$cellID.'.cache', $obj, $this->_cacheTime)) {
|
||||||
|
$this->__destruct();
|
||||||
|
throw new PHPExcel_Exception('Failed to store cell '.$cellID.' in Wincache');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->_cachePrefix = $newCachePrefix;
|
||||||
|
} // function copyCellCollection()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the cell collection and disconnect from our parent
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function unsetWorksheetCells() {
|
||||||
|
if(!is_null($this->_currentObject)) {
|
||||||
|
$this->_currentObject->detach();
|
||||||
|
$this->_currentObject = $this->_currentObjectID = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Flush the WinCache cache
|
||||||
|
$this->__destruct();
|
||||||
|
|
||||||
|
$this->_cellCache = array();
|
||||||
|
|
||||||
|
// detach ourself from the worksheet, so that it can then delete this object successfully
|
||||||
|
$this->_parent = null;
|
||||||
|
} // function unsetWorksheetCells()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialise this new cell collection
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Worksheet $parent The worksheet for this cell collection
|
||||||
|
* @param array of mixed $arguments Additional initialisation arguments
|
||||||
|
*/
|
||||||
|
public function __construct(PHPExcel_Worksheet $parent, $arguments) {
|
||||||
|
$cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600;
|
||||||
|
|
||||||
|
if (is_null($this->_cachePrefix)) {
|
||||||
|
$baseUnique = $this->_getUniqueID();
|
||||||
|
$this->_cachePrefix = substr(md5($baseUnique),0,8).'.';
|
||||||
|
$this->_cacheTime = $cacheTime;
|
||||||
|
|
||||||
|
parent::__construct($parent);
|
||||||
|
}
|
||||||
|
} // function __construct()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroy this cell collection
|
||||||
|
*/
|
||||||
|
public function __destruct() {
|
||||||
|
$cacheList = $this->getCellList();
|
||||||
|
foreach($cacheList as $cellID) {
|
||||||
|
wincache_ucache_delete($this->_cachePrefix.$cellID.'.cache');
|
||||||
|
}
|
||||||
|
} // function __destruct()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Identify whether the caching method is currently available
|
||||||
|
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function cacheMethodIsAvailable() {
|
||||||
|
if (!function_exists('wincache_ucache_add')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
1
admin/helpers/PHPExcel/CachedObjectStorage/index.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
251
admin/helpers/PHPExcel/CachedObjectStorageFactory.php
Normal file
@ -0,0 +1,251 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_CachedObjectStorage
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_CachedObjectStorageFactory
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_CachedObjectStorage
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_CachedObjectStorageFactory
|
||||||
|
{
|
||||||
|
const cache_in_memory = 'Memory';
|
||||||
|
const cache_in_memory_gzip = 'MemoryGZip';
|
||||||
|
const cache_in_memory_serialized = 'MemorySerialized';
|
||||||
|
const cache_igbinary = 'Igbinary';
|
||||||
|
const cache_to_discISAM = 'DiscISAM';
|
||||||
|
const cache_to_apc = 'APC';
|
||||||
|
const cache_to_memcache = 'Memcache';
|
||||||
|
const cache_to_phpTemp = 'PHPTemp';
|
||||||
|
const cache_to_wincache = 'Wincache';
|
||||||
|
const cache_to_sqlite = 'SQLite';
|
||||||
|
const cache_to_sqlite3 = 'SQLite3';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of the method used for cell cacheing
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private static $_cacheStorageMethod = NULL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of the class used for cell cacheing
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private static $_cacheStorageClass = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of all possible cache storage methods
|
||||||
|
*
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
private static $_storageMethods = array(
|
||||||
|
self::cache_in_memory,
|
||||||
|
self::cache_in_memory_gzip,
|
||||||
|
self::cache_in_memory_serialized,
|
||||||
|
self::cache_igbinary,
|
||||||
|
self::cache_to_phpTemp,
|
||||||
|
self::cache_to_discISAM,
|
||||||
|
self::cache_to_apc,
|
||||||
|
self::cache_to_memcache,
|
||||||
|
self::cache_to_wincache,
|
||||||
|
self::cache_to_sqlite,
|
||||||
|
self::cache_to_sqlite3,
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default arguments for each cache storage method
|
||||||
|
*
|
||||||
|
* @var array of mixed array
|
||||||
|
*/
|
||||||
|
private static $_storageMethodDefaultParameters = array(
|
||||||
|
self::cache_in_memory => array(
|
||||||
|
),
|
||||||
|
self::cache_in_memory_gzip => array(
|
||||||
|
),
|
||||||
|
self::cache_in_memory_serialized => array(
|
||||||
|
),
|
||||||
|
self::cache_igbinary => array(
|
||||||
|
),
|
||||||
|
self::cache_to_phpTemp => array( 'memoryCacheSize' => '1MB'
|
||||||
|
),
|
||||||
|
self::cache_to_discISAM => array( 'dir' => NULL
|
||||||
|
),
|
||||||
|
self::cache_to_apc => array( 'cacheTime' => 600
|
||||||
|
),
|
||||||
|
self::cache_to_memcache => array( 'memcacheServer' => 'localhost',
|
||||||
|
'memcachePort' => 11211,
|
||||||
|
'cacheTime' => 600
|
||||||
|
),
|
||||||
|
self::cache_to_wincache => array( 'cacheTime' => 600
|
||||||
|
),
|
||||||
|
self::cache_to_sqlite => array(
|
||||||
|
),
|
||||||
|
self::cache_to_sqlite3 => array(
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Arguments for the active cache storage method
|
||||||
|
*
|
||||||
|
* @var array of mixed array
|
||||||
|
*/
|
||||||
|
private static $_storageMethodParameters = array();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the current cache storage method
|
||||||
|
*
|
||||||
|
* @return string|NULL
|
||||||
|
**/
|
||||||
|
public static function getCacheStorageMethod()
|
||||||
|
{
|
||||||
|
return self::$_cacheStorageMethod;
|
||||||
|
} // function getCacheStorageMethod()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the current cache storage class
|
||||||
|
*
|
||||||
|
* @return PHPExcel_CachedObjectStorage_ICache|NULL
|
||||||
|
**/
|
||||||
|
public static function getCacheStorageClass()
|
||||||
|
{
|
||||||
|
return self::$_cacheStorageClass;
|
||||||
|
} // function getCacheStorageClass()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the list of all possible cache storage methods
|
||||||
|
*
|
||||||
|
* @return string[]
|
||||||
|
**/
|
||||||
|
public static function getAllCacheStorageMethods()
|
||||||
|
{
|
||||||
|
return self::$_storageMethods;
|
||||||
|
} // function getCacheStorageMethods()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the list of all available cache storage methods
|
||||||
|
*
|
||||||
|
* @return string[]
|
||||||
|
**/
|
||||||
|
public static function getCacheStorageMethods()
|
||||||
|
{
|
||||||
|
$activeMethods = array();
|
||||||
|
foreach(self::$_storageMethods as $storageMethod) {
|
||||||
|
$cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $storageMethod;
|
||||||
|
if (call_user_func(array($cacheStorageClass, 'cacheMethodIsAvailable'))) {
|
||||||
|
$activeMethods[] = $storageMethod;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $activeMethods;
|
||||||
|
} // function getCacheStorageMethods()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Identify the cache storage method to use
|
||||||
|
*
|
||||||
|
* @param string $method Name of the method to use for cell cacheing
|
||||||
|
* @param array of mixed $arguments Additional arguments to pass to the cell caching class
|
||||||
|
* when instantiating
|
||||||
|
* @return boolean
|
||||||
|
**/
|
||||||
|
public static function initialize($method = self::cache_in_memory, $arguments = array())
|
||||||
|
{
|
||||||
|
if (!in_array($method,self::$_storageMethods)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
$cacheStorageClass = 'PHPExcel_CachedObjectStorage_'.$method;
|
||||||
|
if (!call_user_func(array( $cacheStorageClass,
|
||||||
|
'cacheMethodIsAvailable'))) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
self::$_storageMethodParameters[$method] = self::$_storageMethodDefaultParameters[$method];
|
||||||
|
foreach($arguments as $k => $v) {
|
||||||
|
if (array_key_exists($k, self::$_storageMethodParameters[$method])) {
|
||||||
|
self::$_storageMethodParameters[$method][$k] = $v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (self::$_cacheStorageMethod === NULL) {
|
||||||
|
self::$_cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $method;
|
||||||
|
self::$_cacheStorageMethod = $method;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
} // function initialize()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialise the cache storage
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Worksheet $parent Enable cell caching for this worksheet
|
||||||
|
* @return PHPExcel_CachedObjectStorage_ICache
|
||||||
|
**/
|
||||||
|
public static function getInstance(PHPExcel_Worksheet $parent)
|
||||||
|
{
|
||||||
|
$cacheMethodIsAvailable = TRUE;
|
||||||
|
if (self::$_cacheStorageMethod === NULL) {
|
||||||
|
$cacheMethodIsAvailable = self::initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($cacheMethodIsAvailable) {
|
||||||
|
$instance = new self::$_cacheStorageClass( $parent,
|
||||||
|
self::$_storageMethodParameters[self::$_cacheStorageMethod]
|
||||||
|
);
|
||||||
|
if ($instance !== NULL) {
|
||||||
|
return $instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
} // function getInstance()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the cache storage
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
public static function finalize()
|
||||||
|
{
|
||||||
|
self::$_cacheStorageMethod = NULL;
|
||||||
|
self::$_cacheStorageClass = NULL;
|
||||||
|
self::$_storageMethodParameters = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
98
admin/helpers/PHPExcel/CalcEngine/CyclicReferenceStack.php
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Calculation
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_CalcEngine_CyclicReferenceStack
|
||||||
|
*
|
||||||
|
* @category PHPExcel_CalcEngine_CyclicReferenceStack
|
||||||
|
* @package PHPExcel_Calculation
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_CalcEngine_CyclicReferenceStack {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The call stack for calculated cells
|
||||||
|
*
|
||||||
|
* @var mixed[]
|
||||||
|
*/
|
||||||
|
private $_stack = array();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the number of entries on the stack
|
||||||
|
*
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public function count() {
|
||||||
|
return count($this->_stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Push a new entry onto the stack
|
||||||
|
*
|
||||||
|
* @param mixed $value
|
||||||
|
*/
|
||||||
|
public function push($value) {
|
||||||
|
$this->_stack[] = $value;
|
||||||
|
} // function push()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pop the last entry from the stack
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function pop() {
|
||||||
|
return array_pop($this->_stack);
|
||||||
|
} // function pop()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test to see if a specified entry exists on the stack
|
||||||
|
*
|
||||||
|
* @param mixed $value The value to test
|
||||||
|
*/
|
||||||
|
public function onStack($value) {
|
||||||
|
return in_array($value, $this->_stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the stack
|
||||||
|
*/
|
||||||
|
public function clear() {
|
||||||
|
$this->_stack = array();
|
||||||
|
} // function push()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return an array of all entries on the stack
|
||||||
|
*
|
||||||
|
* @return mixed[]
|
||||||
|
*/
|
||||||
|
public function showStack() {
|
||||||
|
return $this->_stack;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // class PHPExcel_CalcEngine_CyclicReferenceStack
|
153
admin/helpers/PHPExcel/CalcEngine/Logger.php
Normal file
@ -0,0 +1,153 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Calculation
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_CalcEngine_Logger
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Calculation
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_CalcEngine_Logger {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flag to determine whether a debug log should be generated by the calculation engine
|
||||||
|
* If true, then a debug log will be generated
|
||||||
|
* If false, then a debug log will not be generated
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
private $_writeDebugLog = FALSE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flag to determine whether a debug log should be echoed by the calculation engine
|
||||||
|
* If true, then a debug log will be echoed
|
||||||
|
* If false, then a debug log will not be echoed
|
||||||
|
* A debug log can only be echoed if it is generated
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
private $_echoDebugLog = FALSE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The debug log generated by the calculation engine
|
||||||
|
*
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
private $_debugLog = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The calculation engine cell reference stack
|
||||||
|
*
|
||||||
|
* @var PHPExcel_CalcEngine_CyclicReferenceStack
|
||||||
|
*/
|
||||||
|
private $_cellStack;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiate a Calculation engine logger
|
||||||
|
*
|
||||||
|
* @param PHPExcel_CalcEngine_CyclicReferenceStack $stack
|
||||||
|
*/
|
||||||
|
public function __construct(PHPExcel_CalcEngine_CyclicReferenceStack $stack) {
|
||||||
|
$this->_cellStack = $stack;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable/Disable Calculation engine logging
|
||||||
|
*
|
||||||
|
* @param boolean $pValue
|
||||||
|
*/
|
||||||
|
public function setWriteDebugLog($pValue = FALSE) {
|
||||||
|
$this->_writeDebugLog = $pValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return whether calculation engine logging is enabled or disabled
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function getWriteDebugLog() {
|
||||||
|
return $this->_writeDebugLog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable/Disable echoing of debug log information
|
||||||
|
*
|
||||||
|
* @param boolean $pValue
|
||||||
|
*/
|
||||||
|
public function setEchoDebugLog($pValue = FALSE) {
|
||||||
|
$this->_echoDebugLog = $pValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return whether echoing of debug log information is enabled or disabled
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function getEchoDebugLog() {
|
||||||
|
return $this->_echoDebugLog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write an entry to the calculation engine debug log
|
||||||
|
*/
|
||||||
|
public function writeDebugLog() {
|
||||||
|
// Only write the debug log if logging is enabled
|
||||||
|
if ($this->_writeDebugLog) {
|
||||||
|
$message = implode(func_get_args());
|
||||||
|
$cellReference = implode(' -> ', $this->_cellStack->showStack());
|
||||||
|
if ($this->_echoDebugLog) {
|
||||||
|
echo $cellReference,
|
||||||
|
($this->_cellStack->count() > 0 ? ' => ' : ''),
|
||||||
|
$message,
|
||||||
|
PHP_EOL;
|
||||||
|
}
|
||||||
|
$this->_debugLog[] = $cellReference .
|
||||||
|
($this->_cellStack->count() > 0 ? ' => ' : '') .
|
||||||
|
$message;
|
||||||
|
}
|
||||||
|
} // function _writeDebug()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the calculation engine debug log
|
||||||
|
*/
|
||||||
|
public function clearLog() {
|
||||||
|
$this->_debugLog = array();
|
||||||
|
} // function flushLogger()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the calculation engine debug log
|
||||||
|
*
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function getLog() {
|
||||||
|
return $this->_debugLog;
|
||||||
|
} // function flushLogger()
|
||||||
|
|
||||||
|
} // class PHPExcel_CalcEngine_Logger
|
||||||
|
|
1
admin/helpers/PHPExcel/CalcEngine/index.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
3946
admin/helpers/PHPExcel/Calculation.php
Normal file
725
admin/helpers/PHPExcel/Calculation/Database.php
Normal file
@ -0,0 +1,725 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Calculation
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/** PHPExcel root directory */
|
||||||
|
if (!defined('PHPEXCEL_ROOT')) {
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||||
|
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Calculation_Database
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Calculation
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_Calculation_Database {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* __fieldExtract
|
||||||
|
*
|
||||||
|
* Extracts the column ID to use for the data field.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||||
|
* A database is a list of related data in which rows of related
|
||||||
|
* information are records, and columns of data are fields. The
|
||||||
|
* first row of the list contains labels for each column.
|
||||||
|
* @param mixed $field Indicates which column is used in the function. Enter the
|
||||||
|
* column label enclosed between double quotation marks, such as
|
||||||
|
* "Age" or "Yield," or a number (without quotation marks) that
|
||||||
|
* represents the position of the column within the list: 1 for
|
||||||
|
* the first column, 2 for the second column, and so on.
|
||||||
|
* @return string|NULL
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static function __fieldExtract($database,$field) {
|
||||||
|
$field = strtoupper(PHPExcel_Calculation_Functions::flattenSingleValue($field));
|
||||||
|
$fieldNames = array_map('strtoupper',array_shift($database));
|
||||||
|
|
||||||
|
if (is_numeric($field)) {
|
||||||
|
$keys = array_keys($fieldNames);
|
||||||
|
return $keys[$field-1];
|
||||||
|
}
|
||||||
|
$key = array_search($field,$fieldNames);
|
||||||
|
return ($key) ? $key : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* __filter
|
||||||
|
*
|
||||||
|
* Parses the selection criteria, extracts the database rows that match those criteria, and
|
||||||
|
* returns that subset of rows.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||||
|
* A database is a list of related data in which rows of related
|
||||||
|
* information are records, and columns of data are fields. The
|
||||||
|
* first row of the list contains labels for each column.
|
||||||
|
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
||||||
|
* You can use any range for the criteria argument, as long as it
|
||||||
|
* includes at least one column label and at least one cell below
|
||||||
|
* the column label in which you specify a condition for the
|
||||||
|
* column.
|
||||||
|
* @return array of mixed
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static function __filter($database,$criteria) {
|
||||||
|
$fieldNames = array_shift($database);
|
||||||
|
$criteriaNames = array_shift($criteria);
|
||||||
|
|
||||||
|
// Convert the criteria into a set of AND/OR conditions with [:placeholders]
|
||||||
|
$testConditions = $testValues = array();
|
||||||
|
$testConditionsCount = 0;
|
||||||
|
foreach($criteriaNames as $key => $criteriaName) {
|
||||||
|
$testCondition = array();
|
||||||
|
$testConditionCount = 0;
|
||||||
|
foreach($criteria as $row => $criterion) {
|
||||||
|
if ($criterion[$key] > '') {
|
||||||
|
$testCondition[] = '[:'.$criteriaName.']'.PHPExcel_Calculation_Functions::_ifCondition($criterion[$key]);
|
||||||
|
$testConditionCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($testConditionCount > 1) {
|
||||||
|
$testConditions[] = 'OR('.implode(',',$testCondition).')';
|
||||||
|
$testConditionsCount++;
|
||||||
|
} elseif($testConditionCount == 1) {
|
||||||
|
$testConditions[] = $testCondition[0];
|
||||||
|
$testConditionsCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($testConditionsCount > 1) {
|
||||||
|
$testConditionSet = 'AND('.implode(',',$testConditions).')';
|
||||||
|
} elseif($testConditionsCount == 1) {
|
||||||
|
$testConditionSet = $testConditions[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Loop through each row of the database
|
||||||
|
foreach($database as $dataRow => $dataValues) {
|
||||||
|
// Substitute actual values from the database row for our [:placeholders]
|
||||||
|
$testConditionList = $testConditionSet;
|
||||||
|
foreach($criteriaNames as $key => $criteriaName) {
|
||||||
|
$k = array_search($criteriaName,$fieldNames);
|
||||||
|
if (isset($dataValues[$k])) {
|
||||||
|
$dataValue = $dataValues[$k];
|
||||||
|
$dataValue = (is_string($dataValue)) ? PHPExcel_Calculation::_wrapResult(strtoupper($dataValue)) : $dataValue;
|
||||||
|
$testConditionList = str_replace('[:'.$criteriaName.']',$dataValue,$testConditionList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// evaluate the criteria against the row data
|
||||||
|
$result = PHPExcel_Calculation::getInstance()->_calculateFormulaValue('='.$testConditionList);
|
||||||
|
// If the row failed to meet the criteria, remove it from the database
|
||||||
|
if (!$result) {
|
||||||
|
unset($database[$dataRow]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $database;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DAVERAGE
|
||||||
|
*
|
||||||
|
* Averages the values in a column of a list or database that match conditions you specify.
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* DAVERAGE(database,field,criteria)
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @category Database Functions
|
||||||
|
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||||
|
* A database is a list of related data in which rows of related
|
||||||
|
* information are records, and columns of data are fields. The
|
||||||
|
* first row of the list contains labels for each column.
|
||||||
|
* @param string|integer $field Indicates which column is used in the function. Enter the
|
||||||
|
* column label enclosed between double quotation marks, such as
|
||||||
|
* "Age" or "Yield," or a number (without quotation marks) that
|
||||||
|
* represents the position of the column within the list: 1 for
|
||||||
|
* the first column, 2 for the second column, and so on.
|
||||||
|
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
||||||
|
* You can use any range for the criteria argument, as long as it
|
||||||
|
* includes at least one column label and at least one cell below
|
||||||
|
* the column label in which you specify a condition for the
|
||||||
|
* column.
|
||||||
|
* @return float
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function DAVERAGE($database,$field,$criteria) {
|
||||||
|
$field = self::__fieldExtract($database,$field);
|
||||||
|
if (is_null($field)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
// reduce the database to a set of rows that match all the criteria
|
||||||
|
$database = self::__filter($database,$criteria);
|
||||||
|
// extract an array of values for the requested column
|
||||||
|
$colData = array();
|
||||||
|
foreach($database as $row) {
|
||||||
|
$colData[] = $row[$field];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return
|
||||||
|
return PHPExcel_Calculation_Statistical::AVERAGE($colData);
|
||||||
|
} // function DAVERAGE()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DCOUNT
|
||||||
|
*
|
||||||
|
* Counts the cells that contain numbers in a column of a list or database that match conditions
|
||||||
|
* that you specify.
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* DCOUNT(database,[field],criteria)
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* DAVERAGE(database,field,criteria)
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @category Database Functions
|
||||||
|
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||||
|
* A database is a list of related data in which rows of related
|
||||||
|
* information are records, and columns of data are fields. The
|
||||||
|
* first row of the list contains labels for each column.
|
||||||
|
* @param string|integer $field Indicates which column is used in the function. Enter the
|
||||||
|
* column label enclosed between double quotation marks, such as
|
||||||
|
* "Age" or "Yield," or a number (without quotation marks) that
|
||||||
|
* represents the position of the column within the list: 1 for
|
||||||
|
* the first column, 2 for the second column, and so on.
|
||||||
|
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
||||||
|
* You can use any range for the criteria argument, as long as it
|
||||||
|
* includes at least one column label and at least one cell below
|
||||||
|
* the column label in which you specify a condition for the
|
||||||
|
* column.
|
||||||
|
* @return integer
|
||||||
|
*
|
||||||
|
* @TODO The field argument is optional. If field is omitted, DCOUNT counts all records in the
|
||||||
|
* database that match the criteria.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function DCOUNT($database,$field,$criteria) {
|
||||||
|
$field = self::__fieldExtract($database,$field);
|
||||||
|
if (is_null($field)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// reduce the database to a set of rows that match all the criteria
|
||||||
|
$database = self::__filter($database,$criteria);
|
||||||
|
// extract an array of values for the requested column
|
||||||
|
$colData = array();
|
||||||
|
foreach($database as $row) {
|
||||||
|
$colData[] = $row[$field];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return
|
||||||
|
return PHPExcel_Calculation_Statistical::COUNT($colData);
|
||||||
|
} // function DCOUNT()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DCOUNTA
|
||||||
|
*
|
||||||
|
* Counts the nonblank cells in a column of a list or database that match conditions that you specify.
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* DCOUNTA(database,[field],criteria)
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @category Database Functions
|
||||||
|
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||||
|
* A database is a list of related data in which rows of related
|
||||||
|
* information are records, and columns of data are fields. The
|
||||||
|
* first row of the list contains labels for each column.
|
||||||
|
* @param string|integer $field Indicates which column is used in the function. Enter the
|
||||||
|
* column label enclosed between double quotation marks, such as
|
||||||
|
* "Age" or "Yield," or a number (without quotation marks) that
|
||||||
|
* represents the position of the column within the list: 1 for
|
||||||
|
* the first column, 2 for the second column, and so on.
|
||||||
|
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
||||||
|
* You can use any range for the criteria argument, as long as it
|
||||||
|
* includes at least one column label and at least one cell below
|
||||||
|
* the column label in which you specify a condition for the
|
||||||
|
* column.
|
||||||
|
* @return integer
|
||||||
|
*
|
||||||
|
* @TODO The field argument is optional. If field is omitted, DCOUNTA counts all records in the
|
||||||
|
* database that match the criteria.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function DCOUNTA($database,$field,$criteria) {
|
||||||
|
$field = self::__fieldExtract($database,$field);
|
||||||
|
if (is_null($field)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// reduce the database to a set of rows that match all the criteria
|
||||||
|
$database = self::__filter($database,$criteria);
|
||||||
|
// extract an array of values for the requested column
|
||||||
|
$colData = array();
|
||||||
|
foreach($database as $row) {
|
||||||
|
$colData[] = $row[$field];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return
|
||||||
|
return PHPExcel_Calculation_Statistical::COUNTA($colData);
|
||||||
|
} // function DCOUNTA()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DGET
|
||||||
|
*
|
||||||
|
* Extracts a single value from a column of a list or database that matches conditions that you
|
||||||
|
* specify.
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* DGET(database,field,criteria)
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @category Database Functions
|
||||||
|
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||||
|
* A database is a list of related data in which rows of related
|
||||||
|
* information are records, and columns of data are fields. The
|
||||||
|
* first row of the list contains labels for each column.
|
||||||
|
* @param string|integer $field Indicates which column is used in the function. Enter the
|
||||||
|
* column label enclosed between double quotation marks, such as
|
||||||
|
* "Age" or "Yield," or a number (without quotation marks) that
|
||||||
|
* represents the position of the column within the list: 1 for
|
||||||
|
* the first column, 2 for the second column, and so on.
|
||||||
|
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
||||||
|
* You can use any range for the criteria argument, as long as it
|
||||||
|
* includes at least one column label and at least one cell below
|
||||||
|
* the column label in which you specify a condition for the
|
||||||
|
* column.
|
||||||
|
* @return mixed
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function DGET($database,$field,$criteria) {
|
||||||
|
$field = self::__fieldExtract($database,$field);
|
||||||
|
if (is_null($field)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// reduce the database to a set of rows that match all the criteria
|
||||||
|
$database = self::__filter($database,$criteria);
|
||||||
|
// extract an array of values for the requested column
|
||||||
|
$colData = array();
|
||||||
|
foreach($database as $row) {
|
||||||
|
$colData[] = $row[$field];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return
|
||||||
|
if (count($colData) > 1) {
|
||||||
|
return PHPExcel_Calculation_Functions::NaN();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $colData[0];
|
||||||
|
} // function DGET()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DMAX
|
||||||
|
*
|
||||||
|
* Returns the largest number in a column of a list or database that matches conditions you that
|
||||||
|
* specify.
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* DMAX(database,field,criteria)
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @category Database Functions
|
||||||
|
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||||
|
* A database is a list of related data in which rows of related
|
||||||
|
* information are records, and columns of data are fields. The
|
||||||
|
* first row of the list contains labels for each column.
|
||||||
|
* @param string|integer $field Indicates which column is used in the function. Enter the
|
||||||
|
* column label enclosed between double quotation marks, such as
|
||||||
|
* "Age" or "Yield," or a number (without quotation marks) that
|
||||||
|
* represents the position of the column within the list: 1 for
|
||||||
|
* the first column, 2 for the second column, and so on.
|
||||||
|
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
||||||
|
* You can use any range for the criteria argument, as long as it
|
||||||
|
* includes at least one column label and at least one cell below
|
||||||
|
* the column label in which you specify a condition for the
|
||||||
|
* column.
|
||||||
|
* @return float
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function DMAX($database,$field,$criteria) {
|
||||||
|
$field = self::__fieldExtract($database,$field);
|
||||||
|
if (is_null($field)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// reduce the database to a set of rows that match all the criteria
|
||||||
|
$database = self::__filter($database,$criteria);
|
||||||
|
// extract an array of values for the requested column
|
||||||
|
$colData = array();
|
||||||
|
foreach($database as $row) {
|
||||||
|
$colData[] = $row[$field];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return
|
||||||
|
return PHPExcel_Calculation_Statistical::MAX($colData);
|
||||||
|
} // function DMAX()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DMIN
|
||||||
|
*
|
||||||
|
* Returns the smallest number in a column of a list or database that matches conditions you that
|
||||||
|
* specify.
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* DMIN(database,field,criteria)
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @category Database Functions
|
||||||
|
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||||
|
* A database is a list of related data in which rows of related
|
||||||
|
* information are records, and columns of data are fields. The
|
||||||
|
* first row of the list contains labels for each column.
|
||||||
|
* @param string|integer $field Indicates which column is used in the function. Enter the
|
||||||
|
* column label enclosed between double quotation marks, such as
|
||||||
|
* "Age" or "Yield," or a number (without quotation marks) that
|
||||||
|
* represents the position of the column within the list: 1 for
|
||||||
|
* the first column, 2 for the second column, and so on.
|
||||||
|
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
||||||
|
* You can use any range for the criteria argument, as long as it
|
||||||
|
* includes at least one column label and at least one cell below
|
||||||
|
* the column label in which you specify a condition for the
|
||||||
|
* column.
|
||||||
|
* @return float
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function DMIN($database,$field,$criteria) {
|
||||||
|
$field = self::__fieldExtract($database,$field);
|
||||||
|
if (is_null($field)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// reduce the database to a set of rows that match all the criteria
|
||||||
|
$database = self::__filter($database,$criteria);
|
||||||
|
// extract an array of values for the requested column
|
||||||
|
$colData = array();
|
||||||
|
foreach($database as $row) {
|
||||||
|
$colData[] = $row[$field];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return
|
||||||
|
return PHPExcel_Calculation_Statistical::MIN($colData);
|
||||||
|
} // function DMIN()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DPRODUCT
|
||||||
|
*
|
||||||
|
* Multiplies the values in a column of a list or database that match conditions that you specify.
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* DPRODUCT(database,field,criteria)
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @category Database Functions
|
||||||
|
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||||
|
* A database is a list of related data in which rows of related
|
||||||
|
* information are records, and columns of data are fields. The
|
||||||
|
* first row of the list contains labels for each column.
|
||||||
|
* @param string|integer $field Indicates which column is used in the function. Enter the
|
||||||
|
* column label enclosed between double quotation marks, such as
|
||||||
|
* "Age" or "Yield," or a number (without quotation marks) that
|
||||||
|
* represents the position of the column within the list: 1 for
|
||||||
|
* the first column, 2 for the second column, and so on.
|
||||||
|
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
||||||
|
* You can use any range for the criteria argument, as long as it
|
||||||
|
* includes at least one column label and at least one cell below
|
||||||
|
* the column label in which you specify a condition for the
|
||||||
|
* column.
|
||||||
|
* @return float
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function DPRODUCT($database,$field,$criteria) {
|
||||||
|
$field = self::__fieldExtract($database,$field);
|
||||||
|
if (is_null($field)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// reduce the database to a set of rows that match all the criteria
|
||||||
|
$database = self::__filter($database,$criteria);
|
||||||
|
// extract an array of values for the requested column
|
||||||
|
$colData = array();
|
||||||
|
foreach($database as $row) {
|
||||||
|
$colData[] = $row[$field];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return
|
||||||
|
return PHPExcel_Calculation_MathTrig::PRODUCT($colData);
|
||||||
|
} // function DPRODUCT()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DSTDEV
|
||||||
|
*
|
||||||
|
* Estimates the standard deviation of a population based on a sample by using the numbers in a
|
||||||
|
* column of a list or database that match conditions that you specify.
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* DSTDEV(database,field,criteria)
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @category Database Functions
|
||||||
|
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||||
|
* A database is a list of related data in which rows of related
|
||||||
|
* information are records, and columns of data are fields. The
|
||||||
|
* first row of the list contains labels for each column.
|
||||||
|
* @param string|integer $field Indicates which column is used in the function. Enter the
|
||||||
|
* column label enclosed between double quotation marks, such as
|
||||||
|
* "Age" or "Yield," or a number (without quotation marks) that
|
||||||
|
* represents the position of the column within the list: 1 for
|
||||||
|
* the first column, 2 for the second column, and so on.
|
||||||
|
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
||||||
|
* You can use any range for the criteria argument, as long as it
|
||||||
|
* includes at least one column label and at least one cell below
|
||||||
|
* the column label in which you specify a condition for the
|
||||||
|
* column.
|
||||||
|
* @return float
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function DSTDEV($database,$field,$criteria) {
|
||||||
|
$field = self::__fieldExtract($database,$field);
|
||||||
|
if (is_null($field)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// reduce the database to a set of rows that match all the criteria
|
||||||
|
$database = self::__filter($database,$criteria);
|
||||||
|
// extract an array of values for the requested column
|
||||||
|
$colData = array();
|
||||||
|
foreach($database as $row) {
|
||||||
|
$colData[] = $row[$field];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return
|
||||||
|
return PHPExcel_Calculation_Statistical::STDEV($colData);
|
||||||
|
} // function DSTDEV()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DSTDEVP
|
||||||
|
*
|
||||||
|
* Calculates the standard deviation of a population based on the entire population by using the
|
||||||
|
* numbers in a column of a list or database that match conditions that you specify.
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* DSTDEVP(database,field,criteria)
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @category Database Functions
|
||||||
|
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||||
|
* A database is a list of related data in which rows of related
|
||||||
|
* information are records, and columns of data are fields. The
|
||||||
|
* first row of the list contains labels for each column.
|
||||||
|
* @param string|integer $field Indicates which column is used in the function. Enter the
|
||||||
|
* column label enclosed between double quotation marks, such as
|
||||||
|
* "Age" or "Yield," or a number (without quotation marks) that
|
||||||
|
* represents the position of the column within the list: 1 for
|
||||||
|
* the first column, 2 for the second column, and so on.
|
||||||
|
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
||||||
|
* You can use any range for the criteria argument, as long as it
|
||||||
|
* includes at least one column label and at least one cell below
|
||||||
|
* the column label in which you specify a condition for the
|
||||||
|
* column.
|
||||||
|
* @return float
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function DSTDEVP($database,$field,$criteria) {
|
||||||
|
$field = self::__fieldExtract($database,$field);
|
||||||
|
if (is_null($field)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// reduce the database to a set of rows that match all the criteria
|
||||||
|
$database = self::__filter($database,$criteria);
|
||||||
|
// extract an array of values for the requested column
|
||||||
|
$colData = array();
|
||||||
|
foreach($database as $row) {
|
||||||
|
$colData[] = $row[$field];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return
|
||||||
|
return PHPExcel_Calculation_Statistical::STDEVP($colData);
|
||||||
|
} // function DSTDEVP()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DSUM
|
||||||
|
*
|
||||||
|
* Adds the numbers in a column of a list or database that match conditions that you specify.
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* DSUM(database,field,criteria)
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @category Database Functions
|
||||||
|
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||||
|
* A database is a list of related data in which rows of related
|
||||||
|
* information are records, and columns of data are fields. The
|
||||||
|
* first row of the list contains labels for each column.
|
||||||
|
* @param string|integer $field Indicates which column is used in the function. Enter the
|
||||||
|
* column label enclosed between double quotation marks, such as
|
||||||
|
* "Age" or "Yield," or a number (without quotation marks) that
|
||||||
|
* represents the position of the column within the list: 1 for
|
||||||
|
* the first column, 2 for the second column, and so on.
|
||||||
|
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
||||||
|
* You can use any range for the criteria argument, as long as it
|
||||||
|
* includes at least one column label and at least one cell below
|
||||||
|
* the column label in which you specify a condition for the
|
||||||
|
* column.
|
||||||
|
* @return float
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function DSUM($database,$field,$criteria) {
|
||||||
|
$field = self::__fieldExtract($database,$field);
|
||||||
|
if (is_null($field)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// reduce the database to a set of rows that match all the criteria
|
||||||
|
$database = self::__filter($database,$criteria);
|
||||||
|
// extract an array of values for the requested column
|
||||||
|
$colData = array();
|
||||||
|
foreach($database as $row) {
|
||||||
|
$colData[] = $row[$field];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return
|
||||||
|
return PHPExcel_Calculation_MathTrig::SUM($colData);
|
||||||
|
} // function DSUM()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DVAR
|
||||||
|
*
|
||||||
|
* Estimates the variance of a population based on a sample by using the numbers in a column
|
||||||
|
* of a list or database that match conditions that you specify.
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* DVAR(database,field,criteria)
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @category Database Functions
|
||||||
|
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||||
|
* A database is a list of related data in which rows of related
|
||||||
|
* information are records, and columns of data are fields. The
|
||||||
|
* first row of the list contains labels for each column.
|
||||||
|
* @param string|integer $field Indicates which column is used in the function. Enter the
|
||||||
|
* column label enclosed between double quotation marks, such as
|
||||||
|
* "Age" or "Yield," or a number (without quotation marks) that
|
||||||
|
* represents the position of the column within the list: 1 for
|
||||||
|
* the first column, 2 for the second column, and so on.
|
||||||
|
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
||||||
|
* You can use any range for the criteria argument, as long as it
|
||||||
|
* includes at least one column label and at least one cell below
|
||||||
|
* the column label in which you specify a condition for the
|
||||||
|
* column.
|
||||||
|
* @return float
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function DVAR($database,$field,$criteria) {
|
||||||
|
$field = self::__fieldExtract($database,$field);
|
||||||
|
if (is_null($field)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// reduce the database to a set of rows that match all the criteria
|
||||||
|
$database = self::__filter($database,$criteria);
|
||||||
|
// extract an array of values for the requested column
|
||||||
|
$colData = array();
|
||||||
|
foreach($database as $row) {
|
||||||
|
$colData[] = $row[$field];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return
|
||||||
|
return PHPExcel_Calculation_Statistical::VARFunc($colData);
|
||||||
|
} // function DVAR()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DVARP
|
||||||
|
*
|
||||||
|
* Calculates the variance of a population based on the entire population by using the numbers
|
||||||
|
* in a column of a list or database that match conditions that you specify.
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* DVARP(database,field,criteria)
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @category Database Functions
|
||||||
|
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||||
|
* A database is a list of related data in which rows of related
|
||||||
|
* information are records, and columns of data are fields. The
|
||||||
|
* first row of the list contains labels for each column.
|
||||||
|
* @param string|integer $field Indicates which column is used in the function. Enter the
|
||||||
|
* column label enclosed between double quotation marks, such as
|
||||||
|
* "Age" or "Yield," or a number (without quotation marks) that
|
||||||
|
* represents the position of the column within the list: 1 for
|
||||||
|
* the first column, 2 for the second column, and so on.
|
||||||
|
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
||||||
|
* You can use any range for the criteria argument, as long as it
|
||||||
|
* includes at least one column label and at least one cell below
|
||||||
|
* the column label in which you specify a condition for the
|
||||||
|
* column.
|
||||||
|
* @return float
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function DVARP($database,$field,$criteria) {
|
||||||
|
$field = self::__fieldExtract($database,$field);
|
||||||
|
if (is_null($field)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// reduce the database to a set of rows that match all the criteria
|
||||||
|
$database = self::__filter($database,$criteria);
|
||||||
|
// extract an array of values for the requested column
|
||||||
|
$colData = array();
|
||||||
|
foreach($database as $row) {
|
||||||
|
$colData[] = $row[$field];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return
|
||||||
|
return PHPExcel_Calculation_Statistical::VARP($colData);
|
||||||
|
} // function DVARP()
|
||||||
|
|
||||||
|
|
||||||
|
} // class PHPExcel_Calculation_Database
|
1475
admin/helpers/PHPExcel/Calculation/DateTime.php
Normal file
2505
admin/helpers/PHPExcel/Calculation/Engineering.php
Normal file
52
admin/helpers/PHPExcel/Calculation/Exception.php
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Calculation
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Calculation_Exception
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Calculation
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_Calculation_Exception extends PHPExcel_Exception {
|
||||||
|
/**
|
||||||
|
* Error handler callback
|
||||||
|
*
|
||||||
|
* @param mixed $code
|
||||||
|
* @param mixed $string
|
||||||
|
* @param mixed $file
|
||||||
|
* @param mixed $line
|
||||||
|
* @param mixed $context
|
||||||
|
*/
|
||||||
|
public static function errorHandlerCallback($code, $string, $file, $line, $context) {
|
||||||
|
$e = new self($string, $code);
|
||||||
|
$e->line = $line;
|
||||||
|
$e->file = $file;
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
49
admin/helpers/PHPExcel/Calculation/ExceptionHandler.php
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Calculation
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Calculation_ExceptionHandler
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Calculation
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_Calculation_ExceptionHandler {
|
||||||
|
/**
|
||||||
|
* Register errorhandler
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
set_error_handler(array('PHPExcel_Calculation_Exception', 'errorHandlerCallback'), E_ALL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregister errorhandler
|
||||||
|
*/
|
||||||
|
public function __destruct() {
|
||||||
|
restore_error_handler();
|
||||||
|
}
|
||||||
|
}
|
2292
admin/helpers/PHPExcel/Calculation/Financial.php
Normal file
614
admin/helpers/PHPExcel/Calculation/FormulaParser.php
Normal file
@ -0,0 +1,614 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Calculation
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
PARTLY BASED ON:
|
||||||
|
Copyright (c) 2007 E. W. Bachtal, Inc.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
||||||
|
and associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||||
|
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial
|
||||||
|
portions of the Software.
|
||||||
|
|
||||||
|
The software is provided "as is", without warranty of any kind, express or implied, including but not
|
||||||
|
limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In
|
||||||
|
no event shall the authors or copyright holders be liable for any claim, damages or other liability,
|
||||||
|
whether in an action of contract, tort or otherwise, arising from, out of or in connection with the
|
||||||
|
software or the use or other dealings in the software.
|
||||||
|
|
||||||
|
http://ewbi.blogs.com/develops/2007/03/excel_formula_p.html
|
||||||
|
http://ewbi.blogs.com/develops/2004/12/excel_formula_p.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Calculation_FormulaParser
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Calculation
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_Calculation_FormulaParser {
|
||||||
|
/* Character constants */
|
||||||
|
const QUOTE_DOUBLE = '"';
|
||||||
|
const QUOTE_SINGLE = '\'';
|
||||||
|
const BRACKET_CLOSE = ']';
|
||||||
|
const BRACKET_OPEN = '[';
|
||||||
|
const BRACE_OPEN = '{';
|
||||||
|
const BRACE_CLOSE = '}';
|
||||||
|
const PAREN_OPEN = '(';
|
||||||
|
const PAREN_CLOSE = ')';
|
||||||
|
const SEMICOLON = ';';
|
||||||
|
const WHITESPACE = ' ';
|
||||||
|
const COMMA = ',';
|
||||||
|
const ERROR_START = '#';
|
||||||
|
|
||||||
|
const OPERATORS_SN = "+-";
|
||||||
|
const OPERATORS_INFIX = "+-*/^&=><";
|
||||||
|
const OPERATORS_POSTFIX = "%";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formula
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_formula;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tokens
|
||||||
|
*
|
||||||
|
* @var PHPExcel_Calculation_FormulaToken[]
|
||||||
|
*/
|
||||||
|
private $_tokens = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new PHPExcel_Calculation_FormulaParser
|
||||||
|
*
|
||||||
|
* @param string $pFormula Formula to parse
|
||||||
|
* @throws PHPExcel_Calculation_Exception
|
||||||
|
*/
|
||||||
|
public function __construct($pFormula = '')
|
||||||
|
{
|
||||||
|
// Check parameters
|
||||||
|
if (is_null($pFormula)) {
|
||||||
|
throw new PHPExcel_Calculation_Exception("Invalid parameter passed: formula");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialise values
|
||||||
|
$this->_formula = trim($pFormula);
|
||||||
|
// Parse!
|
||||||
|
$this->_parseToTokens();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Formula
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getFormula() {
|
||||||
|
return $this->_formula;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Token
|
||||||
|
*
|
||||||
|
* @param int $pId Token id
|
||||||
|
* @return string
|
||||||
|
* @throws PHPExcel_Calculation_Exception
|
||||||
|
*/
|
||||||
|
public function getToken($pId = 0) {
|
||||||
|
if (isset($this->_tokens[$pId])) {
|
||||||
|
return $this->_tokens[$pId];
|
||||||
|
} else {
|
||||||
|
throw new PHPExcel_Calculation_Exception("Token with id $pId does not exist.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Token count
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getTokenCount() {
|
||||||
|
return count($this->_tokens);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Tokens
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Calculation_FormulaToken[]
|
||||||
|
*/
|
||||||
|
public function getTokens() {
|
||||||
|
return $this->_tokens;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse to tokens
|
||||||
|
*/
|
||||||
|
private function _parseToTokens() {
|
||||||
|
// No attempt is made to verify formulas; assumes formulas are derived from Excel, where
|
||||||
|
// they can only exist if valid; stack overflows/underflows sunk as nulls without exceptions.
|
||||||
|
|
||||||
|
// Check if the formula has a valid starting =
|
||||||
|
$formulaLength = strlen($this->_formula);
|
||||||
|
if ($formulaLength < 2 || $this->_formula{0} != '=') return;
|
||||||
|
|
||||||
|
// Helper variables
|
||||||
|
$tokens1 = $tokens2 = $stack = array();
|
||||||
|
$inString = $inPath = $inRange = $inError = false;
|
||||||
|
$token = $previousToken = $nextToken = null;
|
||||||
|
|
||||||
|
$index = 1;
|
||||||
|
$value = '';
|
||||||
|
|
||||||
|
$ERRORS = array("#NULL!", "#DIV/0!", "#VALUE!", "#REF!", "#NAME?", "#NUM!", "#N/A");
|
||||||
|
$COMPARATORS_MULTI = array(">=", "<=", "<>");
|
||||||
|
|
||||||
|
while ($index < $formulaLength) {
|
||||||
|
// state-dependent character evaluation (order is important)
|
||||||
|
|
||||||
|
// double-quoted strings
|
||||||
|
// embeds are doubled
|
||||||
|
// end marks token
|
||||||
|
if ($inString) {
|
||||||
|
if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE) {
|
||||||
|
if ((($index + 2) <= $formulaLength) && ($this->_formula{$index + 1} == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE)) {
|
||||||
|
$value .= PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE;
|
||||||
|
++$index;
|
||||||
|
} else {
|
||||||
|
$inString = false;
|
||||||
|
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_TEXT);
|
||||||
|
$value = "";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$value .= $this->_formula{$index};
|
||||||
|
}
|
||||||
|
++$index;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// single-quoted strings (links)
|
||||||
|
// embeds are double
|
||||||
|
// end does not mark a token
|
||||||
|
if ($inPath) {
|
||||||
|
if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE) {
|
||||||
|
if ((($index + 2) <= $formulaLength) && ($this->_formula{$index + 1} == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE)) {
|
||||||
|
$value .= PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE;
|
||||||
|
++$index;
|
||||||
|
} else {
|
||||||
|
$inPath = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$value .= $this->_formula{$index};
|
||||||
|
}
|
||||||
|
++$index;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// bracked strings (R1C1 range index or linked workbook name)
|
||||||
|
// no embeds (changed to "()" by Excel)
|
||||||
|
// end does not mark a token
|
||||||
|
if ($inRange) {
|
||||||
|
if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::BRACKET_CLOSE) {
|
||||||
|
$inRange = false;
|
||||||
|
}
|
||||||
|
$value .= $this->_formula{$index};
|
||||||
|
++$index;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// error values
|
||||||
|
// end marks a token, determined from absolute list of values
|
||||||
|
if ($inError) {
|
||||||
|
$value .= $this->_formula{$index};
|
||||||
|
++$index;
|
||||||
|
if (in_array($value, $ERRORS)) {
|
||||||
|
$inError = false;
|
||||||
|
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_ERROR);
|
||||||
|
$value = "";
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// scientific notation check
|
||||||
|
if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_SN, $this->_formula{$index}) !== false) {
|
||||||
|
if (strlen($value) > 1) {
|
||||||
|
if (preg_match("/^[1-9]{1}(\.[0-9]+)?E{1}$/", $this->_formula{$index}) != 0) {
|
||||||
|
$value .= $this->_formula{$index};
|
||||||
|
++$index;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// independent character evaluation (order not important)
|
||||||
|
|
||||||
|
// establish state-dependent character evaluations
|
||||||
|
if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE) {
|
||||||
|
if (strlen($value > 0)) { // unexpected
|
||||||
|
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
|
||||||
|
$value = "";
|
||||||
|
}
|
||||||
|
$inString = true;
|
||||||
|
++$index;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE) {
|
||||||
|
if (strlen($value) > 0) { // unexpected
|
||||||
|
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
|
||||||
|
$value = "";
|
||||||
|
}
|
||||||
|
$inPath = true;
|
||||||
|
++$index;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::BRACKET_OPEN) {
|
||||||
|
$inRange = true;
|
||||||
|
$value .= PHPExcel_Calculation_FormulaParser::BRACKET_OPEN;
|
||||||
|
++$index;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::ERROR_START) {
|
||||||
|
if (strlen($value) > 0) { // unexpected
|
||||||
|
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
|
||||||
|
$value = "";
|
||||||
|
}
|
||||||
|
$inError = true;
|
||||||
|
$value .= PHPExcel_Calculation_FormulaParser::ERROR_START;
|
||||||
|
++$index;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// mark start and end of arrays and array rows
|
||||||
|
if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::BRACE_OPEN) {
|
||||||
|
if (strlen($value) > 0) { // unexpected
|
||||||
|
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
|
||||||
|
$value = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
$tmp = new PHPExcel_Calculation_FormulaToken("ARRAY", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START);
|
||||||
|
$tokens1[] = $tmp;
|
||||||
|
$stack[] = clone $tmp;
|
||||||
|
|
||||||
|
$tmp = new PHPExcel_Calculation_FormulaToken("ARRAYROW", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START);
|
||||||
|
$tokens1[] = $tmp;
|
||||||
|
$stack[] = clone $tmp;
|
||||||
|
|
||||||
|
++$index;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::SEMICOLON) {
|
||||||
|
if (strlen($value) > 0) {
|
||||||
|
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
|
||||||
|
$value = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
$tmp = array_pop($stack);
|
||||||
|
$tmp->setValue("");
|
||||||
|
$tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP);
|
||||||
|
$tokens1[] = $tmp;
|
||||||
|
|
||||||
|
$tmp = new PHPExcel_Calculation_FormulaToken(",", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_ARGUMENT);
|
||||||
|
$tokens1[] = $tmp;
|
||||||
|
|
||||||
|
$tmp = new PHPExcel_Calculation_FormulaToken("ARRAYROW", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START);
|
||||||
|
$tokens1[] = $tmp;
|
||||||
|
$stack[] = clone $tmp;
|
||||||
|
|
||||||
|
++$index;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::BRACE_CLOSE) {
|
||||||
|
if (strlen($value) > 0) {
|
||||||
|
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
|
||||||
|
$value = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
$tmp = array_pop($stack);
|
||||||
|
$tmp->setValue("");
|
||||||
|
$tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP);
|
||||||
|
$tokens1[] = $tmp;
|
||||||
|
|
||||||
|
$tmp = array_pop($stack);
|
||||||
|
$tmp->setValue("");
|
||||||
|
$tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP);
|
||||||
|
$tokens1[] = $tmp;
|
||||||
|
|
||||||
|
++$index;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// trim white-space
|
||||||
|
if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::WHITESPACE) {
|
||||||
|
if (strlen($value) > 0) {
|
||||||
|
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
|
||||||
|
$value = "";
|
||||||
|
}
|
||||||
|
$tokens1[] = new PHPExcel_Calculation_FormulaToken("", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_WHITESPACE);
|
||||||
|
++$index;
|
||||||
|
while (($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::WHITESPACE) && ($index < $formulaLength)) {
|
||||||
|
++$index;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// multi-character comparators
|
||||||
|
if (($index + 2) <= $formulaLength) {
|
||||||
|
if (in_array(substr($this->_formula, $index, 2), $COMPARATORS_MULTI)) {
|
||||||
|
if (strlen($value) > 0) {
|
||||||
|
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
|
||||||
|
$value = "";
|
||||||
|
}
|
||||||
|
$tokens1[] = new PHPExcel_Calculation_FormulaToken(substr($this->_formula, $index, 2), PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_LOGICAL);
|
||||||
|
$index += 2;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// standard infix operators
|
||||||
|
if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_INFIX, $this->_formula{$index}) !== false) {
|
||||||
|
if (strlen($value) > 0) {
|
||||||
|
$tokens1[] =new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
|
||||||
|
$value = "";
|
||||||
|
}
|
||||||
|
$tokens1[] = new PHPExcel_Calculation_FormulaToken($this->_formula{$index}, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX);
|
||||||
|
++$index;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// standard postfix operators (only one)
|
||||||
|
if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_POSTFIX, $this->_formula{$index}) !== false) {
|
||||||
|
if (strlen($value) > 0) {
|
||||||
|
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
|
||||||
|
$value = "";
|
||||||
|
}
|
||||||
|
$tokens1[] = new PHPExcel_Calculation_FormulaToken($this->_formula{$index}, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX);
|
||||||
|
++$index;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// start subexpression or function
|
||||||
|
if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::PAREN_OPEN) {
|
||||||
|
if (strlen($value) > 0) {
|
||||||
|
$tmp = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START);
|
||||||
|
$tokens1[] = $tmp;
|
||||||
|
$stack[] = clone $tmp;
|
||||||
|
$value = "";
|
||||||
|
} else {
|
||||||
|
$tmp = new PHPExcel_Calculation_FormulaToken("", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START);
|
||||||
|
$tokens1[] = $tmp;
|
||||||
|
$stack[] = clone $tmp;
|
||||||
|
}
|
||||||
|
++$index;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// function, subexpression, or array parameters, or operand unions
|
||||||
|
if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::COMMA) {
|
||||||
|
if (strlen($value) > 0) {
|
||||||
|
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
|
||||||
|
$value = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
$tmp = array_pop($stack);
|
||||||
|
$tmp->setValue("");
|
||||||
|
$tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP);
|
||||||
|
$stack[] = $tmp;
|
||||||
|
|
||||||
|
if ($tmp->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) {
|
||||||
|
$tokens1[] = new PHPExcel_Calculation_FormulaToken(",", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_UNION);
|
||||||
|
} else {
|
||||||
|
$tokens1[] = new PHPExcel_Calculation_FormulaToken(",", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_ARGUMENT);
|
||||||
|
}
|
||||||
|
++$index;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// stop subexpression
|
||||||
|
if ($this->_formula{$index} == PHPExcel_Calculation_FormulaParser::PAREN_CLOSE) {
|
||||||
|
if (strlen($value) > 0) {
|
||||||
|
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
|
||||||
|
$value = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
$tmp = array_pop($stack);
|
||||||
|
$tmp->setValue("");
|
||||||
|
$tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP);
|
||||||
|
$tokens1[] = $tmp;
|
||||||
|
|
||||||
|
++$index;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// token accumulation
|
||||||
|
$value .= $this->_formula{$index};
|
||||||
|
++$index;
|
||||||
|
}
|
||||||
|
|
||||||
|
// dump remaining accumulation
|
||||||
|
if (strlen($value) > 0) {
|
||||||
|
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
|
||||||
|
}
|
||||||
|
|
||||||
|
// move tokenList to new set, excluding unnecessary white-space tokens and converting necessary ones to intersections
|
||||||
|
$tokenCount = count($tokens1);
|
||||||
|
for ($i = 0; $i < $tokenCount; ++$i) {
|
||||||
|
$token = $tokens1[$i];
|
||||||
|
if (isset($tokens1[$i - 1])) {
|
||||||
|
$previousToken = $tokens1[$i - 1];
|
||||||
|
} else {
|
||||||
|
$previousToken = null;
|
||||||
|
}
|
||||||
|
if (isset($tokens1[$i + 1])) {
|
||||||
|
$nextToken = $tokens1[$i + 1];
|
||||||
|
} else {
|
||||||
|
$nextToken = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_null($token)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($token->getTokenType() != PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_WHITESPACE) {
|
||||||
|
$tokens2[] = $token;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_null($previousToken)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! (
|
||||||
|
(($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) && ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) ||
|
||||||
|
(($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) ||
|
||||||
|
($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND)
|
||||||
|
) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_null($nextToken)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! (
|
||||||
|
(($nextToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) && ($nextToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START)) ||
|
||||||
|
(($nextToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($nextToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START)) ||
|
||||||
|
($nextToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND)
|
||||||
|
) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$tokens2[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_INTERSECTION);
|
||||||
|
}
|
||||||
|
|
||||||
|
// move tokens to final list, switching infix "-" operators to prefix when appropriate, switching infix "+" operators
|
||||||
|
// to noop when appropriate, identifying operand and infix-operator subtypes, and pulling "@" from function names
|
||||||
|
$this->_tokens = array();
|
||||||
|
|
||||||
|
$tokenCount = count($tokens2);
|
||||||
|
for ($i = 0; $i < $tokenCount; ++$i) {
|
||||||
|
$token = $tokens2[$i];
|
||||||
|
if (isset($tokens2[$i - 1])) {
|
||||||
|
$previousToken = $tokens2[$i - 1];
|
||||||
|
} else {
|
||||||
|
$previousToken = null;
|
||||||
|
}
|
||||||
|
if (isset($tokens2[$i + 1])) {
|
||||||
|
$nextToken = $tokens2[$i + 1];
|
||||||
|
} else {
|
||||||
|
$nextToken = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_null($token)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX && $token->getValue() == "-") {
|
||||||
|
if ($i == 0) {
|
||||||
|
$token->setTokenType(PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPREFIX);
|
||||||
|
} else if (
|
||||||
|
(($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) && ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) ||
|
||||||
|
(($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) ||
|
||||||
|
($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX) ||
|
||||||
|
($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND)
|
||||||
|
) {
|
||||||
|
$token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_MATH);
|
||||||
|
} else {
|
||||||
|
$token->setTokenType(PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPREFIX);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_tokens[] = $token;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX && $token->getValue() == "+") {
|
||||||
|
if ($i == 0) {
|
||||||
|
continue;
|
||||||
|
} else if (
|
||||||
|
(($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) && ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) ||
|
||||||
|
(($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) ||
|
||||||
|
($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX) ||
|
||||||
|
($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND)
|
||||||
|
) {
|
||||||
|
$token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_MATH);
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_tokens[] = $token;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX && $token->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) {
|
||||||
|
if (strpos("<>=", substr($token->getValue(), 0, 1)) !== false) {
|
||||||
|
$token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_LOGICAL);
|
||||||
|
} else if ($token->getValue() == "&") {
|
||||||
|
$token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_CONCATENATION);
|
||||||
|
} else {
|
||||||
|
$token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_MATH);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_tokens[] = $token;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND && $token->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) {
|
||||||
|
if (!is_numeric($token->getValue())) {
|
||||||
|
if (strtoupper($token->getValue()) == "TRUE" || strtoupper($token->getValue() == "FALSE")) {
|
||||||
|
$token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_LOGICAL);
|
||||||
|
} else {
|
||||||
|
$token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_RANGE);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NUMBER);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_tokens[] = $token;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) {
|
||||||
|
if (strlen($token->getValue() > 0)) {
|
||||||
|
if (substr($token->getValue(), 0, 1) == "@") {
|
||||||
|
$token->setValue(substr($token->getValue(), 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_tokens[] = $token;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
176
admin/helpers/PHPExcel/Calculation/FormulaToken.php
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Calculation
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
PARTLY BASED ON:
|
||||||
|
Copyright (c) 2007 E. W. Bachtal, Inc.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
||||||
|
and associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||||
|
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial
|
||||||
|
portions of the Software.
|
||||||
|
|
||||||
|
The software is provided "as is", without warranty of any kind, express or implied, including but not
|
||||||
|
limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In
|
||||||
|
no event shall the authors or copyright holders be liable for any claim, damages or other liability,
|
||||||
|
whether in an action of contract, tort or otherwise, arising from, out of or in connection with the
|
||||||
|
software or the use or other dealings in the software.
|
||||||
|
|
||||||
|
http://ewbi.blogs.com/develops/2007/03/excel_formula_p.html
|
||||||
|
http://ewbi.blogs.com/develops/2004/12/excel_formula_p.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Calculation_FormulaToken
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Calculation
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_Calculation_FormulaToken {
|
||||||
|
/* Token types */
|
||||||
|
const TOKEN_TYPE_NOOP = 'Noop';
|
||||||
|
const TOKEN_TYPE_OPERAND = 'Operand';
|
||||||
|
const TOKEN_TYPE_FUNCTION = 'Function';
|
||||||
|
const TOKEN_TYPE_SUBEXPRESSION = 'Subexpression';
|
||||||
|
const TOKEN_TYPE_ARGUMENT = 'Argument';
|
||||||
|
const TOKEN_TYPE_OPERATORPREFIX = 'OperatorPrefix';
|
||||||
|
const TOKEN_TYPE_OPERATORINFIX = 'OperatorInfix';
|
||||||
|
const TOKEN_TYPE_OPERATORPOSTFIX = 'OperatorPostfix';
|
||||||
|
const TOKEN_TYPE_WHITESPACE = 'Whitespace';
|
||||||
|
const TOKEN_TYPE_UNKNOWN = 'Unknown';
|
||||||
|
|
||||||
|
/* Token subtypes */
|
||||||
|
const TOKEN_SUBTYPE_NOTHING = 'Nothing';
|
||||||
|
const TOKEN_SUBTYPE_START = 'Start';
|
||||||
|
const TOKEN_SUBTYPE_STOP = 'Stop';
|
||||||
|
const TOKEN_SUBTYPE_TEXT = 'Text';
|
||||||
|
const TOKEN_SUBTYPE_NUMBER = 'Number';
|
||||||
|
const TOKEN_SUBTYPE_LOGICAL = 'Logical';
|
||||||
|
const TOKEN_SUBTYPE_ERROR = 'Error';
|
||||||
|
const TOKEN_SUBTYPE_RANGE = 'Range';
|
||||||
|
const TOKEN_SUBTYPE_MATH = 'Math';
|
||||||
|
const TOKEN_SUBTYPE_CONCATENATION = 'Concatenation';
|
||||||
|
const TOKEN_SUBTYPE_INTERSECTION = 'Intersection';
|
||||||
|
const TOKEN_SUBTYPE_UNION = 'Union';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Value
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Token Type (represented by TOKEN_TYPE_*)
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_tokenType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Token SubType (represented by TOKEN_SUBTYPE_*)
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_tokenSubType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new PHPExcel_Calculation_FormulaToken
|
||||||
|
*
|
||||||
|
* @param string $pValue
|
||||||
|
* @param string $pTokenType Token type (represented by TOKEN_TYPE_*)
|
||||||
|
* @param string $pTokenSubType Token Subtype (represented by TOKEN_SUBTYPE_*)
|
||||||
|
*/
|
||||||
|
public function __construct($pValue, $pTokenType = PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN, $pTokenSubType = PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING)
|
||||||
|
{
|
||||||
|
// Initialise values
|
||||||
|
$this->_value = $pValue;
|
||||||
|
$this->_tokenType = $pTokenType;
|
||||||
|
$this->_tokenSubType = $pTokenSubType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Value
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getValue() {
|
||||||
|
return $this->_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Value
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
*/
|
||||||
|
public function setValue($value) {
|
||||||
|
$this->_value = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Token Type (represented by TOKEN_TYPE_*)
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getTokenType() {
|
||||||
|
return $this->_tokenType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Token Type
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
*/
|
||||||
|
public function setTokenType($value = PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN) {
|
||||||
|
$this->_tokenType = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Token SubType (represented by TOKEN_SUBTYPE_*)
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getTokenSubType() {
|
||||||
|
return $this->_tokenSubType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Token SubType
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
*/
|
||||||
|
public function setTokenSubType($value = PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) {
|
||||||
|
$this->_tokenSubType = $value;
|
||||||
|
}
|
||||||
|
}
|
149
admin/helpers/PHPExcel/Calculation/Function.php
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Calculation
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Calculation_Function
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Calculation
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_Calculation_Function {
|
||||||
|
/* Function categories */
|
||||||
|
const CATEGORY_CUBE = 'Cube';
|
||||||
|
const CATEGORY_DATABASE = 'Database';
|
||||||
|
const CATEGORY_DATE_AND_TIME = 'Date and Time';
|
||||||
|
const CATEGORY_ENGINEERING = 'Engineering';
|
||||||
|
const CATEGORY_FINANCIAL = 'Financial';
|
||||||
|
const CATEGORY_INFORMATION = 'Information';
|
||||||
|
const CATEGORY_LOGICAL = 'Logical';
|
||||||
|
const CATEGORY_LOOKUP_AND_REFERENCE = 'Lookup and Reference';
|
||||||
|
const CATEGORY_MATH_AND_TRIG = 'Math and Trig';
|
||||||
|
const CATEGORY_STATISTICAL = 'Statistical';
|
||||||
|
const CATEGORY_TEXT_AND_DATA = 'Text and Data';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Category (represented by CATEGORY_*)
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_category;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Excel name
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_excelName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel name
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_phpExcelName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new PHPExcel_Calculation_Function
|
||||||
|
*
|
||||||
|
* @param string $pCategory Category (represented by CATEGORY_*)
|
||||||
|
* @param string $pExcelName Excel function name
|
||||||
|
* @param string $pPHPExcelName PHPExcel function mapping
|
||||||
|
* @throws PHPExcel_Calculation_Exception
|
||||||
|
*/
|
||||||
|
public function __construct($pCategory = NULL, $pExcelName = NULL, $pPHPExcelName = NULL)
|
||||||
|
{
|
||||||
|
if (($pCategory !== NULL) && ($pExcelName !== NULL) && ($pPHPExcelName !== NULL)) {
|
||||||
|
// Initialise values
|
||||||
|
$this->_category = $pCategory;
|
||||||
|
$this->_excelName = $pExcelName;
|
||||||
|
$this->_phpExcelName = $pPHPExcelName;
|
||||||
|
} else {
|
||||||
|
throw new PHPExcel_Calculation_Exception("Invalid parameters passed.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Category (represented by CATEGORY_*)
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getCategory() {
|
||||||
|
return $this->_category;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Category (represented by CATEGORY_*)
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
* @throws PHPExcel_Calculation_Exception
|
||||||
|
*/
|
||||||
|
public function setCategory($value = null) {
|
||||||
|
if (!is_null($value)) {
|
||||||
|
$this->_category = $value;
|
||||||
|
} else {
|
||||||
|
throw new PHPExcel_Calculation_Exception("Invalid parameter passed.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Excel name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getExcelName() {
|
||||||
|
return $this->_excelName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Excel name
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
*/
|
||||||
|
public function setExcelName($value) {
|
||||||
|
$this->_excelName = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get PHPExcel name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getPHPExcelName() {
|
||||||
|
return $this->_phpExcelName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set PHPExcel name
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
*/
|
||||||
|
public function setPHPExcelName($value) {
|
||||||
|
$this->_phpExcelName = $value;
|
||||||
|
}
|
||||||
|
}
|
725
admin/helpers/PHPExcel/Calculation/Functions.php
Normal file
@ -0,0 +1,725 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Calculation
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/** PHPExcel root directory */
|
||||||
|
if (!defined('PHPEXCEL_ROOT')) {
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||||
|
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** MAX_VALUE */
|
||||||
|
define('MAX_VALUE', 1.2e308);
|
||||||
|
|
||||||
|
/** 2 / PI */
|
||||||
|
define('M_2DIVPI', 0.63661977236758134307553505349006);
|
||||||
|
|
||||||
|
/** MAX_ITERATIONS */
|
||||||
|
define('MAX_ITERATIONS', 256);
|
||||||
|
|
||||||
|
/** PRECISION */
|
||||||
|
define('PRECISION', 8.88E-016);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Calculation_Functions
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Calculation
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_Calculation_Functions {
|
||||||
|
|
||||||
|
/** constants */
|
||||||
|
const COMPATIBILITY_EXCEL = 'Excel';
|
||||||
|
const COMPATIBILITY_GNUMERIC = 'Gnumeric';
|
||||||
|
const COMPATIBILITY_OPENOFFICE = 'OpenOfficeCalc';
|
||||||
|
|
||||||
|
const RETURNDATE_PHP_NUMERIC = 'P';
|
||||||
|
const RETURNDATE_PHP_OBJECT = 'O';
|
||||||
|
const RETURNDATE_EXCEL = 'E';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compatibility mode to use for error checking and responses
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected static $compatibilityMode = self::COMPATIBILITY_EXCEL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Data Type to use when returning date values
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected static $ReturnDateType = self::RETURNDATE_EXCEL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of error codes
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected static $_errorCodes = array( 'null' => '#NULL!',
|
||||||
|
'divisionbyzero' => '#DIV/0!',
|
||||||
|
'value' => '#VALUE!',
|
||||||
|
'reference' => '#REF!',
|
||||||
|
'name' => '#NAME?',
|
||||||
|
'num' => '#NUM!',
|
||||||
|
'na' => '#N/A',
|
||||||
|
'gettingdata' => '#GETTING_DATA'
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the Compatibility Mode
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @category Function Configuration
|
||||||
|
* @param string $compatibilityMode Compatibility Mode
|
||||||
|
* Permitted values are:
|
||||||
|
* PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL 'Excel'
|
||||||
|
* PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC 'Gnumeric'
|
||||||
|
* PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE 'OpenOfficeCalc'
|
||||||
|
* @return boolean (Success or Failure)
|
||||||
|
*/
|
||||||
|
public static function setCompatibilityMode($compatibilityMode) {
|
||||||
|
if (($compatibilityMode == self::COMPATIBILITY_EXCEL) ||
|
||||||
|
($compatibilityMode == self::COMPATIBILITY_GNUMERIC) ||
|
||||||
|
($compatibilityMode == self::COMPATIBILITY_OPENOFFICE)) {
|
||||||
|
self::$compatibilityMode = $compatibilityMode;
|
||||||
|
return True;
|
||||||
|
}
|
||||||
|
return False;
|
||||||
|
} // function setCompatibilityMode()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the current Compatibility Mode
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @category Function Configuration
|
||||||
|
* @return string Compatibility Mode
|
||||||
|
* Possible Return values are:
|
||||||
|
* PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL 'Excel'
|
||||||
|
* PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC 'Gnumeric'
|
||||||
|
* PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE 'OpenOfficeCalc'
|
||||||
|
*/
|
||||||
|
public static function getCompatibilityMode() {
|
||||||
|
return self::$compatibilityMode;
|
||||||
|
} // function getCompatibilityMode()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the Return Date Format used by functions that return a date/time (Excel, PHP Serialized Numeric or PHP Object)
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @category Function Configuration
|
||||||
|
* @param string $returnDateType Return Date Format
|
||||||
|
* Permitted values are:
|
||||||
|
* PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC 'P'
|
||||||
|
* PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT 'O'
|
||||||
|
* PHPExcel_Calculation_Functions::RETURNDATE_EXCEL 'E'
|
||||||
|
* @return boolean Success or failure
|
||||||
|
*/
|
||||||
|
public static function setReturnDateType($returnDateType) {
|
||||||
|
if (($returnDateType == self::RETURNDATE_PHP_NUMERIC) ||
|
||||||
|
($returnDateType == self::RETURNDATE_PHP_OBJECT) ||
|
||||||
|
($returnDateType == self::RETURNDATE_EXCEL)) {
|
||||||
|
self::$ReturnDateType = $returnDateType;
|
||||||
|
return True;
|
||||||
|
}
|
||||||
|
return False;
|
||||||
|
} // function setReturnDateType()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the current Return Date Format for functions that return a date/time (Excel, PHP Serialized Numeric or PHP Object)
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @category Function Configuration
|
||||||
|
* @return string Return Date Format
|
||||||
|
* Possible Return values are:
|
||||||
|
* PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC 'P'
|
||||||
|
* PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT 'O'
|
||||||
|
* PHPExcel_Calculation_Functions::RETURNDATE_EXCEL 'E'
|
||||||
|
*/
|
||||||
|
public static function getReturnDateType() {
|
||||||
|
return self::$ReturnDateType;
|
||||||
|
} // function getReturnDateType()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DUMMY
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @category Error Returns
|
||||||
|
* @return string #Not Yet Implemented
|
||||||
|
*/
|
||||||
|
public static function DUMMY() {
|
||||||
|
return '#Not Yet Implemented';
|
||||||
|
} // function DUMMY()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DIV0
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @category Error Returns
|
||||||
|
* @return string #Not Yet Implemented
|
||||||
|
*/
|
||||||
|
public static function DIV0() {
|
||||||
|
return self::$_errorCodes['divisionbyzero'];
|
||||||
|
} // function DIV0()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NA
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* =NA()
|
||||||
|
*
|
||||||
|
* Returns the error value #N/A
|
||||||
|
* #N/A is the error value that means "no value is available."
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @category Logical Functions
|
||||||
|
* @return string #N/A!
|
||||||
|
*/
|
||||||
|
public static function NA() {
|
||||||
|
return self::$_errorCodes['na'];
|
||||||
|
} // function NA()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NaN
|
||||||
|
*
|
||||||
|
* Returns the error value #NUM!
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @category Error Returns
|
||||||
|
* @return string #NUM!
|
||||||
|
*/
|
||||||
|
public static function NaN() {
|
||||||
|
return self::$_errorCodes['num'];
|
||||||
|
} // function NaN()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NAME
|
||||||
|
*
|
||||||
|
* Returns the error value #NAME?
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @category Error Returns
|
||||||
|
* @return string #NAME?
|
||||||
|
*/
|
||||||
|
public static function NAME() {
|
||||||
|
return self::$_errorCodes['name'];
|
||||||
|
} // function NAME()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* REF
|
||||||
|
*
|
||||||
|
* Returns the error value #REF!
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @category Error Returns
|
||||||
|
* @return string #REF!
|
||||||
|
*/
|
||||||
|
public static function REF() {
|
||||||
|
return self::$_errorCodes['reference'];
|
||||||
|
} // function REF()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NULL
|
||||||
|
*
|
||||||
|
* Returns the error value #NULL!
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @category Error Returns
|
||||||
|
* @return string #NULL!
|
||||||
|
*/
|
||||||
|
public static function NULL() {
|
||||||
|
return self::$_errorCodes['null'];
|
||||||
|
} // function NULL()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VALUE
|
||||||
|
*
|
||||||
|
* Returns the error value #VALUE!
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @category Error Returns
|
||||||
|
* @return string #VALUE!
|
||||||
|
*/
|
||||||
|
public static function VALUE() {
|
||||||
|
return self::$_errorCodes['value'];
|
||||||
|
} // function VALUE()
|
||||||
|
|
||||||
|
|
||||||
|
public static function isMatrixValue($idx) {
|
||||||
|
return ((substr_count($idx,'.') <= 1) || (preg_match('/\.[A-Z]/',$idx) > 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function isValue($idx) {
|
||||||
|
return (substr_count($idx,'.') == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function isCellValue($idx) {
|
||||||
|
return (substr_count($idx,'.') > 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function _ifCondition($condition) {
|
||||||
|
$condition = PHPExcel_Calculation_Functions::flattenSingleValue($condition);
|
||||||
|
if (!isset($condition{0}))
|
||||||
|
$condition = '=""';
|
||||||
|
if (!in_array($condition{0},array('>', '<', '='))) {
|
||||||
|
if (!is_numeric($condition)) { $condition = PHPExcel_Calculation::_wrapResult(strtoupper($condition)); }
|
||||||
|
return '='.$condition;
|
||||||
|
} else {
|
||||||
|
preg_match('/([<>=]+)(.*)/',$condition,$matches);
|
||||||
|
list(,$operator,$operand) = $matches;
|
||||||
|
|
||||||
|
if (!is_numeric($operand)) {
|
||||||
|
$operand = str_replace('"', '""', $operand);
|
||||||
|
$operand = PHPExcel_Calculation::_wrapResult(strtoupper($operand));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $operator.$operand;
|
||||||
|
}
|
||||||
|
} // function _ifCondition()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ERROR_TYPE
|
||||||
|
*
|
||||||
|
* @param mixed $value Value to check
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function ERROR_TYPE($value = '') {
|
||||||
|
$value = self::flattenSingleValue($value);
|
||||||
|
|
||||||
|
$i = 1;
|
||||||
|
foreach(self::$_errorCodes as $errorCode) {
|
||||||
|
if ($value === $errorCode) {
|
||||||
|
return $i;
|
||||||
|
}
|
||||||
|
++$i;
|
||||||
|
}
|
||||||
|
return self::NA();
|
||||||
|
} // function ERROR_TYPE()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IS_BLANK
|
||||||
|
*
|
||||||
|
* @param mixed $value Value to check
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function IS_BLANK($value = NULL) {
|
||||||
|
if (!is_null($value)) {
|
||||||
|
$value = self::flattenSingleValue($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return is_null($value);
|
||||||
|
} // function IS_BLANK()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IS_ERR
|
||||||
|
*
|
||||||
|
* @param mixed $value Value to check
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function IS_ERR($value = '') {
|
||||||
|
$value = self::flattenSingleValue($value);
|
||||||
|
|
||||||
|
return self::IS_ERROR($value) && (!self::IS_NA($value));
|
||||||
|
} // function IS_ERR()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IS_ERROR
|
||||||
|
*
|
||||||
|
* @param mixed $value Value to check
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function IS_ERROR($value = '') {
|
||||||
|
$value = self::flattenSingleValue($value);
|
||||||
|
|
||||||
|
if (!is_string($value))
|
||||||
|
return false;
|
||||||
|
return in_array($value, array_values(self::$_errorCodes));
|
||||||
|
} // function IS_ERROR()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IS_NA
|
||||||
|
*
|
||||||
|
* @param mixed $value Value to check
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function IS_NA($value = '') {
|
||||||
|
$value = self::flattenSingleValue($value);
|
||||||
|
|
||||||
|
return ($value === self::NA());
|
||||||
|
} // function IS_NA()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IS_EVEN
|
||||||
|
*
|
||||||
|
* @param mixed $value Value to check
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function IS_EVEN($value = NULL) {
|
||||||
|
$value = self::flattenSingleValue($value);
|
||||||
|
|
||||||
|
if ($value === NULL)
|
||||||
|
return self::NAME();
|
||||||
|
if ((is_bool($value)) || ((is_string($value)) && (!is_numeric($value))))
|
||||||
|
return self::VALUE();
|
||||||
|
return ($value % 2 == 0);
|
||||||
|
} // function IS_EVEN()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IS_ODD
|
||||||
|
*
|
||||||
|
* @param mixed $value Value to check
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function IS_ODD($value = NULL) {
|
||||||
|
$value = self::flattenSingleValue($value);
|
||||||
|
|
||||||
|
if ($value === NULL)
|
||||||
|
return self::NAME();
|
||||||
|
if ((is_bool($value)) || ((is_string($value)) && (!is_numeric($value))))
|
||||||
|
return self::VALUE();
|
||||||
|
return (abs($value) % 2 == 1);
|
||||||
|
} // function IS_ODD()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IS_NUMBER
|
||||||
|
*
|
||||||
|
* @param mixed $value Value to check
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function IS_NUMBER($value = NULL) {
|
||||||
|
$value = self::flattenSingleValue($value);
|
||||||
|
|
||||||
|
if (is_string($value)) {
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
return is_numeric($value);
|
||||||
|
} // function IS_NUMBER()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IS_LOGICAL
|
||||||
|
*
|
||||||
|
* @param mixed $value Value to check
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function IS_LOGICAL($value = NULL) {
|
||||||
|
$value = self::flattenSingleValue($value);
|
||||||
|
|
||||||
|
return is_bool($value);
|
||||||
|
} // function IS_LOGICAL()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IS_TEXT
|
||||||
|
*
|
||||||
|
* @param mixed $value Value to check
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function IS_TEXT($value = NULL) {
|
||||||
|
$value = self::flattenSingleValue($value);
|
||||||
|
|
||||||
|
return (is_string($value) && !self::IS_ERROR($value));
|
||||||
|
} // function IS_TEXT()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IS_NONTEXT
|
||||||
|
*
|
||||||
|
* @param mixed $value Value to check
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function IS_NONTEXT($value = NULL) {
|
||||||
|
return !self::IS_TEXT($value);
|
||||||
|
} // function IS_NONTEXT()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VERSION
|
||||||
|
*
|
||||||
|
* @return string Version information
|
||||||
|
*/
|
||||||
|
public static function VERSION() {
|
||||||
|
return 'PHPExcel ##VERSION##, ##DATE##';
|
||||||
|
} // function VERSION()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* N
|
||||||
|
*
|
||||||
|
* Returns a value converted to a number
|
||||||
|
*
|
||||||
|
* @param value The value you want converted
|
||||||
|
* @return number N converts values listed in the following table
|
||||||
|
* If value is or refers to N returns
|
||||||
|
* A number That number
|
||||||
|
* A date The serial number of that date
|
||||||
|
* TRUE 1
|
||||||
|
* FALSE 0
|
||||||
|
* An error value The error value
|
||||||
|
* Anything else 0
|
||||||
|
*/
|
||||||
|
public static function N($value = NULL) {
|
||||||
|
while (is_array($value)) {
|
||||||
|
$value = array_shift($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (gettype($value)) {
|
||||||
|
case 'double' :
|
||||||
|
case 'float' :
|
||||||
|
case 'integer' :
|
||||||
|
return $value;
|
||||||
|
break;
|
||||||
|
case 'boolean' :
|
||||||
|
return (integer) $value;
|
||||||
|
break;
|
||||||
|
case 'string' :
|
||||||
|
// Errors
|
||||||
|
if ((strlen($value) > 0) && ($value{0} == '#')) {
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
} // function N()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TYPE
|
||||||
|
*
|
||||||
|
* Returns a number that identifies the type of a value
|
||||||
|
*
|
||||||
|
* @param value The value you want tested
|
||||||
|
* @return number N converts values listed in the following table
|
||||||
|
* If value is or refers to N returns
|
||||||
|
* A number 1
|
||||||
|
* Text 2
|
||||||
|
* Logical Value 4
|
||||||
|
* An error value 16
|
||||||
|
* Array or Matrix 64
|
||||||
|
*/
|
||||||
|
public static function TYPE($value = NULL) {
|
||||||
|
$value = self::flattenArrayIndexed($value);
|
||||||
|
if (is_array($value) && (count($value) > 1)) {
|
||||||
|
$a = array_keys($value);
|
||||||
|
$a = array_pop($a);
|
||||||
|
// Range of cells is an error
|
||||||
|
if (self::isCellValue($a)) {
|
||||||
|
return 16;
|
||||||
|
// Test for Matrix
|
||||||
|
} elseif (self::isMatrixValue($a)) {
|
||||||
|
return 64;
|
||||||
|
}
|
||||||
|
} elseif(empty($value)) {
|
||||||
|
// Empty Cell
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
$value = self::flattenSingleValue($value);
|
||||||
|
|
||||||
|
if (($value === NULL) || (is_float($value)) || (is_int($value))) {
|
||||||
|
return 1;
|
||||||
|
} elseif(is_bool($value)) {
|
||||||
|
return 4;
|
||||||
|
} elseif(is_array($value)) {
|
||||||
|
return 64;
|
||||||
|
} elseif(is_string($value)) {
|
||||||
|
// Errors
|
||||||
|
if ((strlen($value) > 0) && ($value{0} == '#')) {
|
||||||
|
return 16;
|
||||||
|
}
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
} // function TYPE()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a multi-dimensional array to a simple 1-dimensional array
|
||||||
|
*
|
||||||
|
* @param array $array Array to be flattened
|
||||||
|
* @return array Flattened array
|
||||||
|
*/
|
||||||
|
public static function flattenArray($array) {
|
||||||
|
if (!is_array($array)) {
|
||||||
|
return (array) $array;
|
||||||
|
}
|
||||||
|
|
||||||
|
$arrayValues = array();
|
||||||
|
foreach ($array as $value) {
|
||||||
|
if (is_array($value)) {
|
||||||
|
foreach ($value as $val) {
|
||||||
|
if (is_array($val)) {
|
||||||
|
foreach ($val as $v) {
|
||||||
|
$arrayValues[] = $v;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$arrayValues[] = $val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$arrayValues[] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $arrayValues;
|
||||||
|
} // function flattenArray()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a multi-dimensional array to a simple 1-dimensional array, but retain an element of indexing
|
||||||
|
*
|
||||||
|
* @param array $array Array to be flattened
|
||||||
|
* @return array Flattened array
|
||||||
|
*/
|
||||||
|
public static function flattenArrayIndexed($array) {
|
||||||
|
if (!is_array($array)) {
|
||||||
|
return (array) $array;
|
||||||
|
}
|
||||||
|
|
||||||
|
$arrayValues = array();
|
||||||
|
foreach ($array as $k1 => $value) {
|
||||||
|
if (is_array($value)) {
|
||||||
|
foreach ($value as $k2 => $val) {
|
||||||
|
if (is_array($val)) {
|
||||||
|
foreach ($val as $k3 => $v) {
|
||||||
|
$arrayValues[$k1.'.'.$k2.'.'.$k3] = $v;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$arrayValues[$k1.'.'.$k2] = $val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$arrayValues[$k1] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $arrayValues;
|
||||||
|
} // function flattenArrayIndexed()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert an array to a single scalar value by extracting the first element
|
||||||
|
*
|
||||||
|
* @param mixed $value Array or scalar value
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public static function flattenSingleValue($value = '') {
|
||||||
|
while (is_array($value)) {
|
||||||
|
$value = array_pop($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
|
} // function flattenSingleValue()
|
||||||
|
|
||||||
|
} // class PHPExcel_Calculation_Functions
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// There are a few mathematical functions that aren't available on all versions of PHP for all platforms
|
||||||
|
// These functions aren't available in Windows implementations of PHP prior to version 5.3.0
|
||||||
|
// So we test if they do exist for this version of PHP/operating platform; and if not we create them
|
||||||
|
//
|
||||||
|
if (!function_exists('acosh')) {
|
||||||
|
function acosh($x) {
|
||||||
|
return 2 * log(sqrt(($x + 1) / 2) + sqrt(($x - 1) / 2));
|
||||||
|
} // function acosh()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('asinh')) {
|
||||||
|
function asinh($x) {
|
||||||
|
return log($x + sqrt(1 + $x * $x));
|
||||||
|
} // function asinh()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('atanh')) {
|
||||||
|
function atanh($x) {
|
||||||
|
return (log(1 + $x) - log(1 - $x)) / 2;
|
||||||
|
} // function atanh()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Strangely, PHP doesn't have a mb_str_replace multibyte function
|
||||||
|
// As we'll only ever use this function with UTF-8 characters, we can simply "hard-code" the character set
|
||||||
|
//
|
||||||
|
if ((!function_exists('mb_str_replace')) &&
|
||||||
|
(function_exists('mb_substr')) && (function_exists('mb_strlen')) && (function_exists('mb_strpos'))) {
|
||||||
|
function mb_str_replace($search, $replace, $subject) {
|
||||||
|
if(is_array($subject)) {
|
||||||
|
$ret = array();
|
||||||
|
foreach($subject as $key => $val) {
|
||||||
|
$ret[$key] = mb_str_replace($search, $replace, $val);
|
||||||
|
}
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach((array) $search as $key => $s) {
|
||||||
|
if($s == '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$r = !is_array($replace) ? $replace : (array_key_exists($key, $replace) ? $replace[$key] : '');
|
||||||
|
$pos = mb_strpos($subject, $s, 0, 'UTF-8');
|
||||||
|
while($pos !== false) {
|
||||||
|
$subject = mb_substr($subject, 0, $pos, 'UTF-8') . $r . mb_substr($subject, $pos + mb_strlen($s, 'UTF-8'), 65535, 'UTF-8');
|
||||||
|
$pos = mb_strpos($subject, $s, $pos + mb_strlen($r, 'UTF-8'), 'UTF-8');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $subject;
|
||||||
|
}
|
||||||
|
}
|
288
admin/helpers/PHPExcel/Calculation/Logical.php
Normal file
@ -0,0 +1,288 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Calculation
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/** PHPExcel root directory */
|
||||||
|
if (!defined('PHPEXCEL_ROOT')) {
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||||
|
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Calculation_Logical
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Calculation
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_Calculation_Logical {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TRUE
|
||||||
|
*
|
||||||
|
* Returns the boolean TRUE.
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* =TRUE()
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @category Logical Functions
|
||||||
|
* @return boolean True
|
||||||
|
*/
|
||||||
|
public static function TRUE() {
|
||||||
|
return TRUE;
|
||||||
|
} // function TRUE()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FALSE
|
||||||
|
*
|
||||||
|
* Returns the boolean FALSE.
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* =FALSE()
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @category Logical Functions
|
||||||
|
* @return boolean False
|
||||||
|
*/
|
||||||
|
public static function FALSE() {
|
||||||
|
return FALSE;
|
||||||
|
} // function FALSE()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LOGICAL_AND
|
||||||
|
*
|
||||||
|
* Returns boolean TRUE if all its arguments are TRUE; returns FALSE if one or more argument is FALSE.
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* =AND(logical1[,logical2[, ...]])
|
||||||
|
*
|
||||||
|
* The arguments must evaluate to logical values such as TRUE or FALSE, or the arguments must be arrays
|
||||||
|
* or references that contain logical values.
|
||||||
|
*
|
||||||
|
* Boolean arguments are treated as True or False as appropriate
|
||||||
|
* Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False
|
||||||
|
* If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string holds
|
||||||
|
* the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @category Logical Functions
|
||||||
|
* @param mixed $arg,... Data values
|
||||||
|
* @return boolean The logical AND of the arguments.
|
||||||
|
*/
|
||||||
|
public static function LOGICAL_AND() {
|
||||||
|
// Return value
|
||||||
|
$returnValue = TRUE;
|
||||||
|
|
||||||
|
// Loop through the arguments
|
||||||
|
$aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
|
||||||
|
$argCount = -1;
|
||||||
|
foreach ($aArgs as $argCount => $arg) {
|
||||||
|
// Is it a boolean value?
|
||||||
|
if (is_bool($arg)) {
|
||||||
|
$returnValue = $returnValue && $arg;
|
||||||
|
} elseif ((is_numeric($arg)) && (!is_string($arg))) {
|
||||||
|
$returnValue = $returnValue && ($arg != 0);
|
||||||
|
} elseif (is_string($arg)) {
|
||||||
|
$arg = strtoupper($arg);
|
||||||
|
if (($arg == 'TRUE') || ($arg == PHPExcel_Calculation::getTRUE())) {
|
||||||
|
$arg = TRUE;
|
||||||
|
} elseif (($arg == 'FALSE') || ($arg == PHPExcel_Calculation::getFALSE())) {
|
||||||
|
$arg = FALSE;
|
||||||
|
} else {
|
||||||
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
|
}
|
||||||
|
$returnValue = $returnValue && ($arg != 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return
|
||||||
|
if ($argCount < 0) {
|
||||||
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
|
}
|
||||||
|
return $returnValue;
|
||||||
|
} // function LOGICAL_AND()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LOGICAL_OR
|
||||||
|
*
|
||||||
|
* Returns boolean TRUE if any argument is TRUE; returns FALSE if all arguments are FALSE.
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* =OR(logical1[,logical2[, ...]])
|
||||||
|
*
|
||||||
|
* The arguments must evaluate to logical values such as TRUE or FALSE, or the arguments must be arrays
|
||||||
|
* or references that contain logical values.
|
||||||
|
*
|
||||||
|
* Boolean arguments are treated as True or False as appropriate
|
||||||
|
* Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False
|
||||||
|
* If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string holds
|
||||||
|
* the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @category Logical Functions
|
||||||
|
* @param mixed $arg,... Data values
|
||||||
|
* @return boolean The logical OR of the arguments.
|
||||||
|
*/
|
||||||
|
public static function LOGICAL_OR() {
|
||||||
|
// Return value
|
||||||
|
$returnValue = FALSE;
|
||||||
|
|
||||||
|
// Loop through the arguments
|
||||||
|
$aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
|
||||||
|
$argCount = -1;
|
||||||
|
foreach ($aArgs as $argCount => $arg) {
|
||||||
|
// Is it a boolean value?
|
||||||
|
if (is_bool($arg)) {
|
||||||
|
$returnValue = $returnValue || $arg;
|
||||||
|
} elseif ((is_numeric($arg)) && (!is_string($arg))) {
|
||||||
|
$returnValue = $returnValue || ($arg != 0);
|
||||||
|
} elseif (is_string($arg)) {
|
||||||
|
$arg = strtoupper($arg);
|
||||||
|
if (($arg == 'TRUE') || ($arg == PHPExcel_Calculation::getTRUE())) {
|
||||||
|
$arg = TRUE;
|
||||||
|
} elseif (($arg == 'FALSE') || ($arg == PHPExcel_Calculation::getFALSE())) {
|
||||||
|
$arg = FALSE;
|
||||||
|
} else {
|
||||||
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
|
}
|
||||||
|
$returnValue = $returnValue || ($arg != 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return
|
||||||
|
if ($argCount < 0) {
|
||||||
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
|
}
|
||||||
|
return $returnValue;
|
||||||
|
} // function LOGICAL_OR()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NOT
|
||||||
|
*
|
||||||
|
* Returns the boolean inverse of the argument.
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* =NOT(logical)
|
||||||
|
*
|
||||||
|
* The argument must evaluate to a logical value such as TRUE or FALSE
|
||||||
|
*
|
||||||
|
* Boolean arguments are treated as True or False as appropriate
|
||||||
|
* Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False
|
||||||
|
* If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string holds
|
||||||
|
* the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @category Logical Functions
|
||||||
|
* @param mixed $logical A value or expression that can be evaluated to TRUE or FALSE
|
||||||
|
* @return boolean The boolean inverse of the argument.
|
||||||
|
*/
|
||||||
|
public static function NOT($logical=FALSE) {
|
||||||
|
$logical = PHPExcel_Calculation_Functions::flattenSingleValue($logical);
|
||||||
|
if (is_string($logical)) {
|
||||||
|
$logical = strtoupper($logical);
|
||||||
|
if (($logical == 'TRUE') || ($logical == PHPExcel_Calculation::getTRUE())) {
|
||||||
|
return FALSE;
|
||||||
|
} elseif (($logical == 'FALSE') || ($logical == PHPExcel_Calculation::getFALSE())) {
|
||||||
|
return TRUE;
|
||||||
|
} else {
|
||||||
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return !$logical;
|
||||||
|
} // function NOT()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* STATEMENT_IF
|
||||||
|
*
|
||||||
|
* Returns one value if a condition you specify evaluates to TRUE and another value if it evaluates to FALSE.
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* =IF(condition[,returnIfTrue[,returnIfFalse]])
|
||||||
|
*
|
||||||
|
* Condition is any value or expression that can be evaluated to TRUE or FALSE.
|
||||||
|
* For example, A10=100 is a logical expression; if the value in cell A10 is equal to 100,
|
||||||
|
* the expression evaluates to TRUE. Otherwise, the expression evaluates to FALSE.
|
||||||
|
* This argument can use any comparison calculation operator.
|
||||||
|
* ReturnIfTrue is the value that is returned if condition evaluates to TRUE.
|
||||||
|
* For example, if this argument is the text string "Within budget" and the condition argument evaluates to TRUE,
|
||||||
|
* then the IF function returns the text "Within budget"
|
||||||
|
* If condition is TRUE and ReturnIfTrue is blank, this argument returns 0 (zero). To display the word TRUE, use
|
||||||
|
* the logical value TRUE for this argument.
|
||||||
|
* ReturnIfTrue can be another formula.
|
||||||
|
* ReturnIfFalse is the value that is returned if condition evaluates to FALSE.
|
||||||
|
* For example, if this argument is the text string "Over budget" and the condition argument evaluates to FALSE,
|
||||||
|
* then the IF function returns the text "Over budget".
|
||||||
|
* If condition is FALSE and ReturnIfFalse is omitted, then the logical value FALSE is returned.
|
||||||
|
* If condition is FALSE and ReturnIfFalse is blank, then the value 0 (zero) is returned.
|
||||||
|
* ReturnIfFalse can be another formula.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @category Logical Functions
|
||||||
|
* @param mixed $condition Condition to evaluate
|
||||||
|
* @param mixed $returnIfTrue Value to return when condition is true
|
||||||
|
* @param mixed $returnIfFalse Optional value to return when condition is false
|
||||||
|
* @return mixed The value of returnIfTrue or returnIfFalse determined by condition
|
||||||
|
*/
|
||||||
|
public static function STATEMENT_IF($condition = TRUE, $returnIfTrue = 0, $returnIfFalse = FALSE) {
|
||||||
|
$condition = (is_null($condition)) ? TRUE : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($condition);
|
||||||
|
$returnIfTrue = (is_null($returnIfTrue)) ? 0 : PHPExcel_Calculation_Functions::flattenSingleValue($returnIfTrue);
|
||||||
|
$returnIfFalse = (is_null($returnIfFalse)) ? FALSE : PHPExcel_Calculation_Functions::flattenSingleValue($returnIfFalse);
|
||||||
|
|
||||||
|
return ($condition) ? $returnIfTrue : $returnIfFalse;
|
||||||
|
} // function STATEMENT_IF()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IFERROR
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* =IFERROR(testValue,errorpart)
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @category Logical Functions
|
||||||
|
* @param mixed $testValue Value to check, is also the value returned when no error
|
||||||
|
* @param mixed $errorpart Value to return when testValue is an error condition
|
||||||
|
* @return mixed The value of errorpart or testValue determined by error condition
|
||||||
|
*/
|
||||||
|
public static function IFERROR($testValue = '', $errorpart = '') {
|
||||||
|
$testValue = (is_null($testValue)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($testValue);
|
||||||
|
$errorpart = (is_null($errorpart)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($errorpart);
|
||||||
|
|
||||||
|
return self::STATEMENT_IF(PHPExcel_Calculation_Functions::IS_ERROR($testValue), $errorpart, $testValue);
|
||||||
|
} // function IFERROR()
|
||||||
|
|
||||||
|
} // class PHPExcel_Calculation_Logical
|
881
admin/helpers/PHPExcel/Calculation/LookupRef.php
Normal file
@ -0,0 +1,881 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Calculation
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/** PHPExcel root directory */
|
||||||
|
if (!defined('PHPEXCEL_ROOT')) {
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||||
|
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Calculation_LookupRef
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Calculation
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_Calculation_LookupRef {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CELL_ADDRESS
|
||||||
|
*
|
||||||
|
* Creates a cell address as text, given specified row and column numbers.
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* =ADDRESS(row, column, [relativity], [referenceStyle], [sheetText])
|
||||||
|
*
|
||||||
|
* @param row Row number to use in the cell reference
|
||||||
|
* @param column Column number to use in the cell reference
|
||||||
|
* @param relativity Flag indicating the type of reference to return
|
||||||
|
* 1 or omitted Absolute
|
||||||
|
* 2 Absolute row; relative column
|
||||||
|
* 3 Relative row; absolute column
|
||||||
|
* 4 Relative
|
||||||
|
* @param referenceStyle A logical value that specifies the A1 or R1C1 reference style.
|
||||||
|
* TRUE or omitted CELL_ADDRESS returns an A1-style reference
|
||||||
|
* FALSE CELL_ADDRESS returns an R1C1-style reference
|
||||||
|
* @param sheetText Optional Name of worksheet to use
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function CELL_ADDRESS($row, $column, $relativity=1, $referenceStyle=True, $sheetText='') {
|
||||||
|
$row = PHPExcel_Calculation_Functions::flattenSingleValue($row);
|
||||||
|
$column = PHPExcel_Calculation_Functions::flattenSingleValue($column);
|
||||||
|
$relativity = PHPExcel_Calculation_Functions::flattenSingleValue($relativity);
|
||||||
|
$sheetText = PHPExcel_Calculation_Functions::flattenSingleValue($sheetText);
|
||||||
|
|
||||||
|
if (($row < 1) || ($column < 1)) {
|
||||||
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($sheetText > '') {
|
||||||
|
if (strpos($sheetText,' ') !== False) { $sheetText = "'".$sheetText."'"; }
|
||||||
|
$sheetText .='!';
|
||||||
|
}
|
||||||
|
if ((!is_bool($referenceStyle)) || $referenceStyle) {
|
||||||
|
$rowRelative = $columnRelative = '$';
|
||||||
|
$column = PHPExcel_Cell::stringFromColumnIndex($column-1);
|
||||||
|
if (($relativity == 2) || ($relativity == 4)) { $columnRelative = ''; }
|
||||||
|
if (($relativity == 3) || ($relativity == 4)) { $rowRelative = ''; }
|
||||||
|
return $sheetText.$columnRelative.$column.$rowRelative.$row;
|
||||||
|
} else {
|
||||||
|
if (($relativity == 2) || ($relativity == 4)) { $column = '['.$column.']'; }
|
||||||
|
if (($relativity == 3) || ($relativity == 4)) { $row = '['.$row.']'; }
|
||||||
|
return $sheetText.'R'.$row.'C'.$column;
|
||||||
|
}
|
||||||
|
} // function CELL_ADDRESS()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* COLUMN
|
||||||
|
*
|
||||||
|
* Returns the column number of the given cell reference
|
||||||
|
* If the cell reference is a range of cells, COLUMN returns the column numbers of each column in the reference as a horizontal array.
|
||||||
|
* If cell reference is omitted, and the function is being called through the calculation engine, then it is assumed to be the
|
||||||
|
* reference of the cell in which the COLUMN function appears; otherwise this function returns 0.
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* =COLUMN([cellAddress])
|
||||||
|
*
|
||||||
|
* @param cellAddress A reference to a range of cells for which you want the column numbers
|
||||||
|
* @return integer or array of integer
|
||||||
|
*/
|
||||||
|
public static function COLUMN($cellAddress=Null) {
|
||||||
|
if (is_null($cellAddress) || trim($cellAddress) === '') { return 0; }
|
||||||
|
|
||||||
|
if (is_array($cellAddress)) {
|
||||||
|
foreach($cellAddress as $columnKey => $value) {
|
||||||
|
$columnKey = preg_replace('/[^a-z]/i','',$columnKey);
|
||||||
|
return (integer) PHPExcel_Cell::columnIndexFromString($columnKey);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (strpos($cellAddress,'!') !== false) {
|
||||||
|
list($sheet,$cellAddress) = explode('!',$cellAddress);
|
||||||
|
}
|
||||||
|
if (strpos($cellAddress,':') !== false) {
|
||||||
|
list($startAddress,$endAddress) = explode(':',$cellAddress);
|
||||||
|
$startAddress = preg_replace('/[^a-z]/i','',$startAddress);
|
||||||
|
$endAddress = preg_replace('/[^a-z]/i','',$endAddress);
|
||||||
|
$returnValue = array();
|
||||||
|
do {
|
||||||
|
$returnValue[] = (integer) PHPExcel_Cell::columnIndexFromString($startAddress);
|
||||||
|
} while ($startAddress++ != $endAddress);
|
||||||
|
return $returnValue;
|
||||||
|
} else {
|
||||||
|
$cellAddress = preg_replace('/[^a-z]/i','',$cellAddress);
|
||||||
|
return (integer) PHPExcel_Cell::columnIndexFromString($cellAddress);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // function COLUMN()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* COLUMNS
|
||||||
|
*
|
||||||
|
* Returns the number of columns in an array or reference.
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* =COLUMNS(cellAddress)
|
||||||
|
*
|
||||||
|
* @param cellAddress An array or array formula, or a reference to a range of cells for which you want the number of columns
|
||||||
|
* @return integer The number of columns in cellAddress
|
||||||
|
*/
|
||||||
|
public static function COLUMNS($cellAddress=Null) {
|
||||||
|
if (is_null($cellAddress) || $cellAddress === '') {
|
||||||
|
return 1;
|
||||||
|
} elseif (!is_array($cellAddress)) {
|
||||||
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
|
}
|
||||||
|
|
||||||
|
$x = array_keys($cellAddress);
|
||||||
|
$x = array_shift($x);
|
||||||
|
$isMatrix = (is_numeric($x));
|
||||||
|
list($columns,$rows) = PHPExcel_Calculation::_getMatrixDimensions($cellAddress);
|
||||||
|
|
||||||
|
if ($isMatrix) {
|
||||||
|
return $rows;
|
||||||
|
} else {
|
||||||
|
return $columns;
|
||||||
|
}
|
||||||
|
} // function COLUMNS()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ROW
|
||||||
|
*
|
||||||
|
* Returns the row number of the given cell reference
|
||||||
|
* If the cell reference is a range of cells, ROW returns the row numbers of each row in the reference as a vertical array.
|
||||||
|
* If cell reference is omitted, and the function is being called through the calculation engine, then it is assumed to be the
|
||||||
|
* reference of the cell in which the ROW function appears; otherwise this function returns 0.
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* =ROW([cellAddress])
|
||||||
|
*
|
||||||
|
* @param cellAddress A reference to a range of cells for which you want the row numbers
|
||||||
|
* @return integer or array of integer
|
||||||
|
*/
|
||||||
|
public static function ROW($cellAddress=Null) {
|
||||||
|
if (is_null($cellAddress) || trim($cellAddress) === '') { return 0; }
|
||||||
|
|
||||||
|
if (is_array($cellAddress)) {
|
||||||
|
foreach($cellAddress as $columnKey => $rowValue) {
|
||||||
|
foreach($rowValue as $rowKey => $cellValue) {
|
||||||
|
return (integer) preg_replace('/[^0-9]/i','',$rowKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (strpos($cellAddress,'!') !== false) {
|
||||||
|
list($sheet,$cellAddress) = explode('!',$cellAddress);
|
||||||
|
}
|
||||||
|
if (strpos($cellAddress,':') !== false) {
|
||||||
|
list($startAddress,$endAddress) = explode(':',$cellAddress);
|
||||||
|
$startAddress = preg_replace('/[^0-9]/','',$startAddress);
|
||||||
|
$endAddress = preg_replace('/[^0-9]/','',$endAddress);
|
||||||
|
$returnValue = array();
|
||||||
|
do {
|
||||||
|
$returnValue[][] = (integer) $startAddress;
|
||||||
|
} while ($startAddress++ != $endAddress);
|
||||||
|
return $returnValue;
|
||||||
|
} else {
|
||||||
|
list($cellAddress) = explode(':',$cellAddress);
|
||||||
|
return (integer) preg_replace('/[^0-9]/','',$cellAddress);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // function ROW()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ROWS
|
||||||
|
*
|
||||||
|
* Returns the number of rows in an array or reference.
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* =ROWS(cellAddress)
|
||||||
|
*
|
||||||
|
* @param cellAddress An array or array formula, or a reference to a range of cells for which you want the number of rows
|
||||||
|
* @return integer The number of rows in cellAddress
|
||||||
|
*/
|
||||||
|
public static function ROWS($cellAddress=Null) {
|
||||||
|
if (is_null($cellAddress) || $cellAddress === '') {
|
||||||
|
return 1;
|
||||||
|
} elseif (!is_array($cellAddress)) {
|
||||||
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
|
}
|
||||||
|
|
||||||
|
$i = array_keys($cellAddress);
|
||||||
|
$isMatrix = (is_numeric(array_shift($i)));
|
||||||
|
list($columns,$rows) = PHPExcel_Calculation::_getMatrixDimensions($cellAddress);
|
||||||
|
|
||||||
|
if ($isMatrix) {
|
||||||
|
return $columns;
|
||||||
|
} else {
|
||||||
|
return $rows;
|
||||||
|
}
|
||||||
|
} // function ROWS()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HYPERLINK
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* =HYPERLINK(linkURL,displayName)
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @category Logical Functions
|
||||||
|
* @param string $linkURL Value to check, is also the value returned when no error
|
||||||
|
* @param string $displayName Value to return when testValue is an error condition
|
||||||
|
* @param PHPExcel_Cell $pCell The cell to set the hyperlink in
|
||||||
|
* @return mixed The value of $displayName (or $linkURL if $displayName was blank)
|
||||||
|
*/
|
||||||
|
public static function HYPERLINK($linkURL = '', $displayName = null, PHPExcel_Cell $pCell = null) {
|
||||||
|
$args = func_get_args();
|
||||||
|
$pCell = array_pop($args);
|
||||||
|
|
||||||
|
$linkURL = (is_null($linkURL)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($linkURL);
|
||||||
|
$displayName = (is_null($displayName)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($displayName);
|
||||||
|
|
||||||
|
if ((!is_object($pCell)) || (trim($linkURL) == '')) {
|
||||||
|
return PHPExcel_Calculation_Functions::REF();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((is_object($displayName)) || trim($displayName) == '') {
|
||||||
|
$displayName = $linkURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
$pCell->getHyperlink()->setUrl($linkURL);
|
||||||
|
|
||||||
|
return $displayName;
|
||||||
|
} // function HYPERLINK()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* INDIRECT
|
||||||
|
*
|
||||||
|
* Returns the reference specified by a text string.
|
||||||
|
* References are immediately evaluated to display their contents.
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* =INDIRECT(cellAddress)
|
||||||
|
*
|
||||||
|
* NOTE - INDIRECT() does not yet support the optional a1 parameter introduced in Excel 2010
|
||||||
|
*
|
||||||
|
* @param cellAddress $cellAddress The cell address of the current cell (containing this formula)
|
||||||
|
* @param PHPExcel_Cell $pCell The current cell (containing this formula)
|
||||||
|
* @return mixed The cells referenced by cellAddress
|
||||||
|
*
|
||||||
|
* @todo Support for the optional a1 parameter introduced in Excel 2010
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function INDIRECT($cellAddress = NULL, PHPExcel_Cell $pCell = NULL) {
|
||||||
|
$cellAddress = PHPExcel_Calculation_Functions::flattenSingleValue($cellAddress);
|
||||||
|
if (is_null($cellAddress) || $cellAddress === '') {
|
||||||
|
return PHPExcel_Calculation_Functions::REF();
|
||||||
|
}
|
||||||
|
|
||||||
|
$cellAddress1 = $cellAddress;
|
||||||
|
$cellAddress2 = NULL;
|
||||||
|
if (strpos($cellAddress,':') !== false) {
|
||||||
|
list($cellAddress1,$cellAddress2) = explode(':',$cellAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress1, $matches)) ||
|
||||||
|
((!is_null($cellAddress2)) && (!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress2, $matches)))) {
|
||||||
|
if (!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $cellAddress1, $matches)) {
|
||||||
|
return PHPExcel_Calculation_Functions::REF();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strpos($cellAddress,'!') !== FALSE) {
|
||||||
|
list($sheetName, $cellAddress) = explode('!',$cellAddress);
|
||||||
|
$sheetName = trim($sheetName, "'");
|
||||||
|
$pSheet = $pCell->getWorksheet()->getParent()->getSheetByName($sheetName);
|
||||||
|
} else {
|
||||||
|
$pSheet = $pCell->getWorksheet();
|
||||||
|
}
|
||||||
|
|
||||||
|
return PHPExcel_Calculation::getInstance()->extractNamedRange($cellAddress, $pSheet, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strpos($cellAddress,'!') !== FALSE) {
|
||||||
|
list($sheetName,$cellAddress) = explode('!',$cellAddress);
|
||||||
|
$sheetName = trim($sheetName, "'");
|
||||||
|
$pSheet = $pCell->getWorksheet()->getParent()->getSheetByName($sheetName);
|
||||||
|
} else {
|
||||||
|
$pSheet = $pCell->getWorksheet();
|
||||||
|
}
|
||||||
|
|
||||||
|
return PHPExcel_Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, FALSE);
|
||||||
|
} // function INDIRECT()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OFFSET
|
||||||
|
*
|
||||||
|
* Returns a reference to a range that is a specified number of rows and columns from a cell or range of cells.
|
||||||
|
* The reference that is returned can be a single cell or a range of cells. You can specify the number of rows and
|
||||||
|
* the number of columns to be returned.
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* =OFFSET(cellAddress, rows, cols, [height], [width])
|
||||||
|
*
|
||||||
|
* @param cellAddress The reference from which you want to base the offset. Reference must refer to a cell or
|
||||||
|
* range of adjacent cells; otherwise, OFFSET returns the #VALUE! error value.
|
||||||
|
* @param rows The number of rows, up or down, that you want the upper-left cell to refer to.
|
||||||
|
* Using 5 as the rows argument specifies that the upper-left cell in the reference is
|
||||||
|
* five rows below reference. Rows can be positive (which means below the starting reference)
|
||||||
|
* or negative (which means above the starting reference).
|
||||||
|
* @param cols The number of columns, to the left or right, that you want the upper-left cell of the result
|
||||||
|
* to refer to. Using 5 as the cols argument specifies that the upper-left cell in the
|
||||||
|
* reference is five columns to the right of reference. Cols can be positive (which means
|
||||||
|
* to the right of the starting reference) or negative (which means to the left of the
|
||||||
|
* starting reference).
|
||||||
|
* @param height The height, in number of rows, that you want the returned reference to be. Height must be a positive number.
|
||||||
|
* @param width The width, in number of columns, that you want the returned reference to be. Width must be a positive number.
|
||||||
|
* @return string A reference to a cell or range of cells
|
||||||
|
*/
|
||||||
|
public static function OFFSET($cellAddress=Null,$rows=0,$columns=0,$height=null,$width=null) {
|
||||||
|
$rows = PHPExcel_Calculation_Functions::flattenSingleValue($rows);
|
||||||
|
$columns = PHPExcel_Calculation_Functions::flattenSingleValue($columns);
|
||||||
|
$height = PHPExcel_Calculation_Functions::flattenSingleValue($height);
|
||||||
|
$width = PHPExcel_Calculation_Functions::flattenSingleValue($width);
|
||||||
|
if ($cellAddress == Null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$args = func_get_args();
|
||||||
|
$pCell = array_pop($args);
|
||||||
|
if (!is_object($pCell)) {
|
||||||
|
return PHPExcel_Calculation_Functions::REF();
|
||||||
|
}
|
||||||
|
|
||||||
|
$sheetName = NULL;
|
||||||
|
if (strpos($cellAddress,"!")) {
|
||||||
|
list($sheetName,$cellAddress) = explode("!",$cellAddress);
|
||||||
|
$sheetName = trim($sheetName, "'");
|
||||||
|
}
|
||||||
|
if (strpos($cellAddress,":")) {
|
||||||
|
list($startCell,$endCell) = explode(":",$cellAddress);
|
||||||
|
} else {
|
||||||
|
$startCell = $endCell = $cellAddress;
|
||||||
|
}
|
||||||
|
list($startCellColumn,$startCellRow) = PHPExcel_Cell::coordinateFromString($startCell);
|
||||||
|
list($endCellColumn,$endCellRow) = PHPExcel_Cell::coordinateFromString($endCell);
|
||||||
|
|
||||||
|
$startCellRow += $rows;
|
||||||
|
$startCellColumn = PHPExcel_Cell::columnIndexFromString($startCellColumn) - 1;
|
||||||
|
$startCellColumn += $columns;
|
||||||
|
|
||||||
|
if (($startCellRow <= 0) || ($startCellColumn < 0)) {
|
||||||
|
return PHPExcel_Calculation_Functions::REF();
|
||||||
|
}
|
||||||
|
$endCellColumn = PHPExcel_Cell::columnIndexFromString($endCellColumn) - 1;
|
||||||
|
if (($width != null) && (!is_object($width))) {
|
||||||
|
$endCellColumn = $startCellColumn + $width - 1;
|
||||||
|
} else {
|
||||||
|
$endCellColumn += $columns;
|
||||||
|
}
|
||||||
|
$startCellColumn = PHPExcel_Cell::stringFromColumnIndex($startCellColumn);
|
||||||
|
|
||||||
|
if (($height != null) && (!is_object($height))) {
|
||||||
|
$endCellRow = $startCellRow + $height - 1;
|
||||||
|
} else {
|
||||||
|
$endCellRow += $rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($endCellRow <= 0) || ($endCellColumn < 0)) {
|
||||||
|
return PHPExcel_Calculation_Functions::REF();
|
||||||
|
}
|
||||||
|
$endCellColumn = PHPExcel_Cell::stringFromColumnIndex($endCellColumn);
|
||||||
|
|
||||||
|
$cellAddress = $startCellColumn.$startCellRow;
|
||||||
|
if (($startCellColumn != $endCellColumn) || ($startCellRow != $endCellRow)) {
|
||||||
|
$cellAddress .= ':'.$endCellColumn.$endCellRow;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($sheetName !== NULL) {
|
||||||
|
$pSheet = $pCell->getWorksheet()->getParent()->getSheetByName($sheetName);
|
||||||
|
} else {
|
||||||
|
$pSheet = $pCell->getWorksheet();
|
||||||
|
}
|
||||||
|
|
||||||
|
return PHPExcel_Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, False);
|
||||||
|
} // function OFFSET()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CHOOSE
|
||||||
|
*
|
||||||
|
* Uses lookup_value to return a value from the list of value arguments.
|
||||||
|
* Use CHOOSE to select one of up to 254 values based on the lookup_value.
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* =CHOOSE(index_num, value1, [value2], ...)
|
||||||
|
*
|
||||||
|
* @param index_num Specifies which value argument is selected.
|
||||||
|
* Index_num must be a number between 1 and 254, or a formula or reference to a cell containing a number
|
||||||
|
* between 1 and 254.
|
||||||
|
* @param value1... Value1 is required, subsequent values are optional.
|
||||||
|
* Between 1 to 254 value arguments from which CHOOSE selects a value or an action to perform based on
|
||||||
|
* index_num. The arguments can be numbers, cell references, defined names, formulas, functions, or
|
||||||
|
* text.
|
||||||
|
* @return mixed The selected value
|
||||||
|
*/
|
||||||
|
public static function CHOOSE() {
|
||||||
|
$chooseArgs = func_get_args();
|
||||||
|
$chosenEntry = PHPExcel_Calculation_Functions::flattenArray(array_shift($chooseArgs));
|
||||||
|
$entryCount = count($chooseArgs) - 1;
|
||||||
|
|
||||||
|
if(is_array($chosenEntry)) {
|
||||||
|
$chosenEntry = array_shift($chosenEntry);
|
||||||
|
}
|
||||||
|
if ((is_numeric($chosenEntry)) && (!is_bool($chosenEntry))) {
|
||||||
|
--$chosenEntry;
|
||||||
|
} else {
|
||||||
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
|
}
|
||||||
|
$chosenEntry = floor($chosenEntry);
|
||||||
|
if (($chosenEntry < 0) || ($chosenEntry > $entryCount)) {
|
||||||
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_array($chooseArgs[$chosenEntry])) {
|
||||||
|
return PHPExcel_Calculation_Functions::flattenArray($chooseArgs[$chosenEntry]);
|
||||||
|
} else {
|
||||||
|
return $chooseArgs[$chosenEntry];
|
||||||
|
}
|
||||||
|
} // function CHOOSE()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MATCH
|
||||||
|
*
|
||||||
|
* The MATCH function searches for a specified item in a range of cells
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* =MATCH(lookup_value, lookup_array, [match_type])
|
||||||
|
*
|
||||||
|
* @param lookup_value The value that you want to match in lookup_array
|
||||||
|
* @param lookup_array The range of cells being searched
|
||||||
|
* @param match_type The number -1, 0, or 1. -1 means above, 0 means exact match, 1 means below. If match_type is 1 or -1, the list has to be ordered.
|
||||||
|
* @return integer The relative position of the found item
|
||||||
|
*/
|
||||||
|
public static function MATCH($lookup_value, $lookup_array, $match_type=1) {
|
||||||
|
$lookup_array = PHPExcel_Calculation_Functions::flattenArray($lookup_array);
|
||||||
|
$lookup_value = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value);
|
||||||
|
$match_type = (is_null($match_type)) ? 1 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($match_type);
|
||||||
|
// MATCH is not case sensitive
|
||||||
|
$lookup_value = strtolower($lookup_value);
|
||||||
|
|
||||||
|
// lookup_value type has to be number, text, or logical values
|
||||||
|
if ((!is_numeric($lookup_value)) && (!is_string($lookup_value)) && (!is_bool($lookup_value))) {
|
||||||
|
return PHPExcel_Calculation_Functions::NA();
|
||||||
|
}
|
||||||
|
|
||||||
|
// match_type is 0, 1 or -1
|
||||||
|
if (($match_type !== 0) && ($match_type !== -1) && ($match_type !== 1)) {
|
||||||
|
return PHPExcel_Calculation_Functions::NA();
|
||||||
|
}
|
||||||
|
|
||||||
|
// lookup_array should not be empty
|
||||||
|
$lookupArraySize = count($lookup_array);
|
||||||
|
if ($lookupArraySize <= 0) {
|
||||||
|
return PHPExcel_Calculation_Functions::NA();
|
||||||
|
}
|
||||||
|
|
||||||
|
// lookup_array should contain only number, text, or logical values, or empty (null) cells
|
||||||
|
foreach($lookup_array as $i => $lookupArrayValue) {
|
||||||
|
// check the type of the value
|
||||||
|
if ((!is_numeric($lookupArrayValue)) && (!is_string($lookupArrayValue)) &&
|
||||||
|
(!is_bool($lookupArrayValue)) && (!is_null($lookupArrayValue))) {
|
||||||
|
return PHPExcel_Calculation_Functions::NA();
|
||||||
|
}
|
||||||
|
// convert strings to lowercase for case-insensitive testing
|
||||||
|
if (is_string($lookupArrayValue)) {
|
||||||
|
$lookup_array[$i] = strtolower($lookupArrayValue);
|
||||||
|
}
|
||||||
|
if ((is_null($lookupArrayValue)) && (($match_type == 1) || ($match_type == -1))) {
|
||||||
|
$lookup_array = array_slice($lookup_array,0,$i-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if match_type is 1 or -1, the list has to be ordered
|
||||||
|
if ($match_type == 1) {
|
||||||
|
asort($lookup_array);
|
||||||
|
$keySet = array_keys($lookup_array);
|
||||||
|
} elseif($match_type == -1) {
|
||||||
|
arsort($lookup_array);
|
||||||
|
$keySet = array_keys($lookup_array);
|
||||||
|
}
|
||||||
|
|
||||||
|
// **
|
||||||
|
// find the match
|
||||||
|
// **
|
||||||
|
// loop on the cells
|
||||||
|
// var_dump($lookup_array);
|
||||||
|
// echo '<br />';
|
||||||
|
foreach($lookup_array as $i => $lookupArrayValue) {
|
||||||
|
if (($match_type == 0) && ($lookupArrayValue == $lookup_value)) {
|
||||||
|
// exact match
|
||||||
|
return ++$i;
|
||||||
|
} elseif (($match_type == -1) && ($lookupArrayValue <= $lookup_value)) {
|
||||||
|
// echo '$i = '.$i.' => ';
|
||||||
|
// var_dump($lookupArrayValue);
|
||||||
|
// echo '<br />';
|
||||||
|
// echo 'Keyset = ';
|
||||||
|
// var_dump($keySet);
|
||||||
|
// echo '<br />';
|
||||||
|
$i = array_search($i,$keySet);
|
||||||
|
// echo '$i='.$i.'<br />';
|
||||||
|
// if match_type is -1 <=> find the smallest value that is greater than or equal to lookup_value
|
||||||
|
if ($i < 1){
|
||||||
|
// 1st cell was allready smaller than the lookup_value
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
// the previous cell was the match
|
||||||
|
return $keySet[$i-1]+1;
|
||||||
|
}
|
||||||
|
} elseif (($match_type == 1) && ($lookupArrayValue >= $lookup_value)) {
|
||||||
|
// echo '$i = '.$i.' => ';
|
||||||
|
// var_dump($lookupArrayValue);
|
||||||
|
// echo '<br />';
|
||||||
|
// echo 'Keyset = ';
|
||||||
|
// var_dump($keySet);
|
||||||
|
// echo '<br />';
|
||||||
|
$i = array_search($i,$keySet);
|
||||||
|
// echo '$i='.$i.'<br />';
|
||||||
|
// if match_type is 1 <=> find the largest value that is less than or equal to lookup_value
|
||||||
|
if ($i < 1){
|
||||||
|
// 1st cell was allready bigger than the lookup_value
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
// the previous cell was the match
|
||||||
|
return $keySet[$i-1]+1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// unsuccessful in finding a match, return #N/A error value
|
||||||
|
return PHPExcel_Calculation_Functions::NA();
|
||||||
|
} // function MATCH()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* INDEX
|
||||||
|
*
|
||||||
|
* Uses an index to choose a value from a reference or array
|
||||||
|
*
|
||||||
|
* Excel Function:
|
||||||
|
* =INDEX(range_array, row_num, [column_num])
|
||||||
|
*
|
||||||
|
* @param range_array A range of cells or an array constant
|
||||||
|
* @param row_num The row in array from which to return a value. If row_num is omitted, column_num is required.
|
||||||
|
* @param column_num The column in array from which to return a value. If column_num is omitted, row_num is required.
|
||||||
|
* @return mixed the value of a specified cell or array of cells
|
||||||
|
*/
|
||||||
|
public static function INDEX($arrayValues,$rowNum = 0,$columnNum = 0) {
|
||||||
|
|
||||||
|
if (($rowNum < 0) || ($columnNum < 0)) {
|
||||||
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_array($arrayValues)) {
|
||||||
|
return PHPExcel_Calculation_Functions::REF();
|
||||||
|
}
|
||||||
|
|
||||||
|
$rowKeys = array_keys($arrayValues);
|
||||||
|
$columnKeys = @array_keys($arrayValues[$rowKeys[0]]);
|
||||||
|
|
||||||
|
if ($columnNum > count($columnKeys)) {
|
||||||
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
|
} elseif ($columnNum == 0) {
|
||||||
|
if ($rowNum == 0) {
|
||||||
|
return $arrayValues;
|
||||||
|
}
|
||||||
|
$rowNum = $rowKeys[--$rowNum];
|
||||||
|
$returnArray = array();
|
||||||
|
foreach($arrayValues as $arrayColumn) {
|
||||||
|
if (is_array($arrayColumn)) {
|
||||||
|
if (isset($arrayColumn[$rowNum])) {
|
||||||
|
$returnArray[] = $arrayColumn[$rowNum];
|
||||||
|
} else {
|
||||||
|
return $arrayValues[$rowNum];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return $arrayValues[$rowNum];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $returnArray;
|
||||||
|
}
|
||||||
|
$columnNum = $columnKeys[--$columnNum];
|
||||||
|
if ($rowNum > count($rowKeys)) {
|
||||||
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
|
} elseif ($rowNum == 0) {
|
||||||
|
return $arrayValues[$columnNum];
|
||||||
|
}
|
||||||
|
$rowNum = $rowKeys[--$rowNum];
|
||||||
|
|
||||||
|
return $arrayValues[$rowNum][$columnNum];
|
||||||
|
} // function INDEX()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TRANSPOSE
|
||||||
|
*
|
||||||
|
* @param array $matrixData A matrix of values
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* Unlike the Excel TRANSPOSE function, which will only work on a single row or column, this function will transpose a full matrix.
|
||||||
|
*/
|
||||||
|
public static function TRANSPOSE($matrixData) {
|
||||||
|
$returnMatrix = array();
|
||||||
|
if (!is_array($matrixData)) { $matrixData = array(array($matrixData)); }
|
||||||
|
|
||||||
|
$column = 0;
|
||||||
|
foreach($matrixData as $matrixRow) {
|
||||||
|
$row = 0;
|
||||||
|
foreach($matrixRow as $matrixCell) {
|
||||||
|
$returnMatrix[$row][$column] = $matrixCell;
|
||||||
|
++$row;
|
||||||
|
}
|
||||||
|
++$column;
|
||||||
|
}
|
||||||
|
return $returnMatrix;
|
||||||
|
} // function TRANSPOSE()
|
||||||
|
|
||||||
|
|
||||||
|
private static function _vlookupSort($a,$b) {
|
||||||
|
$f = array_keys($a);
|
||||||
|
$firstColumn = array_shift($f);
|
||||||
|
if (strtolower($a[$firstColumn]) == strtolower($b[$firstColumn])) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return (strtolower($a[$firstColumn]) < strtolower($b[$firstColumn])) ? -1 : 1;
|
||||||
|
} // function _vlookupSort()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VLOOKUP
|
||||||
|
* The VLOOKUP function searches for value in the left-most column of lookup_array and returns the value in the same row based on the index_number.
|
||||||
|
* @param lookup_value The value that you want to match in lookup_array
|
||||||
|
* @param lookup_array The range of cells being searched
|
||||||
|
* @param index_number The column number in table_array from which the matching value must be returned. The first column is 1.
|
||||||
|
* @param not_exact_match Determines if you are looking for an exact match based on lookup_value.
|
||||||
|
* @return mixed The value of the found cell
|
||||||
|
*/
|
||||||
|
public static function VLOOKUP($lookup_value, $lookup_array, $index_number, $not_exact_match=true) {
|
||||||
|
$lookup_value = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value);
|
||||||
|
$index_number = PHPExcel_Calculation_Functions::flattenSingleValue($index_number);
|
||||||
|
$not_exact_match = PHPExcel_Calculation_Functions::flattenSingleValue($not_exact_match);
|
||||||
|
|
||||||
|
// index_number must be greater than or equal to 1
|
||||||
|
if ($index_number < 1) {
|
||||||
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
|
}
|
||||||
|
|
||||||
|
// index_number must be less than or equal to the number of columns in lookup_array
|
||||||
|
if ((!is_array($lookup_array)) || (empty($lookup_array))) {
|
||||||
|
return PHPExcel_Calculation_Functions::REF();
|
||||||
|
} else {
|
||||||
|
$f = array_keys($lookup_array);
|
||||||
|
$firstRow = array_pop($f);
|
||||||
|
if ((!is_array($lookup_array[$firstRow])) || ($index_number > count($lookup_array[$firstRow]))) {
|
||||||
|
return PHPExcel_Calculation_Functions::REF();
|
||||||
|
} else {
|
||||||
|
$columnKeys = array_keys($lookup_array[$firstRow]);
|
||||||
|
$returnColumn = $columnKeys[--$index_number];
|
||||||
|
$firstColumn = array_shift($columnKeys);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$not_exact_match) {
|
||||||
|
uasort($lookup_array,array('self','_vlookupSort'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$rowNumber = $rowValue = False;
|
||||||
|
foreach($lookup_array as $rowKey => $rowData) {
|
||||||
|
if ((is_numeric($lookup_value) && is_numeric($rowData[$firstColumn]) && ($rowData[$firstColumn] > $lookup_value)) ||
|
||||||
|
(!is_numeric($lookup_value) && !is_numeric($rowData[$firstColumn]) && (strtolower($rowData[$firstColumn]) > strtolower($lookup_value)))) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$rowNumber = $rowKey;
|
||||||
|
$rowValue = $rowData[$firstColumn];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($rowNumber !== false) {
|
||||||
|
if ((!$not_exact_match) && ($rowValue != $lookup_value)) {
|
||||||
|
// if an exact match is required, we have what we need to return an appropriate response
|
||||||
|
return PHPExcel_Calculation_Functions::NA();
|
||||||
|
} else {
|
||||||
|
// otherwise return the appropriate value
|
||||||
|
$result = $lookup_array[$rowNumber][$returnColumn];
|
||||||
|
if ((is_numeric($lookup_value) && is_numeric($result)) ||
|
||||||
|
(!is_numeric($lookup_value) && !is_numeric($result))) {
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return PHPExcel_Calculation_Functions::NA();
|
||||||
|
} // function VLOOKUP()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HLOOKUP
|
||||||
|
* The HLOOKUP function searches for value in the top-most row of lookup_array and returns the value in the same column based on the index_number.
|
||||||
|
* @param lookup_value The value that you want to match in lookup_array
|
||||||
|
* @param lookup_array The range of cells being searched
|
||||||
|
* @param index_number The row number in table_array from which the matching value must be returned. The first row is 1.
|
||||||
|
* @param not_exact_match Determines if you are looking for an exact match based on lookup_value.
|
||||||
|
* @return mixed The value of the found cell
|
||||||
|
*/
|
||||||
|
public static function HLOOKUP($lookup_value, $lookup_array, $index_number, $not_exact_match=true) {
|
||||||
|
$lookup_value = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value);
|
||||||
|
$index_number = PHPExcel_Calculation_Functions::flattenSingleValue($index_number);
|
||||||
|
$not_exact_match = PHPExcel_Calculation_Functions::flattenSingleValue($not_exact_match);
|
||||||
|
|
||||||
|
// index_number must be greater than or equal to 1
|
||||||
|
if ($index_number < 1) {
|
||||||
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
|
}
|
||||||
|
|
||||||
|
// index_number must be less than or equal to the number of columns in lookup_array
|
||||||
|
if ((!is_array($lookup_array)) || (empty($lookup_array))) {
|
||||||
|
return PHPExcel_Calculation_Functions::REF();
|
||||||
|
} else {
|
||||||
|
$f = array_keys($lookup_array);
|
||||||
|
$firstRow = array_pop($f);
|
||||||
|
if ((!is_array($lookup_array[$firstRow])) || ($index_number > count($lookup_array[$firstRow]))) {
|
||||||
|
return PHPExcel_Calculation_Functions::REF();
|
||||||
|
} else {
|
||||||
|
$columnKeys = array_keys($lookup_array[$firstRow]);
|
||||||
|
$firstkey = $f[0] - 1;
|
||||||
|
$returnColumn = $firstkey + $index_number;
|
||||||
|
$firstColumn = array_shift($f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$not_exact_match) {
|
||||||
|
$firstRowH = asort($lookup_array[$firstColumn]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$rowNumber = $rowValue = False;
|
||||||
|
foreach($lookup_array[$firstColumn] as $rowKey => $rowData) {
|
||||||
|
if ((is_numeric($lookup_value) && is_numeric($rowData) && ($rowData > $lookup_value)) ||
|
||||||
|
(!is_numeric($lookup_value) && !is_numeric($rowData) && (strtolower($rowData) > strtolower($lookup_value)))) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$rowNumber = $rowKey;
|
||||||
|
$rowValue = $rowData;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($rowNumber !== false) {
|
||||||
|
if ((!$not_exact_match) && ($rowValue != $lookup_value)) {
|
||||||
|
// if an exact match is required, we have what we need to return an appropriate response
|
||||||
|
return PHPExcel_Calculation_Functions::NA();
|
||||||
|
} else {
|
||||||
|
// otherwise return the appropriate value
|
||||||
|
$result = $lookup_array[$returnColumn][$rowNumber];
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return PHPExcel_Calculation_Functions::NA();
|
||||||
|
} // function HLOOKUP()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LOOKUP
|
||||||
|
* The LOOKUP function searches for value either from a one-row or one-column range or from an array.
|
||||||
|
* @param lookup_value The value that you want to match in lookup_array
|
||||||
|
* @param lookup_vector The range of cells being searched
|
||||||
|
* @param result_vector The column from which the matching value must be returned
|
||||||
|
* @return mixed The value of the found cell
|
||||||
|
*/
|
||||||
|
public static function LOOKUP($lookup_value, $lookup_vector, $result_vector=null) {
|
||||||
|
$lookup_value = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value);
|
||||||
|
|
||||||
|
if (!is_array($lookup_vector)) {
|
||||||
|
return PHPExcel_Calculation_Functions::NA();
|
||||||
|
}
|
||||||
|
$lookupRows = count($lookup_vector);
|
||||||
|
$l = array_keys($lookup_vector);
|
||||||
|
$l = array_shift($l);
|
||||||
|
$lookupColumns = count($lookup_vector[$l]);
|
||||||
|
if ((($lookupRows == 1) && ($lookupColumns > 1)) || (($lookupRows == 2) && ($lookupColumns != 2))) {
|
||||||
|
$lookup_vector = self::TRANSPOSE($lookup_vector);
|
||||||
|
$lookupRows = count($lookup_vector);
|
||||||
|
$l = array_keys($lookup_vector);
|
||||||
|
$lookupColumns = count($lookup_vector[array_shift($l)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_null($result_vector)) {
|
||||||
|
$result_vector = $lookup_vector;
|
||||||
|
}
|
||||||
|
$resultRows = count($result_vector);
|
||||||
|
$l = array_keys($result_vector);
|
||||||
|
$l = array_shift($l);
|
||||||
|
$resultColumns = count($result_vector[$l]);
|
||||||
|
if ((($resultRows == 1) && ($resultColumns > 1)) || (($resultRows == 2) && ($resultColumns != 2))) {
|
||||||
|
$result_vector = self::TRANSPOSE($result_vector);
|
||||||
|
$resultRows = count($result_vector);
|
||||||
|
$r = array_keys($result_vector);
|
||||||
|
$resultColumns = count($result_vector[array_shift($r)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($lookupRows == 2) {
|
||||||
|
$result_vector = array_pop($lookup_vector);
|
||||||
|
$lookup_vector = array_shift($lookup_vector);
|
||||||
|
}
|
||||||
|
if ($lookupColumns != 2) {
|
||||||
|
foreach($lookup_vector as &$value) {
|
||||||
|
if (is_array($value)) {
|
||||||
|
$k = array_keys($value);
|
||||||
|
$key1 = $key2 = array_shift($k);
|
||||||
|
$key2++;
|
||||||
|
$dataValue1 = $value[$key1];
|
||||||
|
} else {
|
||||||
|
$key1 = 0;
|
||||||
|
$key2 = 1;
|
||||||
|
$dataValue1 = $value;
|
||||||
|
}
|
||||||
|
$dataValue2 = array_shift($result_vector);
|
||||||
|
if (is_array($dataValue2)) {
|
||||||
|
$dataValue2 = array_shift($dataValue2);
|
||||||
|
}
|
||||||
|
$value = array($key1 => $dataValue1, $key2 => $dataValue2);
|
||||||
|
}
|
||||||
|
unset($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::VLOOKUP($lookup_value,$lookup_vector,2);
|
||||||
|
} // function LOOKUP()
|
||||||
|
|
||||||
|
} // class PHPExcel_Calculation_LookupRef
|
1373
admin/helpers/PHPExcel/Calculation/MathTrig.php
Normal file
3651
admin/helpers/PHPExcel/Calculation/Statistical.php
Normal file
631
admin/helpers/PHPExcel/Calculation/TextData.php
Normal file
@ -0,0 +1,631 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Calculation
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/** PHPExcel root directory */
|
||||||
|
if (!defined('PHPEXCEL_ROOT')) {
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||||
|
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Calculation_TextData
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Calculation
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_Calculation_TextData {
|
||||||
|
|
||||||
|
private static $_invalidChars = Null;
|
||||||
|
|
||||||
|
private static function _uniord($c) {
|
||||||
|
if (ord($c{0}) >=0 && ord($c{0}) <= 127)
|
||||||
|
return ord($c{0});
|
||||||
|
if (ord($c{0}) >= 192 && ord($c{0}) <= 223)
|
||||||
|
return (ord($c{0})-192)*64 + (ord($c{1})-128);
|
||||||
|
if (ord($c{0}) >= 224 && ord($c{0}) <= 239)
|
||||||
|
return (ord($c{0})-224)*4096 + (ord($c{1})-128)*64 + (ord($c{2})-128);
|
||||||
|
if (ord($c{0}) >= 240 && ord($c{0}) <= 247)
|
||||||
|
return (ord($c{0})-240)*262144 + (ord($c{1})-128)*4096 + (ord($c{2})-128)*64 + (ord($c{3})-128);
|
||||||
|
if (ord($c{0}) >= 248 && ord($c{0}) <= 251)
|
||||||
|
return (ord($c{0})-248)*16777216 + (ord($c{1})-128)*262144 + (ord($c{2})-128)*4096 + (ord($c{3})-128)*64 + (ord($c{4})-128);
|
||||||
|
if (ord($c{0}) >= 252 && ord($c{0}) <= 253)
|
||||||
|
return (ord($c{0})-252)*1073741824 + (ord($c{1})-128)*16777216 + (ord($c{2})-128)*262144 + (ord($c{3})-128)*4096 + (ord($c{4})-128)*64 + (ord($c{5})-128);
|
||||||
|
if (ord($c{0}) >= 254 && ord($c{0}) <= 255) //error
|
||||||
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
|
return 0;
|
||||||
|
} // function _uniord()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CHARACTER
|
||||||
|
*
|
||||||
|
* @param string $character Value
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public static function CHARACTER($character) {
|
||||||
|
$character = PHPExcel_Calculation_Functions::flattenSingleValue($character);
|
||||||
|
|
||||||
|
if ((!is_numeric($character)) || ($character < 0)) {
|
||||||
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (function_exists('mb_convert_encoding')) {
|
||||||
|
return mb_convert_encoding('&#'.intval($character).';', 'UTF-8', 'HTML-ENTITIES');
|
||||||
|
} else {
|
||||||
|
return chr(intval($character));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TRIMNONPRINTABLE
|
||||||
|
*
|
||||||
|
* @param mixed $stringValue Value to check
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function TRIMNONPRINTABLE($stringValue = '') {
|
||||||
|
$stringValue = PHPExcel_Calculation_Functions::flattenSingleValue($stringValue);
|
||||||
|
|
||||||
|
if (is_bool($stringValue)) {
|
||||||
|
return ($stringValue) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (self::$_invalidChars == Null) {
|
||||||
|
self::$_invalidChars = range(chr(0),chr(31));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_string($stringValue) || is_numeric($stringValue)) {
|
||||||
|
return str_replace(self::$_invalidChars, '', trim($stringValue, "\x00..\x1F"));
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
} // function TRIMNONPRINTABLE()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TRIMSPACES
|
||||||
|
*
|
||||||
|
* @param mixed $stringValue Value to check
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function TRIMSPACES($stringValue = '') {
|
||||||
|
$stringValue = PHPExcel_Calculation_Functions::flattenSingleValue($stringValue);
|
||||||
|
|
||||||
|
if (is_bool($stringValue)) {
|
||||||
|
return ($stringValue) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_string($stringValue) || is_numeric($stringValue)) {
|
||||||
|
return trim(preg_replace('/ +/',' ',trim($stringValue,' ')));
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
} // function TRIMSPACES()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ASCIICODE
|
||||||
|
*
|
||||||
|
* @param string $characters Value
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public static function ASCIICODE($characters) {
|
||||||
|
if (($characters === NULL) || ($characters === ''))
|
||||||
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
|
$characters = PHPExcel_Calculation_Functions::flattenSingleValue($characters);
|
||||||
|
if (is_bool($characters)) {
|
||||||
|
if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
|
||||||
|
$characters = (int) $characters;
|
||||||
|
} else {
|
||||||
|
$characters = ($characters) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$character = $characters;
|
||||||
|
if ((function_exists('mb_strlen')) && (function_exists('mb_substr'))) {
|
||||||
|
if (mb_strlen($characters, 'UTF-8') > 1) { $character = mb_substr($characters, 0, 1, 'UTF-8'); }
|
||||||
|
return self::_uniord($character);
|
||||||
|
} else {
|
||||||
|
if (strlen($characters) > 0) { $character = substr($characters, 0, 1); }
|
||||||
|
return ord($character);
|
||||||
|
}
|
||||||
|
} // function ASCIICODE()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CONCATENATE
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function CONCATENATE() {
|
||||||
|
// Return value
|
||||||
|
$returnValue = '';
|
||||||
|
|
||||||
|
// Loop through arguments
|
||||||
|
$aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
|
||||||
|
foreach ($aArgs as $arg) {
|
||||||
|
if (is_bool($arg)) {
|
||||||
|
if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
|
||||||
|
$arg = (int) $arg;
|
||||||
|
} else {
|
||||||
|
$arg = ($arg) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$returnValue .= $arg;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return
|
||||||
|
return $returnValue;
|
||||||
|
} // function CONCATENATE()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DOLLAR
|
||||||
|
*
|
||||||
|
* This function converts a number to text using currency format, with the decimals rounded to the specified place.
|
||||||
|
* The format used is $#,##0.00_);($#,##0.00)..
|
||||||
|
*
|
||||||
|
* @param float $value The value to format
|
||||||
|
* @param int $decimals The number of digits to display to the right of the decimal point.
|
||||||
|
* If decimals is negative, number is rounded to the left of the decimal point.
|
||||||
|
* If you omit decimals, it is assumed to be 2
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function DOLLAR($value = 0, $decimals = 2) {
|
||||||
|
$value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
|
||||||
|
$decimals = is_null($decimals) ? 0 : PHPExcel_Calculation_Functions::flattenSingleValue($decimals);
|
||||||
|
|
||||||
|
// Validate parameters
|
||||||
|
if (!is_numeric($value) || !is_numeric($decimals)) {
|
||||||
|
return PHPExcel_Calculation_Functions::NaN();
|
||||||
|
}
|
||||||
|
$decimals = floor($decimals);
|
||||||
|
|
||||||
|
$mask = '$#,##0';
|
||||||
|
if ($decimals > 0) {
|
||||||
|
$mask .= '.' . str_repeat('0',$decimals);
|
||||||
|
} else {
|
||||||
|
$round = pow(10,abs($decimals));
|
||||||
|
if ($value < 0) { $round = 0-$round; }
|
||||||
|
$value = PHPExcel_Calculation_MathTrig::MROUND($value, $round);
|
||||||
|
}
|
||||||
|
|
||||||
|
return PHPExcel_Style_NumberFormat::toFormattedString($value, $mask);
|
||||||
|
|
||||||
|
} // function DOLLAR()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SEARCHSENSITIVE
|
||||||
|
*
|
||||||
|
* @param string $needle The string to look for
|
||||||
|
* @param string $haystack The string in which to look
|
||||||
|
* @param int $offset Offset within $haystack
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function SEARCHSENSITIVE($needle,$haystack,$offset=1) {
|
||||||
|
$needle = PHPExcel_Calculation_Functions::flattenSingleValue($needle);
|
||||||
|
$haystack = PHPExcel_Calculation_Functions::flattenSingleValue($haystack);
|
||||||
|
$offset = PHPExcel_Calculation_Functions::flattenSingleValue($offset);
|
||||||
|
|
||||||
|
if (!is_bool($needle)) {
|
||||||
|
if (is_bool($haystack)) {
|
||||||
|
$haystack = ($haystack) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($offset > 0) && (PHPExcel_Shared_String::CountCharacters($haystack) > $offset)) {
|
||||||
|
if (PHPExcel_Shared_String::CountCharacters($needle) == 0) {
|
||||||
|
return $offset;
|
||||||
|
}
|
||||||
|
if (function_exists('mb_strpos')) {
|
||||||
|
$pos = mb_strpos($haystack, $needle, --$offset, 'UTF-8');
|
||||||
|
} else {
|
||||||
|
$pos = strpos($haystack, $needle, --$offset);
|
||||||
|
}
|
||||||
|
if ($pos !== false) {
|
||||||
|
return ++$pos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
|
} // function SEARCHSENSITIVE()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SEARCHINSENSITIVE
|
||||||
|
*
|
||||||
|
* @param string $needle The string to look for
|
||||||
|
* @param string $haystack The string in which to look
|
||||||
|
* @param int $offset Offset within $haystack
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function SEARCHINSENSITIVE($needle,$haystack,$offset=1) {
|
||||||
|
$needle = PHPExcel_Calculation_Functions::flattenSingleValue($needle);
|
||||||
|
$haystack = PHPExcel_Calculation_Functions::flattenSingleValue($haystack);
|
||||||
|
$offset = PHPExcel_Calculation_Functions::flattenSingleValue($offset);
|
||||||
|
|
||||||
|
if (!is_bool($needle)) {
|
||||||
|
if (is_bool($haystack)) {
|
||||||
|
$haystack = ($haystack) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($offset > 0) && (PHPExcel_Shared_String::CountCharacters($haystack) > $offset)) {
|
||||||
|
if (PHPExcel_Shared_String::CountCharacters($needle) == 0) {
|
||||||
|
return $offset;
|
||||||
|
}
|
||||||
|
if (function_exists('mb_stripos')) {
|
||||||
|
$pos = mb_stripos($haystack, $needle, --$offset,'UTF-8');
|
||||||
|
} else {
|
||||||
|
$pos = stripos($haystack, $needle, --$offset);
|
||||||
|
}
|
||||||
|
if ($pos !== false) {
|
||||||
|
return ++$pos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
|
} // function SEARCHINSENSITIVE()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FIXEDFORMAT
|
||||||
|
*
|
||||||
|
* @param mixed $value Value to check
|
||||||
|
* @param integer $decimals
|
||||||
|
* @param boolean $no_commas
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function FIXEDFORMAT($value, $decimals = 2, $no_commas = FALSE) {
|
||||||
|
$value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
|
||||||
|
$decimals = PHPExcel_Calculation_Functions::flattenSingleValue($decimals);
|
||||||
|
$no_commas = PHPExcel_Calculation_Functions::flattenSingleValue($no_commas);
|
||||||
|
|
||||||
|
// Validate parameters
|
||||||
|
if (!is_numeric($value) || !is_numeric($decimals)) {
|
||||||
|
return PHPExcel_Calculation_Functions::NaN();
|
||||||
|
}
|
||||||
|
$decimals = floor($decimals);
|
||||||
|
|
||||||
|
$valueResult = round($value,$decimals);
|
||||||
|
if ($decimals < 0) { $decimals = 0; }
|
||||||
|
if (!$no_commas) {
|
||||||
|
$valueResult = number_format($valueResult,$decimals);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (string) $valueResult;
|
||||||
|
} // function FIXEDFORMAT()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LEFT
|
||||||
|
*
|
||||||
|
* @param string $value Value
|
||||||
|
* @param int $chars Number of characters
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function LEFT($value = '', $chars = 1) {
|
||||||
|
$value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
|
||||||
|
$chars = PHPExcel_Calculation_Functions::flattenSingleValue($chars);
|
||||||
|
|
||||||
|
if ($chars < 0) {
|
||||||
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_bool($value)) {
|
||||||
|
$value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (function_exists('mb_substr')) {
|
||||||
|
return mb_substr($value, 0, $chars, 'UTF-8');
|
||||||
|
} else {
|
||||||
|
return substr($value, 0, $chars);
|
||||||
|
}
|
||||||
|
} // function LEFT()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MID
|
||||||
|
*
|
||||||
|
* @param string $value Value
|
||||||
|
* @param int $start Start character
|
||||||
|
* @param int $chars Number of characters
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function MID($value = '', $start = 1, $chars = null) {
|
||||||
|
$value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
|
||||||
|
$start = PHPExcel_Calculation_Functions::flattenSingleValue($start);
|
||||||
|
$chars = PHPExcel_Calculation_Functions::flattenSingleValue($chars);
|
||||||
|
|
||||||
|
if (($start < 1) || ($chars < 0)) {
|
||||||
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_bool($value)) {
|
||||||
|
$value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (function_exists('mb_substr')) {
|
||||||
|
return mb_substr($value, --$start, $chars, 'UTF-8');
|
||||||
|
} else {
|
||||||
|
return substr($value, --$start, $chars);
|
||||||
|
}
|
||||||
|
} // function MID()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RIGHT
|
||||||
|
*
|
||||||
|
* @param string $value Value
|
||||||
|
* @param int $chars Number of characters
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function RIGHT($value = '', $chars = 1) {
|
||||||
|
$value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
|
||||||
|
$chars = PHPExcel_Calculation_Functions::flattenSingleValue($chars);
|
||||||
|
|
||||||
|
if ($chars < 0) {
|
||||||
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_bool($value)) {
|
||||||
|
$value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((function_exists('mb_substr')) && (function_exists('mb_strlen'))) {
|
||||||
|
return mb_substr($value, mb_strlen($value, 'UTF-8') - $chars, $chars, 'UTF-8');
|
||||||
|
} else {
|
||||||
|
return substr($value, strlen($value) - $chars);
|
||||||
|
}
|
||||||
|
} // function RIGHT()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* STRINGLENGTH
|
||||||
|
*
|
||||||
|
* @param string $value Value
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function STRINGLENGTH($value = '') {
|
||||||
|
$value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
|
||||||
|
|
||||||
|
if (is_bool($value)) {
|
||||||
|
$value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (function_exists('mb_strlen')) {
|
||||||
|
return mb_strlen($value, 'UTF-8');
|
||||||
|
} else {
|
||||||
|
return strlen($value);
|
||||||
|
}
|
||||||
|
} // function STRINGLENGTH()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LOWERCASE
|
||||||
|
*
|
||||||
|
* Converts a string value to upper case.
|
||||||
|
*
|
||||||
|
* @param string $mixedCaseString
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function LOWERCASE($mixedCaseString) {
|
||||||
|
$mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString);
|
||||||
|
|
||||||
|
if (is_bool($mixedCaseString)) {
|
||||||
|
$mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||||
|
}
|
||||||
|
|
||||||
|
return PHPExcel_Shared_String::StrToLower($mixedCaseString);
|
||||||
|
} // function LOWERCASE()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UPPERCASE
|
||||||
|
*
|
||||||
|
* Converts a string value to upper case.
|
||||||
|
*
|
||||||
|
* @param string $mixedCaseString
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function UPPERCASE($mixedCaseString) {
|
||||||
|
$mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString);
|
||||||
|
|
||||||
|
if (is_bool($mixedCaseString)) {
|
||||||
|
$mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||||
|
}
|
||||||
|
|
||||||
|
return PHPExcel_Shared_String::StrToUpper($mixedCaseString);
|
||||||
|
} // function UPPERCASE()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PROPERCASE
|
||||||
|
*
|
||||||
|
* Converts a string value to upper case.
|
||||||
|
*
|
||||||
|
* @param string $mixedCaseString
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function PROPERCASE($mixedCaseString) {
|
||||||
|
$mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString);
|
||||||
|
|
||||||
|
if (is_bool($mixedCaseString)) {
|
||||||
|
$mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||||
|
}
|
||||||
|
|
||||||
|
return PHPExcel_Shared_String::StrToTitle($mixedCaseString);
|
||||||
|
} // function PROPERCASE()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* REPLACE
|
||||||
|
*
|
||||||
|
* @param string $oldText String to modify
|
||||||
|
* @param int $start Start character
|
||||||
|
* @param int $chars Number of characters
|
||||||
|
* @param string $newText String to replace in defined position
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function REPLACE($oldText = '', $start = 1, $chars = null, $newText) {
|
||||||
|
$oldText = PHPExcel_Calculation_Functions::flattenSingleValue($oldText);
|
||||||
|
$start = PHPExcel_Calculation_Functions::flattenSingleValue($start);
|
||||||
|
$chars = PHPExcel_Calculation_Functions::flattenSingleValue($chars);
|
||||||
|
$newText = PHPExcel_Calculation_Functions::flattenSingleValue($newText);
|
||||||
|
|
||||||
|
$left = self::LEFT($oldText,$start-1);
|
||||||
|
$right = self::RIGHT($oldText,self::STRINGLENGTH($oldText)-($start+$chars)+1);
|
||||||
|
|
||||||
|
return $left.$newText.$right;
|
||||||
|
} // function REPLACE()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SUBSTITUTE
|
||||||
|
*
|
||||||
|
* @param string $text Value
|
||||||
|
* @param string $fromText From Value
|
||||||
|
* @param string $toText To Value
|
||||||
|
* @param integer $instance Instance Number
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function SUBSTITUTE($text = '', $fromText = '', $toText = '', $instance = 0) {
|
||||||
|
$text = PHPExcel_Calculation_Functions::flattenSingleValue($text);
|
||||||
|
$fromText = PHPExcel_Calculation_Functions::flattenSingleValue($fromText);
|
||||||
|
$toText = PHPExcel_Calculation_Functions::flattenSingleValue($toText);
|
||||||
|
$instance = floor(PHPExcel_Calculation_Functions::flattenSingleValue($instance));
|
||||||
|
|
||||||
|
if ($instance == 0) {
|
||||||
|
if(function_exists('mb_str_replace')) {
|
||||||
|
return mb_str_replace($fromText,$toText,$text);
|
||||||
|
} else {
|
||||||
|
return str_replace($fromText,$toText,$text);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$pos = -1;
|
||||||
|
while($instance > 0) {
|
||||||
|
if (function_exists('mb_strpos')) {
|
||||||
|
$pos = mb_strpos($text, $fromText, $pos+1, 'UTF-8');
|
||||||
|
} else {
|
||||||
|
$pos = strpos($text, $fromText, $pos+1);
|
||||||
|
}
|
||||||
|
if ($pos === false) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
--$instance;
|
||||||
|
}
|
||||||
|
if ($pos !== false) {
|
||||||
|
if (function_exists('mb_strlen')) {
|
||||||
|
return self::REPLACE($text,++$pos,mb_strlen($fromText, 'UTF-8'),$toText);
|
||||||
|
} else {
|
||||||
|
return self::REPLACE($text,++$pos,strlen($fromText),$toText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $text;
|
||||||
|
} // function SUBSTITUTE()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RETURNSTRING
|
||||||
|
*
|
||||||
|
* @param mixed $testValue Value to check
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function RETURNSTRING($testValue = '') {
|
||||||
|
$testValue = PHPExcel_Calculation_Functions::flattenSingleValue($testValue);
|
||||||
|
|
||||||
|
if (is_string($testValue)) {
|
||||||
|
return $testValue;
|
||||||
|
}
|
||||||
|
return Null;
|
||||||
|
} // function RETURNSTRING()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TEXTFORMAT
|
||||||
|
*
|
||||||
|
* @param mixed $value Value to check
|
||||||
|
* @param string $format Format mask to use
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function TEXTFORMAT($value,$format) {
|
||||||
|
$value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
|
||||||
|
$format = PHPExcel_Calculation_Functions::flattenSingleValue($format);
|
||||||
|
|
||||||
|
if ((is_string($value)) && (!is_numeric($value)) && PHPExcel_Shared_Date::isDateTimeFormatCode($format)) {
|
||||||
|
$value = PHPExcel_Calculation_DateTime::DATEVALUE($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (string) PHPExcel_Style_NumberFormat::toFormattedString($value,$format);
|
||||||
|
} // function TEXTFORMAT()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VALUE
|
||||||
|
*
|
||||||
|
* @param mixed $value Value to check
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function VALUE($value = '') {
|
||||||
|
$value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
|
||||||
|
|
||||||
|
if (!is_numeric($value)) {
|
||||||
|
$numberValue = str_replace(
|
||||||
|
PHPExcel_Shared_String::getThousandsSeparator(),
|
||||||
|
'',
|
||||||
|
trim($value, " \t\n\r\0\x0B" . PHPExcel_Shared_String::getCurrencyCode())
|
||||||
|
);
|
||||||
|
if (is_numeric($numberValue)) {
|
||||||
|
return (float) $numberValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$dateSetting = PHPExcel_Calculation_Functions::getReturnDateType();
|
||||||
|
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
|
||||||
|
|
||||||
|
if (strpos($value, ':') !== false) {
|
||||||
|
$timeValue = PHPExcel_Calculation_DateTime::TIMEVALUE($value);
|
||||||
|
if ($timeValue !== PHPExcel_Calculation_Functions::VALUE()) {
|
||||||
|
PHPExcel_Calculation_Functions::setReturnDateType($dateSetting);
|
||||||
|
return $timeValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$dateValue = PHPExcel_Calculation_DateTime::DATEVALUE($value);
|
||||||
|
if ($dateValue !== PHPExcel_Calculation_Functions::VALUE()) {
|
||||||
|
PHPExcel_Calculation_Functions::setReturnDateType($dateSetting);
|
||||||
|
return $dateValue;
|
||||||
|
}
|
||||||
|
PHPExcel_Calculation_Functions::setReturnDateType($dateSetting);
|
||||||
|
|
||||||
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
|
}
|
||||||
|
return (float) $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
115
admin/helpers/PHPExcel/Calculation/Token/Stack.php
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Calculation
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Calculation_Token_Stack
|
||||||
|
*
|
||||||
|
* @category PHPExcel_Calculation_Token_Stack
|
||||||
|
* @package PHPExcel_Calculation
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_Calculation_Token_Stack {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The parser stack for formulae
|
||||||
|
*
|
||||||
|
* @var mixed[]
|
||||||
|
*/
|
||||||
|
private $_stack = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Count of entries in the parser stack
|
||||||
|
*
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
private $_count = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the number of entries on the stack
|
||||||
|
*
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public function count() {
|
||||||
|
return $this->_count;
|
||||||
|
} // function count()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Push a new entry onto the stack
|
||||||
|
*
|
||||||
|
* @param mixed $type
|
||||||
|
* @param mixed $value
|
||||||
|
* @param mixed $reference
|
||||||
|
*/
|
||||||
|
public function push($type, $value, $reference = NULL) {
|
||||||
|
$this->_stack[$this->_count++] = array('type' => $type,
|
||||||
|
'value' => $value,
|
||||||
|
'reference' => $reference
|
||||||
|
);
|
||||||
|
if ($type == 'Function') {
|
||||||
|
$localeFunction = PHPExcel_Calculation::_localeFunc($value);
|
||||||
|
if ($localeFunction != $value) {
|
||||||
|
$this->_stack[($this->_count - 1)]['localeValue'] = $localeFunction;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // function push()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pop the last entry from the stack
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function pop() {
|
||||||
|
if ($this->_count > 0) {
|
||||||
|
return $this->_stack[--$this->_count];
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
} // function pop()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return an entry from the stack without removing it
|
||||||
|
*
|
||||||
|
* @param integer $n number indicating how far back in the stack we want to look
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function last($n = 1) {
|
||||||
|
if ($this->_count - $n < 0) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return $this->_stack[$this->_count - $n];
|
||||||
|
} // function last()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the stack
|
||||||
|
*/
|
||||||
|
function clear() {
|
||||||
|
$this->_stack = array();
|
||||||
|
$this->_count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // class PHPExcel_Calculation_Token_Stack
|
1
admin/helpers/PHPExcel/Calculation/Token/index.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
351
admin/helpers/PHPExcel/Calculation/functionlist.txt
Normal file
@ -0,0 +1,351 @@
|
|||||||
|
ABS
|
||||||
|
ACCRINT
|
||||||
|
ACCRINTM
|
||||||
|
ACOS
|
||||||
|
ACOSH
|
||||||
|
ADDRESS
|
||||||
|
AMORDEGRC
|
||||||
|
AMORLINC
|
||||||
|
AND
|
||||||
|
AREAS
|
||||||
|
ASC
|
||||||
|
ASIN
|
||||||
|
ASINH
|
||||||
|
ATAN
|
||||||
|
ATAN2
|
||||||
|
ATANH
|
||||||
|
AVEDEV
|
||||||
|
AVERAGE
|
||||||
|
AVERAGEA
|
||||||
|
AVERAGEIF
|
||||||
|
AVERAGEIFS
|
||||||
|
BAHTTEXT
|
||||||
|
BESSELI
|
||||||
|
BESSELJ
|
||||||
|
BESSELK
|
||||||
|
BESSELY
|
||||||
|
BETADIST
|
||||||
|
BETAINV
|
||||||
|
BIN2DEC
|
||||||
|
BIN2HEX
|
||||||
|
BIN2OCT
|
||||||
|
BINOMDIST
|
||||||
|
CEILING
|
||||||
|
CELL
|
||||||
|
CHAR
|
||||||
|
CHIDIST
|
||||||
|
CHIINV
|
||||||
|
CHITEST
|
||||||
|
CHOOSE
|
||||||
|
CLEAN
|
||||||
|
CODE
|
||||||
|
COLUMN
|
||||||
|
COLUMNS
|
||||||
|
COMBIN
|
||||||
|
COMPLEX
|
||||||
|
CONCATENATE
|
||||||
|
CONFIDENCE
|
||||||
|
CONVERT
|
||||||
|
CORREL
|
||||||
|
COS
|
||||||
|
COSH
|
||||||
|
COUNT
|
||||||
|
COUNTA
|
||||||
|
COUNTBLANK
|
||||||
|
COUNTIF
|
||||||
|
COUNTIFS
|
||||||
|
COUPDAYBS
|
||||||
|
COUPDAYBS
|
||||||
|
COUPDAYSNC
|
||||||
|
COUPNCD
|
||||||
|
COUPNUM
|
||||||
|
COUPPCD
|
||||||
|
COVAR
|
||||||
|
CRITBINOM
|
||||||
|
CUBEKPIMEMBER
|
||||||
|
CUBEMEMBER
|
||||||
|
CUBEMEMBERPROPERTY
|
||||||
|
CUBERANKEDMEMBER
|
||||||
|
CUBESET
|
||||||
|
CUBESETCOUNT
|
||||||
|
CUBEVALUE
|
||||||
|
CUMIPMT
|
||||||
|
CUMPRINC
|
||||||
|
DATE
|
||||||
|
DATEDIF
|
||||||
|
DATEVALUE
|
||||||
|
DAVERAGE
|
||||||
|
DAY
|
||||||
|
DAYS360
|
||||||
|
DB
|
||||||
|
DCOUNT
|
||||||
|
DCOUNTA
|
||||||
|
DDB
|
||||||
|
DEC2BIN
|
||||||
|
DEC2HEX
|
||||||
|
DEC2OCT
|
||||||
|
DEGREES
|
||||||
|
DELTA
|
||||||
|
DEVSQ
|
||||||
|
DGET
|
||||||
|
DISC
|
||||||
|
DMAX
|
||||||
|
DMIN
|
||||||
|
DOLLAR
|
||||||
|
DOLLARDE
|
||||||
|
DOLLARFR
|
||||||
|
DPRODUCT
|
||||||
|
DSTDEV
|
||||||
|
DSTDEVP
|
||||||
|
DSUM
|
||||||
|
DURATION
|
||||||
|
DVAR
|
||||||
|
DVARP
|
||||||
|
EDATE
|
||||||
|
EFFECT
|
||||||
|
EOMONTH
|
||||||
|
ERF
|
||||||
|
ERFC
|
||||||
|
ERROR.TYPE
|
||||||
|
EVEN
|
||||||
|
EXACT
|
||||||
|
EXP
|
||||||
|
EXPONDIST
|
||||||
|
FACT
|
||||||
|
FACTDOUBLE
|
||||||
|
FALSE
|
||||||
|
FDIST
|
||||||
|
FIND
|
||||||
|
FINDB
|
||||||
|
FINV
|
||||||
|
FISHER
|
||||||
|
FISHERINV
|
||||||
|
FIXED
|
||||||
|
FLOOR
|
||||||
|
FORECAST
|
||||||
|
FREQUENCY
|
||||||
|
FTEST
|
||||||
|
FV
|
||||||
|
FVSCHEDULE
|
||||||
|
GAMAMDIST
|
||||||
|
GAMMAINV
|
||||||
|
GAMMALN
|
||||||
|
GCD
|
||||||
|
GEOMEAN
|
||||||
|
GESTEP
|
||||||
|
GETPIVOTDATA
|
||||||
|
GROWTH
|
||||||
|
HARMEAN
|
||||||
|
HEX2BIN
|
||||||
|
HEX2OCT
|
||||||
|
HLOOKUP
|
||||||
|
HOUR
|
||||||
|
HYPERLINK
|
||||||
|
HYPGEOMDIST
|
||||||
|
IF
|
||||||
|
IFERROR
|
||||||
|
IMABS
|
||||||
|
IMAGINARY
|
||||||
|
IMARGUMENT
|
||||||
|
IMCONJUGATE
|
||||||
|
IMCOS
|
||||||
|
IMEXP
|
||||||
|
IMLN
|
||||||
|
IMLOG10
|
||||||
|
IMLOG2
|
||||||
|
IMPOWER
|
||||||
|
IMPRODUCT
|
||||||
|
IMREAL
|
||||||
|
IMSIN
|
||||||
|
IMSQRT
|
||||||
|
IMSUB
|
||||||
|
IMSUM
|
||||||
|
INDEX
|
||||||
|
INDIRECT
|
||||||
|
INFO
|
||||||
|
INT
|
||||||
|
INTERCEPT
|
||||||
|
INTRATE
|
||||||
|
IPMT
|
||||||
|
IRR
|
||||||
|
ISBLANK
|
||||||
|
ISERR
|
||||||
|
ISERROR
|
||||||
|
ISEVEN
|
||||||
|
ISLOGICAL
|
||||||
|
ISNA
|
||||||
|
ISNONTEXT
|
||||||
|
ISNUMBER
|
||||||
|
ISODD
|
||||||
|
ISPMT
|
||||||
|
ISREF
|
||||||
|
ISTEXT
|
||||||
|
JIS
|
||||||
|
KURT
|
||||||
|
LARGE
|
||||||
|
LCM
|
||||||
|
LEFT
|
||||||
|
LEFTB
|
||||||
|
LEN
|
||||||
|
LENB
|
||||||
|
LINEST
|
||||||
|
LN
|
||||||
|
LOG
|
||||||
|
LOG10
|
||||||
|
LOGEST
|
||||||
|
LOGINV
|
||||||
|
LOGNORMDIST
|
||||||
|
LOOKUP
|
||||||
|
LOWER
|
||||||
|
MATCH
|
||||||
|
MAX
|
||||||
|
MAXA
|
||||||
|
MDETERM
|
||||||
|
MDURATION
|
||||||
|
MEDIAN
|
||||||
|
MID
|
||||||
|
MIDB
|
||||||
|
MIN
|
||||||
|
MINA
|
||||||
|
MINUTE
|
||||||
|
MINVERSE
|
||||||
|
MIRR
|
||||||
|
MMULT
|
||||||
|
MOD
|
||||||
|
MODE
|
||||||
|
MONTH
|
||||||
|
MROUND
|
||||||
|
MULTINOMIAL
|
||||||
|
N
|
||||||
|
NA
|
||||||
|
NEGBINOMDIST
|
||||||
|
NETWORKDAYS
|
||||||
|
NOMINAL
|
||||||
|
NORMDIST
|
||||||
|
NORMINV
|
||||||
|
NORMSDIST
|
||||||
|
NORMSINV
|
||||||
|
NOT
|
||||||
|
NOW
|
||||||
|
NPER
|
||||||
|
NPV
|
||||||
|
OCT2BIN
|
||||||
|
OCT2DEC
|
||||||
|
OCT2HEX
|
||||||
|
ODD
|
||||||
|
ODDFPRICE
|
||||||
|
ODDFYIELD
|
||||||
|
ODDLPRICE
|
||||||
|
ODDLYIELD
|
||||||
|
OFFSET
|
||||||
|
OR
|
||||||
|
PEARSON
|
||||||
|
PERCENTILE
|
||||||
|
PERCENTRANK
|
||||||
|
PERMUT
|
||||||
|
PHONETIC
|
||||||
|
PI
|
||||||
|
PMT
|
||||||
|
POISSON
|
||||||
|
POWER
|
||||||
|
PPMT
|
||||||
|
PRICE
|
||||||
|
PRICEDISC
|
||||||
|
PRICEMAT
|
||||||
|
PROB
|
||||||
|
PRODUCT
|
||||||
|
PROPER
|
||||||
|
PV
|
||||||
|
QUARTILE
|
||||||
|
QUOTIENT
|
||||||
|
RADIANS
|
||||||
|
RAND
|
||||||
|
RANDBETWEEN
|
||||||
|
RANK
|
||||||
|
RATE
|
||||||
|
RECEIVED
|
||||||
|
REPLACE
|
||||||
|
REPLACEB
|
||||||
|
REPT
|
||||||
|
RIGHT
|
||||||
|
RIGHTB
|
||||||
|
ROMAN
|
||||||
|
ROUND
|
||||||
|
ROUNDDOWN
|
||||||
|
ROUNDUP
|
||||||
|
ROW
|
||||||
|
ROWS
|
||||||
|
RSQ
|
||||||
|
RTD
|
||||||
|
SEARCH
|
||||||
|
SEARCHB
|
||||||
|
SECOND
|
||||||
|
SERIESSUM
|
||||||
|
SIGN
|
||||||
|
SIN
|
||||||
|
SINH
|
||||||
|
SKEW
|
||||||
|
SLN
|
||||||
|
SLOPE
|
||||||
|
SMALL
|
||||||
|
SQRT
|
||||||
|
SQRTPI
|
||||||
|
STANDARDIZE
|
||||||
|
STDEV
|
||||||
|
STDEVA
|
||||||
|
STDEVP
|
||||||
|
STDEVPA
|
||||||
|
STEYX
|
||||||
|
SUBSTITUTE
|
||||||
|
SUBTOTAL
|
||||||
|
SUM
|
||||||
|
SUMIF
|
||||||
|
SUMIFS
|
||||||
|
SUMPRODUCT
|
||||||
|
SUMSQ
|
||||||
|
SUMX2MY2
|
||||||
|
SUMX2PY2
|
||||||
|
SUMXMY2
|
||||||
|
SYD
|
||||||
|
T
|
||||||
|
TAN
|
||||||
|
TANH
|
||||||
|
TBILLEQ
|
||||||
|
TBILLPRICE
|
||||||
|
TBILLYIELD
|
||||||
|
TDIST
|
||||||
|
TEXT
|
||||||
|
TIME
|
||||||
|
TIMEVALUE
|
||||||
|
TINV
|
||||||
|
TODAY
|
||||||
|
TRANSPOSE
|
||||||
|
TREND
|
||||||
|
TRIM
|
||||||
|
TRIMMEAN
|
||||||
|
TRUE
|
||||||
|
TRUNC
|
||||||
|
TTEST
|
||||||
|
TYPE
|
||||||
|
UPPER
|
||||||
|
USDOLLAR
|
||||||
|
VALUE
|
||||||
|
VAR
|
||||||
|
VARA
|
||||||
|
VARP
|
||||||
|
VARPA
|
||||||
|
VDB
|
||||||
|
VERSION
|
||||||
|
VLOOKUP
|
||||||
|
WEEKDAY
|
||||||
|
WEEKNUM
|
||||||
|
WEIBULL
|
||||||
|
WORKDAY
|
||||||
|
XIRR
|
||||||
|
XNPV
|
||||||
|
YEAR
|
||||||
|
YEARFRAC
|
||||||
|
YIELD
|
||||||
|
YIELDDISC
|
||||||
|
YIELDMAT
|
||||||
|
ZTEST
|
1
admin/helpers/PHPExcel/Calculation/index.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
1022
admin/helpers/PHPExcel/Cell.php
Normal file
192
admin/helpers/PHPExcel/Cell/AdvancedValueBinder.php
Normal file
@ -0,0 +1,192 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Cell
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/** PHPExcel root directory */
|
||||||
|
if (!defined('PHPEXCEL_ROOT')) {
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||||
|
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Cell_AdvancedValueBinder
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Cell
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Bind value to a cell
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Cell $cell Cell to bind value to
|
||||||
|
* @param mixed $value Value to bind in cell
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function bindValue(PHPExcel_Cell $cell, $value = null)
|
||||||
|
{
|
||||||
|
// sanitize UTF-8 strings
|
||||||
|
if (is_string($value)) {
|
||||||
|
$value = PHPExcel_Shared_String::SanitizeUTF8($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find out data type
|
||||||
|
$dataType = parent::dataTypeForValue($value);
|
||||||
|
|
||||||
|
// Style logic - strings
|
||||||
|
if ($dataType === PHPExcel_Cell_DataType::TYPE_STRING && !$value instanceof PHPExcel_RichText) {
|
||||||
|
// Test for booleans using locale-setting
|
||||||
|
if ($value == PHPExcel_Calculation::getTRUE()) {
|
||||||
|
$cell->setValueExplicit( TRUE, PHPExcel_Cell_DataType::TYPE_BOOL);
|
||||||
|
return true;
|
||||||
|
} elseif($value == PHPExcel_Calculation::getFALSE()) {
|
||||||
|
$cell->setValueExplicit( FALSE, PHPExcel_Cell_DataType::TYPE_BOOL);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for number in scientific format
|
||||||
|
if (preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NUMBER.'$/', $value)) {
|
||||||
|
$cell->setValueExplicit( (float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for fraction
|
||||||
|
if (preg_match('/^([+-]?)\s*([0-9]+)\s?\/\s*([0-9]+)$/', $value, $matches)) {
|
||||||
|
// Convert value to number
|
||||||
|
$value = $matches[2] / $matches[3];
|
||||||
|
if ($matches[1] == '-') $value = 0 - $value;
|
||||||
|
$cell->setValueExplicit( (float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||||
|
// Set style
|
||||||
|
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
||||||
|
->getNumberFormat()->setFormatCode( '??/??' );
|
||||||
|
return true;
|
||||||
|
} elseif (preg_match('/^([+-]?)([0-9]*) +([0-9]*)\s?\/\s*([0-9]*)$/', $value, $matches)) {
|
||||||
|
// Convert value to number
|
||||||
|
$value = $matches[2] + ($matches[3] / $matches[4]);
|
||||||
|
if ($matches[1] == '-') $value = 0 - $value;
|
||||||
|
$cell->setValueExplicit( (float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||||
|
// Set style
|
||||||
|
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
||||||
|
->getNumberFormat()->setFormatCode( '# ??/??' );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for percentage
|
||||||
|
if (preg_match('/^\-?[0-9]*\.?[0-9]*\s?\%$/', $value)) {
|
||||||
|
// Convert value to number
|
||||||
|
$value = (float) str_replace('%', '', $value) / 100;
|
||||||
|
$cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||||
|
// Set style
|
||||||
|
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
||||||
|
->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00 );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for currency
|
||||||
|
$currencyCode = PHPExcel_Shared_String::getCurrencyCode();
|
||||||
|
$decimalSeparator = PHPExcel_Shared_String::getDecimalSeparator();
|
||||||
|
$thousandsSeparator = PHPExcel_Shared_String::getThousandsSeparator();
|
||||||
|
if (preg_match('/^'.preg_quote($currencyCode).' *(\d{1,3}('.preg_quote($thousandsSeparator).'\d{3})*|(\d+))('.preg_quote($decimalSeparator).'\d{2})?$/', $value)) {
|
||||||
|
// Convert value to number
|
||||||
|
$value = (float) trim(str_replace(array($currencyCode, $thousandsSeparator, $decimalSeparator), array('', '', '.'), $value));
|
||||||
|
$cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||||
|
// Set style
|
||||||
|
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
||||||
|
->getNumberFormat()->setFormatCode(
|
||||||
|
str_replace('$', $currencyCode, PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE )
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
} elseif (preg_match('/^\$ *(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$/', $value)) {
|
||||||
|
// Convert value to number
|
||||||
|
$value = (float) trim(str_replace(array('$',','), '', $value));
|
||||||
|
$cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||||
|
// Set style
|
||||||
|
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
||||||
|
->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for time without seconds e.g. '9:45', '09:45'
|
||||||
|
if (preg_match('/^(\d|[0-1]\d|2[0-3]):[0-5]\d$/', $value)) {
|
||||||
|
// Convert value to number
|
||||||
|
list($h, $m) = explode(':', $value);
|
||||||
|
$days = $h / 24 + $m / 1440;
|
||||||
|
$cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||||
|
// Set style
|
||||||
|
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
||||||
|
->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME3 );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for time with seconds '9:45:59', '09:45:59'
|
||||||
|
if (preg_match('/^(\d|[0-1]\d|2[0-3]):[0-5]\d:[0-5]\d$/', $value)) {
|
||||||
|
// Convert value to number
|
||||||
|
list($h, $m, $s) = explode(':', $value);
|
||||||
|
$days = $h / 24 + $m / 1440 + $s / 86400;
|
||||||
|
// Convert value to number
|
||||||
|
$cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||||
|
// Set style
|
||||||
|
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
||||||
|
->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4 );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for datetime, e.g. '2008-12-31', '2008-12-31 15:59', '2008-12-31 15:59:10'
|
||||||
|
if (($d = PHPExcel_Shared_Date::stringToExcel($value)) !== false) {
|
||||||
|
// Convert value to number
|
||||||
|
$cell->setValueExplicit($d, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||||
|
// Determine style. Either there is a time part or not. Look for ':'
|
||||||
|
if (strpos($value, ':') !== false) {
|
||||||
|
$formatCode = 'yyyy-mm-dd h:mm';
|
||||||
|
} else {
|
||||||
|
$formatCode = 'yyyy-mm-dd';
|
||||||
|
}
|
||||||
|
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
||||||
|
->getNumberFormat()->setFormatCode($formatCode);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for newline character "\n"
|
||||||
|
if (strpos($value, "\n") !== FALSE) {
|
||||||
|
$value = PHPExcel_Shared_String::SanitizeUTF8($value);
|
||||||
|
$cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_STRING);
|
||||||
|
// Set style
|
||||||
|
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
|
||||||
|
->getAlignment()->setWrapText(TRUE);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not bound yet? Use parent...
|
||||||
|
return parent::bindValue($cell, $value);
|
||||||
|
}
|
||||||
|
}
|
122
admin/helpers/PHPExcel/Cell/DataType.php
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Cell
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Cell_DataType
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Cell
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_Cell_DataType
|
||||||
|
{
|
||||||
|
/* Data types */
|
||||||
|
const TYPE_STRING2 = 'str';
|
||||||
|
const TYPE_STRING = 's';
|
||||||
|
const TYPE_FORMULA = 'f';
|
||||||
|
const TYPE_NUMERIC = 'n';
|
||||||
|
const TYPE_BOOL = 'b';
|
||||||
|
const TYPE_NULL = 'null';
|
||||||
|
const TYPE_INLINE = 'inlineStr';
|
||||||
|
const TYPE_ERROR = 'e';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of error codes
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private static $_errorCodes = array(
|
||||||
|
'#NULL!' => 0,
|
||||||
|
'#DIV/0!' => 1,
|
||||||
|
'#VALUE!' => 2,
|
||||||
|
'#REF!' => 3,
|
||||||
|
'#NAME?' => 4,
|
||||||
|
'#NUM!' => 5,
|
||||||
|
'#N/A' => 6
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get list of error codes
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getErrorCodes() {
|
||||||
|
return self::$_errorCodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DataType for value
|
||||||
|
*
|
||||||
|
* @deprecated Replaced by PHPExcel_Cell_IValueBinder infrastructure, will be removed in version 1.8.0
|
||||||
|
* @param mixed $pValue
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function dataTypeForValue($pValue = null) {
|
||||||
|
return PHPExcel_Cell_DefaultValueBinder::dataTypeForValue($pValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check a string that it satisfies Excel requirements
|
||||||
|
*
|
||||||
|
* @param mixed Value to sanitize to an Excel string
|
||||||
|
* @return mixed Sanitized value
|
||||||
|
*/
|
||||||
|
public static function checkString($pValue = null)
|
||||||
|
{
|
||||||
|
if ($pValue instanceof PHPExcel_RichText) {
|
||||||
|
// TODO: Sanitize Rich-Text string (max. character count is 32,767)
|
||||||
|
return $pValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// string must never be longer than 32,767 characters, truncate if necessary
|
||||||
|
$pValue = PHPExcel_Shared_String::Substring($pValue, 0, 32767);
|
||||||
|
|
||||||
|
// we require that newline is represented as "\n" in core, not as "\r\n" or "\r"
|
||||||
|
$pValue = str_replace(array("\r\n", "\r"), "\n", $pValue);
|
||||||
|
|
||||||
|
return $pValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check a value that it is a valid error code
|
||||||
|
*
|
||||||
|
* @param mixed Value to sanitize to an Excel error code
|
||||||
|
* @return string Sanitized value
|
||||||
|
*/
|
||||||
|
public static function checkErrorCode($pValue = null)
|
||||||
|
{
|
||||||
|
$pValue = (string) $pValue;
|
||||||
|
|
||||||
|
if ( !array_key_exists($pValue, self::$_errorCodes) ) {
|
||||||
|
$pValue = '#NULL!';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $pValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
472
admin/helpers/PHPExcel/Cell/DataValidation.php
Normal file
@ -0,0 +1,472 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Cell
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Cell_DataValidation
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Cell
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_Cell_DataValidation
|
||||||
|
{
|
||||||
|
/* Data validation types */
|
||||||
|
const TYPE_NONE = 'none';
|
||||||
|
const TYPE_CUSTOM = 'custom';
|
||||||
|
const TYPE_DATE = 'date';
|
||||||
|
const TYPE_DECIMAL = 'decimal';
|
||||||
|
const TYPE_LIST = 'list';
|
||||||
|
const TYPE_TEXTLENGTH = 'textLength';
|
||||||
|
const TYPE_TIME = 'time';
|
||||||
|
const TYPE_WHOLE = 'whole';
|
||||||
|
|
||||||
|
/* Data validation error styles */
|
||||||
|
const STYLE_STOP = 'stop';
|
||||||
|
const STYLE_WARNING = 'warning';
|
||||||
|
const STYLE_INFORMATION = 'information';
|
||||||
|
|
||||||
|
/* Data validation operators */
|
||||||
|
const OPERATOR_BETWEEN = 'between';
|
||||||
|
const OPERATOR_EQUAL = 'equal';
|
||||||
|
const OPERATOR_GREATERTHAN = 'greaterThan';
|
||||||
|
const OPERATOR_GREATERTHANOREQUAL = 'greaterThanOrEqual';
|
||||||
|
const OPERATOR_LESSTHAN = 'lessThan';
|
||||||
|
const OPERATOR_LESSTHANOREQUAL = 'lessThanOrEqual';
|
||||||
|
const OPERATOR_NOTBETWEEN = 'notBetween';
|
||||||
|
const OPERATOR_NOTEQUAL = 'notEqual';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formula 1
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_formula1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formula 2
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_formula2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_type = PHPExcel_Cell_DataValidation::TYPE_NONE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Error style
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Operator
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_operator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allow Blank
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
private $_allowBlank;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show DropDown
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
private $_showDropDown;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show InputMessage
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
private $_showInputMessage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show ErrorMessage
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
private $_showErrorMessage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Error title
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_errorTitle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Error
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_error;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prompt title
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_promptTitle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prompt
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_prompt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new PHPExcel_Cell_DataValidation
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
// Initialise member variables
|
||||||
|
$this->_formula1 = '';
|
||||||
|
$this->_formula2 = '';
|
||||||
|
$this->_type = PHPExcel_Cell_DataValidation::TYPE_NONE;
|
||||||
|
$this->_errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP;
|
||||||
|
$this->_operator = '';
|
||||||
|
$this->_allowBlank = FALSE;
|
||||||
|
$this->_showDropDown = FALSE;
|
||||||
|
$this->_showInputMessage = FALSE;
|
||||||
|
$this->_showErrorMessage = FALSE;
|
||||||
|
$this->_errorTitle = '';
|
||||||
|
$this->_error = '';
|
||||||
|
$this->_promptTitle = '';
|
||||||
|
$this->_prompt = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Formula 1
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getFormula1() {
|
||||||
|
return $this->_formula1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Formula 1
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
* @return PHPExcel_Cell_DataValidation
|
||||||
|
*/
|
||||||
|
public function setFormula1($value = '') {
|
||||||
|
$this->_formula1 = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Formula 2
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getFormula2() {
|
||||||
|
return $this->_formula2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Formula 2
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
* @return PHPExcel_Cell_DataValidation
|
||||||
|
*/
|
||||||
|
public function setFormula2($value = '') {
|
||||||
|
$this->_formula2 = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Type
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getType() {
|
||||||
|
return $this->_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Type
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
* @return PHPExcel_Cell_DataValidation
|
||||||
|
*/
|
||||||
|
public function setType($value = PHPExcel_Cell_DataValidation::TYPE_NONE) {
|
||||||
|
$this->_type = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Error style
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getErrorStyle() {
|
||||||
|
return $this->_errorStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Error style
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
* @return PHPExcel_Cell_DataValidation
|
||||||
|
*/
|
||||||
|
public function setErrorStyle($value = PHPExcel_Cell_DataValidation::STYLE_STOP) {
|
||||||
|
$this->_errorStyle = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Operator
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getOperator() {
|
||||||
|
return $this->_operator;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Operator
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
* @return PHPExcel_Cell_DataValidation
|
||||||
|
*/
|
||||||
|
public function setOperator($value = '') {
|
||||||
|
$this->_operator = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Allow Blank
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function getAllowBlank() {
|
||||||
|
return $this->_allowBlank;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Allow Blank
|
||||||
|
*
|
||||||
|
* @param boolean $value
|
||||||
|
* @return PHPExcel_Cell_DataValidation
|
||||||
|
*/
|
||||||
|
public function setAllowBlank($value = false) {
|
||||||
|
$this->_allowBlank = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Show DropDown
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function getShowDropDown() {
|
||||||
|
return $this->_showDropDown;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Show DropDown
|
||||||
|
*
|
||||||
|
* @param boolean $value
|
||||||
|
* @return PHPExcel_Cell_DataValidation
|
||||||
|
*/
|
||||||
|
public function setShowDropDown($value = false) {
|
||||||
|
$this->_showDropDown = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Show InputMessage
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function getShowInputMessage() {
|
||||||
|
return $this->_showInputMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Show InputMessage
|
||||||
|
*
|
||||||
|
* @param boolean $value
|
||||||
|
* @return PHPExcel_Cell_DataValidation
|
||||||
|
*/
|
||||||
|
public function setShowInputMessage($value = false) {
|
||||||
|
$this->_showInputMessage = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Show ErrorMessage
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function getShowErrorMessage() {
|
||||||
|
return $this->_showErrorMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Show ErrorMessage
|
||||||
|
*
|
||||||
|
* @param boolean $value
|
||||||
|
* @return PHPExcel_Cell_DataValidation
|
||||||
|
*/
|
||||||
|
public function setShowErrorMessage($value = false) {
|
||||||
|
$this->_showErrorMessage = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Error title
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getErrorTitle() {
|
||||||
|
return $this->_errorTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Error title
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
* @return PHPExcel_Cell_DataValidation
|
||||||
|
*/
|
||||||
|
public function setErrorTitle($value = '') {
|
||||||
|
$this->_errorTitle = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Error
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getError() {
|
||||||
|
return $this->_error;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Error
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
* @return PHPExcel_Cell_DataValidation
|
||||||
|
*/
|
||||||
|
public function setError($value = '') {
|
||||||
|
$this->_error = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Prompt title
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getPromptTitle() {
|
||||||
|
return $this->_promptTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Prompt title
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
* @return PHPExcel_Cell_DataValidation
|
||||||
|
*/
|
||||||
|
public function setPromptTitle($value = '') {
|
||||||
|
$this->_promptTitle = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Prompt
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getPrompt() {
|
||||||
|
return $this->_prompt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Prompt
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
* @return PHPExcel_Cell_DataValidation
|
||||||
|
*/
|
||||||
|
public function setPrompt($value = '') {
|
||||||
|
$this->_prompt = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get hash code
|
||||||
|
*
|
||||||
|
* @return string Hash code
|
||||||
|
*/
|
||||||
|
public function getHashCode() {
|
||||||
|
return md5(
|
||||||
|
$this->_formula1
|
||||||
|
. $this->_formula2
|
||||||
|
. $this->_type = PHPExcel_Cell_DataValidation::TYPE_NONE
|
||||||
|
. $this->_errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP
|
||||||
|
. $this->_operator
|
||||||
|
. ($this->_allowBlank ? 't' : 'f')
|
||||||
|
. ($this->_showDropDown ? 't' : 'f')
|
||||||
|
. ($this->_showInputMessage ? 't' : 'f')
|
||||||
|
. ($this->_showErrorMessage ? 't' : 'f')
|
||||||
|
. $this->_errorTitle
|
||||||
|
. $this->_error
|
||||||
|
. $this->_promptTitle
|
||||||
|
. $this->_prompt
|
||||||
|
. __CLASS__
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||||
|
*/
|
||||||
|
public function __clone() {
|
||||||
|
$vars = get_object_vars($this);
|
||||||
|
foreach ($vars as $key => $value) {
|
||||||
|
if (is_object($value)) {
|
||||||
|
$this->$key = clone $value;
|
||||||
|
} else {
|
||||||
|
$this->$key = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
100
admin/helpers/PHPExcel/Cell/DefaultValueBinder.php
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Cell
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/** PHPExcel root directory */
|
||||||
|
if (!defined('PHPEXCEL_ROOT')) {
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||||
|
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Cell_DefaultValueBinder
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Cell
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Bind value to a cell
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Cell $cell Cell to bind value to
|
||||||
|
* @param mixed $value Value to bind in cell
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function bindValue(PHPExcel_Cell $cell, $value = null)
|
||||||
|
{
|
||||||
|
// sanitize UTF-8 strings
|
||||||
|
if (is_string($value)) {
|
||||||
|
$value = PHPExcel_Shared_String::SanitizeUTF8($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set value explicit
|
||||||
|
$cell->setValueExplicit( $value, self::dataTypeForValue($value) );
|
||||||
|
|
||||||
|
// Done!
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DataType for value
|
||||||
|
*
|
||||||
|
* @param mixed $pValue
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function dataTypeForValue($pValue = null) {
|
||||||
|
// Match the value against a few data types
|
||||||
|
if (is_null($pValue)) {
|
||||||
|
return PHPExcel_Cell_DataType::TYPE_NULL;
|
||||||
|
} elseif ($pValue === '') {
|
||||||
|
return PHPExcel_Cell_DataType::TYPE_STRING;
|
||||||
|
} elseif ($pValue instanceof PHPExcel_RichText) {
|
||||||
|
return PHPExcel_Cell_DataType::TYPE_INLINE;
|
||||||
|
} elseif ($pValue{0} === '=' && strlen($pValue) > 1) {
|
||||||
|
return PHPExcel_Cell_DataType::TYPE_FORMULA;
|
||||||
|
} elseif (is_bool($pValue)) {
|
||||||
|
return PHPExcel_Cell_DataType::TYPE_BOOL;
|
||||||
|
} elseif (is_float($pValue) || is_int($pValue)) {
|
||||||
|
return PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||||
|
} elseif (preg_match('/^\-?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)$/', $pValue)) {
|
||||||
|
if (is_string($pValue) && $pValue{0} === '0' && strlen($pValue) > 1 && $pValue{1} !== '.' ) {
|
||||||
|
return PHPExcel_Cell_DataType::TYPE_STRING;
|
||||||
|
}
|
||||||
|
return PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||||
|
} elseif (is_string($pValue) && array_key_exists($pValue, PHPExcel_Cell_DataType::getErrorCodes())) {
|
||||||
|
return PHPExcel_Cell_DataType::TYPE_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return PHPExcel_Cell_DataType::TYPE_STRING;
|
||||||
|
}
|
||||||
|
}
|
126
admin/helpers/PHPExcel/Cell/Hyperlink.php
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Cell
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Cell_Hyperlink
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Cell
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_Cell_Hyperlink
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* URL to link the cell to
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_url;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tooltip to display on the hyperlink
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_tooltip;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new PHPExcel_Cell_Hyperlink
|
||||||
|
*
|
||||||
|
* @param string $pUrl Url to link the cell to
|
||||||
|
* @param string $pTooltip Tooltip to display on the hyperlink
|
||||||
|
*/
|
||||||
|
public function __construct($pUrl = '', $pTooltip = '')
|
||||||
|
{
|
||||||
|
// Initialise member variables
|
||||||
|
$this->_url = $pUrl;
|
||||||
|
$this->_tooltip = $pTooltip;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get URL
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getUrl() {
|
||||||
|
return $this->_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set URL
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
* @return PHPExcel_Cell_Hyperlink
|
||||||
|
*/
|
||||||
|
public function setUrl($value = '') {
|
||||||
|
$this->_url = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get tooltip
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getTooltip() {
|
||||||
|
return $this->_tooltip;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set tooltip
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
* @return PHPExcel_Cell_Hyperlink
|
||||||
|
*/
|
||||||
|
public function setTooltip($value = '') {
|
||||||
|
$this->_tooltip = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is this hyperlink internal? (to another worksheet)
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isInternal() {
|
||||||
|
return strpos($this->_url, 'sheet://') !== false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get hash code
|
||||||
|
*
|
||||||
|
* @return string Hash code
|
||||||
|
*/
|
||||||
|
public function getHashCode() {
|
||||||
|
return md5(
|
||||||
|
$this->_url
|
||||||
|
. $this->_tooltip
|
||||||
|
. __CLASS__
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
46
admin/helpers/PHPExcel/Cell/IValueBinder.php
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Cell
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Cell_IValueBinder
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Cell
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
interface PHPExcel_Cell_IValueBinder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Bind value to a cell
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Cell $cell Cell to bind value to
|
||||||
|
* @param mixed $value Value to bind in cell
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function bindValue(PHPExcel_Cell $cell, $value = NULL);
|
||||||
|
}
|
1
admin/helpers/PHPExcel/Cell/index.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
635
admin/helpers/PHPExcel/Chart.php
Normal file
@ -0,0 +1,635 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Chart
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Chart
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Chart
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_Chart
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Chart Name
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_name = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Worksheet
|
||||||
|
*
|
||||||
|
* @var PHPExcel_Worksheet
|
||||||
|
*/
|
||||||
|
private $_worksheet = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chart Title
|
||||||
|
*
|
||||||
|
* @var PHPExcel_Chart_Title
|
||||||
|
*/
|
||||||
|
private $_title = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chart Legend
|
||||||
|
*
|
||||||
|
* @var PHPExcel_Chart_Legend
|
||||||
|
*/
|
||||||
|
private $_legend = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* X-Axis Label
|
||||||
|
*
|
||||||
|
* @var PHPExcel_Chart_Title
|
||||||
|
*/
|
||||||
|
private $_xAxisLabel = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Y-Axis Label
|
||||||
|
*
|
||||||
|
* @var PHPExcel_Chart_Title
|
||||||
|
*/
|
||||||
|
private $_yAxisLabel = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chart Plot Area
|
||||||
|
*
|
||||||
|
* @var PHPExcel_Chart_PlotArea
|
||||||
|
*/
|
||||||
|
private $_plotArea = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plot Visible Only
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
private $_plotVisibleOnly = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display Blanks as
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_displayBlanksAs = '0';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chart Asix Y as
|
||||||
|
*
|
||||||
|
* @var PHPExcel_Chart_Axis
|
||||||
|
*/
|
||||||
|
private $_yAxis = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chart Asix X as
|
||||||
|
*
|
||||||
|
* @var PHPExcel_Chart_Axis
|
||||||
|
*/
|
||||||
|
private $_xAxis = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chart Major Gridlines as
|
||||||
|
*
|
||||||
|
* @var PHPExcel_Chart_Gridlines
|
||||||
|
*/
|
||||||
|
private $_majorGridlines = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chart Minor Gridlines as
|
||||||
|
*
|
||||||
|
* @var PHPExcel_Chart_Gridlines
|
||||||
|
*/
|
||||||
|
private $_minorGridlines = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Top-Left Cell Position
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_topLeftCellRef = 'A1';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Top-Left X-Offset
|
||||||
|
*
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
private $_topLeftXOffset = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Top-Left Y-Offset
|
||||||
|
*
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
private $_topLeftYOffset = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bottom-Right Cell Position
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_bottomRightCellRef = 'A1';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bottom-Right X-Offset
|
||||||
|
*
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
private $_bottomRightXOffset = 10;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bottom-Right Y-Offset
|
||||||
|
*
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
private $_bottomRightYOffset = 10;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new PHPExcel_Chart
|
||||||
|
*/
|
||||||
|
public function __construct($name, PHPExcel_Chart_Title $title = null, PHPExcel_Chart_Legend $legend = null, PHPExcel_Chart_PlotArea $plotArea = null, $plotVisibleOnly = true, $displayBlanksAs = '0', PHPExcel_Chart_Title $xAxisLabel = null, PHPExcel_Chart_Title $yAxisLabel = null, PHPExcel_Chart_Axis $xAxis = null, PHPExcel_Chart_Axis $yAxis = null, PHPExcel_Chart_Gridlines $majorGridlines = null, PHPExcel_Chart_Gridlines $minorGridlines = null)
|
||||||
|
{
|
||||||
|
$this->_name = $name;
|
||||||
|
$this->_title = $title;
|
||||||
|
$this->_legend = $legend;
|
||||||
|
$this->_xAxisLabel = $xAxisLabel;
|
||||||
|
$this->_yAxisLabel = $yAxisLabel;
|
||||||
|
$this->_plotArea = $plotArea;
|
||||||
|
$this->_plotVisibleOnly = $plotVisibleOnly;
|
||||||
|
$this->_displayBlanksAs = $displayBlanksAs;
|
||||||
|
$this->_xAxis = $xAxis;
|
||||||
|
$this->_yAxis = $yAxis;
|
||||||
|
$this->_majorGridlines = $majorGridlines;
|
||||||
|
$this->_minorGridlines = $minorGridlines;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getName() {
|
||||||
|
return $this->_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Worksheet
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Worksheet
|
||||||
|
*/
|
||||||
|
public function getWorksheet() {
|
||||||
|
return $this->_worksheet;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Worksheet
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Worksheet $pValue
|
||||||
|
* @throws PHPExcel_Chart_Exception
|
||||||
|
* @return PHPExcel_Chart
|
||||||
|
*/
|
||||||
|
public function setWorksheet(PHPExcel_Worksheet $pValue = null) {
|
||||||
|
$this->_worksheet = $pValue;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Title
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Chart_Title
|
||||||
|
*/
|
||||||
|
public function getTitle() {
|
||||||
|
return $this->_title;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Title
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Chart_Title $title
|
||||||
|
* @return PHPExcel_Chart
|
||||||
|
*/
|
||||||
|
public function setTitle(PHPExcel_Chart_Title $title) {
|
||||||
|
$this->_title = $title;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Legend
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Chart_Legend
|
||||||
|
*/
|
||||||
|
public function getLegend() {
|
||||||
|
return $this->_legend;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Legend
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Chart_Legend $legend
|
||||||
|
* @return PHPExcel_Chart
|
||||||
|
*/
|
||||||
|
public function setLegend(PHPExcel_Chart_Legend $legend) {
|
||||||
|
$this->_legend = $legend;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get X-Axis Label
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Chart_Title
|
||||||
|
*/
|
||||||
|
public function getXAxisLabel() {
|
||||||
|
return $this->_xAxisLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set X-Axis Label
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Chart_Title $label
|
||||||
|
* @return PHPExcel_Chart
|
||||||
|
*/
|
||||||
|
public function setXAxisLabel(PHPExcel_Chart_Title $label) {
|
||||||
|
$this->_xAxisLabel = $label;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Y-Axis Label
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Chart_Title
|
||||||
|
*/
|
||||||
|
public function getYAxisLabel() {
|
||||||
|
return $this->_yAxisLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Y-Axis Label
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Chart_Title $label
|
||||||
|
* @return PHPExcel_Chart
|
||||||
|
*/
|
||||||
|
public function setYAxisLabel(PHPExcel_Chart_Title $label) {
|
||||||
|
$this->_yAxisLabel = $label;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Plot Area
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Chart_PlotArea
|
||||||
|
*/
|
||||||
|
public function getPlotArea() {
|
||||||
|
return $this->_plotArea;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Plot Visible Only
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function getPlotVisibleOnly() {
|
||||||
|
return $this->_plotVisibleOnly;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Plot Visible Only
|
||||||
|
*
|
||||||
|
* @param boolean $plotVisibleOnly
|
||||||
|
* @return PHPExcel_Chart
|
||||||
|
*/
|
||||||
|
public function setPlotVisibleOnly($plotVisibleOnly = true) {
|
||||||
|
$this->_plotVisibleOnly = $plotVisibleOnly;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Display Blanks as
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getDisplayBlanksAs() {
|
||||||
|
return $this->_displayBlanksAs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Display Blanks as
|
||||||
|
*
|
||||||
|
* @param string $displayBlanksAs
|
||||||
|
* @return PHPExcel_Chart
|
||||||
|
*/
|
||||||
|
public function setDisplayBlanksAs($displayBlanksAs = '0') {
|
||||||
|
$this->_displayBlanksAs = $displayBlanksAs;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get yAxis
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Chart_Axis
|
||||||
|
*/
|
||||||
|
public function getChartAxisY() {
|
||||||
|
if($this->_yAxis !== NULL){
|
||||||
|
return $this->_yAxis;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new PHPExcel_Chart_Axis();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get xAxis
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Chart_Axis
|
||||||
|
*/
|
||||||
|
public function getChartAxisX() {
|
||||||
|
if($this->_xAxis !== NULL){
|
||||||
|
return $this->_xAxis;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new PHPExcel_Chart_Axis();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Major Gridlines
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Chart_Gridlines
|
||||||
|
*/
|
||||||
|
public function getMajorGridlines() {
|
||||||
|
if($this->_majorGridlines !== NULL){
|
||||||
|
return $this->_majorGridlines;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new PHPExcel_Chart_Gridlines();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Minor Gridlines
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Chart_Gridlines
|
||||||
|
*/
|
||||||
|
public function getMinorGridlines() {
|
||||||
|
if($this->_minorGridlines !== NULL){
|
||||||
|
return $this->_minorGridlines;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new PHPExcel_Chart_Gridlines();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the Top Left position for the chart
|
||||||
|
*
|
||||||
|
* @param string $cell
|
||||||
|
* @param integer $xOffset
|
||||||
|
* @param integer $yOffset
|
||||||
|
* @return PHPExcel_Chart
|
||||||
|
*/
|
||||||
|
public function setTopLeftPosition($cell, $xOffset=null, $yOffset=null) {
|
||||||
|
$this->_topLeftCellRef = $cell;
|
||||||
|
if (!is_null($xOffset))
|
||||||
|
$this->setTopLeftXOffset($xOffset);
|
||||||
|
if (!is_null($yOffset))
|
||||||
|
$this->setTopLeftYOffset($yOffset);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the top left position of the chart
|
||||||
|
*
|
||||||
|
* @return array an associative array containing the cell address, X-Offset and Y-Offset from the top left of that cell
|
||||||
|
*/
|
||||||
|
public function getTopLeftPosition() {
|
||||||
|
return array( 'cell' => $this->_topLeftCellRef,
|
||||||
|
'xOffset' => $this->_topLeftXOffset,
|
||||||
|
'yOffset' => $this->_topLeftYOffset
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the cell address where the top left of the chart is fixed
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getTopLeftCell() {
|
||||||
|
return $this->_topLeftCellRef;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the Top Left cell position for the chart
|
||||||
|
*
|
||||||
|
* @param string $cell
|
||||||
|
* @return PHPExcel_Chart
|
||||||
|
*/
|
||||||
|
public function setTopLeftCell($cell) {
|
||||||
|
$this->_topLeftCellRef = $cell;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the offset position within the Top Left cell for the chart
|
||||||
|
*
|
||||||
|
* @param integer $xOffset
|
||||||
|
* @param integer $yOffset
|
||||||
|
* @return PHPExcel_Chart
|
||||||
|
*/
|
||||||
|
public function setTopLeftOffset($xOffset=null,$yOffset=null) {
|
||||||
|
if (!is_null($xOffset))
|
||||||
|
$this->setTopLeftXOffset($xOffset);
|
||||||
|
if (!is_null($yOffset))
|
||||||
|
$this->setTopLeftYOffset($yOffset);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the offset position within the Top Left cell for the chart
|
||||||
|
*
|
||||||
|
* @return integer[]
|
||||||
|
*/
|
||||||
|
public function getTopLeftOffset() {
|
||||||
|
return array( 'X' => $this->_topLeftXOffset,
|
||||||
|
'Y' => $this->_topLeftYOffset
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setTopLeftXOffset($xOffset) {
|
||||||
|
$this->_topLeftXOffset = $xOffset;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTopLeftXOffset() {
|
||||||
|
return $this->_topLeftXOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setTopLeftYOffset($yOffset) {
|
||||||
|
$this->_topLeftYOffset = $yOffset;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTopLeftYOffset() {
|
||||||
|
return $this->_topLeftYOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the Bottom Right position of the chart
|
||||||
|
*
|
||||||
|
* @param string $cell
|
||||||
|
* @param integer $xOffset
|
||||||
|
* @param integer $yOffset
|
||||||
|
* @return PHPExcel_Chart
|
||||||
|
*/
|
||||||
|
public function setBottomRightPosition($cell, $xOffset=null, $yOffset=null) {
|
||||||
|
$this->_bottomRightCellRef = $cell;
|
||||||
|
if (!is_null($xOffset))
|
||||||
|
$this->setBottomRightXOffset($xOffset);
|
||||||
|
if (!is_null($yOffset))
|
||||||
|
$this->setBottomRightYOffset($yOffset);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the bottom right position of the chart
|
||||||
|
*
|
||||||
|
* @return array an associative array containing the cell address, X-Offset and Y-Offset from the top left of that cell
|
||||||
|
*/
|
||||||
|
public function getBottomRightPosition() {
|
||||||
|
return array( 'cell' => $this->_bottomRightCellRef,
|
||||||
|
'xOffset' => $this->_bottomRightXOffset,
|
||||||
|
'yOffset' => $this->_bottomRightYOffset
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setBottomRightCell($cell) {
|
||||||
|
$this->_bottomRightCellRef = $cell;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the cell address where the bottom right of the chart is fixed
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getBottomRightCell() {
|
||||||
|
return $this->_bottomRightCellRef;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the offset position within the Bottom Right cell for the chart
|
||||||
|
*
|
||||||
|
* @param integer $xOffset
|
||||||
|
* @param integer $yOffset
|
||||||
|
* @return PHPExcel_Chart
|
||||||
|
*/
|
||||||
|
public function setBottomRightOffset($xOffset=null,$yOffset=null) {
|
||||||
|
if (!is_null($xOffset))
|
||||||
|
$this->setBottomRightXOffset($xOffset);
|
||||||
|
if (!is_null($yOffset))
|
||||||
|
$this->setBottomRightYOffset($yOffset);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the offset position within the Bottom Right cell for the chart
|
||||||
|
*
|
||||||
|
* @return integer[]
|
||||||
|
*/
|
||||||
|
public function getBottomRightOffset() {
|
||||||
|
return array( 'X' => $this->_bottomRightXOffset,
|
||||||
|
'Y' => $this->_bottomRightYOffset
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setBottomRightXOffset($xOffset) {
|
||||||
|
$this->_bottomRightXOffset = $xOffset;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBottomRightXOffset() {
|
||||||
|
return $this->_bottomRightXOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setBottomRightYOffset($yOffset) {
|
||||||
|
$this->_bottomRightYOffset = $yOffset;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBottomRightYOffset() {
|
||||||
|
return $this->_bottomRightYOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function refresh() {
|
||||||
|
if ($this->_worksheet !== NULL) {
|
||||||
|
$this->_plotArea->refresh($this->_worksheet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function render($outputDestination = null) {
|
||||||
|
$libraryName = PHPExcel_Settings::getChartRendererName();
|
||||||
|
if (is_null($libraryName)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// Ensure that data series values are up-to-date before we render
|
||||||
|
$this->refresh();
|
||||||
|
|
||||||
|
$libraryPath = PHPExcel_Settings::getChartRendererPath();
|
||||||
|
$includePath = str_replace('\\','/',get_include_path());
|
||||||
|
$rendererPath = str_replace('\\','/',$libraryPath);
|
||||||
|
if (strpos($rendererPath,$includePath) === false) {
|
||||||
|
set_include_path(get_include_path() . PATH_SEPARATOR . $libraryPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
$rendererName = 'PHPExcel_Chart_Renderer_'.$libraryName;
|
||||||
|
$renderer = new $rendererName($this);
|
||||||
|
|
||||||
|
if ($outputDestination == 'php://output') {
|
||||||
|
$outputDestination = null;
|
||||||
|
}
|
||||||
|
return $renderer->render($outputDestination);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
584
admin/helpers/PHPExcel/Chart/Axis.php
Normal file
@ -0,0 +1,584 @@
|
|||||||
|
<?php
|
||||||
|
require_once 'Properties.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: Wiktor Trzonkowski
|
||||||
|
* Date: 6/17/14
|
||||||
|
* Time: 12:11 PM
|
||||||
|
*/
|
||||||
|
|
||||||
|
class PHPExcel_Chart_Axis extends
|
||||||
|
PHPExcel_Properties {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Axis Number
|
||||||
|
*
|
||||||
|
* @var array of mixed
|
||||||
|
*/
|
||||||
|
|
||||||
|
private
|
||||||
|
$_axis_number = array(
|
||||||
|
'format' => self::FORMAT_CODE_GENERAL,
|
||||||
|
'source_linked' => 1
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Axis Options
|
||||||
|
*
|
||||||
|
* @var array of mixed
|
||||||
|
*/
|
||||||
|
|
||||||
|
private $_axis_options = array(
|
||||||
|
'minimum' => NULL,
|
||||||
|
'maximum' => NULL,
|
||||||
|
'major_unit' => NULL,
|
||||||
|
'minor_unit' => NULL,
|
||||||
|
'orientation' => self::ORIENTATION_NORMAL,
|
||||||
|
'minor_tick_mark' => self::TICK_MARK_NONE,
|
||||||
|
'major_tick_mark' => self::TICK_MARK_NONE,
|
||||||
|
'axis_labels' => self::AXIS_LABELS_NEXT_TO,
|
||||||
|
'horizontal_crosses' => self::HORIZONTAL_CROSSES_AUTOZERO,
|
||||||
|
'horizontal_crosses_value' => NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fill Properties
|
||||||
|
*
|
||||||
|
* @var array of mixed
|
||||||
|
*/
|
||||||
|
|
||||||
|
private $_fill_properties = array(
|
||||||
|
'type' => self::EXCEL_COLOR_TYPE_ARGB,
|
||||||
|
'value' => NULL,
|
||||||
|
'alpha' => 0
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Line Properties
|
||||||
|
*
|
||||||
|
* @var array of mixed
|
||||||
|
*/
|
||||||
|
|
||||||
|
private $_line_properties = array(
|
||||||
|
'type' => self::EXCEL_COLOR_TYPE_ARGB,
|
||||||
|
'value' => NULL,
|
||||||
|
'alpha' => 0
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Line Style Properties
|
||||||
|
*
|
||||||
|
* @var array of mixed
|
||||||
|
*/
|
||||||
|
|
||||||
|
private $_line_style_properties = array(
|
||||||
|
'width' => '9525',
|
||||||
|
'compound' => self::LINE_STYLE_COMPOUND_SIMPLE,
|
||||||
|
'dash' => self::LINE_STYLE_DASH_SOLID,
|
||||||
|
'cap' => self::LINE_STYLE_CAP_FLAT,
|
||||||
|
'join' => self::LINE_STYLE_JOIN_BEVEL,
|
||||||
|
'arrow' => array(
|
||||||
|
'head' => array(
|
||||||
|
'type' => self::LINE_STYLE_ARROW_TYPE_NOARROW,
|
||||||
|
'size' => self::LINE_STYLE_ARROW_SIZE_5
|
||||||
|
),
|
||||||
|
'end' => array(
|
||||||
|
'type' => self::LINE_STYLE_ARROW_TYPE_NOARROW,
|
||||||
|
'size' => self::LINE_STYLE_ARROW_SIZE_8
|
||||||
|
),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shadow Properties
|
||||||
|
*
|
||||||
|
* @var array of mixed
|
||||||
|
*/
|
||||||
|
|
||||||
|
private $_shadow_properties = array(
|
||||||
|
'presets' => self::SHADOW_PRESETS_NOSHADOW,
|
||||||
|
'effect' => NULL,
|
||||||
|
'color' => array(
|
||||||
|
'type' => self::EXCEL_COLOR_TYPE_STANDARD,
|
||||||
|
'value' => 'black',
|
||||||
|
'alpha' => 40,
|
||||||
|
),
|
||||||
|
'size' => array(
|
||||||
|
'sx' => NULL,
|
||||||
|
'sy' => NULL,
|
||||||
|
'kx' => NULL
|
||||||
|
),
|
||||||
|
'blur' => NULL,
|
||||||
|
'direction' => NULL,
|
||||||
|
'distance' => NULL,
|
||||||
|
'algn' => NULL,
|
||||||
|
'rotWithShape' => NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Glow Properties
|
||||||
|
*
|
||||||
|
* @var array of mixed
|
||||||
|
*/
|
||||||
|
|
||||||
|
private $_glow_properties = array(
|
||||||
|
'size' => NULL,
|
||||||
|
'color' => array(
|
||||||
|
'type' => self::EXCEL_COLOR_TYPE_STANDARD,
|
||||||
|
'value' => 'black',
|
||||||
|
'alpha' => 40
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Soft Edge Properties
|
||||||
|
*
|
||||||
|
* @var array of mixed
|
||||||
|
*/
|
||||||
|
|
||||||
|
private $_soft_edges = array(
|
||||||
|
'size' => NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Series Data Type
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function setAxisNumberProperties($format_code) {
|
||||||
|
$this->_axis_number['format'] = (string) $format_code;
|
||||||
|
$this->_axis_number['source_linked'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Axis Number Format Data Type
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function getAxisNumberFormat() {
|
||||||
|
return $this->_axis_number['format'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Axis Number Source Linked
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function getAxisNumberSourceLinked() {
|
||||||
|
return (string) $this->_axis_number['source_linked'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Axis Options Properties
|
||||||
|
*
|
||||||
|
* @param string $axis_labels
|
||||||
|
* @param string $horizontal_crosses_value
|
||||||
|
* @param string $horizontal_crosses
|
||||||
|
* @param string $axis_orientation
|
||||||
|
* @param string $major_tmt
|
||||||
|
* @param string $minor_tmt
|
||||||
|
* @param string $minimum
|
||||||
|
* @param string $maximum
|
||||||
|
* @param string $major_unit
|
||||||
|
* @param string $minor_unit
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function setAxisOptionsProperties($axis_labels, $horizontal_crosses_value = NULL, $horizontal_crosses = NULL,
|
||||||
|
$axis_orientation = NULL, $major_tmt = NULL, $minor_tmt = NULL, $minimum = NULL, $maximum = NULL, $major_unit = NULL,
|
||||||
|
$minor_unit = NULL) {
|
||||||
|
|
||||||
|
$this->_axis_options['axis_labels'] = (string) $axis_labels;
|
||||||
|
($horizontal_crosses_value !== NULL)
|
||||||
|
? $this->_axis_options['horizontal_crosses_value'] = (string) $horizontal_crosses_value : NULL;
|
||||||
|
($horizontal_crosses !== NULL) ? $this->_axis_options['horizontal_crosses'] = (string) $horizontal_crosses : NULL;
|
||||||
|
($axis_orientation !== NULL) ? $this->_axis_options['orientation'] = (string) $axis_orientation : NULL;
|
||||||
|
($major_tmt !== NULL) ? $this->_axis_options['major_tick_mark'] = (string) $major_tmt : NULL;
|
||||||
|
($minor_tmt !== NULL) ? $this->_axis_options['minor_tick_mark'] = (string) $minor_tmt : NULL;
|
||||||
|
($minor_tmt !== NULL) ? $this->_axis_options['minor_tick_mark'] = (string) $minor_tmt : NULL;
|
||||||
|
($minimum !== NULL) ? $this->_axis_options['minimum'] = (string) $minimum : NULL;
|
||||||
|
($maximum !== NULL) ? $this->_axis_options['maximum'] = (string) $maximum : NULL;
|
||||||
|
($major_unit !== NULL) ? $this->_axis_options['major_unit'] = (string) $major_unit : NULL;
|
||||||
|
($minor_unit !== NULL) ? $this->_axis_options['minor_unit'] = (string) $minor_unit : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Axis Options Property
|
||||||
|
*
|
||||||
|
* @param string $property
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function getAxisOptionsProperty($property) {
|
||||||
|
return $this->_axis_options[$property];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Axis Orientation Property
|
||||||
|
*
|
||||||
|
* @param string $orientation
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function setAxisOrientation($orientation) {
|
||||||
|
$this->orientation = (string) $orientation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Fill Property
|
||||||
|
*
|
||||||
|
* @param string $color
|
||||||
|
* @param int $alpha
|
||||||
|
* @param string $type
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function setFillParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB) {
|
||||||
|
$this->_fill_properties = $this->setColorProperties($color, $alpha, $type);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Line Property
|
||||||
|
*
|
||||||
|
* @param string $color
|
||||||
|
* @param int $alpha
|
||||||
|
* @param string $type
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function setLineParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB) {
|
||||||
|
$this->_line_properties = $this->setColorProperties($color, $alpha, $type);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Fill Property
|
||||||
|
*
|
||||||
|
* @param string $property
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function getFillProperty($property) {
|
||||||
|
return $this->_fill_properties[$property];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Line Property
|
||||||
|
*
|
||||||
|
* @param string $property
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function getLineProperty($property) {
|
||||||
|
return $this->_line_properties[$property];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Line Style Properties
|
||||||
|
*
|
||||||
|
* @param float $line_width
|
||||||
|
* @param string $compound_type
|
||||||
|
* @param string $dash_type
|
||||||
|
* @param string $cap_type
|
||||||
|
* @param string $join_type
|
||||||
|
* @param string $head_arrow_type
|
||||||
|
* @param string $head_arrow_size
|
||||||
|
* @param string $end_arrow_type
|
||||||
|
* @param string $end_arrow_size
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function setLineStyleProperties($line_width = NULL, $compound_type = NULL,
|
||||||
|
$dash_type = NULL, $cap_type = NULL, $join_type = NULL, $head_arrow_type = NULL,
|
||||||
|
$head_arrow_size = NULL, $end_arrow_type = NULL, $end_arrow_size = NULL) {
|
||||||
|
|
||||||
|
(!is_null($line_width)) ? $this->_line_style_properties['width'] = $this->getExcelPointsWidth((float) $line_width)
|
||||||
|
: NULL;
|
||||||
|
(!is_null($compound_type)) ? $this->_line_style_properties['compound'] = (string) $compound_type : NULL;
|
||||||
|
(!is_null($dash_type)) ? $this->_line_style_properties['dash'] = (string) $dash_type : NULL;
|
||||||
|
(!is_null($cap_type)) ? $this->_line_style_properties['cap'] = (string) $cap_type : NULL;
|
||||||
|
(!is_null($join_type)) ? $this->_line_style_properties['join'] = (string) $join_type : NULL;
|
||||||
|
(!is_null($head_arrow_type)) ? $this->_line_style_properties['arrow']['head']['type'] = (string) $head_arrow_type
|
||||||
|
: NULL;
|
||||||
|
(!is_null($head_arrow_size)) ? $this->_line_style_properties['arrow']['head']['size'] = (string) $head_arrow_size
|
||||||
|
: NULL;
|
||||||
|
(!is_null($end_arrow_type)) ? $this->_line_style_properties['arrow']['end']['type'] = (string) $end_arrow_type
|
||||||
|
: NULL;
|
||||||
|
(!is_null($end_arrow_size)) ? $this->_line_style_properties['arrow']['end']['size'] = (string) $end_arrow_size
|
||||||
|
: NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Line Style Property
|
||||||
|
*
|
||||||
|
* @param array|string $elements
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function getLineStyleProperty($elements) {
|
||||||
|
return $this->getArrayElementsValue($this->_line_style_properties, $elements);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Line Style Arrow Excel Width
|
||||||
|
*
|
||||||
|
* @param string $arrow
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function getLineStyleArrowWidth($arrow) {
|
||||||
|
return $this->getLineStyleArrowSize($this->_line_style_properties['arrow'][$arrow]['size'], 'w');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Line Style Arrow Excel Length
|
||||||
|
*
|
||||||
|
* @param string $arrow
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function getLineStyleArrowLength($arrow) {
|
||||||
|
return $this->getLineStyleArrowSize($this->_line_style_properties['arrow'][$arrow]['size'], 'len');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Shadow Properties
|
||||||
|
*
|
||||||
|
* @param int $shadow_presets
|
||||||
|
* @param string $sh_color_value
|
||||||
|
* @param string $sh_color_type
|
||||||
|
* @param string $sh_color_alpha
|
||||||
|
* @param float $sh_blur
|
||||||
|
* @param int $sh_angle
|
||||||
|
* @param float $sh_distance
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function setShadowProperties($sh_presets, $sh_color_value = NULL, $sh_color_type = NULL, $sh_color_alpha = NULL, $sh_blur = NULL, $sh_angle = NULL, $sh_distance = NULL) {
|
||||||
|
$this
|
||||||
|
->_setShadowPresetsProperties((int) $sh_presets)
|
||||||
|
->_setShadowColor(
|
||||||
|
is_null($sh_color_value) ? $this->_shadow_properties['color']['value'] : $sh_color_value
|
||||||
|
, is_null($sh_color_alpha) ? (int) $this->_shadow_properties['color']['alpha'] : $sh_color_alpha
|
||||||
|
, is_null($sh_color_type) ? $this->_shadow_properties['color']['type'] : $sh_color_type)
|
||||||
|
->_setShadowBlur($sh_blur)
|
||||||
|
->_setShadowAngle($sh_angle)
|
||||||
|
->_setShadowDistance($sh_distance);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Shadow Color
|
||||||
|
*
|
||||||
|
* @param int $shadow_presets
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Chart_Axis
|
||||||
|
*/
|
||||||
|
|
||||||
|
private function _setShadowPresetsProperties($shadow_presets) {
|
||||||
|
$this->_shadow_properties['presets'] = $shadow_presets;
|
||||||
|
$this->_setShadowProperiesMapValues($this->getShadowPresetsMap($shadow_presets));
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Shadow Properties from Maped Values
|
||||||
|
*
|
||||||
|
* @param array $properties_map
|
||||||
|
* @param * $reference
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Chart_Axis
|
||||||
|
*/
|
||||||
|
|
||||||
|
private function _setShadowProperiesMapValues(array $properties_map, &$reference = NULL) {
|
||||||
|
$base_reference = $reference;
|
||||||
|
foreach ($properties_map as $property_key => $property_val) {
|
||||||
|
if (is_array($property_val)) {
|
||||||
|
if ($reference === NULL) {
|
||||||
|
$reference = & $this->_shadow_properties[$property_key];
|
||||||
|
} else {
|
||||||
|
$reference = & $reference[$property_key];
|
||||||
|
}
|
||||||
|
$this->_setShadowProperiesMapValues($property_val, $reference);
|
||||||
|
} else {
|
||||||
|
if ($base_reference === NULL) {
|
||||||
|
$this->_shadow_properties[$property_key] = $property_val;
|
||||||
|
} else {
|
||||||
|
$reference[$property_key] = $property_val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Shadow Color
|
||||||
|
*
|
||||||
|
* @param string $color
|
||||||
|
* @param int $alpha
|
||||||
|
* @param string $type
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Chart_Axis
|
||||||
|
*/
|
||||||
|
|
||||||
|
private function _setShadowColor($color, $alpha, $type) {
|
||||||
|
$this->_shadow_properties['color'] = $this->setColorProperties($color, $alpha, $type);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Shadow Blur
|
||||||
|
*
|
||||||
|
* @param float $blur
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Chart_Axis
|
||||||
|
*/
|
||||||
|
|
||||||
|
private function _setShadowBlur($blur) {
|
||||||
|
if ($blur !== NULL) {
|
||||||
|
$this->_shadow_properties['blur'] = (string) $this->getExcelPointsWidth($blur);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Shadow Angle
|
||||||
|
*
|
||||||
|
* @param int $angle
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Chart_Axis
|
||||||
|
*/
|
||||||
|
|
||||||
|
private function _setShadowAngle($angle) {
|
||||||
|
if ($angle !== NULL) {
|
||||||
|
$this->_shadow_properties['direction'] = (string) $this->getExcelPointsAngle($angle);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Shadow Distance
|
||||||
|
*
|
||||||
|
* @param float $distance
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Chart_Axis
|
||||||
|
*/
|
||||||
|
|
||||||
|
private function _setShadowDistance($distance) {
|
||||||
|
if ($distance !== NULL) {
|
||||||
|
$this->_shadow_properties['distance'] = (string) $this->getExcelPointsWidth($distance);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Glow Property
|
||||||
|
*
|
||||||
|
* @param float $size
|
||||||
|
* @param string $color_value
|
||||||
|
* @param int $color_alpha
|
||||||
|
* @param string $color_type
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function getShadowProperty($elements) {
|
||||||
|
return $this->getArrayElementsValue($this->_shadow_properties, $elements);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Glow Properties
|
||||||
|
*
|
||||||
|
* @param float $size
|
||||||
|
* @param string $color_value
|
||||||
|
* @param int $color_alpha
|
||||||
|
* @param string $color_type
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function setGlowProperties($size, $color_value = NULL, $color_alpha = NULL, $color_type = NULL) {
|
||||||
|
$this
|
||||||
|
->_setGlowSize($size)
|
||||||
|
->_setGlowColor(
|
||||||
|
is_null($color_value) ? $this->_glow_properties['color']['value'] : $color_value
|
||||||
|
, is_null($color_alpha) ? (int) $this->_glow_properties['color']['alpha'] : $color_alpha
|
||||||
|
, is_null($color_type) ? $this->_glow_properties['color']['type'] : $color_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Glow Property
|
||||||
|
*
|
||||||
|
* @param array|string $property
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function getGlowProperty($property) {
|
||||||
|
return $this->getArrayElementsValue($this->_glow_properties, $property);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Glow Color
|
||||||
|
*
|
||||||
|
* @param float $size
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Chart_Axis
|
||||||
|
*/
|
||||||
|
|
||||||
|
private function _setGlowSize($size) {
|
||||||
|
if (!is_null($size)) {
|
||||||
|
$this->_glow_properties['size'] = $this->getExcelPointsWidth($size);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Glow Color
|
||||||
|
*
|
||||||
|
* @param string $color
|
||||||
|
* @param int $alpha
|
||||||
|
* @param string $type
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Chart_Axis
|
||||||
|
*/
|
||||||
|
|
||||||
|
private function _setGlowColor($color, $alpha, $type) {
|
||||||
|
$this->_glow_properties['color'] = $this->setColorProperties($color, $alpha, $type);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Soft Edges Size
|
||||||
|
*
|
||||||
|
* @param float $size
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function setSoftEdges($size) {
|
||||||
|
if (!is_null($size)) {
|
||||||
|
$_soft_edges['size'] = (string) $this->getExcelPointsWidth($size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Soft Edges Size
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function getSoftEdgesSize() {
|
||||||
|
return $this->_soft_edges['size'];
|
||||||
|
}
|
||||||
|
}
|
365
admin/helpers/PHPExcel/Chart/DataSeries.php
Normal file
@ -0,0 +1,365 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2014 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Chart
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Chart_DataSeries
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Chart
|
||||||
|
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_Chart_DataSeries
|
||||||
|
{
|
||||||
|
|
||||||
|
const TYPE_BARCHART = 'barChart';
|
||||||
|
const TYPE_BARCHART_3D = 'bar3DChart';
|
||||||
|
const TYPE_LINECHART = 'lineChart';
|
||||||
|
const TYPE_LINECHART_3D = 'line3DChart';
|
||||||
|
const TYPE_AREACHART = 'areaChart';
|
||||||
|
const TYPE_AREACHART_3D = 'area3DChart';
|
||||||
|
const TYPE_PIECHART = 'pieChart';
|
||||||
|
const TYPE_PIECHART_3D = 'pie3DChart';
|
||||||
|
const TYPE_DOUGHTNUTCHART = 'doughnutChart';
|
||||||
|
const TYPE_DONUTCHART = self::TYPE_DOUGHTNUTCHART; // Synonym
|
||||||
|
const TYPE_SCATTERCHART = 'scatterChart';
|
||||||
|
const TYPE_SURFACECHART = 'surfaceChart';
|
||||||
|
const TYPE_SURFACECHART_3D = 'surface3DChart';
|
||||||
|
const TYPE_RADARCHART = 'radarChart';
|
||||||
|
const TYPE_BUBBLECHART = 'bubbleChart';
|
||||||
|
const TYPE_STOCKCHART = 'stockChart';
|
||||||
|
const TYPE_CANDLECHART = self::TYPE_STOCKCHART; // Synonym
|
||||||
|
|
||||||
|
const GROUPING_CLUSTERED = 'clustered';
|
||||||
|
const GROUPING_STACKED = 'stacked';
|
||||||
|
const GROUPING_PERCENT_STACKED = 'percentStacked';
|
||||||
|
const GROUPING_STANDARD = 'standard';
|
||||||
|
|
||||||
|
const DIRECTION_BAR = 'bar';
|
||||||
|
const DIRECTION_HORIZONTAL = self::DIRECTION_BAR;
|
||||||
|
const DIRECTION_COL = 'col';
|
||||||
|
const DIRECTION_COLUMN = self::DIRECTION_COL;
|
||||||
|
const DIRECTION_VERTICAL = self::DIRECTION_COL;
|
||||||
|
|
||||||
|
const STYLE_LINEMARKER = 'lineMarker';
|
||||||
|
const STYLE_SMOOTHMARKER = 'smoothMarker';
|
||||||
|
const STYLE_MARKER = 'marker';
|
||||||
|
const STYLE_FILLED = 'filled';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Series Plot Type
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_plotType = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plot Grouping Type
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
private $_plotGrouping = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plot Direction
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
private $_plotDirection = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plot Style
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_plotStyle = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Order of plots in Series
|
||||||
|
*
|
||||||
|
* @var array of integer
|
||||||
|
*/
|
||||||
|
private $_plotOrder = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plot Label
|
||||||
|
*
|
||||||
|
* @var array of PHPExcel_Chart_DataSeriesValues
|
||||||
|
*/
|
||||||
|
private $_plotLabel = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plot Category
|
||||||
|
*
|
||||||
|
* @var array of PHPExcel_Chart_DataSeriesValues
|
||||||
|
*/
|
||||||
|
private $_plotCategory = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Smooth Line
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_smoothLine = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plot Values
|
||||||
|
*
|
||||||
|
* @var array of PHPExcel_Chart_DataSeriesValues
|
||||||
|
*/
|
||||||
|
private $_plotValues = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new PHPExcel_Chart_DataSeries
|
||||||
|
*/
|
||||||
|
public function __construct($plotType = null, $plotGrouping = null, $plotOrder = array(), $plotLabel = array(), $plotCategory = array(), $plotValues = array(), $smoothLine = null, $plotStyle = null)
|
||||||
|
{
|
||||||
|
$this->_plotType = $plotType;
|
||||||
|
$this->_plotGrouping = $plotGrouping;
|
||||||
|
$this->_plotOrder = $plotOrder;
|
||||||
|
$keys = array_keys($plotValues);
|
||||||
|
$this->_plotValues = $plotValues;
|
||||||
|
if ((count($plotLabel) == 0) || (is_null($plotLabel[$keys[0]]))) {
|
||||||
|
$plotLabel[$keys[0]] = new PHPExcel_Chart_DataSeriesValues();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_plotLabel = $plotLabel;
|
||||||
|
if ((count($plotCategory) == 0) || (is_null($plotCategory[$keys[0]]))) {
|
||||||
|
$plotCategory[$keys[0]] = new PHPExcel_Chart_DataSeriesValues();
|
||||||
|
}
|
||||||
|
$this->_plotCategory = $plotCategory;
|
||||||
|
$this->_smoothLine = $smoothLine;
|
||||||
|
$this->_plotStyle = $plotStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Plot Type
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getPlotType() {
|
||||||
|
return $this->_plotType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Plot Type
|
||||||
|
*
|
||||||
|
* @param string $plotType
|
||||||
|
* @return PHPExcel_Chart_DataSeries
|
||||||
|
*/
|
||||||
|
public function setPlotType($plotType = '') {
|
||||||
|
$this->_plotType = $plotType;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Plot Grouping Type
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getPlotGrouping() {
|
||||||
|
return $this->_plotGrouping;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Plot Grouping Type
|
||||||
|
*
|
||||||
|
* @param string $groupingType
|
||||||
|
* @return PHPExcel_Chart_DataSeries
|
||||||
|
*/
|
||||||
|
public function setPlotGrouping($groupingType = null) {
|
||||||
|
$this->_plotGrouping = $groupingType;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Plot Direction
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getPlotDirection() {
|
||||||
|
return $this->_plotDirection;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Plot Direction
|
||||||
|
*
|
||||||
|
* @param string $plotDirection
|
||||||
|
* @return PHPExcel_Chart_DataSeries
|
||||||
|
*/
|
||||||
|
public function setPlotDirection($plotDirection = null) {
|
||||||
|
$this->_plotDirection = $plotDirection;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Plot Order
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getPlotOrder() {
|
||||||
|
return $this->_plotOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Plot Labels
|
||||||
|
*
|
||||||
|
* @return array of PHPExcel_Chart_DataSeriesValues
|
||||||
|
*/
|
||||||
|
public function getPlotLabels() {
|
||||||
|
return $this->_plotLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Plot Label by Index
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Chart_DataSeriesValues
|
||||||
|
*/
|
||||||
|
public function getPlotLabelByIndex($index) {
|
||||||
|
$keys = array_keys($this->_plotLabel);
|
||||||
|
if (in_array($index,$keys)) {
|
||||||
|
return $this->_plotLabel[$index];
|
||||||
|
} elseif(isset($keys[$index])) {
|
||||||
|
return $this->_plotLabel[$keys[$index]];
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Plot Categories
|
||||||
|
*
|
||||||
|
* @return array of PHPExcel_Chart_DataSeriesValues
|
||||||
|
*/
|
||||||
|
public function getPlotCategories() {
|
||||||
|
return $this->_plotCategory;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Plot Category by Index
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Chart_DataSeriesValues
|
||||||
|
*/
|
||||||
|
public function getPlotCategoryByIndex($index) {
|
||||||
|
$keys = array_keys($this->_plotCategory);
|
||||||
|
if (in_array($index,$keys)) {
|
||||||
|
return $this->_plotCategory[$index];
|
||||||
|
} elseif(isset($keys[$index])) {
|
||||||
|
return $this->_plotCategory[$keys[$index]];
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Plot Style
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getPlotStyle() {
|
||||||
|
return $this->_plotStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Plot Style
|
||||||
|
*
|
||||||
|
* @param string $plotStyle
|
||||||
|
* @return PHPExcel_Chart_DataSeries
|
||||||
|
*/
|
||||||
|
public function setPlotStyle($plotStyle = null) {
|
||||||
|
$this->_plotStyle = $plotStyle;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Plot Values
|
||||||
|
*
|
||||||
|
* @return array of PHPExcel_Chart_DataSeriesValues
|
||||||
|
*/
|
||||||
|
public function getPlotValues() {
|
||||||
|
return $this->_plotValues;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Plot Values by Index
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Chart_DataSeriesValues
|
||||||
|
*/
|
||||||
|
public function getPlotValuesByIndex($index) {
|
||||||
|
$keys = array_keys($this->_plotValues);
|
||||||
|
if (in_array($index,$keys)) {
|
||||||
|
return $this->_plotValues[$index];
|
||||||
|
} elseif(isset($keys[$index])) {
|
||||||
|
return $this->_plotValues[$keys[$index]];
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Number of Plot Series
|
||||||
|
*
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public function getPlotSeriesCount() {
|
||||||
|
return count($this->_plotValues);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Smooth Line
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function getSmoothLine() {
|
||||||
|
return $this->_smoothLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Smooth Line
|
||||||
|
*
|
||||||
|
* @param boolean $smoothLine
|
||||||
|
* @return PHPExcel_Chart_DataSeries
|
||||||
|
*/
|
||||||
|
public function setSmoothLine($smoothLine = TRUE) {
|
||||||
|
$this->_smoothLine = $smoothLine;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function refresh(PHPExcel_Worksheet $worksheet) {
|
||||||
|
foreach($this->_plotValues as $plotValues) {
|
||||||
|
if ($plotValues !== NULL)
|
||||||
|
$plotValues->refresh($worksheet, TRUE);
|
||||||
|
}
|
||||||
|
foreach($this->_plotLabel as $plotValues) {
|
||||||
|
if ($plotValues !== NULL)
|
||||||
|
$plotValues->refresh($worksheet, TRUE);
|
||||||
|
}
|
||||||
|
foreach($this->_plotCategory as $plotValues) {
|
||||||
|
if ($plotValues !== NULL)
|
||||||
|
$plotValues->refresh($worksheet, FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|