mirror of
https://github.com/mojuncong/psi.git
synced 2024-09-20 06:46:10 +08:00
PSI
This commit is contained in:
commit
01e6ea94a9
5
.buildpath
Normal file
5
.buildpath
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<buildpath>
|
||||
<buildpathentry kind="src" path=""/>
|
||||
<buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
|
||||
</buildpath>
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/web/nbproject/private/
|
39
.project
Normal file
39
.project
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>PSI</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.dltk.core.scriptbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||
<nature>org.eclipse.php.core.PHPNature</nature>
|
||||
</natures>
|
||||
<filteredResources>
|
||||
<filter>
|
||||
<id>1424357269441</id>
|
||||
<name>web/Application/Runtime</name>
|
||||
<type>30</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||
<arguments>1.0-name-matches-false-false-*</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
</filteredResources>
|
||||
</projectDescription>
|
1341
Mobile_Detect.php
Normal file
1341
Mobile_Detect.php
Normal file
File diff suppressed because one or more lines are too long
78
README.md
Normal file
78
README.md
Normal file
|
@ -0,0 +1,78 @@
|
|||
关于PSI
|
||||
-------------
|
||||
>PSI是开源进销存系统。
|
||||
>
|
||||
>PSI是希腊字母Ψ的读音。
|
||||
>
|
||||
>产品寓意:PSI本身不完美,但追求的是不断改进的品质,距离终极产品就一步之遥(因为在希腊字母表中,Ψ之后是Ω,Ω有终极的意思)。
|
||||
|
||||
一张图看懂开源进销存PSI
|
||||
-------------
|
||||
<p>
|
||||
<img src="http://static.oschina.net/uploads/space/2015/0306/111629_RuyO_134395.jpg"/>
|
||||
</p>
|
||||
|
||||
PSI演示
|
||||
-------------
|
||||
>PSI的演示见:<a href = 'http://psi.oschina.mopaas.com' target = '_blank'>http://psi.oschina.mopaasapp.com</a>
|
||||
|
||||
|
||||
源代码下载地址
|
||||
-------------
|
||||
>源码下载地址:http://git.oschina.net/crm8000/PSI/repository/archive/master
|
||||
|
||||
通过PSI源码在本地安装
|
||||
-------------
|
||||
> 本地环境搭建: http://my.oschina.net/u/134395/blog/376530
|
||||
> <br /> <br />
|
||||
> 用WampServer部署可能会遇到的问题:http://my.oschina.net/u/134395/blog/383754
|
||||
> <br /> <br />
|
||||
> 用Nginx部署可能会遇到的问题:http://my.oschina.net/u/134395/blog/390650
|
||||
>
|
||||
> lnmp部署参考:http://my.oschina.net/u/2525829/blog/532614
|
||||
> <br /> <br />
|
||||
> 用IIS如何配置:http://my.oschina.net/u/1415918/blog/511228
|
||||
|
||||
PSI的开源协议
|
||||
-------------
|
||||
>PSI的开源协议为GPL v3
|
||||
|
||||
>如果您有Sencha Ext JS的商业许可(参见: http://www.sencha.com/legal/#Sencha_Ext_JS ),那么PSI的开源协议为Apache License v2。
|
||||
>在Apache License协议下,您可以闭源并私有化PSI的代码,作为您自己的商业产品来销售。
|
||||
|
||||
>
|
||||
>关于开源协议和私有化PSI代码的详细解释,可以参考这里:http://my.oschina.net/u/134395/blog/524350
|
||||
|
||||
更多文档
|
||||
-------------
|
||||
> 更多文档,请参考:http://my.oschina.net/u/134395
|
||||
|
||||
|
||||
PSI行业版
|
||||
-------------
|
||||
> 食品行业版 http://git.oschina.net/crm8000/PSI_Food_Industry
|
||||
|
||||
|
||||
如需要技术支持,请联系
|
||||
-------------
|
||||
- QQ群: <a target="_blank" href="http://shang.qq.com/wpa/qunwpa?idkey=64808ce24f2a3186ccb1f37aad9ed591bcc4fb257d09749753aca98c6c73e400">414474186</a>
|
||||
|
||||
致谢
|
||||
-------------
|
||||
>PSI使用了如下开源软件,没有你们,就没有PSI
|
||||
>
|
||||
>1、PHP (http://php.net/)
|
||||
>
|
||||
>2、MySQL (http://www.mysql.com/)
|
||||
>
|
||||
>3、ExtJS 4.2 (http://www.sencha.com/)
|
||||
>
|
||||
>4、ThinkPHP 3.2.3 (http://www.thinkphp.cn/)
|
||||
>
|
||||
>5、乱码 / pinyin_php (https://git.oschina.net/cik/pinyin_php)
|
||||
>
|
||||
>6、PHPExcel (https://github.com/PHPOffice/PHPExcel)
|
||||
>
|
||||
>7、TCPDF (http://www.tcpdf.org/)
|
||||
>
|
||||
>8、MUI (http://dev.dcloud.net.cn/mui/)
|
BIN
doc/01 概要设计/PSI.pptx
Normal file
BIN
doc/01 概要设计/PSI.pptx
Normal file
Binary file not shown.
BIN
doc/01 概要设计/PSI概要设计.xlsx
Normal file
BIN
doc/01 概要设计/PSI概要设计.xlsx
Normal file
Binary file not shown.
BIN
doc/02 表结构/表结构说明.xlsx
Normal file
BIN
doc/02 表结构/表结构说明.xlsx
Normal file
Binary file not shown.
BIN
doc/03 使用手册/PSI使用手册.docx
Normal file
BIN
doc/03 使用手册/PSI使用手册.docx
Normal file
Binary file not shown.
BIN
doc/10 众包/01 任务台账/任务台账.xlsx
Normal file
BIN
doc/10 众包/01 任务台账/任务台账.xlsx
Normal file
Binary file not shown.
BIN
doc/10 众包/02 任务单/20151019-01.xlsx
Normal file
BIN
doc/10 众包/02 任务单/20151019-01.xlsx
Normal file
Binary file not shown.
BIN
doc/10 众包/02 任务单/20151028-01.xlsx
Normal file
BIN
doc/10 众包/02 任务单/20151028-01.xlsx
Normal file
Binary file not shown.
BIN
doc/10 众包/02 任务单/20151104-01.xlsx
Normal file
BIN
doc/10 众包/02 任务单/20151104-01.xlsx
Normal file
Binary file not shown.
BIN
doc/10 众包/02 任务单/20151104-02.xlsx
Normal file
BIN
doc/10 众包/02 任务单/20151104-02.xlsx
Normal file
Binary file not shown.
BIN
doc/10 众包/02 任务单/20151110-01.xlsx
Normal file
BIN
doc/10 众包/02 任务单/20151110-01.xlsx
Normal file
Binary file not shown.
BIN
doc/10 众包/02 任务单/20151115-01.xlsx
Normal file
BIN
doc/10 众包/02 任务单/20151115-01.xlsx
Normal file
Binary file not shown.
210
doc/98 编码规范/PSI_编码风格_Ecllipse.xml
Normal file
210
doc/98 编码规范/PSI_编码风格_Ecllipse.xml
Normal file
|
@ -0,0 +1,210 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<profiles>
|
||||
<profile name="PSI">
|
||||
<setting id="indentationChar" value="	"/>
|
||||
<setting id="insert_space_after_opening_paren_in_declare" value="false"/>
|
||||
<setting id="insert_space_before_closing_paren_in_declare" value="false"/>
|
||||
<setting id="insert_space_before_opening_paren_in_declare" value="false"/>
|
||||
<setting id="org.eclipse.php.core.formatter.insert_new_line_in_function_invoke" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_allocation_expression_force_split" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_allocation_expression_indent_policy" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_allocation_expression_line_wrap_policy" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_method_invocation_force_split" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_method_invocation_indent_policy" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_method_invocation_line_wrap_policy" value="1"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_assignment_force_split" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_assignment_indent_policy" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_assignment_line_wrap_policy" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_binary_expression_force_split" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_binary_expression_indent_policy" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_binary_expression_line_wrap_policy" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_compact_if_force_split" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_compact_if_indent_policy" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_compact_if_line_wrap_policy" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_conditional_expression_force_split" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_conditional_expression_indent_policy" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_conditional_expression_line_wrap_policy" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_expressions_in_array_initializer_force_split" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_expressions_in_array_initializer_indent_policy" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_expressions_in_array_initializer_line_wrap_policy" value="3"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_parameters_in_method_declaration_force_split" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_parameters_in_method_declaration_indent_policy" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_parameters_in_method_declaration_line_wrap_policy" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superclass_in_type_declaration_force_split" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superclass_in_type_declaration_indent_policy" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superclass_in_type_declaration_line_wrap_policy" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superinterfaces_in_type_declaration_force_split" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superinterfaces_in_type_declaration_indent_policy" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superinterfaces_in_type_declaration_line_wrap_policy" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.blank_lines_before_field" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.blank_lines_before_member_type" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.blank_lines_before_method" value="1"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.blank_lines_between_type_declarations" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.brace_position_for_block" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.brace_position_for_lambda_function_declaration" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.brace_position_for_method_declaration" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.brace_position_for_switch" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.brace_position_for_type_declaration" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.comment.format_block_comments" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.comment.format_header" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.comment.format_html" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.comment.format_javadoc_comments" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.comment.format_line_comments" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.comment.format_source_code" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.comment.indent_parameter_description" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.comment.indent_root_tags" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.comment.insert_new_line_before_root_tags" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.comment.insert_new_line_for_parameter" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.comment.line_length" value="9999"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.continuation_indentation" value="2"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.disabling_tag" value="@formatter:off"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.enabling_tag" value="@formatter:on"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.format_guardian_clause_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.format_line_comment_starting_on_first_column" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.indent_breaks_compare_to_cases" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.indent_empty_lines" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.indent_statements_compare_to_block" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.indent_statements_compare_to_body" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.indentation.size" value="1"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_before_catch_in_try_statement" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_before_else_in_if_statement" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_before_finally_in_try_statement" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_before_while_in_do_statement" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_in_empty_block" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_in_empty_method_body" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_in_empty_type_declaration" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_array_creation" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_field_access" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_foreach" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_method_invocation" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_yield" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_assignment_operator" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_binary_operator" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_closing_brace_in_block" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_closing_paren_in_cast" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_colon_in_conditional" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_coloncolon_in_field_access" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_coloncolon_in_method_invocation" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_array_creation" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_echo" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_for_inits" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_global" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_list" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_multiple_constant_declarations" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_static" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_superinterfaces" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_array_creation" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_cast" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_catch" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_for" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_foreach" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_if" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_list" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_switch" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_while" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_postfix_operator" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_prefix_operator" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_question_in_conditional" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_semicolon_in_for" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_unary_operator" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_array_creation" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_field_access" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_foreach" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_method_invocation" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_yield" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_assignment_operator" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_binary_operator" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_array_creation" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_cast" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_catch" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_for" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_foreach" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_if" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_list" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_switch" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_while" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_colon_in_case" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_colon_in_conditional" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_colon_in_default" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_coloncolon_in_field_access" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_coloncolon_in_method_invocation" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_array_creation" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_echo" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_for_inits" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_global" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_list" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_multiple_constant_declarations" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_static" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_superinterfaces" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_brace_in_block" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_brace_in_switch" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_array_creation" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_catch" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_for" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_foreach" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_if" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_list" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_switch" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_while" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_postfix_operator" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_prefix_operator" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_question_in_conditional" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_semicolon" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_semicolon_in_for" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_unary_operator" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_between_brackets_in_array_type_reference" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.join_lines_in_comments" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.keep_else_statement_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.keep_elseif_statement_on_same_line" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.keep_imple_if_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.keep_then_statement_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.lineSplit" value="100"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_after_namespace" value="1"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_after_use_statements" value="1"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_at_end_of_class_body" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_at_end_of_method_body" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_before_namespace" value="1"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_before_use_statements" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_between_namespaces" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_between_use_statements" value="0"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.put_empty_statement_on_new_line" value="true"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.tabulation.size" value="4"/>
|
||||
<setting id="org.eclipse.php.formatter.core.formatter.use_on_off_tags" value="false"/>
|
||||
</profile>
|
||||
</profiles>
|
907
doc/99 SQL/01CreateTables.sql
Normal file
907
doc/99 SQL/01CreateTables.sql
Normal file
|
@ -0,0 +1,907 @@
|
|||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
|
||||
DROP TABLE IF EXISTS `t_biz_log`;
|
||||
CREATE TABLE IF NOT EXISTS `t_biz_log` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`date_created` datetime DEFAULT NULL,
|
||||
`info` varchar(1000) NOT NULL,
|
||||
`ip` varchar(255) NOT NULL,
|
||||
`user_id` varchar(255) NOT NULL,
|
||||
`log_category` varchar(50) NOT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`ip_from` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
||||
|
||||
DROP TABLE IF EXISTS `t_fid`;
|
||||
CREATE TABLE IF NOT EXISTS `t_fid` (
|
||||
`fid` varchar(255) NOT NULL,
|
||||
`name` varchar(255) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_menu_item`;
|
||||
CREATE TABLE IF NOT EXISTS `t_menu_item` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`caption` varchar(255) NOT NULL,
|
||||
`fid` varchar(255) DEFAULT NULL,
|
||||
`parent_id` varchar(255) DEFAULT NULL,
|
||||
`show_order` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_org`;
|
||||
CREATE TABLE IF NOT EXISTS `t_org` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`full_name` varchar(255) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`org_code` varchar(255) NOT NULL,
|
||||
`parent_id` varchar(255) DEFAULT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_permission`;
|
||||
CREATE TABLE IF NOT EXISTS `t_permission` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`fid` varchar(255) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`note` varchar(255) DEFAULT NULL,
|
||||
`category` varchar(255) DEFAULT NULL,
|
||||
`py` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_recent_fid`;
|
||||
CREATE TABLE IF NOT EXISTS `t_recent_fid` (
|
||||
`fid` varchar(255) NOT NULL,
|
||||
`user_id` varchar(255) NOT NULL,
|
||||
`click_count` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_role`;
|
||||
CREATE TABLE IF NOT EXISTS `t_role` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_role_permission`;
|
||||
CREATE TABLE IF NOT EXISTS `t_role_permission` (
|
||||
`role_id` varchar(255) DEFAULT NULL,
|
||||
`permission_id` varchar(255) DEFAULT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_role_user`;
|
||||
CREATE TABLE IF NOT EXISTS `t_role_user` (
|
||||
`role_id` varchar(255) DEFAULT NULL,
|
||||
`user_id` varchar(255) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_user`;
|
||||
CREATE TABLE IF NOT EXISTS `t_user` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`enabled` int(11) NOT NULL,
|
||||
`login_name` varchar(255) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`org_id` varchar(255) NOT NULL,
|
||||
`org_code` varchar(255) NOT NULL,
|
||||
`password` varchar(255) NOT NULL,
|
||||
`py` varchar(255) DEFAULT NULL,
|
||||
`gender` varchar(255) DEFAULT NULL,
|
||||
`birthday` varchar(255) DEFAULT NULL,
|
||||
`id_card_number` varchar(255) DEFAULT NULL,
|
||||
`tel` varchar(255) DEFAULT NULL,
|
||||
`tel02` varchar(255) DEFAULT NULL,
|
||||
`address` varchar(255) DEFAULT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_warehouse`;
|
||||
CREATE TABLE IF NOT EXISTS `t_warehouse` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`code` varchar(255) NOT NULL,
|
||||
`inited` int(11) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`py` varchar(255) DEFAULT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_supplier`;
|
||||
CREATE TABLE IF NOT EXISTS `t_supplier` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`category_id` varchar(255) NOT NULL,
|
||||
`code` varchar(255) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`contact01` varchar(255) DEFAULT NULL,
|
||||
`qq01` varchar(255) DEFAULT NULL,
|
||||
`tel01` varchar(255) DEFAULT NULL,
|
||||
`mobile01` varchar(255) DEFAULT NULL,
|
||||
`contact02` varchar(255) DEFAULT NULL,
|
||||
`qq02` varchar(255) DEFAULT NULL,
|
||||
`tel02` varchar(255) DEFAULT NULL,
|
||||
`mobile02` varchar(255) DEFAULT NULL,
|
||||
`address` varchar(255) DEFAULT NULL,
|
||||
`address_shipping` varchar(255) DEFAULT NULL,
|
||||
`address_receipt` varchar(255) DEFAULT NULL,
|
||||
`py` varchar(255) DEFAULT NULL,
|
||||
`init_receivables` decimal(19,2) DEFAULT NULL,
|
||||
`init_receivables_dt` datetime DEFAULT NULL,
|
||||
`init_payables` decimal(19,2) DEFAULT NULL,
|
||||
`init_payables_dt` datetime DEFAULT NULL,
|
||||
`bank_name` varchar(255) DEFAULT NULL,
|
||||
`bank_account` varchar(255) DEFAULT NULL,
|
||||
`tax_number` varchar(255) DEFAULT NULL,
|
||||
`fax` varchar(255) DEFAULT NULL,
|
||||
`note` varchar(255) DEFAULT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_supplier_category`;
|
||||
CREATE TABLE IF NOT EXISTS `t_supplier_category` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`code` varchar(255) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`parent_id` varchar(255) DEFAULT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_goods`;
|
||||
CREATE TABLE IF NOT EXISTS `t_goods` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`category_id` varchar(255) NOT NULL,
|
||||
`code` varchar(255) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`sale_price` decimal(19,2) NOT NULL,
|
||||
`spec` varchar(255) NOT NULL,
|
||||
`unit_id` varchar(255) NOT NULL,
|
||||
`purchase_price` decimal(19, 2) DEFAULT NULL,
|
||||
`py` varchar(255) DEFAULT NULL,
|
||||
`spec_py` varchar(255) DEFAULT NULL,
|
||||
`bar_code` varchar(255) DEFAULT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`memo` varchar(500) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
`brand_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_goods_category`;
|
||||
CREATE TABLE IF NOT EXISTS `t_goods_category` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`code` varchar(255) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`parent_id` varchar(255) DEFAULT NULL,
|
||||
`full_name` varchar(1000) DEFAULT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_goods_unit`;
|
||||
CREATE TABLE IF NOT EXISTS `t_goods_unit` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_customer`;
|
||||
CREATE TABLE IF NOT EXISTS `t_customer` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`category_id` varchar(255) NOT NULL,
|
||||
`code` varchar(255) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`contact01` varchar(255) DEFAULT NULL,
|
||||
`qq01` varchar(255) DEFAULT NULL,
|
||||
`tel01` varchar(255) DEFAULT NULL,
|
||||
`mobile01` varchar(255) DEFAULT NULL,
|
||||
`contact02` varchar(255) DEFAULT NULL,
|
||||
`qq02` varchar(255) DEFAULT NULL,
|
||||
`tel02` varchar(255) DEFAULT NULL,
|
||||
`mobile02` varchar(255) DEFAULT NULL,
|
||||
`address` varchar(255) DEFAULT NULL,
|
||||
`address_shipping` varchar(255) DEFAULT NULL,
|
||||
`address_receipt` varchar(255) DEFAULT NULL,
|
||||
`py` varchar(255) DEFAULT NULL,
|
||||
`init_receivables` decimal(19,2) DEFAULT NULL,
|
||||
`init_receivables_dt` datetime DEFAULT NULL,
|
||||
`init_payables` decimal(19,2) DEFAULT NULL,
|
||||
`init_payables_dt` datetime DEFAULT NULL,
|
||||
`bank_name` varchar(255) DEFAULT NULL,
|
||||
`bank_account` varchar(255) DEFAULT NULL,
|
||||
`tax_number` varchar(255) DEFAULT NULL,
|
||||
`fax` varchar(255) DEFAULT NULL,
|
||||
`note` varchar(255) DEFAULT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_customer_category`;
|
||||
CREATE TABLE IF NOT EXISTS `t_customer_category` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`code` varchar(255) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`parent_id` varchar(255) DEFAULT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `t_inventory`;
|
||||
CREATE TABLE IF NOT EXISTS `t_inventory` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`balance_count` decimal(19,2) NOT NULL,
|
||||
`balance_money` decimal(19,2) NOT NULL,
|
||||
`balance_price` decimal(19,2) NOT NULL,
|
||||
`goods_id` varchar(255) NOT NULL,
|
||||
`in_count` decimal(19,2) DEFAULT NULL,
|
||||
`in_money` decimal(19,2) DEFAULT NULL,
|
||||
`in_price` decimal(19,2) DEFAULT NULL,
|
||||
`out_count` decimal(19,2) DEFAULT NULL,
|
||||
`out_money` decimal(19,2) DEFAULT NULL,
|
||||
`out_price` decimal(19,2) DEFAULT NULL,
|
||||
`afloat_count` decimal(19,2) DEFAULT NULL,
|
||||
`afloat_money` decimal(19,2) DEFAULT NULL,
|
||||
`afloat_price` decimal(19,2) DEFAULT NULL,
|
||||
`warehouse_id` varchar(255) NOT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
||||
|
||||
DROP TABLE IF EXISTS `t_inventory_detail`;
|
||||
CREATE TABLE IF NOT EXISTS `t_inventory_detail` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`balance_count` decimal(19,2) NOT NULL,
|
||||
`balance_money` decimal(19,2) NOT NULL,
|
||||
`balance_price` decimal(19,2) NOT NULL,
|
||||
`biz_date` datetime NOT NULL,
|
||||
`biz_user_id` varchar(255) NOT NULL,
|
||||
`date_created` datetime DEFAULT NULL,
|
||||
`goods_id` varchar(255) NOT NULL,
|
||||
`in_count` decimal(19,2) DEFAULT NULL,
|
||||
`in_money` decimal(19,2) DEFAULT NULL,
|
||||
`in_price` decimal(19,2) DEFAULT NULL,
|
||||
`out_count` decimal(19,2) DEFAULT NULL,
|
||||
`out_money` decimal(19,2) DEFAULT NULL,
|
||||
`out_price` decimal(19,2) DEFAULT NULL,
|
||||
`ref_number` varchar(255) DEFAULT NULL,
|
||||
`ref_type` varchar(255) NOT NULL,
|
||||
`warehouse_id` varchar(255) NOT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `t_pw_bill`;
|
||||
CREATE TABLE IF NOT EXISTS `t_pw_bill` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`bill_status` int(11) NOT NULL,
|
||||
`biz_dt` datetime NOT NULL,
|
||||
`biz_user_id` varchar(255) NOT NULL,
|
||||
`date_created` datetime DEFAULT NULL,
|
||||
`goods_money` decimal(19,2) NOT NULL,
|
||||
`input_user_id` varchar(255) NOT NULL,
|
||||
`ref` varchar(255) NOT NULL,
|
||||
`supplier_id` varchar(255) NOT NULL,
|
||||
`warehouse_id` varchar(255) NOT NULL,
|
||||
`payment_type` int(11) NOT NULL DEFAULT 0,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_pw_bill_detail`;
|
||||
CREATE TABLE IF NOT EXISTS `t_pw_bill_detail` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`date_created` datetime DEFAULT NULL,
|
||||
`goods_id` varchar(255) NOT NULL,
|
||||
`goods_count` int(11) NOT NULL,
|
||||
`goods_money` decimal(19,2) NOT NULL,
|
||||
`goods_price` decimal(19,2) NOT NULL,
|
||||
`pwbill_id` varchar(255) NOT NULL,
|
||||
`show_order` int(11) NOT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`memo` varchar(1000) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `t_payables`;
|
||||
CREATE TABLE IF NOT EXISTS `t_payables` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`act_money` decimal(19,2) NOT NULL,
|
||||
`balance_money` decimal(19,2) NOT NULL,
|
||||
`ca_id` varchar(255) NOT NULL,
|
||||
`ca_type` varchar(255) NOT NULL,
|
||||
`pay_money` decimal(19,2) NOT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_payables_detail`;
|
||||
CREATE TABLE IF NOT EXISTS `t_payables_detail` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`act_money` decimal(19,2) NOT NULL,
|
||||
`balance_money` decimal(19,2) NOT NULL,
|
||||
`ca_id` varchar(255) NOT NULL,
|
||||
`ca_type` varchar(255) NOT NULL,
|
||||
`biz_date` datetime DEFAULT NULL,
|
||||
`date_created` datetime DEFAULT NULL,
|
||||
`pay_money` decimal(19,2) NOT NULL,
|
||||
`ref_number` varchar(255) NOT NULL,
|
||||
`ref_type` varchar(255) NOT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_receivables`;
|
||||
CREATE TABLE IF NOT EXISTS `t_receivables` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`act_money` decimal(19,2) NOT NULL,
|
||||
`balance_money` decimal(19,2) NOT NULL,
|
||||
`ca_id` varchar(255) NOT NULL,
|
||||
`ca_type` varchar(255) NOT NULL,
|
||||
`rv_money` decimal(19,2) NOT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_receivables_detail`;
|
||||
CREATE TABLE IF NOT EXISTS `t_receivables_detail` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`act_money` decimal(19,2) NOT NULL,
|
||||
`balance_money` decimal(19,2) NOT NULL,
|
||||
`ca_id` varchar(255) NOT NULL,
|
||||
`ca_type` varchar(255) NOT NULL,
|
||||
`biz_date` datetime DEFAULT NULL,
|
||||
`date_created` datetime DEFAULT NULL,
|
||||
`ref_number` varchar(255) NOT NULL,
|
||||
`ref_type` varchar(255) NOT NULL,
|
||||
`rv_money` decimal(19,2) NOT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `t_payment`;
|
||||
CREATE TABLE IF NOT EXISTS `t_payment` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`act_money` decimal(19,2) NOT NULL,
|
||||
`biz_date` datetime NOT NULL,
|
||||
`date_created` datetime DEFAULT NULL,
|
||||
`input_user_id` varchar(255) NOT NULL,
|
||||
`pay_user_id` varchar(255) NOT NULL,
|
||||
`bill_id` varchar(255) NOT NULL,
|
||||
`ref_type` varchar(255) NOT NULL,
|
||||
`ref_number` varchar(255) NOT NULL,
|
||||
`remark` varchar(255) NOT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_ws_bill`;
|
||||
CREATE TABLE IF NOT EXISTS `t_ws_bill` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`bill_status` int(11) NOT NULL,
|
||||
`bizdt` datetime NOT NULL,
|
||||
`biz_user_id` varchar(255) NOT NULL,
|
||||
`customer_id` varchar(255) NOT NULL,
|
||||
`date_created` datetime DEFAULT NULL,
|
||||
`input_user_id` varchar(255) NOT NULL,
|
||||
`inventory_money` decimal(19,2) DEFAULT NULL,
|
||||
`profit` decimal(19,2) DEFAULT NULL,
|
||||
`ref` varchar(255) NOT NULL,
|
||||
`sale_money` decimal(19,2) DEFAULT NULL,
|
||||
`warehouse_id` varchar(255) NOT NULL,
|
||||
`receiving_type` int(11) NOT NULL DEFAULT 0,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
`memo` varchar(1000) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_ws_bill_detail`;
|
||||
CREATE TABLE IF NOT EXISTS `t_ws_bill_detail` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`date_created` datetime DEFAULT NULL,
|
||||
`goods_id` varchar(255) NOT NULL,
|
||||
`goods_count` int(11) NOT NULL,
|
||||
`goods_money` decimal(19,2) NOT NULL,
|
||||
`goods_price` decimal(19,2) NOT NULL,
|
||||
`inventory_money` decimal(19,2) DEFAULT NULL,
|
||||
`inventory_price` decimal(19,2) DEFAULT NULL,
|
||||
`show_order` int(11) NOT NULL,
|
||||
`wsbill_id` varchar(255) NOT NULL,
|
||||
`sn_note` varchar(255) DEFAULT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`memo` varchar(1000) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `t_receiving`;
|
||||
CREATE TABLE IF NOT EXISTS `t_receiving` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`act_money` decimal(19,2) NOT NULL,
|
||||
`biz_date` datetime NOT NULL,
|
||||
`date_created` datetime DEFAULT NULL,
|
||||
`input_user_id` varchar(255) NOT NULL,
|
||||
`remark` varchar(255) NOT NULL,
|
||||
`rv_user_id` varchar(255) NOT NULL,
|
||||
`bill_id` varchar(255) NOT NULL,
|
||||
`ref_number` varchar(255) NOT NULL,
|
||||
`ref_type` varchar(255) NOT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `t_sr_bill`;
|
||||
CREATE TABLE IF NOT EXISTS `t_sr_bill` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`bill_status` int(11) NOT NULL,
|
||||
`bizdt` datetime NOT NULL,
|
||||
`biz_user_id` varchar(255) NOT NULL,
|
||||
`customer_id` varchar(255) NOT NULL,
|
||||
`date_created` datetime DEFAULT NULL,
|
||||
`input_user_id` varchar(255) NOT NULL,
|
||||
`inventory_money` decimal(19,2) DEFAULT NULL,
|
||||
`profit` decimal(19,2) DEFAULT NULL,
|
||||
`ref` varchar(255) NOT NULL,
|
||||
`rejection_sale_money` decimal(19,2) DEFAULT NULL,
|
||||
`warehouse_id` varchar(255) NOT NULL,
|
||||
`ws_bill_id` varchar(255) NOT NULL,
|
||||
`payment_type` int(11) NOT NULL DEFAULT 0,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_sr_bill_detail`;
|
||||
CREATE TABLE IF NOT EXISTS `t_sr_bill_detail` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`date_created` datetime DEFAULT NULL,
|
||||
`goods_id` varchar(255) NOT NULL,
|
||||
`goods_count` int(11) NOT NULL,
|
||||
`goods_money` decimal(19,2) NOT NULL,
|
||||
`goods_price` decimal(19,2) NOT NULL,
|
||||
`inventory_money` decimal(19,2) NOT NULL,
|
||||
`inventory_price` decimal(19,2) NOT NULL,
|
||||
`rejection_goods_count` int(11) NOT NULL,
|
||||
`rejection_goods_price` decimal(19,2) NOT NULL,
|
||||
`rejection_sale_money` decimal(19,2) NOT NULL,
|
||||
`show_order` int(11) NOT NULL,
|
||||
`srbill_id` varchar(255) NOT NULL,
|
||||
`wsbilldetail_id` varchar(255) NOT NULL,
|
||||
`sn_note` varchar(255) DEFAULT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_it_bill`;
|
||||
CREATE TABLE IF NOT EXISTS `t_it_bill` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`bill_status` int(11) NOT NULL,
|
||||
`bizdt` datetime NOT NULL,
|
||||
`biz_user_id` varchar(255) NOT NULL,
|
||||
`date_created` datetime DEFAULT NULL,
|
||||
`input_user_id` varchar(255) NOT NULL,
|
||||
`ref` varchar(255) NOT NULL,
|
||||
`from_warehouse_id` varchar(255) NOT NULL,
|
||||
`to_warehouse_id` varchar(255) NOT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_it_bill_detail`;
|
||||
CREATE TABLE IF NOT EXISTS `t_it_bill_detail` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`date_created` datetime DEFAULT NULL,
|
||||
`goods_id` varchar(255) NOT NULL,
|
||||
`goods_count` int(11) NOT NULL,
|
||||
`show_order` int(11) NOT NULL,
|
||||
`itbill_id` varchar(255) NOT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_ic_bill`;
|
||||
CREATE TABLE IF NOT EXISTS `t_ic_bill` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`bill_status` int(11) NOT NULL,
|
||||
`bizdt` datetime NOT NULL,
|
||||
`biz_user_id` varchar(255) NOT NULL,
|
||||
`date_created` datetime DEFAULT NULL,
|
||||
`input_user_id` varchar(255) NOT NULL,
|
||||
`ref` varchar(255) NOT NULL,
|
||||
`warehouse_id` varchar(255) NOT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_ic_bill_detail`;
|
||||
CREATE TABLE IF NOT EXISTS `t_ic_bill_detail` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`date_created` datetime DEFAULT NULL,
|
||||
`goods_id` varchar(255) NOT NULL,
|
||||
`goods_count` int(11) NOT NULL,
|
||||
`goods_money` decimal(19,2) NOT NULL,
|
||||
`show_order` int(11) NOT NULL,
|
||||
`icbill_id` varchar(255) NOT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_pr_bill`;
|
||||
CREATE TABLE IF NOT EXISTS `t_pr_bill` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`bill_status` int(11) NOT NULL,
|
||||
`bizdt` datetime NOT NULL,
|
||||
`biz_user_id` varchar(255) NOT NULL,
|
||||
`supplier_id` varchar(255) NOT NULL,
|
||||
`date_created` datetime DEFAULT NULL,
|
||||
`input_user_id` varchar(255) NOT NULL,
|
||||
`inventory_money` decimal(19,2) DEFAULT NULL,
|
||||
`ref` varchar(255) NOT NULL,
|
||||
`rejection_money` decimal(19,2) DEFAULT NULL,
|
||||
`warehouse_id` varchar(255) NOT NULL,
|
||||
`pw_bill_id` varchar(255) NOT NULL,
|
||||
`receiving_type` int(11) NOT NULL DEFAULT 0,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_pr_bill_detail`;
|
||||
CREATE TABLE IF NOT EXISTS `t_pr_bill_detail` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`date_created` datetime DEFAULT NULL,
|
||||
`goods_id` varchar(255) NOT NULL,
|
||||
`goods_count` int(11) NOT NULL,
|
||||
`goods_money` decimal(19,2) NOT NULL,
|
||||
`goods_price` decimal(19,2) NOT NULL,
|
||||
`inventory_money` decimal(19,2) NOT NULL,
|
||||
`inventory_price` decimal(19,2) NOT NULL,
|
||||
`rejection_goods_count` int(11) NOT NULL,
|
||||
`rejection_goods_price` decimal(19,2) NOT NULL,
|
||||
`rejection_money` decimal(19,2) NOT NULL,
|
||||
`show_order` int(11) NOT NULL,
|
||||
`prbill_id` varchar(255) NOT NULL,
|
||||
`pwbilldetail_id` varchar(255) NOT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `t_config`;
|
||||
CREATE TABLE IF NOT EXISTS `t_config` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`value` varchar(255) NOT NULL,
|
||||
`note` varchar(255) NOT NULL,
|
||||
`show_order` int(11) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_psi_db_version`;
|
||||
CREATE TABLE IF NOT EXISTS `t_psi_db_version` (
|
||||
`db_version` varchar(255) NOT NULL,
|
||||
`update_dt` datetime NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_goods_si`;
|
||||
CREATE TABLE IF NOT EXISTS `t_goods_si` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`goods_id` varchar(255) NOT NULL,
|
||||
`warehouse_id` varchar(255) NOT NULL,
|
||||
`safety_inventory` decimal(19,2) NOT NULL,
|
||||
`inventory_upper` decimal(19,2) DEFAULT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_cash`;
|
||||
CREATE TABLE IF NOT EXISTS `t_cash` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`biz_date` datetime NOT NULL,
|
||||
`in_money` decimal(19,2) DEFAULT NULL,
|
||||
`out_money` decimal(19,2) DEFAULT NULL,
|
||||
`balance_money` decimal(19,2) NOT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_cash_detail`;
|
||||
CREATE TABLE IF NOT EXISTS `t_cash_detail` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`biz_date` datetime NOT NULL,
|
||||
`in_money` decimal(19,2) DEFAULT NULL,
|
||||
`out_money` decimal(19,2) DEFAULT NULL,
|
||||
`balance_money` decimal(19,2) NOT NULL,
|
||||
`ref_number` varchar(255) NOT NULL,
|
||||
`ref_type` varchar(255) NOT NULL,
|
||||
`date_created` datetime NOT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_pre_receiving`;
|
||||
CREATE TABLE IF NOT EXISTS `t_pre_receiving` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`customer_id` varchar(255) NOT NULL,
|
||||
`in_money` decimal(19,2) DEFAULT NULL,
|
||||
`out_money` decimal(19,2) DEFAULT NULL,
|
||||
`balance_money` decimal(19,2) NOT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_pre_receiving_detail`;
|
||||
CREATE TABLE IF NOT EXISTS `t_pre_receiving_detail` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`customer_id` varchar(255) NOT NULL,
|
||||
`in_money` decimal(19,2) DEFAULT NULL,
|
||||
`out_money` decimal(19,2) DEFAULT NULL,
|
||||
`balance_money` decimal(19,2) NOT NULL,
|
||||
`biz_date` datetime DEFAULT NULL,
|
||||
`date_created` datetime DEFAULT NULL,
|
||||
`ref_number` varchar(255) NOT NULL,
|
||||
`ref_type` varchar(255) NOT NULL,
|
||||
`biz_user_id` varchar(255) NOT NULL,
|
||||
`input_user_id` varchar(255) NOT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_pre_payment`;
|
||||
CREATE TABLE IF NOT EXISTS `t_pre_payment` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`supplier_id` varchar(255) NOT NULL,
|
||||
`in_money` decimal(19,2) DEFAULT NULL,
|
||||
`out_money` decimal(19,2) DEFAULT NULL,
|
||||
`balance_money` decimal(19,2) NOT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_pre_payment_detail`;
|
||||
CREATE TABLE IF NOT EXISTS `t_pre_payment_detail` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`supplier_id` varchar(255) NOT NULL,
|
||||
`in_money` decimal(19,2) DEFAULT NULL,
|
||||
`out_money` decimal(19,2) DEFAULT NULL,
|
||||
`balance_money` decimal(19,2) NOT NULL,
|
||||
`biz_date` datetime DEFAULT NULL,
|
||||
`date_created` datetime DEFAULT NULL,
|
||||
`ref_number` varchar(255) NOT NULL,
|
||||
`ref_type` varchar(255) NOT NULL,
|
||||
`biz_user_id` varchar(255) NOT NULL,
|
||||
`input_user_id` varchar(255) NOT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_po_bill`;
|
||||
CREATE TABLE IF NOT EXISTS `t_po_bill` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`bill_status` int(11) NOT NULL,
|
||||
`biz_dt` datetime NOT NULL,
|
||||
`deal_date` datetime NOT NULL,
|
||||
`org_id` varchar(255) NOT NULL,
|
||||
`biz_user_id` varchar(255) NOT NULL,
|
||||
`date_created` datetime DEFAULT NULL,
|
||||
`goods_money` decimal(19,2) NOT NULL,
|
||||
`tax` decimal(19,2) NOT NULL,
|
||||
`money_with_tax` decimal(19,2) NOT NULL,
|
||||
`input_user_id` varchar(255) NOT NULL,
|
||||
`ref` varchar(255) NOT NULL,
|
||||
`supplier_id` varchar(255) NOT NULL,
|
||||
`contact` varchar(255) NOT NULL,
|
||||
`tel` varchar(255) DEFAULT NULL,
|
||||
`fax` varchar(255) DEFAULT NULL,
|
||||
`deal_address` varchar(255) DEFAULT NULL,
|
||||
`bill_memo` varchar(255) DEFAULT NULL,
|
||||
`payment_type` int(11) NOT NULL DEFAULT 0,
|
||||
`confirm_user_id` varchar(255) DEFAULT NULL,
|
||||
`confirm_date` datetime DEFAULT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_po_bill_detail`;
|
||||
CREATE TABLE IF NOT EXISTS `t_po_bill_detail` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`date_created` datetime DEFAULT NULL,
|
||||
`goods_id` varchar(255) NOT NULL,
|
||||
`goods_count` int(11) NOT NULL,
|
||||
`goods_money` decimal(19,2) NOT NULL,
|
||||
`goods_price` decimal(19,2) NOT NULL,
|
||||
`pobill_id` varchar(255) NOT NULL,
|
||||
`tax_rate` decimal(19,2) NOT NULL,
|
||||
`tax` decimal(19,2) NOT NULL,
|
||||
`money_with_tax` decimal(19,2) NOT NULL,
|
||||
`pw_count` int(11) NOT NULL,
|
||||
`left_count` int(11) NOT NULL,
|
||||
`show_order` int(11) NOT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_po_pw`;
|
||||
CREATE TABLE IF NOT EXISTS `t_po_pw` (
|
||||
`po_id` varchar(255) NOT NULL,
|
||||
`pw_id` varchar(255) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_role_permission_dataorg`;
|
||||
CREATE TABLE IF NOT EXISTS `t_role_permission_dataorg` (
|
||||
`role_id` varchar(255) DEFAULT NULL,
|
||||
`permission_id` varchar(255) DEFAULT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_inventory_fifo`;
|
||||
CREATE TABLE IF NOT EXISTS `t_inventory_fifo` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`balance_count` decimal(19,2) NOT NULL,
|
||||
`balance_money` decimal(19,2) NOT NULL,
|
||||
`balance_price` decimal(19,2) NOT NULL,
|
||||
`date_created` datetime DEFAULT NULL,
|
||||
`goods_id` varchar(255) NOT NULL,
|
||||
`in_count` decimal(19,2) DEFAULT NULL,
|
||||
`in_money` decimal(19,2) DEFAULT NULL,
|
||||
`in_price` decimal(19,2) DEFAULT NULL,
|
||||
`out_count` decimal(19,2) DEFAULT NULL,
|
||||
`out_money` decimal(19,2) DEFAULT NULL,
|
||||
`out_price` decimal(19,2) DEFAULT NULL,
|
||||
`in_ref` varchar(255) DEFAULT NULL,
|
||||
`in_ref_type` varchar(255) NOT NULL,
|
||||
`warehouse_id` varchar(255) NOT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`pwbilldetail_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
||||
|
||||
DROP TABLE IF EXISTS `t_inventory_fifo_detail`;
|
||||
CREATE TABLE IF NOT EXISTS `t_inventory_fifo_detail` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`balance_count` decimal(19,2) NOT NULL,
|
||||
`balance_money` decimal(19,2) NOT NULL,
|
||||
`balance_price` decimal(19,2) NOT NULL,
|
||||
`date_created` datetime DEFAULT NULL,
|
||||
`goods_id` varchar(255) NOT NULL,
|
||||
`in_count` decimal(19,2) DEFAULT NULL,
|
||||
`in_money` decimal(19,2) DEFAULT NULL,
|
||||
`in_price` decimal(19,2) DEFAULT NULL,
|
||||
`out_count` decimal(19,2) DEFAULT NULL,
|
||||
`out_money` decimal(19,2) DEFAULT NULL,
|
||||
`out_price` decimal(19,2) DEFAULT NULL,
|
||||
`warehouse_id` varchar(255) NOT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`pwbilldetail_id` varchar(255) DEFAULT NULL,
|
||||
`wsbilldetail_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `t_so_bill`;
|
||||
CREATE TABLE IF NOT EXISTS `t_so_bill` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`bill_status` int(11) NOT NULL,
|
||||
`biz_dt` datetime NOT NULL,
|
||||
`deal_date` datetime NOT NULL,
|
||||
`org_id` varchar(255) NOT NULL,
|
||||
`biz_user_id` varchar(255) NOT NULL,
|
||||
`date_created` datetime DEFAULT NULL,
|
||||
`goods_money` decimal(19,2) NOT NULL,
|
||||
`tax` decimal(19,2) NOT NULL,
|
||||
`money_with_tax` decimal(19,2) NOT NULL,
|
||||
`input_user_id` varchar(255) NOT NULL,
|
||||
`ref` varchar(255) NOT NULL,
|
||||
`customer_id` varchar(255) NOT NULL,
|
||||
`contact` varchar(255) NOT NULL,
|
||||
`tel` varchar(255) DEFAULT NULL,
|
||||
`fax` varchar(255) DEFAULT NULL,
|
||||
`deal_address` varchar(255) DEFAULT NULL,
|
||||
`bill_memo` varchar(255) DEFAULT NULL,
|
||||
`receiving_type` int(11) NOT NULL DEFAULT 0,
|
||||
`confirm_user_id` varchar(255) DEFAULT NULL,
|
||||
`confirm_date` datetime DEFAULT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_so_bill_detail`;
|
||||
CREATE TABLE IF NOT EXISTS `t_so_bill_detail` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`date_created` datetime DEFAULT NULL,
|
||||
`goods_id` varchar(255) NOT NULL,
|
||||
`goods_count` int(11) NOT NULL,
|
||||
`goods_money` decimal(19,2) NOT NULL,
|
||||
`goods_price` decimal(19,2) NOT NULL,
|
||||
`sobill_id` varchar(255) NOT NULL,
|
||||
`tax_rate` decimal(19,2) NOT NULL,
|
||||
`tax` decimal(19,2) NOT NULL,
|
||||
`money_with_tax` decimal(19,2) NOT NULL,
|
||||
`ws_count` int(11) NOT NULL,
|
||||
`left_count` int(11) NOT NULL,
|
||||
`show_order` int(11) NOT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_so_ws`;
|
||||
CREATE TABLE IF NOT EXISTS `t_so_ws` (
|
||||
`so_id` varchar(255) NOT NULL,
|
||||
`ws_id` varchar(255) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_goods_brand`;
|
||||
CREATE TABLE IF NOT EXISTS `t_goods_brand` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`parent_id` varchar(255) DEFAULT NULL,
|
||||
`full_name` varchar(1000) DEFAULT NULL,
|
||||
`data_org` varchar(255) DEFAULT NULL,
|
||||
`company_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_goods_bom`;
|
||||
CREATE TABLE IF NOT EXISTS `t_goods_bom` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`goods_id` varchar(255) NOT NULL,
|
||||
`sub_goods_id` varchar(255) NOT NULL,
|
||||
`parent_id` varchar(255) DEFAULT NULL,
|
||||
`sub_goods_count` decimal(19,2) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
320
doc/99 SQL/02InsertInitData.sql
Normal file
320
doc/99 SQL/02InsertInitData.sql
Normal file
|
@ -0,0 +1,320 @@
|
|||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
|
||||
TRUNCATE TABLE `t_fid`;
|
||||
INSERT INTO `t_fid` (`fid`, `name`) VALUES
|
||||
('-9999', '重新登录'),
|
||||
('-9997', '首页'),
|
||||
('-9996', '修改我的密码'),
|
||||
('-9995', '帮助'),
|
||||
('-9994', '关于'),
|
||||
('-9993', '购买商业服务'),
|
||||
('-8999', '用户管理'),
|
||||
('-8999-01', '组织机构在业务单据中的使用权限'),
|
||||
('-8999-02', '业务员在业务单据中的使用权限'),
|
||||
('-8997', '业务日志'),
|
||||
('-8996', '权限管理'),
|
||||
('1001', '商品'),
|
||||
('1001-01', '商品在业务单据中的使用权限'),
|
||||
('1001-02', '商品分类'),
|
||||
('1002', '商品计量单位'),
|
||||
('1003', '仓库'),
|
||||
('1003-01', '仓库在业务单据中的使用权限'),
|
||||
('1004', '供应商档案'),
|
||||
('1004-01', '供应商档案在业务单据中的使用权限'),
|
||||
('1004-02', '供应商分类'),
|
||||
('1007', '客户资料'),
|
||||
('1007-01', '客户资料在业务单据中的使用权限'),
|
||||
('1007-02', '客户分类'),
|
||||
('2000', '库存建账'),
|
||||
('2001', '采购入库'),
|
||||
('2002', '销售出库'),
|
||||
('2002-01', '销售出库'),
|
||||
('2003', '库存账查询'),
|
||||
('2004', '应收账款管理'),
|
||||
('2005', '应付账款管理'),
|
||||
('2006', '销售退货入库'),
|
||||
('2007', '采购退货出库'),
|
||||
('2008', '业务设置'),
|
||||
('2009', '库间调拨'),
|
||||
('2010', '库存盘点'),
|
||||
('2011-01', '首页-销售看板'),
|
||||
('2011-02', '首页-库存看板'),
|
||||
('2011-03', '首页-采购看板'),
|
||||
('2011-04', '首页-资金看板'),
|
||||
('2012', '报表-销售日报表(按商品汇总)'),
|
||||
('2013', '报表-销售日报表(按客户汇总)'),
|
||||
('2014', '报表-销售日报表(按仓库汇总)'),
|
||||
('2015', '报表-销售日报表(按业务员汇总)'),
|
||||
('2016', '报表-销售月报表(按商品汇总)'),
|
||||
('2017', '报表-销售月报表(按客户汇总)'),
|
||||
('2018', '报表-销售月报表(按仓库汇总)'),
|
||||
('2019', '报表-销售月报表(按业务员汇总)'),
|
||||
('2020', '报表-安全库存明细表'),
|
||||
('2021', '报表-应收账款账龄分析表'),
|
||||
('2022', '报表-应付账款账龄分析表'),
|
||||
('2023', '报表-库存超上限明细表'),
|
||||
('2024', '现金收支查询'),
|
||||
('2025', '预收款管理'),
|
||||
('2026', '预付款管理'),
|
||||
('2027', '采购订单'),
|
||||
('2027-01', '采购订单 - 审核/取消审核'),
|
||||
('2027-02', '采购订单 - 生成采购入库单'),
|
||||
('2028', '销售订单'),
|
||||
('2028-01', '销售订单 - 审核/取消审核'),
|
||||
('2028-02', '销售订单 - 生成销售出库单'),
|
||||
('2029', '商品品牌');
|
||||
|
||||
TRUNCATE TABLE `t_menu_item`;
|
||||
INSERT INTO `t_menu_item` (`id`, `caption`, `fid`, `parent_id`, `show_order`) VALUES
|
||||
('01', '文件', NULL, NULL, 1),
|
||||
('0101', '首页', '-9997', '01', 1),
|
||||
('0102', '重新登录', '-9999', '01', 2),
|
||||
('0103', '修改我的密码', '-9996', '01', 3),
|
||||
('02', '采购', NULL, NULL, 2),
|
||||
('0200', '采购订单', '2027', '02', 0),
|
||||
('0201', '采购入库', '2001', '02', 1),
|
||||
('0202', '采购退货出库', '2007', '02', 2),
|
||||
('03', '库存', NULL, NULL, 3),
|
||||
('0301', '库存账查询', '2003', '03', 1),
|
||||
('0302', '库存建账', '2000', '03', 2),
|
||||
('0303', '库间调拨', '2009', '03', 3),
|
||||
('0304', '库存盘点', '2010', '03', 4),
|
||||
('04', '销售', NULL, NULL, 4),
|
||||
('0400', '销售订单', '2028', '04', 0),
|
||||
('0401', '销售出库', '2002', '04', 1),
|
||||
('0402', '销售退货入库', '2006', '04', 2),
|
||||
('05', '客户关系', NULL, NULL, 5),
|
||||
('0501', '客户资料', '1007', '05', 1),
|
||||
('06', '资金', NULL, NULL, 6),
|
||||
('0601', '应收账款管理', '2004', '06', 1),
|
||||
('0602', '应付账款管理', '2005', '06', 2),
|
||||
('0603', '现金收支查询', '2024', '06', 3),
|
||||
('0604', '预收款管理', '2025', '06', 4),
|
||||
('0605', '预付款管理', '2026', '06', 5),
|
||||
('07', '报表', NULL, NULL, 7),
|
||||
('0701', '销售日报表', NULL, '07', 1),
|
||||
('070101', '销售日报表(按商品汇总)', '2012', '0701', 1),
|
||||
('070102', '销售日报表(按客户汇总)', '2013', '0701', 2),
|
||||
('070103', '销售日报表(按仓库汇总)', '2014', '0701', 3),
|
||||
('070104', '销售日报表(按业务员汇总)', '2015', '0701', 4),
|
||||
('0702', '销售月报表', NULL, '07', 2),
|
||||
('070201', '销售月报表(按商品汇总)', '2016', '0702', 1),
|
||||
('070202', '销售月报表(按客户汇总)', '2017', '0702', 2),
|
||||
('070203', '销售月报表(按仓库汇总)', '2018', '0702', 3),
|
||||
('070204', '销售月报表(按业务员汇总)', '2019', '0702', 4),
|
||||
('0703', '库存报表', NULL, '07', 3),
|
||||
('070301', '安全库存明细表', '2020', '0703', 1),
|
||||
('070302', '库存超上限明细表', '2023', '0703', 2),
|
||||
('0706', '资金报表', NULL, '07', 6),
|
||||
('070601', '应收账款账龄分析表', '2021', '0706', 1),
|
||||
('070602', '应付账款账龄分析表', '2022', '0706', 2),
|
||||
('08', '基础数据', NULL, NULL, 8),
|
||||
('0801', '商品', NULL, '08', 1),
|
||||
('080101', '商品', '1001', '0801', 1),
|
||||
('080102', '商品计量单位', '1002', '0801', 2),
|
||||
('080103', '商品品牌', '2029', '0801', 3),
|
||||
('0803', '仓库', '1003', '08', 3),
|
||||
('0804', '供应商档案', '1004', '08', 4),
|
||||
('09', '系统管理', NULL, NULL, 9),
|
||||
('0901', '用户管理', '-8999', '09', 1),
|
||||
('0902', '权限管理', '-8996', '09', 2),
|
||||
('0903', '业务日志', '-8997', '09', 3),
|
||||
('0904', '业务设置', '2008', '09', 4),
|
||||
('10', '帮助', NULL, NULL, 10),
|
||||
('1001', '使用帮助', '-9995', '10', 1),
|
||||
('1002', '购买商业服务', '-9993', '10', 2),
|
||||
('1003', '关于PSI', '-9994', '10', 3);
|
||||
|
||||
TRUNCATE TABLE `t_org`;
|
||||
INSERT INTO `t_org` (`id`, `full_name`, `name`, `org_code`, `data_org`, `parent_id`) VALUES
|
||||
('4D74E1E4-A129-11E4-9B6A-782BCBD7746B', '公司', '公司', '01', '01', NULL),
|
||||
('5EBDBE11-A129-11E4-9B6A-782BCBD7746B', '公司\\信息部', '信息部', '0199', '0101', '4D74E1E4-A129-11E4-9B6A-782BCBD7746B');
|
||||
|
||||
TRUNCATE TABLE `t_permission`;
|
||||
INSERT INTO `t_permission` (`id`, `fid`, `name`, `note`, `category`, `py`) VALUES
|
||||
('-8996', '-8996', '权限管理', '通过菜单进入权限管理模块的权限', '权限管理', 'QXGL'),
|
||||
('-8996-01', '-8996-01', '权限管理-新增角色', '权限管理模块[新增角色]按钮的权限', '权限管理', 'QXGL_XZJS'),
|
||||
('-8996-02', '-8996-02', '权限管理-编辑角色', '权限管理模块[编辑角色]按钮的权限', '权限管理', 'QXGL_BJJS'),
|
||||
('-8996-03', '-8996-03', '权限管理-删除角色', '权限管理模块[删除角色]按钮的权限', '权限管理', 'QXGL_SCJS'),
|
||||
('-8997', '-8997', '业务日志', '业务日志', '系统管理', 'YWRZ'),
|
||||
('-8999', '-8999', '用户管理', '通过菜单进入用户管理模块的权限', '用户管理', 'YHGL'),
|
||||
('-8999-01', '-8999-01', '组织机构在业务单据中的使用权限', '组织机构在业务单据中的使用权限', '用户管理', 'ZZJGZYWDJZDSYQX'),
|
||||
('-8999-02', '-8999-02', '业务员在业务单据中的使用权限', '业务员在业务单据中的使用权限', '用户管理', 'YWYZYWDJZDSYQX'),
|
||||
('-8999-03', '-8999-03', '用户管理-新增组织机构', '用户管理模块[新增组织机构]按钮的权限', '用户管理', 'YHGL_XZZZJG'),
|
||||
('-8999-04', '-8999-04', '用户管理-编辑组织机构', '用户管理模块[编辑组织机构]按钮的权限', '用户管理', 'YHGL_BJZZJG'),
|
||||
('-8999-05', '-8999-05', '用户管理-删除组织机构', '用户管理模块[删除组织机构]按钮的权限', '用户管理', 'YHGL_SCZZJG'),
|
||||
('-8999-06', '-8999-06', '用户管理-新增用户', '用户管理模块[新增用户]按钮的权限', '用户管理', 'YHGL_XZYH'),
|
||||
('-8999-07', '-8999-07', '用户管理-编辑用户', '用户管理模块[编辑用户]按钮的权限', '用户管理', 'YHGL_BJYH'),
|
||||
('-8999-08', '-8999-08', '用户管理-删除用户', '用户管理模块[删除用户]按钮的权限', '用户管理', 'YHGL_SCYH'),
|
||||
('-8999-09', '-8999-09', '用户管理-修改用户密码', '用户管理模块[修改用户密码]按钮的权限', '用户管理', 'YHGL_XGYHMM'),
|
||||
('1001', '1001', '商品', '通过菜单进入基础数据商品模块的权限', '商品', 'SP'),
|
||||
('1001-01', '1001-01', '商品在业务单据中的使用权限', '商品在业务单据中的使用权限', '商品', 'SPZYWDJZDSYQX'),
|
||||
('1001-02', '1001-02', '商品分类', '商品分类', '商品', 'SPFL'),
|
||||
('1001-03', '1001-03', '新增商品分类', '基础数据商品模块[新增商品分类]按钮的权限', '商品', 'XZSPFL'),
|
||||
('1001-04', '1001-04', '编辑商品分类', '基础数据商品模块[编辑商品分类]按钮的权限', '商品', 'BJSPFL'),
|
||||
('1001-05', '1001-05', '删除商品分类', '基础数据商品模块[删除商品分类]按钮的权限', '商品', 'SCSPFL'),
|
||||
('1001-06', '1001-06', '新增商品', '基础数据商品模块[新增商品]按钮的权限', '商品', 'XZSP'),
|
||||
('1001-07', '1001-07', '编辑商品', '基础数据商品模块[编辑商品]按钮的权限', '商品', 'BJSP'),
|
||||
('1001-08', '1001-08', '删除商品', '基础数据商品模块[删除商品]按钮的权限', '商品', 'SCSP'),
|
||||
('1001-09', '1001-09', '导入商品', '基础数据商品模块[导入商品]按钮的权限', '商品', 'DRSP'),
|
||||
('1001-10', '1001-10', '设置商品安全库存', '基础数据商品模块[设置商品安全库存]按钮的权限', '商品', 'SZSPAQKC'),
|
||||
('1002', '1002', '商品计量单位', '商品计量单位', '商品', 'SPJLDW'),
|
||||
('1003', '1003', '仓库', '通过菜单进入基础数据仓库模块的权限', '仓库', 'CK'),
|
||||
('1003-01', '1003-01', '仓库在业务单据中的使用权限', '仓库在业务单据中的使用权限', '仓库', 'CKZYWDJZDSYQX'),
|
||||
('1003-02', '1003-02', '新增仓库', '基础数据仓库模块[新增仓库]按钮的权限', '仓库', 'XZCK'),
|
||||
('1003-03', '1003-03', '编辑仓库', '基础数据仓库模块[编辑仓库]按钮的权限', '仓库', 'BJCK'),
|
||||
('1003-04', '1003-04', '删除仓库', '基础数据仓库模块[删除仓库]按钮的权限', '仓库', 'SCCK'),
|
||||
('1003-05', '1003-05', '修改仓库数据域', '基础数据仓库模块[修改仓库数据域]按钮的权限', '仓库', 'XGCKSJY'),
|
||||
('1004', '1004', '供应商档案', '通过菜单进入基础数据供应商档案模块的权限', '供应商管理', 'GYSDA'),
|
||||
('1004-01', '1004-01', '供应商档案在业务单据中的使用权限', '供应商档案在业务单据中的使用权限', '供应商管理', 'GYSDAZYWDJZDSYQX'),
|
||||
('1004-02', '1004-02', '供应商分类', '供应商分类', '供应商管理', 'GYSFL'),
|
||||
('1004-03', '1004-03', '新增供应商分类', '基础数据供应商档案模块[新增供应商分类]按钮的权限', '供应商管理', 'XZGYSFL'),
|
||||
('1004-04', '1004-04', '编辑供应商分类', '基础数据供应商档案模块[编辑供应商分类]按钮的权限', '供应商管理', 'BJGYSFL'),
|
||||
('1004-05', '1004-05', '删除供应商分类', '基础数据供应商档案模块[删除供应商分类]按钮的权限', '供应商管理', 'SCGYSFL'),
|
||||
('1004-06', '1004-06', '新增供应商', '基础数据供应商档案模块[新增供应商]按钮的权限', '供应商管理', 'XZGYS'),
|
||||
('1004-07', '1004-07', '编辑供应商', '基础数据供应商档案模块[编辑供应商]按钮的权限', '供应商管理', 'BJGYS'),
|
||||
('1004-08', '1004-08', '删除供应商', '基础数据供应商档案模块[删除供应商]按钮的权限', '供应商管理', 'SCGYS'),
|
||||
('1007', '1007', '客户资料', '通过菜单进入客户资料模块的权限', '客户管理', 'KHZL'),
|
||||
('1007-01', '1007-01', '客户资料在业务单据中的使用权限', '客户资料在业务单据中的使用权限', '客户管理', 'KHZLZYWDJZDSYQX'),
|
||||
('1007-02', '1007-02', '客户分类', '客户分类', '客户管理', 'KHFL'),
|
||||
('1007-03', '1007-03', '新增客户分类', '客户资料模块[新增客户分类]按钮的权限', '客户管理', 'XZKHFL'),
|
||||
('1007-04', '1007-04', '编辑客户分类', '客户资料模块[编辑客户分类]按钮的权限', '客户管理', 'BJKHFL'),
|
||||
('1007-05', '1007-05', '删除客户分类', '客户资料模块[删除客户分类]按钮的权限', '客户管理', 'SCKHFL'),
|
||||
('1007-06', '1007-06', '新增客户', '客户资料模块[新增客户]按钮的权限', '客户管理', 'XZKH'),
|
||||
('1007-07', '1007-07', '编辑客户', '客户资料模块[编辑客户]按钮的权限', '客户管理', 'BJKH'),
|
||||
('1007-08', '1007-08', '删除客户', '客户资料模块[删除客户]按钮的权限', '客户管理', 'SCKH'),
|
||||
('1007-09', '1007-09', '导入客户', '客户资料模块[导入客户]按钮的权限', '客户管理', 'DRKH'),
|
||||
('2000', '2000', '库存建账', '库存建账', '库存建账', 'KCJZ'),
|
||||
('2001', '2001', '采购入库', '采购入库', '采购入库', 'CGRK'),
|
||||
('2002', '2002', '销售出库', '销售出库', '销售出库', 'XSCK'),
|
||||
('2002-01', '2002-01', '销售出库单允许编辑销售单价', '销售出库单允许编辑销售单价', '销售出库', 'XSCKDYXBJXSDJ'),
|
||||
('2003', '2003', '库存账查询', '库存账查询', '库存账查询', 'KCZCX'),
|
||||
('2004', '2004', '应收账款管理', '应收账款管理', '应收账款管理', 'YSZKGL'),
|
||||
('2005', '2005', '应付账款管理', '应付账款管理', '应付账款管理', 'YFZKGL'),
|
||||
('2006', '2006', '销售退货入库', '销售退货入库', '销售退货入库', 'XSTHRK'),
|
||||
('2007', '2007', '采购退货出库', '采购退货出库', '采购退货出库', 'CGTHCK'),
|
||||
('2008', '2008', '业务设置', '业务设置', '系统管理', 'YWSZ'),
|
||||
('2009', '2009', '库间调拨', '库间调拨', '库间调拨', 'KJDB'),
|
||||
('2010', '2010', '库存盘点', '库存盘点', '库存盘点', 'KCPD'),
|
||||
('2011-01', '2011-01', '首页-销售看板', '首页-销售看板', '首页看板', 'SY_XSKB'),
|
||||
('2011-02', '2011-02', '首页-库存看板', '首页-库存看板', '首页看板', 'SY_KCKB'),
|
||||
('2011-03', '2011-03', '首页-采购看板', '首页-采购看板', '首页看板', 'SY_CGKB'),
|
||||
('2011-04', '2011-04', '首页-资金看板', '首页-资金看板', '首页看板', 'SY_ZJKB'),
|
||||
('2012', '2012', '报表-销售日报表(按商品汇总)', '报表-销售日报表(按商品汇总)', '销售日报表', 'BB_XSRBB_ASPHZ_'),
|
||||
('2013', '2013', '报表-销售日报表(按客户汇总)', '报表-销售日报表(按客户汇总)', '销售日报表', 'BB_XSRBB_AKHHZ_'),
|
||||
('2014', '2014', '报表-销售日报表(按仓库汇总)', '报表-销售日报表(按仓库汇总)', '销售日报表', 'BB_XSRBB_ACKHZ_'),
|
||||
('2015', '2015', '报表-销售日报表(按业务员汇总)', '报表-销售日报表(按业务员汇总)', '销售日报表', 'BB_XSRBB_AYWYHZ_'),
|
||||
('2016', '2016', '报表-销售月报表(按商品汇总)', '报表-销售月报表(按商品汇总)', '销售月报表', 'BB_XSYBB_ASPHZ_'),
|
||||
('2017', '2017', '报表-销售月报表(按客户汇总)', '报表-销售月报表(按客户汇总)', '销售月报表', 'BB_XSYBB_AKHHZ_'),
|
||||
('2018', '2018', '报表-销售月报表(按仓库汇总)', '报表-销售月报表(按仓库汇总)', '销售月报表', 'BB_XSYBB_ACKHZ_'),
|
||||
('2019', '2019', '报表-销售月报表(按业务员汇总)', '报表-销售月报表(按业务员汇总)', '销售月报表', 'BB_XSYBB_AYWYHZ_'),
|
||||
('2020', '2020', '报表-安全库存明细表', '报表-安全库存明细表', '库存报表', 'BB_AQKCMXB'),
|
||||
('2021', '2021', '报表-应收账款账龄分析表', '报表-应收账款账龄分析表', '资金报表', 'BB_YSZKZLFXB'),
|
||||
('2022', '2022', '报表-应付账款账龄分析表', '报表-应付账款账龄分析表', '资金报表', 'BB_YFZKZLFXB'),
|
||||
('2023', '2023', '报表-库存超上限明细表', '报表-库存超上限明细表', '库存报表', 'BB_KCCSXMXB'),
|
||||
('2024', '2024', '现金收支查询', '现金收支查询', '现金管理', 'XJSZCX'),
|
||||
('2025', '2025', '预收款管理', '预收款管理', '预收款管理', 'YSKGL'),
|
||||
('2026', '2026', '预付款管理', '预付款管理', '预付款管理', 'YFKGL'),
|
||||
('2027', '2027', '采购订单', '采购订单', '采购订单', 'CGDD'),
|
||||
('2027-01', '2027-01', '采购订单 - 审核/取消审核', '采购订单 - 审核/取消审核', '采购订单', 'CGDD _ SH_QXSH'),
|
||||
('2027-02', '2027-02', '采购订单 - 生成采购入库单', '采购订单 - 生成采购入库单', '采购订单', 'CGDD _ SCCGRKD'),
|
||||
('2028', '2028', '销售订单', '销售订单', '销售订单', 'XSDD'),
|
||||
('2028-01', '2028-01', '销售订单 - 审核/取消审核', '销售订单 - 审核/取消审核', '销售订单', 'XSDD _ SH_QXSH'),
|
||||
('2028-02', '2028-02', '销售订单 - 生成销售出库单', '销售订单 - 生成销售出库单', '销售订单', 'XSDD _ SCXSCKD'),
|
||||
('2029', '2029', '商品品牌', '通过菜单进入基础数据商品品牌模块的权限', '商品', 'SPPP');
|
||||
|
||||
TRUNCATE TABLE `t_role`;
|
||||
INSERT INTO `t_role` (`id`, `name`, `data_org`, `company_id`) VALUES
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '系统管理', '01010001', '4D74E1E4-A129-11E4-9B6A-782BCBD7746B');
|
||||
|
||||
TRUNCATE TABLE `t_role_permission`;
|
||||
INSERT INTO `t_role_permission` (`role_id`, `permission_id`) VALUES
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '-8999'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '-8997'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '-8996'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '1001'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '1002'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '1003'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '1004'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '1007'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2000'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2001'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2002'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2002-01'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2003'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2004'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2005'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2006'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2007'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2008'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2009'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2010'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2011-01'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2011-02'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2011-03'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2011-04'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2012'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2013'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2014'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2015'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2016'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2017'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2018'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2019'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2020'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2021'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2022'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2023'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2024'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2025'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2026'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2027'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2027-01'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2027-02'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2028'),
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '2029');
|
||||
|
||||
TRUNCATE TABLE `t_role_user`;
|
||||
INSERT INTO `t_role_user` (`role_id`, `user_id`) VALUES
|
||||
('A83F617E-A153-11E4-A9B8-782BCBD7746B', '6C2A09CD-A129-11E4-9B6A-782BCBD7746B');
|
||||
|
||||
TRUNCATE TABLE `t_user`;
|
||||
INSERT INTO `t_user` (`id`, `enabled`, `login_name`, `name`, `org_id`, `org_code`, `data_org`, `password`, `py`) VALUES
|
||||
('6C2A09CD-A129-11E4-9B6A-782BCBD7746B', '1', 'admin', '系统管理员', '5EBDBE11-A129-11E4-9B6A-782BCBD7746B', '019901', '01010001', '21232f297a57a5a743894a0e4a801fc3', 'XTGLY');
|
||||
|
||||
TRUNCATE TABLE `t_config`;
|
||||
INSERT INTO `t_config` (`id`, `name`, `value`, `note`, `show_order`) VALUES
|
||||
('9000-01', '公司名称', '', '', 100),
|
||||
('9000-02', '公司地址', '', '', 101),
|
||||
('9000-03', '公司电话', '', '', 102),
|
||||
('9000-04', '公司传真', '', '', 103),
|
||||
('9000-05', '公司邮编', '', '', 104),
|
||||
('2001-01', '采购入库默认仓库', '', '', 200),
|
||||
('2002-02', '销售出库默认仓库', '', '', 300),
|
||||
('2002-01', '销售出库单允许编辑销售单价', '0', '当允许编辑的时候,还需要给用户赋予权限[销售出库单允许编辑销售单价]', 301),
|
||||
('1003-02', '存货计价方法', '0', '', 401),
|
||||
('9001-01', '增值税税率', '17', '', 501),
|
||||
('9002-01', '产品名称', '开源进销存PSI', '', 0),
|
||||
('9003-01', '采购订单单号前缀', 'PO', '', 601),
|
||||
('9003-02', '采购入库单单号前缀', 'PW', '', 602),
|
||||
('9003-03', '采购退货出库单单号前缀', 'PR', '', 603),
|
||||
('9003-04', '销售出库单单号前缀', 'WS', '', 604),
|
||||
('9003-05', '销售退货入库单单号前缀', 'SR', '', 605),
|
||||
('9003-06', '调拨单单号前缀', 'IT', '', 606),
|
||||
('9003-07', '盘点单单号前缀', 'IC', '', 607),
|
||||
('9003-08', '销售订单单号前缀', 'SO', '', 608);
|
||||
|
||||
update t_config set company_id = '4D74E1E4-A129-11E4-9B6A-782BCBD7746B' ;
|
||||
|
||||
TRUNCATE TABLE `t_psi_db_version`;
|
||||
INSERT INTO `t_psi_db_version` (`db_version`, `update_dt`) VALUES
|
||||
('20160314-01', now());
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
173
doc/99 SQL/99psi_demo_data.sql
Normal file
173
doc/99 SQL/99psi_demo_data.sql
Normal file
|
@ -0,0 +1,173 @@
|
|||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
|
||||
TRUNCATE TABLE `t_customer`;
|
||||
INSERT INTO `t_customer` (`id`, `category_id`, `code`, `name`, `contact01`, `qq01`, `tel01`, `mobile01`, `contact02`, `qq02`, `tel02`, `mobile02`, `py`, `init_receivables`, `init_receivables_dt`, `init_payables`, `init_payables_dt`) VALUES
|
||||
('04B53C5E-B812-11E4-8FC9-782BCBD7746B', 'CDD1DE38-B811-11E4-8FC9-782BCBD7746B', '102', '大连宏光天宝大酒店有限公司', '', '', '', '', '', '', '', '', 'DLHGTBDJDYXGS', '7000.00', '2015-01-01 00:00:00', NULL, NULL),
|
||||
('20B0AF03-B812-11E4-8FC9-782BCBD7746B', 'CDD1DE38-B811-11E4-8FC9-782BCBD7746B', '103', '大连华城电子有限公司', '', '', '', '', '', '', '', '', 'DLHCDZYXGS', NULL, NULL, NULL, NULL),
|
||||
('2A837526-B812-11E4-8FC9-782BCBD7746B', 'CDD1DE38-B811-11E4-8FC9-782BCBD7746B', '104', '哈尔滨工大建设监理有限公司', '', '', '', '', '', '', '', '', 'HEBGDJSJLYXGS', NULL, NULL, NULL, NULL),
|
||||
('3DE2F4E1-B812-11E4-8FC9-782BCBD7746B', 'D33D2C0B-B811-11E4-8FC9-782BCBD7746B', '201', '大连海恩橡胶辅机有限公司', '', '', '', '', '', '', '', '', 'DLHEXJFJYXGS', NULL, NULL, NULL, NULL),
|
||||
('E76FA3FC-B811-11E4-8FC9-782BCBD7746B', 'CDD1DE38-B811-11E4-8FC9-782BCBD7746B', '101', '匿名', '', '', '', '', '', '', '', '', 'NM', NULL, NULL, NULL, NULL);
|
||||
|
||||
update t_customer set data_org = '01010001', company_id = '4D74E1E4-A129-11E4-9B6A-782BCBD7746B' ;
|
||||
|
||||
TRUNCATE TABLE `t_customer_category`;
|
||||
INSERT INTO `t_customer_category` (`id`, `code`, `name`, `parent_id`) VALUES
|
||||
('CDD1DE38-B811-11E4-8FC9-782BCBD7746B', '1', '市内', NULL),
|
||||
('D33D2C0B-B811-11E4-8FC9-782BCBD7746B', '2', '北三市', NULL);
|
||||
|
||||
update t_customer_category set data_org = '01010001', company_id = '4D74E1E4-A129-11E4-9B6A-782BCBD7746B' ;
|
||||
|
||||
TRUNCATE TABLE `t_goods`;
|
||||
INSERT INTO `t_goods` (`id`, `category_id`, `code`, `name`, `sale_price`, `spec`, `unit_id`, `purchase_price`, `py`) VALUES
|
||||
('04C2141B-B74A-11E4-98B5-782BCBD7746B', '6C2AFC9A-B3F3-11E4-9DEA-782BCBD7746B', '2103', '夏普空气净化器', '1399.00', 'KC-W200SW', '5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', NULL, 'XPKQJHQ'),
|
||||
('06CFC35B-B75F-11E4-B135-782BCBD7746B', '953219F9-B3F3-11E4-9DEA-782BCBD7746B', '5103', '朗瑞特家用无线智能门铃', '88.00', '白色LR-1688BY-2 ', '5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', NULL, 'LRTJYWXZNML'),
|
||||
('089D45AB-B745-11E4-9C3C-782BCBD7746B', '66D899C2-B3F3-11E4-9DEA-782BCBD7746B', '1204', '海尔多门冰箱', '4299.00', '银灰色BCD-339WBA 339 ', '5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', NULL, 'HEDMBX'),
|
||||
('14716F2E-B749-11E4-98B5-782BCBD7746B', '66D899C2-B3F3-11E4-9DEA-782BCBD7746B', '1404', '森太消毒柜', '675.00', '黑色一体冲压款F280嵌入式家用厨房消毒碗柜 黑色钢化玻璃轻触按键款 ', '5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', NULL, 'STXDG'),
|
||||
('1736597F-B74B-11E4-98B5-782BCBD7746B', '89BCA8E9-B3F3-11E4-9DEA-782BCBD7746B', '4101', '金泰昌按摩足浴盆', '369.00', 'TC-5196', '5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', NULL, 'JTCAMZYP'),
|
||||
('1B411CD9-B76A-11E4-9AAE-782BCBD7746B', '74C50B1B-B3F3-11E4-9DEA-782BCBD7746B', '3102', '九阳多功能无网全钢豆浆机', '249.00', 'DJ12B-A603DG ', '5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', NULL, 'JYDGNWWQGDJJ'),
|
||||
('1D0177A0-B746-11E4-9C3C-782BCBD7746B', '66D899C2-B3F3-11E4-9DEA-782BCBD7746B', '1303', '飞利浦家庭影院 ', '3599.00', '黑色HTB5540D/93 晶晰音效 3D蓝光DVD 内置WIFI 蓝牙 可搭配高清电视', '50C40382-B745-11E4-9C3C-782BCBD7746B', NULL, 'FLPJTYY'),
|
||||
('2D1C672D-B74A-11E4-98B5-782BCBD7746B', '6C2AFC9A-B3F3-11E4-9DEA-782BCBD7746B', '2104', '纽贝尔小王子空气净化器', '3999.00', '金色 NBE-XWZ', '5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', NULL, 'NBEXWZKQJHQ'),
|
||||
('359389E5-B745-11E4-9C3C-782BCBD7746B', '66D899C2-B3F3-11E4-9DEA-782BCBD7746B', '1205', '松下风冷变频三门冰箱', '5099.00', '316升典雅银NR-C32WP2-S ', '5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', NULL, 'SXFLBPSMBX'),
|
||||
('35FA2DE1-B746-11E4-9C3C-782BCBD7746B', '66D899C2-B3F3-11E4-9DEA-782BCBD7746B', '1304', 'JBL CINEMA BASECN 回音壁音箱', '2980.00', '黑色', '50C40382-B745-11E4-9C3C-782BCBD7746B', NULL, 'JCBHYBYX'),
|
||||
('373A750B-B749-11E4-98B5-782BCBD7746B', '66D899C2-B3F3-11E4-9DEA-782BCBD7746B', '1405', '西门子原装进口电烤箱', '5999.00', 'HB11AB521W', '5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', NULL, 'XMZYZJKDKX'),
|
||||
('3AD67063-B74B-11E4-98B5-782BCBD7746B', '89BCA8E9-B3F3-11E4-9DEA-782BCBD7746B', '4201', '欧姆龙电子血压计', '299.00', 'HEM-7051上臂式', '5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', NULL, 'OMLDZXYJ'),
|
||||
('45B5B8A2-B3F5-11E4-9DEA-782BCBD7746B', '66D899C2-B3F3-11E4-9DEA-782BCBD7746B', '1201', '容声冰箱', '1498.00', '202升 三门 拉丝银色BCD-202M/TX6-GF61-C', '5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', NULL, 'RSBX'),
|
||||
('4735240F-B3F4-11E4-9DEA-782BCBD7746B', '66D899C2-B3F3-11E4-9DEA-782BCBD7746B', '1103', '索尼全高清LED液晶电视', '2799.00', '40英寸黑色KDL-40RM10B', '5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', NULL, 'SNQGQLJDS'),
|
||||
('496850A9-B74A-11E4-98B5-782BCBD7746B', '6C2AFC9A-B3F3-11E4-9DEA-782BCBD7746B', '2105', '瑞典布鲁雅尔专业空气净化器', '11680.00', '603', '5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', NULL, 'RDBLYEZYKQJHQ'),
|
||||
('5148FC80-B76A-11E4-9AAE-782BCBD7746B', '74C50B1B-B3F3-11E4-9DEA-782BCBD7746B', '3103', '苏泊尔豆浆机', '349.00', 'DJ12B-Y94E', '5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', NULL, 'SBEDJJ'),
|
||||
('5472B0C8-B746-11E4-9C3C-782BCBD7746B', '66D899C2-B3F3-11E4-9DEA-782BCBD7746B', '1305', '三星家庭影院', '1499.00', '黑色 无线重低音炮 蓝牙 3D水晶功放Soundbar回音壁音响电视音箱', '50C40382-B745-11E4-9C3C-782BCBD7746B', NULL, 'SXJTYY'),
|
||||
('5ADA53E3-B749-11E4-98B5-782BCBD7746B', '66D899C2-B3F3-11E4-9DEA-782BCBD7746B', '1501', '凡萨帝高端风冷压缩机恒温红酒柜', '2980.00', '1挂+7层', '5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', NULL, 'FSDGDFLYSJHWHJG'),
|
||||
('5E8F05FF-B74B-11E4-98B5-782BCBD7746B', '953219F9-B3F3-11E4-9DEA-782BCBD7746B', '5101', '朗瑞特一拖一 家用无线智能门铃', '48.00', '白色LR-1688BY', '5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', NULL, 'LRTYTYJYWXZNML'),
|
||||
('7122320E-B76A-11E4-9AAE-782BCBD7746B', '74C50B1B-B3F3-11E4-9DEA-782BCBD7746B', '3104', '飞利浦豆浆机', '798.00', 'HD2078/03', '5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', NULL, 'FLPDJJ'),
|
||||
('7ED6D9C2-B749-11E4-98B5-782BCBD7746B', '66D899C2-B3F3-11E4-9DEA-782BCBD7746B', '1502', '博世专业酒柜', '6899.00', '银色228升 ', '5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', NULL, 'BSZYJG'),
|
||||
('8CBD95C4-B3F4-11E4-9DEA-782BCBD7746B', '66D899C2-B3F3-11E4-9DEA-782BCBD7746B', '1104', '创维酷开4K超高清平板液晶电视', '4499.00', '55英寸白色U55', '5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', NULL, 'CWKKGQPBYJDS'),
|
||||
('903F1597-B744-11E4-9C3C-782BCBD7746B', '66D899C2-B3F3-11E4-9DEA-782BCBD7746B', '1202', '美的对开门冰箱', '3499.00', '516升泰坦银BCD-516WKM(E) ', '5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', NULL, 'MDDKMBX'),
|
||||
('95554EBC-B74A-11E4-98B5-782BCBD7746B', '6C2AFC9A-B3F3-11E4-9DEA-782BCBD7746B', '2106', '爱屋安智能测控空气净化器', '2999.00', 'AP450', '5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', NULL, 'AWAZNCKKQJHQ'),
|
||||
('95D1BFFC-B746-11E4-9C3C-782BCBD7746B', '66D899C2-B3F3-11E4-9DEA-782BCBD7746B', '1401', '康宝立式消毒柜消毒碗柜', '439.00', 'ZTP80A-25(H)', '5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', NULL, 'KBLSXDGXDWG'),
|
||||
('AB325C43-B744-11E4-9C3C-782BCBD7746B', '66D899C2-B3F3-11E4-9DEA-782BCBD7746B', '1203', '格兰仕节能冰箱', '999.00', 'BCD-178N 178L珍·鲜系列', '5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', NULL, 'GLSJNBX'),
|
||||
('B0F6FBA5-B745-11E4-9C3C-782BCBD7746B', '66D899C2-B3F3-11E4-9DEA-782BCBD7746B', '1301', '索尼家庭影院', '3088.00', '黑色HT-CT770无线重低音扬声器 Soundbar回音壁音响 可挂式电视音箱', '50C40382-B745-11E4-9C3C-782BCBD7746B', NULL, 'SNJTYY'),
|
||||
('BA7AC1DC-B746-11E4-9C3C-782BCBD7746B', '66D899C2-B3F3-11E4-9DEA-782BCBD7746B', '1402', '欧尼尔嵌入式消毒碗柜', '739.00', '黑色低温(OUNIER)X8 消毒柜 家用 消毒碗柜 ', '50C40382-B745-11E4-9C3C-782BCBD7746B', NULL, 'ONEQRSXDWG'),
|
||||
('BB01CEF8-B3F5-11E4-9DEA-782BCBD7746B', '6C2AFC9A-B3F3-11E4-9DEA-782BCBD7746B', '2101', '飞利浦空气净化器', '2999.00', '香槟色 AC4076 ', '5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', NULL, 'FLPKQJHQ'),
|
||||
('BE3C9CBF-B74A-11E4-98B5-782BCBD7746B', '6C2AFC9A-B3F3-11E4-9DEA-782BCBD7746B', '2201', '美的温热型饮水机', '199.00', 'MYR718S-X', '5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', NULL, 'MDWRXYSJ'),
|
||||
('BF635F9D-B749-11E4-98B5-782BCBD7746B', '6C2AFC9A-B3F3-11E4-9DEA-782BCBD7746B', '2102', '瑞典布鲁雅尔专业空气净化器', '6299.00', '510B', '5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', NULL, 'RDBLYEZYKQJHQ'),
|
||||
('D84201A3-B745-11E4-9C3C-782BCBD7746B', '66D899C2-B3F3-11E4-9DEA-782BCBD7746B', '1302', '飞利浦迷你音响', '1599.00', '黑色HTL4110/93 电视音箱音响 家庭影院 回音壁音箱 木质音箱 USB播放器', '50C40382-B745-11E4-9C3C-782BCBD7746B', NULL, 'FLPMNYX'),
|
||||
('DA4D10A8-B3F3-11E4-9DEA-782BCBD7746B', '66D899C2-B3F3-11E4-9DEA-782BCBD7746B', '1101', '创维酷开网络平板液晶电视', '2799.00', '50英寸黑色K50J', '5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', NULL, 'CWKKWLPBYJDS'),
|
||||
('E2A660FD-B3F4-11E4-9DEA-782BCBD7746B', '66D899C2-B3F3-11E4-9DEA-782BCBD7746B', '1105', '长虹安卓智能LED液晶电视', '2299.00', '42英寸黑色', '5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', NULL, 'CHAZZNLJDS'),
|
||||
('E600D194-B75E-11E4-B135-782BCBD7746B', '953219F9-B3F3-11E4-9DEA-782BCBD7746B', '5102', '海得曼无线门铃', '66.00', 'E-228 ', '5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', NULL, 'HDMWXML'),
|
||||
('EF05A6DF-B74A-11E4-98B5-782BCBD7746B', '74C50B1B-B3F3-11E4-9DEA-782BCBD7746B', '3101', '九阳双磨多功能全钢豆浆机', '399.00', 'DJ13B-D08EC', '5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', NULL, 'JYSMDGNQGDJJ'),
|
||||
('F4BA9C47-B748-11E4-98B5-782BCBD7746B', '66D899C2-B3F3-11E4-9DEA-782BCBD7746B', '1403', '海尔消毒柜', '1098.00', 'ZTD100-A', '5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', NULL, 'HEXDG'),
|
||||
('FDE1B0F0-B3F3-11E4-9DEA-782BCBD7746B', '66D899C2-B3F3-11E4-9DEA-782BCBD7746B', '1102', '康佳窄边全高清液晶电视', '1999.00', '42英寸黑色LED42E330CE', '5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', NULL, 'KJZBQGQYJDS');
|
||||
|
||||
update t_goods set data_org = '01010001', company_id = '4D74E1E4-A129-11E4-9B6A-782BCBD7746B' ;
|
||||
|
||||
TRUNCATE TABLE `t_goods_category`;
|
||||
INSERT INTO `t_goods_category` (`id`, `code`, `name`) VALUES
|
||||
('66D899C2-B3F3-11E4-9DEA-782BCBD7746B', '1', '大家电'),
|
||||
('6C2AFC9A-B3F3-11E4-9DEA-782BCBD7746B', '2', '生活电器'),
|
||||
('74C50B1B-B3F3-11E4-9DEA-782BCBD7746B', '3', '厨房电器'),
|
||||
('89BCA8E9-B3F3-11E4-9DEA-782BCBD7746B', '4', '个护健康'),
|
||||
('953219F9-B3F3-11E4-9DEA-782BCBD7746B', '5', '五金家装');
|
||||
|
||||
update t_goods_category set data_org = '01010001', full_name = name, company_id = '4D74E1E4-A129-11E4-9B6A-782BCBD7746B' ;
|
||||
|
||||
TRUNCATE TABLE `t_goods_unit`;
|
||||
INSERT INTO `t_goods_unit` (`id`, `name`) VALUES
|
||||
('50C40382-B745-11E4-9C3C-782BCBD7746B', '套'),
|
||||
('5D6D901E-B3F3-11E4-9DEA-782BCBD7746B', '台');
|
||||
|
||||
update t_goods_unit set data_org = '01010001', company_id = '4D74E1E4-A129-11E4-9B6A-782BCBD7746B';
|
||||
|
||||
TRUNCATE TABLE `t_payables`;
|
||||
INSERT INTO `t_payables` (`id`, `act_money`, `balance_money`, `ca_id`, `ca_type`, `pay_money`) VALUES
|
||||
('88072F8B-B80F-11E4-8FC9-782BCBD7746B', '0.00', '5000.00', '87D62652-B80F-11E4-8FC9-782BCBD7746B', 'supplier', '5000.00');
|
||||
|
||||
update t_payables set data_org = '01010001', company_id = '4D74E1E4-A129-11E4-9B6A-782BCBD7746B' ;
|
||||
|
||||
TRUNCATE TABLE `t_payables_detail`;
|
||||
INSERT INTO `t_payables_detail` (`id`, `act_money`, `balance_money`, `ca_id`, `ca_type`, `biz_date`, `date_created`, `pay_money`, `ref_number`, `ref_type`) VALUES
|
||||
('8800479E-B80F-11E4-8FC9-782BCBD7746B', '0.00', '5000.00', '87D62652-B80F-11E4-8FC9-782BCBD7746B', 'supplier', '2015-01-01 00:00:00', '2015-02-19 16:15:57', '5000.00', '87D62652-B80F-11E4-8FC9-782BCBD7746B', '应付账款期初建账');
|
||||
|
||||
update t_payables_detail set data_org = '01010001', company_id = '4D74E1E4-A129-11E4-9B6A-782BCBD7746B' ;
|
||||
|
||||
TRUNCATE TABLE `t_receivables`;
|
||||
INSERT INTO `t_receivables` (`id`, `act_money`, `balance_money`, `ca_id`, `ca_type`, `rv_money`) VALUES
|
||||
('04DFC20D-B812-11E4-8FC9-782BCBD7746B', '0.00', '7000.00', '04B53C5E-B812-11E4-8FC9-782BCBD7746B', 'customer', '7000.00');
|
||||
|
||||
update t_receivables set data_org = '01010001', company_id = '4D74E1E4-A129-11E4-9B6A-782BCBD7746B' ;
|
||||
|
||||
TRUNCATE TABLE `t_receivables_detail`;
|
||||
INSERT INTO `t_receivables_detail` (`id`, `act_money`, `balance_money`, `ca_id`, `ca_type`, `biz_date`, `date_created`, `ref_number`, `ref_type`, `rv_money`) VALUES
|
||||
('04D71E39-B812-11E4-8FC9-782BCBD7746B', '0.00', '7000.00', '04B53C5E-B812-11E4-8FC9-782BCBD7746B', 'customer', '2015-01-01 00:00:00', '2015-02-19 16:33:45', '04B53C5E-B812-11E4-8FC9-782BCBD7746B', '应收账款期初建账', '7000.00');
|
||||
|
||||
update t_receivables_detail set data_org = '01010001', company_id = '4D74E1E4-A129-11E4-9B6A-782BCBD7746B' ;
|
||||
|
||||
TRUNCATE TABLE `t_recent_fid`;
|
||||
INSERT INTO `t_recent_fid` (`fid`, `user_id`, `click_count`) VALUES
|
||||
('-8999', '6C2A09CD-A129-11E4-9B6A-782BCBD7746B', 4),
|
||||
('-8996', '6C2A09CD-A129-11E4-9B6A-782BCBD7746B', 3),
|
||||
('1003', '6C2A09CD-A129-11E4-9B6A-782BCBD7746B', 2),
|
||||
('1002', '6C2A09CD-A129-11E4-9B6A-782BCBD7746B', 2),
|
||||
('1001', '6C2A09CD-A129-11E4-9B6A-782BCBD7746B', 12),
|
||||
('-8997', '6C2A09CD-A129-11E4-9B6A-782BCBD7746B', 2),
|
||||
('2001', '6C2A09CD-A129-11E4-9B6A-782BCBD7746B', 3),
|
||||
('1004', '6C2A09CD-A129-11E4-9B6A-782BCBD7746B', 2),
|
||||
('2005', '6C2A09CD-A129-11E4-9B6A-782BCBD7746B', 1),
|
||||
('1007', '6C2A09CD-A129-11E4-9B6A-782BCBD7746B', 2),
|
||||
('2004', '6C2A09CD-A129-11E4-9B6A-782BCBD7746B', 1),
|
||||
('2000', '6C2A09CD-A129-11E4-9B6A-782BCBD7746B', 1),
|
||||
('2009', '6C2A09CD-A129-11E4-9B6A-782BCBD7746B', 1);
|
||||
|
||||
TRUNCATE TABLE `t_supplier`;
|
||||
INSERT INTO `t_supplier` (`id`, `category_id`, `code`, `name`, `contact01`, `qq01`, `tel01`, `mobile01`, `contact02`, `qq02`, `tel02`, `mobile02`, `py`, `init_receivables`, `init_receivables_dt`, `init_payables`, `init_payables_dt`) VALUES
|
||||
('01F98E5A-B811-11E4-8FC9-782BCBD7746B', '602BA712-B80F-11E4-8FC9-782BCBD7746B', '220', '大连华鑫船舶物资有限公司', '', '', '', '', '', '', '', '', 'DLHXCBWZYXGS', NULL, NULL, NULL, NULL),
|
||||
('0AAE3DAA-B811-11E4-8FC9-782BCBD7746B', '602BA712-B80F-11E4-8FC9-782BCBD7746B', '221', '大连聚丰芮生国际贸易有限公司', '', '', '', '', '', '', '', '', 'DLJFRSGJMYYXGS', NULL, NULL, NULL, NULL),
|
||||
('1275ABFD-B810-11E4-8FC9-782BCBD7746B', '602BA712-B80F-11E4-8FC9-782BCBD7746B', '208', '大连纳源电力建设工程有限公司', '', '', '', '', '', '', '', '', 'DLNYDLJSGCYXGS', NULL, NULL, NULL, NULL),
|
||||
('2530FF8A-B810-11E4-8FC9-782BCBD7746B', '602BA712-B80F-11E4-8FC9-782BCBD7746B', '209', '大连天运物流设备有限公司', '', '', '', '', '', '', '', '', 'DLTYWLSBYXGS', NULL, NULL, NULL, NULL),
|
||||
('267C11BA-B811-11E4-8FC9-782BCBD7746B', '602BA712-B80F-11E4-8FC9-782BCBD7746B', '222', '大连弗瑞得科技有限公司', '', '', '', '', '', '', '', '', 'DLFRDKJYXGS', NULL, NULL, NULL, NULL),
|
||||
('3AE15383-B811-11E4-8FC9-782BCBD7746B', '599B7CF5-B80F-11E4-8FC9-782BCBD7746B', '101', '杉德电子商务服务有限公司大连分公司', '', '', '', '', '', '', '', '', 'SDDZSWFWYXGSDLFGS', NULL, NULL, NULL, NULL),
|
||||
('3EB4B95E-B810-11E4-8FC9-782BCBD7746B', '602BA712-B80F-11E4-8FC9-782BCBD7746B', '210', '大连亚农农业科技有限公司', '', '', '', '', '', '', '', '', 'DLYNNYKJYXGS', NULL, NULL, NULL, NULL),
|
||||
('4B41D6E0-B810-11E4-8FC9-782BCBD7746B', '602BA712-B80F-11E4-8FC9-782BCBD7746B', '211', '大连市友光科技有限公司', '', '', '', '', '', '', '', '', 'DLSYGKJYXGS', NULL, NULL, NULL, NULL),
|
||||
('5AD88F44-B810-11E4-8FC9-782BCBD7746B', '602BA712-B80F-11E4-8FC9-782BCBD7746B', '212', '大连保税区埃玛国际贸易有限公司', '', '', '', '', '', '', '', '', 'DLBSQAMGJMYYXGS', NULL, NULL, NULL, NULL),
|
||||
('634489C3-B811-11E4-8FC9-782BCBD7746B', '602BA712-B80F-11E4-8FC9-782BCBD7746B', '223', '辽宁华谊兄弟贸易有限公司', '', '', '', '', '', '', '', '', 'LNHYXDMYYXGS', NULL, NULL, NULL, NULL),
|
||||
('7566E8A3-B810-11E4-8FC9-782BCBD7746B', '602BA712-B80F-11E4-8FC9-782BCBD7746B', '213', '大连北城国际贸易有限公司', '', '', '', '', '', '', '', '', 'DLBCGJMYYXGS', NULL, NULL, NULL, NULL),
|
||||
('83E70C80-B810-11E4-8FC9-782BCBD7746B', '602BA712-B80F-11E4-8FC9-782BCBD7746B', '214', '大连升鑫金属制品有限公司', '', '', '', '', '', '', '', '', 'DLSXJSZPYXGS', NULL, NULL, NULL, NULL),
|
||||
('87D62652-B80F-11E4-8FC9-782BCBD7746B', '602BA712-B80F-11E4-8FC9-782BCBD7746B', '201', '大连保税区海尔电冰箱贸易有限公司', '', '', '', '', '', '', '', '', 'DLBSQHEDBXMYYXGS', NULL, NULL, '5000.00', '2015-01-01 00:00:00'),
|
||||
('92FC6367-B811-11E4-8FC9-782BCBD7746B', '599B7CF5-B80F-11E4-8FC9-782BCBD7746B', '102', '大连铭源伟业商贸有限公司', '', '', '', '', '', '', '', '', 'DLMYWYSMYXGS', NULL, NULL, NULL, NULL),
|
||||
('97940C9F-B80F-11E4-8FC9-782BCBD7746B', '602BA712-B80F-11E4-8FC9-782BCBD7746B', '202', '大连宜家家居有限公司', '', '', '', '', '', '', '', '', 'DLYJJJYXGS', NULL, NULL, NULL, NULL),
|
||||
('99D4AD20-B811-11E4-8FC9-782BCBD7746B', '599B7CF5-B80F-11E4-8FC9-782BCBD7746B', '103', '苏宁易购大连分公司', '', '', '', '', '', '', '', '', 'SNYGDLFGS', NULL, NULL, NULL, NULL),
|
||||
('AAE2F77F-B80F-11E4-8FC9-782BCBD7746B', '602BA712-B80F-11E4-8FC9-782BCBD7746B', '203', '大连伊辉商贸有限公司', '', '', '', '', '', '', '', '', 'DLYHSMYXGS', NULL, NULL, NULL, NULL),
|
||||
('AEF560B6-B810-11E4-8FC9-782BCBD7746B', '602BA712-B80F-11E4-8FC9-782BCBD7746B', '215', '海而空调器有限公司大连分公司', '', '', '', '', '', '', '', '', 'HEKTQYXGSDLFGS', NULL, NULL, NULL, NULL),
|
||||
('B7DCAC49-B80F-11E4-8FC9-782BCBD7746B', '602BA712-B80F-11E4-8FC9-782BCBD7746B', '204', '屈臣氏个人用品连锁商店有限公司', '', '', '', '', '', '', '', '', 'QCSGRYPLSSDYXGS', NULL, NULL, NULL, NULL),
|
||||
('BB1C951F-B810-11E4-8FC9-782BCBD7746B', '602BA712-B80F-11E4-8FC9-782BCBD7746B', '216', '大连富盾机械有限公司', '', '', '', '', '', '', '', '', 'DLFDJXYXGS', NULL, NULL, NULL, NULL),
|
||||
('C881D864-B810-11E4-8FC9-782BCBD7746B', '602BA712-B80F-11E4-8FC9-782BCBD7746B', '217', '大连伟丰国际贸易有限公司', '', '', '', '', '', '', '', '', 'DLWFGJMYYXGS', NULL, NULL, NULL, NULL),
|
||||
('C8D67CBB-B80F-11E4-8FC9-782BCBD7746B', '602BA712-B80F-11E4-8FC9-782BCBD7746B', '205', '大连明天良友金伴便利连锁有限公司', '', '', '', '', '', '', '', '', 'DLMTLYJBBLLSYXGS', NULL, NULL, NULL, NULL),
|
||||
('DDA71B3E-B810-11E4-8FC9-782BCBD7746B', '602BA712-B80F-11E4-8FC9-782BCBD7746B', '218', '大连中运国际', '', '', '', '', '', '', '', '', 'DLZYGJ', NULL, NULL, NULL, NULL),
|
||||
('F1974D46-B80F-11E4-8FC9-782BCBD7746B', '602BA712-B80F-11E4-8FC9-782BCBD7746B', '206', '大连冠晨科技发展有限公司', '', '', '', '', '', '', '', '', 'DLGCKJFZYXGS', NULL, NULL, NULL, NULL),
|
||||
('F5AA127C-B810-11E4-8FC9-782BCBD7746B', '602BA712-B80F-11E4-8FC9-782BCBD7746B', '219', '大连海珍尚品海洋产品商贸有限公司', '', '', '', '', '', '', '', '', 'DLHZSPHYCPSMYXGS', NULL, NULL, NULL, NULL),
|
||||
('FE7BCC92-B80F-11E4-8FC9-782BCBD7746B', '602BA712-B80F-11E4-8FC9-782BCBD7746B', '207', '大连彤加贸易有限公司', '', '', '', '', '', '', '', '', 'DLTJMYYXGS', NULL, NULL, NULL, NULL);
|
||||
|
||||
update t_supplier set data_org = '01010001', company_id = '4D74E1E4-A129-11E4-9B6A-782BCBD7746B' ;
|
||||
|
||||
TRUNCATE TABLE `t_supplier_category`;
|
||||
INSERT INTO `t_supplier_category` (`id`, `code`, `name`) VALUES
|
||||
('599B7CF5-B80F-11E4-8FC9-782BCBD7746B', '1', '电商'),
|
||||
('602BA712-B80F-11E4-8FC9-782BCBD7746B', '2', '本地供应商');
|
||||
|
||||
update t_supplier_category set data_org = '01010001', company_id = '4D74E1E4-A129-11E4-9B6A-782BCBD7746B' ;
|
||||
|
||||
TRUNCATE TABLE `t_warehouse`;
|
||||
INSERT INTO `t_warehouse` (`id`, `code`, `inited`, `name`, `py`) VALUES
|
||||
('17A72FFA-B3F3-11E4-9DEA-782BCBD7746B', '1', 1, '城区中心库房', 'CQZXKF');
|
||||
|
||||
update t_warehouse set data_org = '01010001', company_id = '4D74E1E4-A129-11E4-9B6A-782BCBD7746B' ;
|
||||
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
22
index.php
Normal file
22
index.php
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
require "Mobile_Detect.php";
|
||||
|
||||
$_isCGI = (0 === strpos(PHP_SAPI, 'cgi') || false !== strpos(PHP_SAPI, 'fcgi')) ? 1 : 0;
|
||||
|
||||
if ($_isCGI) {
|
||||
// CGI/FASTCGI模式下
|
||||
$_temp = explode('.php', $_SERVER['PHP_SELF']);
|
||||
$_phpFile = rtrim(str_replace($_SERVER['HTTP_HOST'], '', $_temp[0] . '.php'), '/');
|
||||
} else {
|
||||
$_phpFile = rtrim($_SERVER['SCRIPT_NAME'], '/');
|
||||
}
|
||||
|
||||
$_root = rtrim(dirname($_phpFile), '/');
|
||||
$_root = ($_root == '/' || $_root == '\\') ? '' : $_root;
|
||||
|
||||
$detect = new Mobile_Detect();
|
||||
if ($detect->isMobile()) {
|
||||
header('Location: ' . $_root . '/web/Mobile');
|
||||
} else {
|
||||
header('Location: ' . $_root . '/web/');
|
||||
}
|
191
license/LICENSE_ApacheLicenseV2
Normal file
191
license/LICENSE_ApacheLicenseV2
Normal file
|
@ -0,0 +1,191 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and
|
||||
distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright
|
||||
owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities
|
||||
that control, are controlled by, or are under common control with that entity.
|
||||
For the purposes of this definition, "control" means (i) the power, direct or
|
||||
indirect, to cause the direction or management of such entity, whether by
|
||||
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising
|
||||
permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including
|
||||
but not limited to software source code, documentation source, and configuration
|
||||
files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation or
|
||||
translation of a Source form, including but not limited to compiled object code,
|
||||
generated documentation, and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made
|
||||
available under the License, as indicated by a copyright notice that is included
|
||||
in or attached to the work (an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that
|
||||
is based on (or derived from) the Work and for which the editorial revisions,
|
||||
annotations, elaborations, or other modifications represent, as a whole, an
|
||||
original work of authorship. For the purposes of this License, Derivative Works
|
||||
shall not include works that remain separable from, or merely link (or bind by
|
||||
name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version
|
||||
of the Work and any modifications or additions to that Work or Derivative Works
|
||||
thereof, that is intentionally submitted to Licensor for inclusion in the Work
|
||||
by the copyright owner or by an individual or Legal Entity authorized to submit
|
||||
on behalf of the copyright owner. For the purposes of this definition,
|
||||
"submitted" means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems, and
|
||||
issue tracking systems that are managed by, or on behalf of, the Licensor for
|
||||
the purpose of discussing and improving the Work, but excluding communication
|
||||
that is conspicuously marked or otherwise designated in writing by the copyright
|
||||
owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
|
||||
of whom a Contribution has been received by Licensor and subsequently
|
||||
incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License.
|
||||
|
||||
Subject to the terms and conditions of this License, each Contributor hereby
|
||||
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
||||
irrevocable copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the Work and such
|
||||
Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License.
|
||||
|
||||
Subject to the terms and conditions of this License, each Contributor hereby
|
||||
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
||||
irrevocable (except as stated in this section) patent license to make, have
|
||||
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
|
||||
such license applies only to those patent claims licensable by such Contributor
|
||||
that are necessarily infringed by their Contribution(s) alone or by combination
|
||||
of their Contribution(s) with the Work to which such Contribution(s) was
|
||||
submitted. If You institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
|
||||
Contribution incorporated within the Work constitutes direct or contributory
|
||||
patent infringement, then any patent licenses granted to You under this License
|
||||
for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution.
|
||||
|
||||
You may reproduce and distribute copies of the Work or Derivative Works thereof
|
||||
in any medium, with or without modifications, and in Source or Object form,
|
||||
provided that You meet the following conditions:
|
||||
|
||||
You must give any other recipients of the Work or Derivative Works a copy of
|
||||
this License; and
|
||||
You must cause any modified files to carry prominent notices stating that You
|
||||
changed the files; and
|
||||
You must retain, in the Source form of any Derivative Works that You distribute,
|
||||
all copyright, patent, trademark, and attribution notices from the Source form
|
||||
of the Work, excluding those notices that do not pertain to any part of the
|
||||
Derivative Works; and
|
||||
If the Work includes a "NOTICE" text file as part of its distribution, then any
|
||||
Derivative Works that You distribute must include a readable copy of the
|
||||
attribution notices contained within such NOTICE file, excluding those notices
|
||||
that do not pertain to any part of the Derivative Works, in at least one of the
|
||||
following places: within a NOTICE text file distributed as part of the
|
||||
Derivative Works; within the Source form or documentation, if provided along
|
||||
with the Derivative Works; or, within a display generated by the Derivative
|
||||
Works, if and wherever such third-party notices normally appear. The contents of
|
||||
the NOTICE file are for informational purposes only and do not modify the
|
||||
License. You may add Your own attribution notices within Derivative Works that
|
||||
You distribute, alongside or as an addendum to the NOTICE text from the Work,
|
||||
provided that such additional attribution notices cannot be construed as
|
||||
modifying the License.
|
||||
You may add Your own copyright statement to Your modifications and may provide
|
||||
additional or different license terms and conditions for use, reproduction, or
|
||||
distribution of Your modifications, or for any such Derivative Works as a whole,
|
||||
provided Your use, reproduction, and distribution of the Work otherwise complies
|
||||
with the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions.
|
||||
|
||||
Unless You explicitly state otherwise, any Contribution intentionally submitted
|
||||
for inclusion in the Work by You to the Licensor shall be under the terms and
|
||||
conditions of this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify the terms of
|
||||
any separate license agreement you may have executed with Licensor regarding
|
||||
such Contributions.
|
||||
|
||||
6. Trademarks.
|
||||
|
||||
This License does not grant permission to use the trade names, trademarks,
|
||||
service marks, or product names of the Licensor, except as required for
|
||||
reasonable and customary use in describing the origin of the Work and
|
||||
reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty.
|
||||
|
||||
Unless required by applicable law or agreed to in writing, Licensor provides the
|
||||
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
|
||||
including, without limitation, any warranties or conditions of TITLE,
|
||||
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
|
||||
solely responsible for determining the appropriateness of using or
|
||||
redistributing the Work and assume any risks associated with Your exercise of
|
||||
permissions under this License.
|
||||
|
||||
8. Limitation of Liability.
|
||||
|
||||
In no event and under no legal theory, whether in tort (including negligence),
|
||||
contract, or otherwise, unless required by applicable law (such as deliberate
|
||||
and grossly negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special, incidental,
|
||||
or consequential damages of any character arising as a result of this License or
|
||||
out of the use or inability to use the Work (including but not limited to
|
||||
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
|
||||
any and all other commercial damages or losses), even if such Contributor has
|
||||
been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability.
|
||||
|
||||
While redistributing the Work or Derivative Works thereof, You may choose to
|
||||
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
|
||||
other liability obligations and/or rights consistent with this License. However,
|
||||
in accepting such obligations, You may act only on Your own behalf and on Your
|
||||
sole responsibility, not on behalf of any other Contributor, and only if You
|
||||
agree to indemnify, defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason of your
|
||||
accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work
|
||||
|
||||
To apply the Apache License to your work, attach the following boilerplate
|
||||
notice, with the fields enclosed by brackets "{}" replaced with your own
|
||||
identifying information. (Don't include the brackets!) The text should be
|
||||
enclosed in the appropriate comment syntax for the file format. We also
|
||||
recommend that a file or class name and description of purpose be included on
|
||||
the same "printed page" as the copyright notice for easier identification within
|
||||
third-party archives.
|
||||
|
||||
Copyright 2015 李静波
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
674
license/LICENSE_GPLv3
Normal file
674
license/LICENSE_GPLv3
Normal file
|
@ -0,0 +1,674 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. [http://fsf.org/]
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. 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
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. 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.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
{one line to give the program's name and a brief idea of what it does.}
|
||||
Copyright (C) {year} {fullname}
|
||||
|
||||
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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see [http://www.gnu.org/licenses/].
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
CRM8000 Copyright (C) 2014 李静波
|
||||
This program 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, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
[http://www.gnu.org/licenses/].
|
||||
|
||||
The GNU 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 Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
[http://www.gnu.org/philosophy/why-not-lgpl.html].
|
345
license/LICENSE_LGPL.txt
Normal file
345
license/LICENSE_LGPL.txt
Normal file
|
@ -0,0 +1,345 @@
|
|||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, 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 library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete 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 distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
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 Library or any portion
|
||||
of it, thus forming a work based on the Library, 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) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
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 Library, 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 Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you 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.
|
||||
|
||||
If distribution of 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 satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be 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.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library 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.
|
||||
|
||||
9. 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 Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
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 with
|
||||
this License.
|
||||
|
||||
11. 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 Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library 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 Library.
|
||||
|
||||
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.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library 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.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser 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 Library
|
||||
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 Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
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
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "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
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. 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 LIBRARY 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
|
||||
LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
48
license/LICENSE_MIT.txt
Normal file
48
license/LICENSE_MIT.txt
Normal file
|
@ -0,0 +1,48 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) <2011-2014> <Serban Ghita> <serbanghita@gmail.com>
|
||||
|
||||
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.
|
||||
|
||||
Developer’s Certificate of Origin 1.1
|
||||
|
||||
By making a contribution to this project, I certify that:
|
||||
|
||||
(a) The contribution was created in whole or in part by me and I
|
||||
have the right to submit it under the open source license
|
||||
indicated in the file; or
|
||||
|
||||
(b) The contribution is based upon previous work that, to the best
|
||||
of my knowledge, is covered under an appropriate open source
|
||||
license and I have the right under that license to submit that
|
||||
work with modifications, whether created in whole or in part
|
||||
by me, under the same open source license (unless I am
|
||||
permitted to submit under a different license), as indicated
|
||||
in the file; or
|
||||
|
||||
(c) The contribution was provided directly to me by some other
|
||||
person who certified (a), (b) or (c) and I have not modified
|
||||
it.
|
||||
|
||||
(d) I understand and agree that this project and the contribution
|
||||
are public and that a record of the contribution (including all
|
||||
personal information I submit with it, including my sign-off) is
|
||||
maintained indefinitely and may be redistributed consistent with
|
||||
this project or the open source license(s) involved.
|
8
web/.htaccess
Normal file
8
web/.htaccess
Normal file
|
@ -0,0 +1,8 @@
|
|||
<IfModule mod_rewrite.c>
|
||||
Options +FollowSymlinks
|
||||
RewriteEngine On
|
||||
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
|
||||
</IfModule>
|
1
web/Application/.gitignore
vendored
Normal file
1
web/Application/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/Runtime/
|
1
web/Application/Common/Common/index.html
Normal file
1
web/Application/Common/Common/index.html
Normal file
|
@ -0,0 +1 @@
|
|||
|
90
web/Application/Common/Conf/config.php
Normal file
90
web/Application/Common/Conf/config.php
Normal file
|
@ -0,0 +1,90 @@
|
|||
<?php
|
||||
|
||||
function PSI_getMoPaasV2MySQLConfig() {
|
||||
$services = getenv("VCAP_SERVICES");
|
||||
$services_json = json_decode($services, true);
|
||||
|
||||
// 数据库使用 MoPaaS提供的 MySQL-docker
|
||||
$mysql_config = $services_json["MySQL-docker-5.5"][0]["credentials"];
|
||||
|
||||
return $mysql_config;
|
||||
}
|
||||
|
||||
function PSI_getHost() {
|
||||
// MoPaaS V2
|
||||
$cfg = PSI_getMoPaasV2MySQLConfig();
|
||||
if ($cfg) {
|
||||
return $cfg["host"];
|
||||
}
|
||||
|
||||
// 本地单机部署,发现写IP地址比localhost,数据库要快很多
|
||||
return "127.0.0.1";
|
||||
}
|
||||
|
||||
function PSI_getDBName() {
|
||||
// MoPaaS V2
|
||||
$cfg = PSI_getMoPaasV2MySQLConfig();
|
||||
if ($cfg) {
|
||||
return $cfg["db"];
|
||||
}
|
||||
|
||||
return "psi";
|
||||
}
|
||||
|
||||
function PSI_getUser() {
|
||||
// MoPaaS V2
|
||||
$cfg = PSI_getMoPaasV2MySQLConfig();
|
||||
if ($cfg) {
|
||||
return $cfg["user"];
|
||||
}
|
||||
|
||||
return "root";
|
||||
}
|
||||
|
||||
function PSI_getPassword() {
|
||||
// MoPaaS V2
|
||||
$cfg = PSI_getMoPaasV2MySQLConfig();
|
||||
if ($cfg) {
|
||||
return $cfg["password"];
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
function PSI_getPort() {
|
||||
// MoPaaS V2
|
||||
$cfg = PSI_getMoPaasV2MySQLConfig();
|
||||
if ($cfg) {
|
||||
return $cfg["port"];
|
||||
}
|
||||
|
||||
return 3306;
|
||||
}
|
||||
|
||||
return array(
|
||||
'URL_CASE_INSENSITIVE' => false,
|
||||
'SHOW_ERROR_MSG' => true,
|
||||
'DB_TYPE' => 'mysql', // 数据库类型
|
||||
'DB_HOST' => PSI_getHost(), // 服务器地址
|
||||
'DB_NAME' => PSI_getDBName(), // 数据库名
|
||||
'DB_USER' => PSI_getUser(), // 用户名
|
||||
'DB_PWD' => PSI_getPassword(), // 密码
|
||||
'DB_PORT' => PSI_getPort() // 端口
|
||||
);
|
||||
|
||||
/*
|
||||
|
||||
// 也可以把上面的代码都删除掉,然后按下面的写法来配置
|
||||
|
||||
return array(
|
||||
'URL_CASE_INSENSITIVE' => false,
|
||||
'SHOW_ERROR_MSG' => true,
|
||||
'DB_TYPE' => 'mysql', // 数据库类型
|
||||
'DB_HOST' => '127.0.0.1', // 服务器地址
|
||||
'DB_NAME' => 'psi', // 数据库名
|
||||
'DB_USER' => 'root', // 用户名
|
||||
'DB_PWD' => '', // 密码
|
||||
'DB_PORT' => 3306 // 端口
|
||||
);
|
||||
|
||||
*/
|
1
web/Application/Common/Conf/index.html
Normal file
1
web/Application/Common/Conf/index.html
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
web/Application/Common/index.html
Normal file
1
web/Application/Common/index.html
Normal file
|
@ -0,0 +1 @@
|
|||
|
30
web/Application/Home/Common/DemoConst.class.php
Normal file
30
web/Application/Home/Common/DemoConst.class.php
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace Home\Common;
|
||||
|
||||
/**
|
||||
* 演示用的一些常数值
|
||||
*
|
||||
* @author 李静波
|
||||
*/
|
||||
class DemoConst {
|
||||
/**
|
||||
* admin的user id
|
||||
*/
|
||||
const ADMIN_USER_ID = "6C2A09CD-A129-11E4-9B6A-782BCBD7746B";
|
||||
|
||||
/**
|
||||
* 系统管理的role id
|
||||
*/
|
||||
const ADMIN_ROLE_ID = "A83F617E-A153-11E4-A9B8-782BCBD7746B";
|
||||
|
||||
/**
|
||||
* 组织机构中“公司”的org id
|
||||
*/
|
||||
const ORG_COMPANY_ID = "4D74E1E4-A129-11E4-9B6A-782BCBD7746B";
|
||||
|
||||
/**
|
||||
* 组织机构中“信息部”的org id
|
||||
*/
|
||||
const ORG_INFODEPT_ID = "5EBDBE11-A129-11E4-9B6A-782BCBD7746B";
|
||||
}
|
1139
web/Application/Home/Common/Excel/PHPExcel.php
Normal file
1139
web/Application/Home/Common/Excel/PHPExcel.php
Normal file
File diff suppressed because it is too large
Load diff
89
web/Application/Home/Common/Excel/PHPExcel/Autoloader.php
Normal file
89
web/Application/Home/Common/Excel/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()
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,376 @@
|
|||
<?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 && !is_null($this->_currentObject)) {
|
||||
$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()
|
||||
|
||||
/**
|
||||
* Remove a row, deleting all cells in that row
|
||||
*
|
||||
* @param string $row Row number to remove
|
||||
* @return void
|
||||
*/
|
||||
public function removeRow($row) {
|
||||
foreach ($this->getCellList() as $coord) {
|
||||
sscanf($coord,'%[A-Z]%d', $c, $r);
|
||||
if ($r == $row) {
|
||||
$this->deleteCacheData($coord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a column, deleting all cells in that column
|
||||
*
|
||||
* @param string $column Column ID to remove
|
||||
* @return void
|
||||
*/
|
||||
public function removeColumn($column) {
|
||||
foreach ($this->getCellList() as $coord) {
|
||||
sscanf($coord,'%[A-Z]%d', $c, $r);
|
||||
if ($c == $column) {
|
||||
$this->deleteCacheData($coord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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()
|
||||
|
||||
}
|
|
@ -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();
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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()
|
||||
|
||||
}
|
|
@ -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()
|
||||
|
||||
}
|
|
@ -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()
|
||||
|
||||
}
|
|
@ -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()
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
|
@ -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] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pop the last entry from the stack
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function pop() {
|
||||
return array_pop($this->_stack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test to see if a specified entry exists on the stack
|
||||
*
|
||||
* @param mixed $value The value to test
|
||||
*/
|
||||
public function onStack($value) {
|
||||
return isset($this->_stack[$value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the stack
|
||||
*/
|
||||
public function clear() {
|
||||
$this->_stack = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an array of all entries on the stack
|
||||
*
|
||||
* @return mixed[]
|
||||
*/
|
||||
public function showStack() {
|
||||
return $this->_stack;
|
||||
}
|
||||
|
||||
}
|
153
web/Application/Home/Common/Excel/PHPExcel/CalcEngine/Logger.php
Normal file
153
web/Application/Home/Common/Excel/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
|
||||
|
3952
web/Application/Home/Common/Excel/PHPExcel/Calculation.php
Normal file
3952
web/Application/Home/Common/Excel/PHPExcel/Calculation.php
Normal file
File diff suppressed because it is too large
Load diff
|
@ -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
|
1485
web/Application/Home/Common/Excel/PHPExcel/Calculation/DateTime.php
Normal file
1485
web/Application/Home/Common/Excel/PHPExcel/Calculation/DateTime.php
Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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
web/Application/Home/Common/Excel/PHPExcel/Calculation/Financial.php
Normal file
2292
web/Application/Home/Common/Excel/PHPExcel/Calculation/Financial.php
Normal file
File diff suppressed because it is too large
Load diff
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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 1.8.1, 2015-04-30';
|
||||
} // 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 == '' && $s !== 0) {
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -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
|
|
@ -0,0 +1,876 @@
|
|||
<?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
|
||||
return $lookup_array[$rowNumber][$returnColumn];
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
return $lookup_array[$returnColumn][$rowNumber];
|
||||
}
|
||||
}
|
||||
|
||||
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
|
1376
web/Application/Home/Common/Excel/PHPExcel/Calculation/MathTrig.php
Normal file
1376
web/Application/Home/Common/Excel/PHPExcel/Calculation/MathTrig.php
Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,630 @@
|
|||
<?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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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
|
|
@ -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
|
1022
web/Application/Home/Common/Excel/PHPExcel/Cell.php
Normal file
1022
web/Application/Home/Common/Excel/PHPExcel/Cell.php
Normal file
File diff suppressed because it is too large
Load diff
|
@ -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
web/Application/Home/Common/Excel/PHPExcel/Cell/DataType.php
Normal file
122
web/Application/Home/Common/Excel/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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
<?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);
|
||||
} elseif (is_object($value)) {
|
||||
// Handle any objects that might be injected
|
||||
if ($value instanceof DateTime) {
|
||||
$value = $value->format('Y-m-d H:i:s');
|
||||
} elseif (!($value instanceof PHPExcel_RichText)) {
|
||||
$value = (string) $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 ($pValue === null) {
|
||||
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]+)([Ee][\-\+]?[0-2]?\d{1,3})?$/', $pValue)) {
|
||||
$tValue = ltrim($pValue, '+-');
|
||||
if (is_string($pValue) && $tValue{0} === '0' && strlen($tValue) > 1 && $tValue{1} !== '.' ) {
|
||||
return PHPExcel_Cell_DataType::TYPE_STRING;
|
||||
} elseif((strpos($pValue, '.') === false) && ($pValue > PHP_INT_MAX)) {
|
||||
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
web/Application/Home/Common/Excel/PHPExcel/Cell/Hyperlink.php
Normal file
126
web/Application/Home/Common/Excel/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__
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
635
web/Application/Home/Common/Excel/PHPExcel/Chart.php
Normal file
635
web/Application/Home/Common/Excel/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
web/Application/Home/Common/Excel/PHPExcel/Chart/Axis.php
Normal file
584
web/Application/Home/Common/Excel/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'];
|
||||
}
|
||||
}
|
370
web/Application/Home/Common/Excel/PHPExcel/Chart/DataSeries.php
Normal file
370
web/Application/Home/Common/Excel/PHPExcel/Chart/DataSeries.php
Normal file
|
@ -0,0 +1,370 @@
|
|||
<?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(), $plotDirection = null, $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;
|
||||
|
||||
if (is_null($plotDirection)) {
|
||||
$plotDirection = self::DIRECTION_COL;
|
||||
}
|
||||
$this->_plotDirection = $plotDirection;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,327 @@
|
|||
<?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_DataSeriesValues
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Chart
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Chart_DataSeriesValues
|
||||
{
|
||||
|
||||
const DATASERIES_TYPE_STRING = 'String';
|
||||
const DATASERIES_TYPE_NUMBER = 'Number';
|
||||
|
||||
private static $_dataTypeValues = array(
|
||||
self::DATASERIES_TYPE_STRING,
|
||||
self::DATASERIES_TYPE_NUMBER,
|
||||
);
|
||||
|
||||
/**
|
||||
* Series Data Type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_dataType = null;
|
||||
|
||||
/**
|
||||
* Series Data Source
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_dataSource = null;
|
||||
|
||||
/**
|
||||
* Format Code
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_formatCode = null;
|
||||
|
||||
/**
|
||||
* Series Point Marker
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_marker = null;
|
||||
|
||||
/**
|
||||
* Point Count (The number of datapoints in the dataseries)
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
private $_pointCount = 0;
|
||||
|
||||
/**
|
||||
* Data Values
|
||||
*
|
||||
* @var array of mixed
|
||||
*/
|
||||
private $_dataValues = array();
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Chart_DataSeriesValues object
|
||||
*/
|
||||
public function __construct($dataType = self::DATASERIES_TYPE_NUMBER, $dataSource = null, $formatCode = null, $pointCount = 0, $dataValues = array(), $marker = null)
|
||||
{
|
||||
$this->setDataType($dataType);
|
||||
$this->_dataSource = $dataSource;
|
||||
$this->_formatCode = $formatCode;
|
||||
$this->_pointCount = $pointCount;
|
||||
$this->_dataValues = $dataValues;
|
||||
$this->_marker = $marker;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Series Data Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDataType() {
|
||||
return $this->_dataType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Series Data Type
|
||||
*
|
||||
* @param string $dataType Datatype of this data series
|
||||
* Typical values are:
|
||||
* PHPExcel_Chart_DataSeriesValues::DATASERIES_TYPE_STRING
|
||||
* Normally used for axis point values
|
||||
* PHPExcel_Chart_DataSeriesValues::DATASERIES_TYPE_NUMBER
|
||||
* Normally used for chart data values
|
||||
* @return PHPExcel_Chart_DataSeriesValues
|
||||
*/
|
||||
public function setDataType($dataType = self::DATASERIES_TYPE_NUMBER) {
|
||||
if (!in_array($dataType, self::$_dataTypeValues)) {
|
||||
throw new PHPExcel_Chart_Exception('Invalid datatype for chart data series values');
|
||||
}
|
||||
$this->_dataType = $dataType;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Series Data Source (formula)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDataSource() {
|
||||
return $this->_dataSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Series Data Source (formula)
|
||||
*
|
||||
* @param string $dataSource
|
||||
* @return PHPExcel_Chart_DataSeriesValues
|
||||
*/
|
||||
public function setDataSource($dataSource = null, $refreshDataValues = true) {
|
||||
$this->_dataSource = $dataSource;
|
||||
|
||||
if ($refreshDataValues) {
|
||||
// TO DO
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Point Marker
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPointMarker() {
|
||||
return $this->_marker;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Point Marker
|
||||
*
|
||||
* @param string $marker
|
||||
* @return PHPExcel_Chart_DataSeriesValues
|
||||
*/
|
||||
public function setPointMarker($marker = null) {
|
||||
$this->_marker = $marker;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Series Format Code
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFormatCode() {
|
||||
return $this->_formatCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Series Format Code
|
||||
*
|
||||
* @param string $formatCode
|
||||
* @return PHPExcel_Chart_DataSeriesValues
|
||||
*/
|
||||
public function setFormatCode($formatCode = null) {
|
||||
$this->_formatCode = $formatCode;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Series Point Count
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getPointCount() {
|
||||
return $this->_pointCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identify if the Data Series is a multi-level or a simple series
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isMultiLevelSeries() {
|
||||
if (count($this->_dataValues) > 0) {
|
||||
return is_array($this->_dataValues[0]);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the level count of a multi-level Data Series
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function multiLevelCount() {
|
||||
$levelCount = 0;
|
||||
foreach($this->_dataValues as $dataValueSet) {
|
||||
$levelCount = max($levelCount,count($dataValueSet));
|
||||
}
|
||||
return $levelCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Series Data Values
|
||||
*
|
||||
* @return array of mixed
|
||||
*/
|
||||
public function getDataValues() {
|
||||
return $this->_dataValues;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the first Series Data value
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDataValue() {
|
||||
$count = count($this->_dataValues);
|
||||
if ($count == 0) {
|
||||
return null;
|
||||
} elseif ($count == 1) {
|
||||
return $this->_dataValues[0];
|
||||
}
|
||||
return $this->_dataValues;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Series Data Values
|
||||
*
|
||||
* @param array $dataValues
|
||||
* @param boolean $refreshDataSource
|
||||
* TRUE - refresh the value of _dataSource based on the values of $dataValues
|
||||
* FALSE - don't change the value of _dataSource
|
||||
* @return PHPExcel_Chart_DataSeriesValues
|
||||
*/
|
||||
public function setDataValues($dataValues = array(), $refreshDataSource = TRUE) {
|
||||
$this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($dataValues);
|
||||
$this->_pointCount = count($dataValues);
|
||||
|
||||
if ($refreshDataSource) {
|
||||
// TO DO
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function _stripNulls($var) {
|
||||
return $var !== NULL;
|
||||
}
|
||||
|
||||
public function refresh(PHPExcel_Worksheet $worksheet, $flatten = TRUE) {
|
||||
if ($this->_dataSource !== NULL) {
|
||||
$calcEngine = PHPExcel_Calculation::getInstance($worksheet->getParent());
|
||||
$newDataValues = PHPExcel_Calculation::_unwrapResult(
|
||||
$calcEngine->_calculateFormulaValue(
|
||||
'='.$this->_dataSource,
|
||||
NULL,
|
||||
$worksheet->getCell('A1')
|
||||
)
|
||||
);
|
||||
if ($flatten) {
|
||||
$this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
|
||||
foreach($this->_dataValues as &$dataValue) {
|
||||
if ((!empty($dataValue)) && ($dataValue[0] == '#')) {
|
||||
$dataValue = 0.0;
|
||||
}
|
||||
}
|
||||
unset($dataValue);
|
||||
} else {
|
||||
$cellRange = explode('!',$this->_dataSource);
|
||||
if (count($cellRange) > 1) {
|
||||
list(,$cellRange) = $cellRange;
|
||||
}
|
||||
|
||||
$dimensions = PHPExcel_Cell::rangeDimension(str_replace('$','',$cellRange));
|
||||
if (($dimensions[0] == 1) || ($dimensions[1] == 1)) {
|
||||
$this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
|
||||
} else {
|
||||
$newArray = array_values(array_shift($newDataValues));
|
||||
foreach($newArray as $i => $newDataSet) {
|
||||
$newArray[$i] = array($newDataSet);
|
||||
}
|
||||
|
||||
foreach($newDataValues as $newDataSet) {
|
||||
$i = 0;
|
||||
foreach($newDataSet as $newDataVal) {
|
||||
array_unshift($newArray[$i++],$newDataVal);
|
||||
}
|
||||
}
|
||||
$this->_dataValues = $newArray;
|
||||
}
|
||||
}
|
||||
$this->_pointCount = count($this->_dataValues);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -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_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_Exception
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Chart
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Chart_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;
|
||||
}
|
||||
}
|
458
web/Application/Home/Common/Excel/PHPExcel/Chart/GridLines.php
Normal file
458
web/Application/Home/Common/Excel/PHPExcel/Chart/GridLines.php
Normal file
|
@ -0,0 +1,458 @@
|
|||
<?php
|
||||
require_once 'Properties.php';
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Wiktor Trzonkowski
|
||||
* Date: 7/2/14
|
||||
* Time: 2:36 PM
|
||||
*/
|
||||
|
||||
class PHPExcel_Chart_GridLines extends
|
||||
PHPExcel_Properties {
|
||||
|
||||
/**
|
||||
* Properties of Class:
|
||||
* Object State (State for Minor Tick Mark) @var bool
|
||||
* Line Properties @var array of mixed
|
||||
* Shadow Properties @var array of mixed
|
||||
* Glow Properties @var array of mixed
|
||||
* Soft Properties @var array of mixed
|
||||
*
|
||||
*/
|
||||
|
||||
private
|
||||
$_object_state = FALSE,
|
||||
$_line_properties = array(
|
||||
'color' => array(
|
||||
'type' => self::EXCEL_COLOR_TYPE_STANDARD,
|
||||
'value' => NULL,
|
||||
'alpha' => 0
|
||||
),
|
||||
'style' => 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 = array(
|
||||
'presets' => self::SHADOW_PRESETS_NOSHADOW,
|
||||
'effect' => NULL,
|
||||
'color' => array(
|
||||
'type' => self::EXCEL_COLOR_TYPE_STANDARD,
|
||||
'value' => 'black',
|
||||
'alpha' => 85,
|
||||
),
|
||||
'size' => array(
|
||||
'sx' => NULL,
|
||||
'sy' => NULL,
|
||||
'kx' => NULL
|
||||
),
|
||||
'blur' => NULL,
|
||||
'direction' => NULL,
|
||||
'distance' => NULL,
|
||||
'algn' => NULL,
|
||||
'rotWithShape' => NULL
|
||||
),
|
||||
$_glow_properties = array(
|
||||
'size' => NULL,
|
||||
'color' => array(
|
||||
'type' => self::EXCEL_COLOR_TYPE_STANDARD,
|
||||
'value' => 'black',
|
||||
'alpha' => 40
|
||||
)
|
||||
),
|
||||
$_soft_edges = array(
|
||||
'size' => NULL
|
||||
);
|
||||
|
||||
/**
|
||||
* Get Object State
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
||||
public function getObjectState() {
|
||||
return $this->_object_state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change Object State to True
|
||||
*
|
||||
* @return PHPExcel_Chart_GridLines
|
||||
*/
|
||||
|
||||
private function _activateObject() {
|
||||
$this->_object_state = TRUE;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Line Color Properties
|
||||
*
|
||||
* @param string $value
|
||||
* @param int $alpha
|
||||
* @param string $type
|
||||
*/
|
||||
|
||||
public function setLineColorProperties($value, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_STANDARD) {
|
||||
$this
|
||||
->_activateObject()
|
||||
->_line_properties['color'] = $this->setColorProperties(
|
||||
$value,
|
||||
$alpha,
|
||||
$type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Line Color 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) {
|
||||
$this->_activateObject();
|
||||
(!is_null($line_width))
|
||||
? $this->_line_properties['style']['width'] = $this->getExcelPointsWidth((float) $line_width)
|
||||
: NULL;
|
||||
(!is_null($compound_type))
|
||||
? $this->_line_properties['style']['compound'] = (string) $compound_type
|
||||
: NULL;
|
||||
(!is_null($dash_type))
|
||||
? $this->_line_properties['style']['dash'] = (string) $dash_type
|
||||
: NULL;
|
||||
(!is_null($cap_type))
|
||||
? $this->_line_properties['style']['cap'] = (string) $cap_type
|
||||
: NULL;
|
||||
(!is_null($join_type))
|
||||
? $this->_line_properties['style']['join'] = (string) $join_type
|
||||
: NULL;
|
||||
(!is_null($head_arrow_type))
|
||||
? $this->_line_properties['style']['arrow']['head']['type'] = (string) $head_arrow_type
|
||||
: NULL;
|
||||
(!is_null($head_arrow_size))
|
||||
? $this->_line_properties['style']['arrow']['head']['size'] = (string) $head_arrow_size
|
||||
: NULL;
|
||||
(!is_null($end_arrow_type))
|
||||
? $this->_line_properties['style']['arrow']['end']['type'] = (string) $end_arrow_type
|
||||
: NULL;
|
||||
(!is_null($end_arrow_size))
|
||||
? $this->_line_properties['style']['arrow']['end']['size'] = (string) $end_arrow_size
|
||||
: NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Line Color Property
|
||||
*
|
||||
* @param string $parameter
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
||||
public function getLineColorProperty($parameter) {
|
||||
return $this->_line_properties['color'][$parameter];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Line Style Property
|
||||
*
|
||||
* @param array|string $elements
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
||||
public function getLineStyleProperty($elements) {
|
||||
return $this->getArrayElementsValue($this->_line_properties['style'], $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
|
||||
->_activateObject()
|
||||
->_setGlowSize($size)
|
||||
->_setGlowColor($color_value, $color_alpha, $color_type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Glow Color Property
|
||||
*
|
||||
* @param string $property
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
||||
public function getGlowColor($property) {
|
||||
return $this->_glow_properties['color'][$property];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Glow Size
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
||||
public function getGlowSize() {
|
||||
return $this->_glow_properties['size'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Glow Size
|
||||
*
|
||||
* @param float $size
|
||||
*
|
||||
* @return PHPExcel_Chart_GridLines
|
||||
*/
|
||||
|
||||
private function _setGlowSize($size) {
|
||||
$this->_glow_properties['size'] = $this->getExcelPointsWidth((float) $size);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Glow Color
|
||||
*
|
||||
* @param string $color
|
||||
* @param int $alpha
|
||||
* @param string $type
|
||||
*
|
||||
* @return PHPExcel_Chart_GridLines
|
||||
*/
|
||||
|
||||
private function _setGlowColor($color, $alpha, $type) {
|
||||
if (!is_null($color)) {
|
||||
$this->_glow_properties['color']['value'] = (string) $color;
|
||||
}
|
||||
if (!is_null($alpha)) {
|
||||
$this->_glow_properties['color']['alpha'] = $this->getTrueAlpha((int) $alpha);
|
||||
}
|
||||
if (!is_null($type)) {
|
||||
$this->_glow_properties['color']['type'] = (string) $type;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Line Style Arrow Parameters
|
||||
*
|
||||
* @param string $arrow_selector
|
||||
* @param string $property_selector
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
||||
public function getLineStyleArrowParameters($arrow_selector, $property_selector) {
|
||||
return $this->getLineStyleArrowSize($this->_line_properties['style']['arrow'][$arrow_selector]['size'], $property_selector);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Shadow Properties
|
||||
*
|
||||
* @param int $sh_presets
|
||||
* @param string $sh_color_value
|
||||
* @param string $sh_color_type
|
||||
* @param int $sh_color_alpha
|
||||
* @param string $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
|
||||
->_activateObject()
|
||||
->_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']
|
||||
: $this->getTrueAlpha($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 Presets Properties
|
||||
*
|
||||
* @param int $shadow_presets
|
||||
*
|
||||
* @return PHPExcel_Chart_GridLines
|
||||
*/
|
||||
|
||||
private function _setShadowPresetsProperties($shadow_presets) {
|
||||
$this->_shadow_properties['presets'] = $shadow_presets;
|
||||
$this->_setShadowProperiesMapValues($this->getShadowPresetsMap($shadow_presets));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Shadow Properties Values
|
||||
*
|
||||
* @param array $properties_map
|
||||
* @param * $reference
|
||||
*
|
||||
* @return PHPExcel_Chart_GridLines
|
||||
*/
|
||||
|
||||
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_GridLines
|
||||
*/
|
||||
|
||||
private function _setShadowColor($color, $alpha, $type) {
|
||||
if (!is_null($color)) {
|
||||
$this->_shadow_properties['color']['value'] = (string) $color;
|
||||
}
|
||||
if (!is_null($alpha)) {
|
||||
$this->_shadow_properties['color']['alpha'] = $this->getTrueAlpha((int) $alpha);
|
||||
}
|
||||
if (!is_null($type)) {
|
||||
$this->_shadow_properties['color']['type'] = (string) $type;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Shadow Blur
|
||||
*
|
||||
* @param float $blur
|
||||
*
|
||||
* @return PHPExcel_Chart_GridLines
|
||||
*/
|
||||
|
||||
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_GridLines
|
||||
*/
|
||||
|
||||
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_GridLines
|
||||
*/
|
||||
|
||||
private function _setShadowDistance($distance) {
|
||||
if ($distance !== NULL) {
|
||||
$this->_shadow_properties['distance'] = (string) $this->getExcelPointsWidth($distance);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Shadow Property
|
||||
*
|
||||
* @param string $elements
|
||||
* @param array $elements
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
||||
public function getShadowProperty($elements) {
|
||||
return $this->getArrayElementsValue($this->_shadow_properties, $elements);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Soft Edges Size
|
||||
*
|
||||
* @param float $size
|
||||
*/
|
||||
|
||||
public function setSoftEdgesSize($size) {
|
||||
if (!is_null($size)) {
|
||||
$this->_activateObject();
|
||||
$_soft_edges['size'] = (string) $this->getExcelPointsWidth($size);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Soft Edges Size
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
||||
public function getSoftEdgesSize() {
|
||||
return $this->_soft_edges['size'];
|
||||
}
|
||||
}
|
445
web/Application/Home/Common/Excel/PHPExcel/Chart/Layout.php
Normal file
445
web/Application/Home/Common/Excel/PHPExcel/Chart/Layout.php
Normal file
|
@ -0,0 +1,445 @@
|
|||
<?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_Layout
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Chart
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Chart_Layout
|
||||
{
|
||||
/**
|
||||
* layoutTarget
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_layoutTarget = NULL;
|
||||
|
||||
/**
|
||||
* X Mode
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_xMode = NULL;
|
||||
|
||||
/**
|
||||
* Y Mode
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_yMode = NULL;
|
||||
|
||||
/**
|
||||
* X-Position
|
||||
*
|
||||
* @var float
|
||||
*/
|
||||
private $_xPos = NULL;
|
||||
|
||||
/**
|
||||
* Y-Position
|
||||
*
|
||||
* @var float
|
||||
*/
|
||||
private $_yPos = NULL;
|
||||
|
||||
/**
|
||||
* width
|
||||
*
|
||||
* @var float
|
||||
*/
|
||||
private $_width = NULL;
|
||||
|
||||
/**
|
||||
* height
|
||||
*
|
||||
* @var float
|
||||
*/
|
||||
private $_height = NULL;
|
||||
|
||||
/**
|
||||
* show legend key
|
||||
* Specifies that legend keys should be shown in data labels
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_showLegendKey = NULL;
|
||||
|
||||
/**
|
||||
* show value
|
||||
* Specifies that the value should be shown in a data label.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_showVal = NULL;
|
||||
|
||||
/**
|
||||
* show category name
|
||||
* Specifies that the category name should be shown in the data label.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_showCatName = NULL;
|
||||
|
||||
/**
|
||||
* show data series name
|
||||
* Specifies that the series name should be shown in the data label.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_showSerName = NULL;
|
||||
|
||||
/**
|
||||
* show percentage
|
||||
* Specifies that the percentage should be shown in the data label.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_showPercent = NULL;
|
||||
|
||||
/**
|
||||
* show bubble size
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_showBubbleSize = NULL;
|
||||
|
||||
/**
|
||||
* show leader lines
|
||||
* Specifies that leader lines should be shown for the data label.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_showLeaderLines = NULL;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Chart_Layout
|
||||
*/
|
||||
public function __construct($layout=array())
|
||||
{
|
||||
if (isset($layout['layoutTarget'])) { $this->_layoutTarget = $layout['layoutTarget']; }
|
||||
if (isset($layout['xMode'])) { $this->_xMode = $layout['xMode']; }
|
||||
if (isset($layout['yMode'])) { $this->_yMode = $layout['yMode']; }
|
||||
if (isset($layout['x'])) { $this->_xPos = (float) $layout['x']; }
|
||||
if (isset($layout['y'])) { $this->_yPos = (float) $layout['y']; }
|
||||
if (isset($layout['w'])) { $this->_width = (float) $layout['w']; }
|
||||
if (isset($layout['h'])) { $this->_height = (float) $layout['h']; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Layout Target
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLayoutTarget() {
|
||||
return $this->_layoutTarget;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Layout Target
|
||||
*
|
||||
* @param Layout Target $value
|
||||
* @return PHPExcel_Chart_Layout
|
||||
*/
|
||||
public function setLayoutTarget($value) {
|
||||
$this->_layoutTarget = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get X-Mode
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getXMode() {
|
||||
return $this->_xMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set X-Mode
|
||||
*
|
||||
* @param X-Mode $value
|
||||
* @return PHPExcel_Chart_Layout
|
||||
*/
|
||||
public function setXMode($value) {
|
||||
$this->_xMode = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Y-Mode
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getYMode() {
|
||||
return $this->_yMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Y-Mode
|
||||
*
|
||||
* @param Y-Mode $value
|
||||
* @return PHPExcel_Chart_Layout
|
||||
*/
|
||||
public function setYMode($value) {
|
||||
$this->_yMode = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get X-Position
|
||||
*
|
||||
* @return number
|
||||
*/
|
||||
public function getXPosition() {
|
||||
return $this->_xPos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set X-Position
|
||||
*
|
||||
* @param X-Position $value
|
||||
* @return PHPExcel_Chart_Layout
|
||||
*/
|
||||
public function setXPosition($value) {
|
||||
$this->_xPos = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Y-Position
|
||||
*
|
||||
* @return number
|
||||
*/
|
||||
public function getYPosition() {
|
||||
return $this->_yPos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Y-Position
|
||||
*
|
||||
* @param Y-Position $value
|
||||
* @return PHPExcel_Chart_Layout
|
||||
*/
|
||||
public function setYPosition($value) {
|
||||
$this->_yPos = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Width
|
||||
*
|
||||
* @return number
|
||||
*/
|
||||
public function getWidth() {
|
||||
return $this->_width;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Width
|
||||
*
|
||||
* @param Width $value
|
||||
* @return PHPExcel_Chart_Layout
|
||||
*/
|
||||
public function setWidth($value) {
|
||||
$this->_width = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Height
|
||||
*
|
||||
* @return number
|
||||
*/
|
||||
public function getHeight() {
|
||||
return $this->_height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Height
|
||||
*
|
||||
* @param Height $value
|
||||
* @return PHPExcel_Chart_Layout
|
||||
*/
|
||||
public function setHeight($value) {
|
||||
$this->_height = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get show legend key
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getShowLegendKey() {
|
||||
return $this->_showLegendKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set show legend key
|
||||
* Specifies that legend keys should be shown in data labels.
|
||||
*
|
||||
* @param boolean $value Show legend key
|
||||
* @return PHPExcel_Chart_Layout
|
||||
*/
|
||||
public function setShowLegendKey($value) {
|
||||
$this->_showLegendKey = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get show value
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getShowVal() {
|
||||
return $this->_showVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set show val
|
||||
* Specifies that the value should be shown in data labels.
|
||||
*
|
||||
* @param boolean $value Show val
|
||||
* @return PHPExcel_Chart_Layout
|
||||
*/
|
||||
public function setShowVal($value) {
|
||||
$this->_showVal = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get show category name
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getShowCatName() {
|
||||
return $this->_showCatName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set show cat name
|
||||
* Specifies that the category name should be shown in data labels.
|
||||
*
|
||||
* @param boolean $value Show cat name
|
||||
* @return PHPExcel_Chart_Layout
|
||||
*/
|
||||
public function setShowCatName($value) {
|
||||
$this->_showCatName = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get show data series name
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getShowSerName() {
|
||||
return $this->_showSerName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set show ser name
|
||||
* Specifies that the series name should be shown in data labels.
|
||||
*
|
||||
* @param boolean $value Show series name
|
||||
* @return PHPExcel_Chart_Layout
|
||||
*/
|
||||
public function setShowSerName($value) {
|
||||
$this->_showSerName = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get show percentage
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getShowPercent() {
|
||||
return $this->_showPercent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set show percentage
|
||||
* Specifies that the percentage should be shown in data labels.
|
||||
*
|
||||
* @param boolean $value Show percentage
|
||||
* @return PHPExcel_Chart_Layout
|
||||
*/
|
||||
public function setShowPercent($value) {
|
||||
$this->_showPercent = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get show bubble size
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getShowBubbleSize() {
|
||||
return $this->_showBubbleSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set show bubble size
|
||||
* Specifies that the bubble size should be shown in data labels.
|
||||
*
|
||||
* @param boolean $value Show bubble size
|
||||
* @return PHPExcel_Chart_Layout
|
||||
*/
|
||||
public function setShowBubbleSize($value) {
|
||||
$this->_showBubbleSize = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get show leader lines
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getShowLeaderLines() {
|
||||
return $this->_showLeaderLines;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set show leader lines
|
||||
* Specifies that leader lines should be shown in data labels.
|
||||
*
|
||||
* @param boolean $value Show leader lines
|
||||
* @return PHPExcel_Chart_Layout
|
||||
*/
|
||||
public function setShowLeaderLines($value) {
|
||||
$this->_showLeaderLines = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
171
web/Application/Home/Common/Excel/PHPExcel/Chart/Legend.php
Normal file
171
web/Application/Home/Common/Excel/PHPExcel/Chart/Legend.php
Normal file
|
@ -0,0 +1,171 @@
|
|||
<?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_Legend
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Chart
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Chart_Legend
|
||||
{
|
||||
/** Legend positions */
|
||||
const xlLegendPositionBottom = -4107; // Below the chart.
|
||||
const xlLegendPositionCorner = 2; // In the upper right-hand corner of the chart border.
|
||||
const xlLegendPositionCustom = -4161; // A custom position.
|
||||
const xlLegendPositionLeft = -4131; // Left of the chart.
|
||||
const xlLegendPositionRight = -4152; // Right of the chart.
|
||||
const xlLegendPositionTop = -4160; // Above the chart.
|
||||
|
||||
const POSITION_RIGHT = 'r';
|
||||
const POSITION_LEFT = 'l';
|
||||
const POSITION_BOTTOM = 'b';
|
||||
const POSITION_TOP = 't';
|
||||
const POSITION_TOPRIGHT = 'tr';
|
||||
|
||||
private static $_positionXLref = array( self::xlLegendPositionBottom => self::POSITION_BOTTOM,
|
||||
self::xlLegendPositionCorner => self::POSITION_TOPRIGHT,
|
||||
self::xlLegendPositionCustom => '??',
|
||||
self::xlLegendPositionLeft => self::POSITION_LEFT,
|
||||
self::xlLegendPositionRight => self::POSITION_RIGHT,
|
||||
self::xlLegendPositionTop => self::POSITION_TOP
|
||||
);
|
||||
|
||||
/**
|
||||
* Legend position
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_position = self::POSITION_RIGHT;
|
||||
|
||||
/**
|
||||
* Allow overlay of other elements?
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_overlay = TRUE;
|
||||
|
||||
/**
|
||||
* Legend Layout
|
||||
*
|
||||
* @var PHPExcel_Chart_Layout
|
||||
*/
|
||||
private $_layout = NULL;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Chart_Legend
|
||||
*/
|
||||
public function __construct($position = self::POSITION_RIGHT, PHPExcel_Chart_Layout $layout = NULL, $overlay = FALSE)
|
||||
{
|
||||
$this->setPosition($position);
|
||||
$this->_layout = $layout;
|
||||
$this->setOverlay($overlay);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get legend position as an excel string value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPosition() {
|
||||
return $this->_position;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get legend position using an excel string value
|
||||
*
|
||||
* @param string $position
|
||||
*/
|
||||
public function setPosition($position = self::POSITION_RIGHT) {
|
||||
if (!in_array($position,self::$_positionXLref)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->_position = $position;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get legend position as an Excel internal numeric value
|
||||
*
|
||||
* @return number
|
||||
*/
|
||||
public function getPositionXL() {
|
||||
return array_search($this->_position,self::$_positionXLref);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set legend position using an Excel internal numeric value
|
||||
*
|
||||
* @param number $positionXL
|
||||
*/
|
||||
public function setPositionXL($positionXL = self::xlLegendPositionRight) {
|
||||
if (!array_key_exists($positionXL,self::$_positionXLref)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->_position = self::$_positionXLref[$positionXL];
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get allow overlay of other elements?
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getOverlay() {
|
||||
return $this->_overlay;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set allow overlay of other elements?
|
||||
*
|
||||
* @param boolean $overlay
|
||||
* @return boolean
|
||||
*/
|
||||
public function setOverlay($overlay = FALSE) {
|
||||
if (!is_bool($overlay)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->_overlay = $overlay;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Layout
|
||||
*
|
||||
* @return PHPExcel_Chart_Layout
|
||||
*/
|
||||
public function getLayout() {
|
||||
return $this->_layout;
|
||||
}
|
||||
|
||||
}
|
128
web/Application/Home/Common/Excel/PHPExcel/Chart/PlotArea.php
Normal file
128
web/Application/Home/Common/Excel/PHPExcel/Chart/PlotArea.php
Normal file
|
@ -0,0 +1,128 @@
|
|||
<?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_PlotArea
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Chart
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Chart_PlotArea
|
||||
{
|
||||
/**
|
||||
* PlotArea Layout
|
||||
*
|
||||
* @var PHPExcel_Chart_Layout
|
||||
*/
|
||||
private $_layout = null;
|
||||
|
||||
/**
|
||||
* Plot Series
|
||||
*
|
||||
* @var array of PHPExcel_Chart_DataSeries
|
||||
*/
|
||||
private $_plotSeries = array();
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Chart_PlotArea
|
||||
*/
|
||||
public function __construct(PHPExcel_Chart_Layout $layout = null, $plotSeries = array())
|
||||
{
|
||||
$this->_layout = $layout;
|
||||
$this->_plotSeries = $plotSeries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Layout
|
||||
*
|
||||
* @return PHPExcel_Chart_Layout
|
||||
*/
|
||||
public function getLayout() {
|
||||
return $this->_layout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Number of Plot Groups
|
||||
*
|
||||
* @return array of PHPExcel_Chart_DataSeries
|
||||
*/
|
||||
public function getPlotGroupCount() {
|
||||
return count($this->_plotSeries);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Number of Plot Series
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getPlotSeriesCount() {
|
||||
$seriesCount = 0;
|
||||
foreach($this->_plotSeries as $plot) {
|
||||
$seriesCount += $plot->getPlotSeriesCount();
|
||||
}
|
||||
return $seriesCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Plot Series
|
||||
*
|
||||
* @return array of PHPExcel_Chart_DataSeries
|
||||
*/
|
||||
public function getPlotGroup() {
|
||||
return $this->_plotSeries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Plot Series by Index
|
||||
*
|
||||
* @return PHPExcel_Chart_DataSeries
|
||||
*/
|
||||
public function getPlotGroupByIndex($index) {
|
||||
return $this->_plotSeries[$index];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Plot Series
|
||||
*
|
||||
* @param [PHPExcel_Chart_DataSeries]
|
||||
* @return PHPExcel_Chart_PlotArea
|
||||
*/
|
||||
public function setPlotSeries($plotSeries = array()) {
|
||||
$this->_plotSeries = $plotSeries;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function refresh(PHPExcel_Worksheet $worksheet) {
|
||||
foreach($this->_plotSeries as $plotSeries) {
|
||||
$plotSeries->refresh($worksheet);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
359
web/Application/Home/Common/Excel/PHPExcel/Chart/Properties.php
Normal file
359
web/Application/Home/Common/Excel/PHPExcel/Chart/Properties.php
Normal file
|
@ -0,0 +1,359 @@
|
|||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: nhw2h8s
|
||||
* Date: 7/2/14
|
||||
* Time: 5:45 PM
|
||||
*/
|
||||
|
||||
abstract class PHPExcel_Properties {
|
||||
|
||||
const
|
||||
EXCEL_COLOR_TYPE_STANDARD = 'prstClr',
|
||||
EXCEL_COLOR_TYPE_SCHEME = 'schemeClr',
|
||||
EXCEL_COLOR_TYPE_ARGB = 'srgbClr';
|
||||
|
||||
const
|
||||
AXIS_LABELS_LOW = 'low',
|
||||
AXIS_LABELS_HIGH = 'high',
|
||||
AXIS_LABELS_NEXT_TO = 'nextTo',
|
||||
AXIS_LABELS_NONE = 'none';
|
||||
|
||||
const
|
||||
TICK_MARK_NONE = 'none',
|
||||
TICK_MARK_INSIDE = 'in',
|
||||
TICK_MARK_OUTSIDE = 'out',
|
||||
TICK_MARK_CROSS = 'cross';
|
||||
|
||||
const
|
||||
HORIZONTAL_CROSSES_AUTOZERO = 'autoZero',
|
||||
HORIZONTAL_CROSSES_MAXIMUM = 'max';
|
||||
|
||||
const
|
||||
FORMAT_CODE_GENERAL = 'General',
|
||||
FORMAT_CODE_NUMBER = '#,##0.00',
|
||||
FORMAT_CODE_CURRENCY = '$#,##0.00',
|
||||
FORMAT_CODE_ACCOUNTING = '_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)',
|
||||
FORMAT_CODE_DATE = 'm/d/yyyy',
|
||||
FORMAT_CODE_TIME = '[$-F400]h:mm:ss AM/PM',
|
||||
FORMAT_CODE_PERCENTAGE = '0.00%',
|
||||
FORMAT_CODE_FRACTION = '# ?/?',
|
||||
FORMAT_CODE_SCIENTIFIC = '0.00E+00',
|
||||
FORMAT_CODE_TEXT = '@',
|
||||
FORMAT_CODE_SPECIAL = '00000';
|
||||
|
||||
const
|
||||
ORIENTATION_NORMAL = 'minMax',
|
||||
ORIENTATION_REVERSED = 'maxMin';
|
||||
|
||||
const
|
||||
LINE_STYLE_COMPOUND_SIMPLE = 'sng',
|
||||
LINE_STYLE_COMPOUND_DOUBLE = 'dbl',
|
||||
LINE_STYLE_COMPOUND_THICKTHIN = 'thickThin',
|
||||
LINE_STYLE_COMPOUND_THINTHICK = 'thinThick',
|
||||
LINE_STYLE_COMPOUND_TRIPLE = 'tri',
|
||||
|
||||
LINE_STYLE_DASH_SOLID = 'solid',
|
||||
LINE_STYLE_DASH_ROUND_DOT = 'sysDot',
|
||||
LINE_STYLE_DASH_SQUERE_DOT = 'sysDash',
|
||||
LINE_STYPE_DASH_DASH = 'dash',
|
||||
LINE_STYLE_DASH_DASH_DOT = 'dashDot',
|
||||
LINE_STYLE_DASH_LONG_DASH = 'lgDash',
|
||||
LINE_STYLE_DASH_LONG_DASH_DOT = 'lgDashDot',
|
||||
LINE_STYLE_DASH_LONG_DASH_DOT_DOT = 'lgDashDotDot',
|
||||
|
||||
LINE_STYLE_CAP_SQUARE = 'sq',
|
||||
LINE_STYLE_CAP_ROUND = 'rnd',
|
||||
LINE_STYLE_CAP_FLAT = 'flat',
|
||||
|
||||
LINE_STYLE_JOIN_ROUND = 'bevel',
|
||||
LINE_STYLE_JOIN_MITER = 'miter',
|
||||
LINE_STYLE_JOIN_BEVEL = 'bevel',
|
||||
|
||||
LINE_STYLE_ARROW_TYPE_NOARROW = NULL,
|
||||
LINE_STYLE_ARROW_TYPE_ARROW = 'triangle',
|
||||
LINE_STYLE_ARROW_TYPE_OPEN = 'arrow',
|
||||
LINE_STYLE_ARROW_TYPE_STEALTH = 'stealth',
|
||||
LINE_STYLE_ARROW_TYPE_DIAMOND = 'diamond',
|
||||
LINE_STYLE_ARROW_TYPE_OVAL = 'oval',
|
||||
|
||||
LINE_STYLE_ARROW_SIZE_1 = 1,
|
||||
LINE_STYLE_ARROW_SIZE_2 = 2,
|
||||
LINE_STYLE_ARROW_SIZE_3 = 3,
|
||||
LINE_STYLE_ARROW_SIZE_4 = 4,
|
||||
LINE_STYLE_ARROW_SIZE_5 = 5,
|
||||
LINE_STYLE_ARROW_SIZE_6 = 6,
|
||||
LINE_STYLE_ARROW_SIZE_7 = 7,
|
||||
LINE_STYLE_ARROW_SIZE_8 = 8,
|
||||
LINE_STYLE_ARROW_SIZE_9 = 9;
|
||||
|
||||
const
|
||||
SHADOW_PRESETS_NOSHADOW = NULL,
|
||||
SHADOW_PRESETS_OUTER_BOTTTOM_RIGHT = 1,
|
||||
SHADOW_PRESETS_OUTER_BOTTOM = 2,
|
||||
SHADOW_PRESETS_OUTER_BOTTOM_LEFT = 3,
|
||||
SHADOW_PRESETS_OUTER_RIGHT = 4,
|
||||
SHADOW_PRESETS_OUTER_CENTER = 5,
|
||||
SHADOW_PRESETS_OUTER_LEFT = 6,
|
||||
SHADOW_PRESETS_OUTER_TOP_RIGHT = 7,
|
||||
SHADOW_PRESETS_OUTER_TOP = 8,
|
||||
SHADOW_PRESETS_OUTER_TOP_LEFT = 9,
|
||||
SHADOW_PRESETS_INNER_BOTTTOM_RIGHT = 10,
|
||||
SHADOW_PRESETS_INNER_BOTTOM = 11,
|
||||
SHADOW_PRESETS_INNER_BOTTOM_LEFT = 12,
|
||||
SHADOW_PRESETS_INNER_RIGHT = 13,
|
||||
SHADOW_PRESETS_INNER_CENTER = 14,
|
||||
SHADOW_PRESETS_INNER_LEFT = 15,
|
||||
SHADOW_PRESETS_INNER_TOP_RIGHT = 16,
|
||||
SHADOW_PRESETS_INNER_TOP = 17,
|
||||
SHADOW_PRESETS_INNER_TOP_LEFT = 18,
|
||||
SHADOW_PRESETS_PERSPECTIVE_BELOW = 19,
|
||||
SHADOW_PRESETS_PERSPECTIVE_UPPER_RIGHT = 20,
|
||||
SHADOW_PRESETS_PERSPECTIVE_UPPER_LEFT = 21,
|
||||
SHADOW_PRESETS_PERSPECTIVE_LOWER_RIGHT = 22,
|
||||
SHADOW_PRESETS_PERSPECTIVE_LOWER_LEFT = 23;
|
||||
|
||||
protected function getExcelPointsWidth($width) {
|
||||
return $width * 12700;
|
||||
}
|
||||
|
||||
protected function getExcelPointsAngle($angle) {
|
||||
return $angle * 60000;
|
||||
}
|
||||
|
||||
protected function getTrueAlpha($alpha) {
|
||||
return (string) 100 - $alpha . '000';
|
||||
}
|
||||
|
||||
protected function setColorProperties($color, $alpha, $type) {
|
||||
return array(
|
||||
'type' => (string) $type,
|
||||
'value' => (string) $color,
|
||||
'alpha' => (string) $this->getTrueAlpha($alpha)
|
||||
);
|
||||
}
|
||||
|
||||
protected function getLineStyleArrowSize($array_selector, $array_kay_selector) {
|
||||
$sizes = array(
|
||||
1 => array('w' => 'sm', 'len' => 'sm'),
|
||||
2 => array('w' => 'sm', 'len' => 'med'),
|
||||
3 => array('w' => 'sm', 'len' => 'lg'),
|
||||
4 => array('w' => 'med', 'len' => 'sm'),
|
||||
5 => array('w' => 'med', 'len' => 'med'),
|
||||
6 => array('w' => 'med', 'len' => 'lg'),
|
||||
7 => array('w' => 'lg', 'len' => 'sm'),
|
||||
8 => array('w' => 'lg', 'len' => 'med'),
|
||||
9 => array('w' => 'lg', 'len' => 'lg')
|
||||
);
|
||||
|
||||
return $sizes[$array_selector][$array_kay_selector];
|
||||
}
|
||||
|
||||
protected function getShadowPresetsMap($shadow_presets_option) {
|
||||
$presets_options = array(
|
||||
//OUTER
|
||||
1 => array(
|
||||
'effect' => 'outerShdw',
|
||||
'blur' => '50800',
|
||||
'distance' => '38100',
|
||||
'direction' => '2700000',
|
||||
'algn' => 'tl',
|
||||
'rotWithShape' => '0'
|
||||
),
|
||||
2 => array(
|
||||
'effect' => 'outerShdw',
|
||||
'blur' => '50800',
|
||||
'distance' => '38100',
|
||||
'direction' => '5400000',
|
||||
'algn' => 't',
|
||||
'rotWithShape' => '0'
|
||||
),
|
||||
3 => array(
|
||||
'effect' => 'outerShdw',
|
||||
'blur' => '50800',
|
||||
'distance' => '38100',
|
||||
'direction' => '8100000',
|
||||
'algn' => 'tr',
|
||||
'rotWithShape' => '0'
|
||||
),
|
||||
4 => array(
|
||||
'effect' => 'outerShdw',
|
||||
'blur' => '50800',
|
||||
'distance' => '38100',
|
||||
'algn' => 'l',
|
||||
'rotWithShape' => '0'
|
||||
),
|
||||
5 => array(
|
||||
'effect' => 'outerShdw',
|
||||
'size' => array(
|
||||
'sx' => '102000',
|
||||
'sy' => '102000'
|
||||
)
|
||||
,
|
||||
'blur' => '63500',
|
||||
'distance' => '38100',
|
||||
'algn' => 'ctr',
|
||||
'rotWithShape' => '0'
|
||||
),
|
||||
6 => array(
|
||||
'effect' => 'outerShdw',
|
||||
'blur' => '50800',
|
||||
'distance' => '38100',
|
||||
'direction' => '10800000',
|
||||
'algn' => 'r',
|
||||
'rotWithShape' => '0'
|
||||
),
|
||||
7 => array(
|
||||
'effect' => 'outerShdw',
|
||||
'blur' => '50800',
|
||||
'distance' => '38100',
|
||||
'direction' => '18900000',
|
||||
'algn' => 'bl',
|
||||
'rotWithShape' => '0'
|
||||
),
|
||||
8 => array(
|
||||
'effect' => 'outerShdw',
|
||||
'blur' => '50800',
|
||||
'distance' => '38100',
|
||||
'direction' => '16200000',
|
||||
'rotWithShape' => '0'
|
||||
),
|
||||
9 => array(
|
||||
'effect' => 'outerShdw',
|
||||
'blur' => '50800',
|
||||
'distance' => '38100',
|
||||
'direction' => '13500000',
|
||||
'algn' => 'br',
|
||||
'rotWithShape' => '0'
|
||||
),
|
||||
//INNER
|
||||
10 => array(
|
||||
'effect' => 'innerShdw',
|
||||
'blur' => '63500',
|
||||
'distance' => '50800',
|
||||
'direction' => '2700000',
|
||||
),
|
||||
11 => array(
|
||||
'effect' => 'innerShdw',
|
||||
'blur' => '63500',
|
||||
'distance' => '50800',
|
||||
'direction' => '5400000',
|
||||
),
|
||||
12 => array(
|
||||
'effect' => 'innerShdw',
|
||||
'blur' => '63500',
|
||||
'distance' => '50800',
|
||||
'direction' => '8100000',
|
||||
),
|
||||
13 => array(
|
||||
'effect' => 'innerShdw',
|
||||
'blur' => '63500',
|
||||
'distance' => '50800',
|
||||
),
|
||||
14 => array(
|
||||
'effect' => 'innerShdw',
|
||||
'blur' => '114300',
|
||||
),
|
||||
15 => array(
|
||||
'effect' => 'innerShdw',
|
||||
'blur' => '63500',
|
||||
'distance' => '50800',
|
||||
'direction' => '10800000',
|
||||
),
|
||||
16 => array(
|
||||
'effect' => 'innerShdw',
|
||||
'blur' => '63500',
|
||||
'distance' => '50800',
|
||||
'direction' => '18900000',
|
||||
),
|
||||
17 => array(
|
||||
'effect' => 'innerShdw',
|
||||
'blur' => '63500',
|
||||
'distance' => '50800',
|
||||
'direction' => '16200000',
|
||||
),
|
||||
18 => array(
|
||||
'effect' => 'innerShdw',
|
||||
'blur' => '63500',
|
||||
'distance' => '50800',
|
||||
'direction' => '13500000',
|
||||
),
|
||||
//perspective
|
||||
19 => array(
|
||||
'effect' => 'outerShdw',
|
||||
'blur' => '152400',
|
||||
'distance' => '317500',
|
||||
'size' => array(
|
||||
'sx' => '90000',
|
||||
'sy' => '-19000',
|
||||
),
|
||||
'direction' => '5400000',
|
||||
'rotWithShape' => '0',
|
||||
),
|
||||
20 => array(
|
||||
'effect' => 'outerShdw',
|
||||
'blur' => '76200',
|
||||
'direction' => '18900000',
|
||||
'size' => array(
|
||||
'sy' => '23000',
|
||||
'kx' => '-1200000',
|
||||
),
|
||||
'algn' => 'bl',
|
||||
'rotWithShape' => '0',
|
||||
),
|
||||
21 => array(
|
||||
'effect' => 'outerShdw',
|
||||
'blur' => '76200',
|
||||
'direction' => '13500000',
|
||||
'size' => array(
|
||||
'sy' => '23000',
|
||||
'kx' => '1200000',
|
||||
),
|
||||
'algn' => 'br',
|
||||
'rotWithShape' => '0',
|
||||
),
|
||||
22 => array(
|
||||
'effect' => 'outerShdw',
|
||||
'blur' => '76200',
|
||||
'distance' => '12700',
|
||||
'direction' => '2700000',
|
||||
'size' => array(
|
||||
'sy' => '-23000',
|
||||
'kx' => '-800400',
|
||||
),
|
||||
'algn' => 'bl',
|
||||
'rotWithShape' => '0',
|
||||
),
|
||||
23 => array(
|
||||
'effect' => 'outerShdw',
|
||||
'blur' => '76200',
|
||||
'distance' => '12700',
|
||||
'direction' => '8100000',
|
||||
'size' => array(
|
||||
'sy' => '-23000',
|
||||
'kx' => '800400',
|
||||
),
|
||||
'algn' => 'br',
|
||||
'rotWithShape' => '0',
|
||||
),
|
||||
);
|
||||
|
||||
return $presets_options[$shadow_presets_option];
|
||||
}
|
||||
|
||||
protected function getArrayElementsValue($properties, $elements) {
|
||||
$reference = & $properties;
|
||||
if (!is_array($elements)) {
|
||||
return $reference[$elements];
|
||||
} else {
|
||||
foreach ($elements as $keys) {
|
||||
$reference = & $reference[$keys];
|
||||
}
|
||||
|
||||
return $reference;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
ChartDirector
|
||||
http://www.advsofteng.com/cdphp.html
|
||||
|
||||
GraPHPite
|
||||
http://graphpite.sourceforge.net/
|
||||
|
||||
JpGraph
|
||||
http://www.aditus.nu/jpgraph/
|
||||
|
||||
LibChart
|
||||
http://naku.dohcrew.com/libchart/pages/introduction/
|
||||
|
||||
pChart
|
||||
http://pchart.sourceforge.net/
|
||||
|
||||
TeeChart
|
||||
http://www.steema.com/products/teechart/overview.html
|
|
@ -0,0 +1,855 @@
|
|||
<?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_Renderer
|
||||
* @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##
|
||||
*/
|
||||
|
||||
|
||||
require_once(PHPExcel_Settings::getChartRendererPath().'/jpgraph.php');
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Chart_Renderer_jpgraph
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Chart_Renderer
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Chart_Renderer_jpgraph
|
||||
{
|
||||
private static $_width = 640;
|
||||
|
||||
private static $_height = 480;
|
||||
|
||||
private static $_colourSet = array( 'mediumpurple1', 'palegreen3', 'gold1', 'cadetblue1',
|
||||
'darkmagenta', 'coral', 'dodgerblue3', 'eggplant',
|
||||
'mediumblue', 'magenta', 'sandybrown', 'cyan',
|
||||
'firebrick1', 'forestgreen', 'deeppink4', 'darkolivegreen',
|
||||
'goldenrod2'
|
||||
);
|
||||
|
||||
private static $_markSet = array( 'diamond' => MARK_DIAMOND,
|
||||
'square' => MARK_SQUARE,
|
||||
'triangle' => MARK_UTRIANGLE,
|
||||
'x' => MARK_X,
|
||||
'star' => MARK_STAR,
|
||||
'dot' => MARK_FILLEDCIRCLE,
|
||||
'dash' => MARK_DTRIANGLE,
|
||||
'circle' => MARK_CIRCLE,
|
||||
'plus' => MARK_CROSS
|
||||
);
|
||||
|
||||
|
||||
private $_chart = null;
|
||||
|
||||
private $_graph = null;
|
||||
|
||||
private static $_plotColour = 0;
|
||||
|
||||
private static $_plotMark = 0;
|
||||
|
||||
|
||||
private function _formatPointMarker($seriesPlot,$markerID) {
|
||||
$plotMarkKeys = array_keys(self::$_markSet);
|
||||
if (is_null($markerID)) {
|
||||
// Use default plot marker (next marker in the series)
|
||||
self::$_plotMark %= count(self::$_markSet);
|
||||
$seriesPlot->mark->SetType(self::$_markSet[$plotMarkKeys[self::$_plotMark++]]);
|
||||
} elseif ($markerID !== 'none') {
|
||||
// Use specified plot marker (if it exists)
|
||||
if (isset(self::$_markSet[$markerID])) {
|
||||
$seriesPlot->mark->SetType(self::$_markSet[$markerID]);
|
||||
} else {
|
||||
// If the specified plot marker doesn't exist, use default plot marker (next marker in the series)
|
||||
self::$_plotMark %= count(self::$_markSet);
|
||||
$seriesPlot->mark->SetType(self::$_markSet[$plotMarkKeys[self::$_plotMark++]]);
|
||||
}
|
||||
} else {
|
||||
// Hide plot marker
|
||||
$seriesPlot->mark->Hide();
|
||||
}
|
||||
$seriesPlot->mark->SetColor(self::$_colourSet[self::$_plotColour]);
|
||||
$seriesPlot->mark->SetFillColor(self::$_colourSet[self::$_plotColour]);
|
||||
$seriesPlot->SetColor(self::$_colourSet[self::$_plotColour++]);
|
||||
|
||||
return $seriesPlot;
|
||||
} // function _formatPointMarker()
|
||||
|
||||
|
||||
private function _formatDataSetLabels($groupID, $datasetLabels, $labelCount, $rotation = '') {
|
||||
$datasetLabelFormatCode = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getFormatCode();
|
||||
if (!is_null($datasetLabelFormatCode)) {
|
||||
// Retrieve any label formatting code
|
||||
$datasetLabelFormatCode = stripslashes($datasetLabelFormatCode);
|
||||
}
|
||||
|
||||
$testCurrentIndex = 0;
|
||||
foreach($datasetLabels as $i => $datasetLabel) {
|
||||
if (is_array($datasetLabel)) {
|
||||
if ($rotation == 'bar') {
|
||||
$datasetLabels[$i] = implode(" ",$datasetLabel);
|
||||
} else {
|
||||
$datasetLabel = array_reverse($datasetLabel);
|
||||
$datasetLabels[$i] = implode("\n",$datasetLabel);
|
||||
}
|
||||
} else {
|
||||
// Format labels according to any formatting code
|
||||
if (!is_null($datasetLabelFormatCode)) {
|
||||
$datasetLabels[$i] = PHPExcel_Style_NumberFormat::toFormattedString($datasetLabel,$datasetLabelFormatCode);
|
||||
}
|
||||
}
|
||||
++$testCurrentIndex;
|
||||
}
|
||||
|
||||
return $datasetLabels;
|
||||
} // function _formatDataSetLabels()
|
||||
|
||||
|
||||
private function _percentageSumCalculation($groupID,$seriesCount) {
|
||||
// Adjust our values to a percentage value across all series in the group
|
||||
for($i = 0; $i < $seriesCount; ++$i) {
|
||||
if ($i == 0) {
|
||||
$sumValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
|
||||
} else {
|
||||
$nextValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
|
||||
foreach($nextValues as $k => $value) {
|
||||
if (isset($sumValues[$k])) {
|
||||
$sumValues[$k] += $value;
|
||||
} else {
|
||||
$sumValues[$k] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $sumValues;
|
||||
} // function _percentageSumCalculation()
|
||||
|
||||
|
||||
private function _percentageAdjustValues($dataValues,$sumValues) {
|
||||
foreach($dataValues as $k => $dataValue) {
|
||||
$dataValues[$k] = $dataValue / $sumValues[$k] * 100;
|
||||
}
|
||||
|
||||
return $dataValues;
|
||||
} // function _percentageAdjustValues()
|
||||
|
||||
|
||||
private function _getCaption($captionElement) {
|
||||
// Read any caption
|
||||
$caption = (!is_null($captionElement)) ? $captionElement->getCaption() : NULL;
|
||||
// Test if we have a title caption to display
|
||||
if (!is_null($caption)) {
|
||||
// If we do, it could be a plain string or an array
|
||||
if (is_array($caption)) {
|
||||
// Implode an array to a plain string
|
||||
$caption = implode('',$caption);
|
||||
}
|
||||
}
|
||||
return $caption;
|
||||
} // function _getCaption()
|
||||
|
||||
|
||||
private function _renderTitle() {
|
||||
$title = $this->_getCaption($this->_chart->getTitle());
|
||||
if (!is_null($title)) {
|
||||
$this->_graph->title->Set($title);
|
||||
}
|
||||
} // function _renderTitle()
|
||||
|
||||
|
||||
private function _renderLegend() {
|
||||
$legend = $this->_chart->getLegend();
|
||||
if (!is_null($legend)) {
|
||||
$legendPosition = $legend->getPosition();
|
||||
$legendOverlay = $legend->getOverlay();
|
||||
switch ($legendPosition) {
|
||||
case 'r' :
|
||||
$this->_graph->legend->SetPos(0.01,0.5,'right','center'); // right
|
||||
$this->_graph->legend->SetColumns(1);
|
||||
break;
|
||||
case 'l' :
|
||||
$this->_graph->legend->SetPos(0.01,0.5,'left','center'); // left
|
||||
$this->_graph->legend->SetColumns(1);
|
||||
break;
|
||||
case 't' :
|
||||
$this->_graph->legend->SetPos(0.5,0.01,'center','top'); // top
|
||||
break;
|
||||
case 'b' :
|
||||
$this->_graph->legend->SetPos(0.5,0.99,'center','bottom'); // bottom
|
||||
break;
|
||||
default :
|
||||
$this->_graph->legend->SetPos(0.01,0.01,'right','top'); // top-right
|
||||
$this->_graph->legend->SetColumns(1);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
$this->_graph->legend->Hide();
|
||||
}
|
||||
} // function _renderLegend()
|
||||
|
||||
|
||||
private function _renderCartesianPlotArea($type='textlin') {
|
||||
$this->_graph = new Graph(self::$_width,self::$_height);
|
||||
$this->_graph->SetScale($type);
|
||||
|
||||
$this->_renderTitle();
|
||||
|
||||
// Rotate for bar rather than column chart
|
||||
$rotation = $this->_chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotDirection();
|
||||
$reverse = ($rotation == 'bar') ? true : false;
|
||||
|
||||
$xAxisLabel = $this->_chart->getXAxisLabel();
|
||||
if (!is_null($xAxisLabel)) {
|
||||
$title = $this->_getCaption($xAxisLabel);
|
||||
if (!is_null($title)) {
|
||||
$this->_graph->xaxis->SetTitle($title,'center');
|
||||
$this->_graph->xaxis->title->SetMargin(35);
|
||||
if ($reverse) {
|
||||
$this->_graph->xaxis->title->SetAngle(90);
|
||||
$this->_graph->xaxis->title->SetMargin(90);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$yAxisLabel = $this->_chart->getYAxisLabel();
|
||||
if (!is_null($yAxisLabel)) {
|
||||
$title = $this->_getCaption($yAxisLabel);
|
||||
if (!is_null($title)) {
|
||||
$this->_graph->yaxis->SetTitle($title,'center');
|
||||
if ($reverse) {
|
||||
$this->_graph->yaxis->title->SetAngle(0);
|
||||
$this->_graph->yaxis->title->SetMargin(-55);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // function _renderCartesianPlotArea()
|
||||
|
||||
|
||||
private function _renderPiePlotArea($doughnut = False) {
|
||||
$this->_graph = new PieGraph(self::$_width,self::$_height);
|
||||
|
||||
$this->_renderTitle();
|
||||
} // function _renderPiePlotArea()
|
||||
|
||||
|
||||
private function _renderRadarPlotArea() {
|
||||
$this->_graph = new RadarGraph(self::$_width,self::$_height);
|
||||
$this->_graph->SetScale('lin');
|
||||
|
||||
$this->_renderTitle();
|
||||
} // function _renderRadarPlotArea()
|
||||
|
||||
|
||||
private function _renderPlotLine($groupID, $filled = false, $combination = false, $dimensions = '2d') {
|
||||
$grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
|
||||
|
||||
$labelCount = count($this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
|
||||
if ($labelCount > 0) {
|
||||
$datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
|
||||
$datasetLabels = $this->_formatDataSetLabels($groupID, $datasetLabels, $labelCount);
|
||||
$this->_graph->xaxis->SetTickLabels($datasetLabels);
|
||||
}
|
||||
|
||||
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
|
||||
$seriesPlots = array();
|
||||
if ($grouping == 'percentStacked') {
|
||||
$sumValues = $this->_percentageSumCalculation($groupID,$seriesCount);
|
||||
}
|
||||
|
||||
// Loop through each data series in turn
|
||||
for($i = 0; $i < $seriesCount; ++$i) {
|
||||
$dataValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
|
||||
$marker = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker();
|
||||
|
||||
if ($grouping == 'percentStacked') {
|
||||
$dataValues = $this->_percentageAdjustValues($dataValues,$sumValues);
|
||||
}
|
||||
|
||||
// Fill in any missing values in the $dataValues array
|
||||
$testCurrentIndex = 0;
|
||||
foreach($dataValues as $k => $dataValue) {
|
||||
while($k != $testCurrentIndex) {
|
||||
$dataValues[$testCurrentIndex] = null;
|
||||
++$testCurrentIndex;
|
||||
}
|
||||
++$testCurrentIndex;
|
||||
}
|
||||
|
||||
$seriesPlot = new LinePlot($dataValues);
|
||||
if ($combination) {
|
||||
$seriesPlot->SetBarCenter();
|
||||
}
|
||||
|
||||
if ($filled) {
|
||||
$seriesPlot->SetFilled(true);
|
||||
$seriesPlot->SetColor('black');
|
||||
$seriesPlot->SetFillColor(self::$_colourSet[self::$_plotColour++]);
|
||||
} else {
|
||||
// Set the appropriate plot marker
|
||||
$this->_formatPointMarker($seriesPlot,$marker);
|
||||
}
|
||||
$dataLabel = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue();
|
||||
$seriesPlot->SetLegend($dataLabel);
|
||||
|
||||
$seriesPlots[] = $seriesPlot;
|
||||
}
|
||||
|
||||
if ($grouping == 'standard') {
|
||||
$groupPlot = $seriesPlots;
|
||||
} else {
|
||||
$groupPlot = new AccLinePlot($seriesPlots);
|
||||
}
|
||||
$this->_graph->Add($groupPlot);
|
||||
} // function _renderPlotLine()
|
||||
|
||||
|
||||
private function _renderPlotBar($groupID, $dimensions = '2d') {
|
||||
$rotation = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotDirection();
|
||||
// Rotate for bar rather than column chart
|
||||
if (($groupID == 0) && ($rotation == 'bar')) {
|
||||
$this->_graph->Set90AndMargin();
|
||||
}
|
||||
$grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
|
||||
|
||||
$labelCount = count($this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
|
||||
if ($labelCount > 0) {
|
||||
$datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
|
||||
$datasetLabels = $this->_formatDataSetLabels($groupID, $datasetLabels, $labelCount, $rotation);
|
||||
// Rotate for bar rather than column chart
|
||||
if ($rotation == 'bar') {
|
||||
$datasetLabels = array_reverse($datasetLabels);
|
||||
$this->_graph->yaxis->SetPos('max');
|
||||
$this->_graph->yaxis->SetLabelAlign('center','top');
|
||||
$this->_graph->yaxis->SetLabelSide(SIDE_RIGHT);
|
||||
}
|
||||
$this->_graph->xaxis->SetTickLabels($datasetLabels);
|
||||
}
|
||||
|
||||
|
||||
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
|
||||
$seriesPlots = array();
|
||||
if ($grouping == 'percentStacked') {
|
||||
$sumValues = $this->_percentageSumCalculation($groupID,$seriesCount);
|
||||
}
|
||||
|
||||
// Loop through each data series in turn
|
||||
for($j = 0; $j < $seriesCount; ++$j) {
|
||||
$dataValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($j)->getDataValues();
|
||||
if ($grouping == 'percentStacked') {
|
||||
$dataValues = $this->_percentageAdjustValues($dataValues,$sumValues);
|
||||
}
|
||||
|
||||
// Fill in any missing values in the $dataValues array
|
||||
$testCurrentIndex = 0;
|
||||
foreach($dataValues as $k => $dataValue) {
|
||||
while($k != $testCurrentIndex) {
|
||||
$dataValues[$testCurrentIndex] = null;
|
||||
++$testCurrentIndex;
|
||||
}
|
||||
++$testCurrentIndex;
|
||||
}
|
||||
|
||||
// Reverse the $dataValues order for bar rather than column chart
|
||||
if ($rotation == 'bar') {
|
||||
$dataValues = array_reverse($dataValues);
|
||||
}
|
||||
$seriesPlot = new BarPlot($dataValues);
|
||||
$seriesPlot->SetColor('black');
|
||||
$seriesPlot->SetFillColor(self::$_colourSet[self::$_plotColour++]);
|
||||
if ($dimensions == '3d') {
|
||||
$seriesPlot->SetShadow();
|
||||
}
|
||||
if (!$this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($j)) {
|
||||
$dataLabel = '';
|
||||
} else {
|
||||
$dataLabel = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($j)->getDataValue();
|
||||
}
|
||||
$seriesPlot->SetLegend($dataLabel);
|
||||
|
||||
$seriesPlots[] = $seriesPlot;
|
||||
}
|
||||
// Reverse the plot order for bar rather than column chart
|
||||
if (($rotation == 'bar') && (!($grouping == 'percentStacked'))) {
|
||||
$seriesPlots = array_reverse($seriesPlots);
|
||||
}
|
||||
|
||||
if ($grouping == 'clustered') {
|
||||
$groupPlot = new GroupBarPlot($seriesPlots);
|
||||
} elseif ($grouping == 'standard') {
|
||||
$groupPlot = new GroupBarPlot($seriesPlots);
|
||||
} else {
|
||||
$groupPlot = new AccBarPlot($seriesPlots);
|
||||
if ($dimensions == '3d') {
|
||||
$groupPlot->SetShadow();
|
||||
}
|
||||
}
|
||||
|
||||
$this->_graph->Add($groupPlot);
|
||||
} // function _renderPlotBar()
|
||||
|
||||
|
||||
private function _renderPlotScatter($groupID,$bubble) {
|
||||
$grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
|
||||
$scatterStyle = $bubbleSize = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
|
||||
|
||||
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
|
||||
$seriesPlots = array();
|
||||
|
||||
// Loop through each data series in turn
|
||||
for($i = 0; $i < $seriesCount; ++$i) {
|
||||
$dataValuesY = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues();
|
||||
$dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
|
||||
|
||||
foreach($dataValuesY as $k => $dataValueY) {
|
||||
$dataValuesY[$k] = $k;
|
||||
}
|
||||
|
||||
$seriesPlot = new ScatterPlot($dataValuesX,$dataValuesY);
|
||||
if ($scatterStyle == 'lineMarker') {
|
||||
$seriesPlot->SetLinkPoints();
|
||||
$seriesPlot->link->SetColor(self::$_colourSet[self::$_plotColour]);
|
||||
} elseif ($scatterStyle == 'smoothMarker') {
|
||||
$spline = new Spline($dataValuesY,$dataValuesX);
|
||||
list($splineDataY,$splineDataX) = $spline->Get(count($dataValuesX) * self::$_width / 20);
|
||||
$lplot = new LinePlot($splineDataX,$splineDataY);
|
||||
$lplot->SetColor(self::$_colourSet[self::$_plotColour]);
|
||||
|
||||
$this->_graph->Add($lplot);
|
||||
}
|
||||
|
||||
if ($bubble) {
|
||||
$this->_formatPointMarker($seriesPlot,'dot');
|
||||
$seriesPlot->mark->SetColor('black');
|
||||
$seriesPlot->mark->SetSize($bubbleSize);
|
||||
} else {
|
||||
$marker = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker();
|
||||
$this->_formatPointMarker($seriesPlot,$marker);
|
||||
}
|
||||
$dataLabel = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue();
|
||||
$seriesPlot->SetLegend($dataLabel);
|
||||
|
||||
$this->_graph->Add($seriesPlot);
|
||||
}
|
||||
} // function _renderPlotScatter()
|
||||
|
||||
|
||||
private function _renderPlotRadar($groupID) {
|
||||
$radarStyle = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
|
||||
|
||||
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
|
||||
$seriesPlots = array();
|
||||
|
||||
// Loop through each data series in turn
|
||||
for($i = 0; $i < $seriesCount; ++$i) {
|
||||
$dataValuesY = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues();
|
||||
$dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
|
||||
$marker = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker();
|
||||
|
||||
$dataValues = array();
|
||||
foreach($dataValuesY as $k => $dataValueY) {
|
||||
$dataValues[$k] = implode(' ',array_reverse($dataValueY));
|
||||
}
|
||||
$tmp = array_shift($dataValues);
|
||||
$dataValues[] = $tmp;
|
||||
$tmp = array_shift($dataValuesX);
|
||||
$dataValuesX[] = $tmp;
|
||||
|
||||
$this->_graph->SetTitles(array_reverse($dataValues));
|
||||
|
||||
$seriesPlot = new RadarPlot(array_reverse($dataValuesX));
|
||||
|
||||
$dataLabel = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue();
|
||||
$seriesPlot->SetColor(self::$_colourSet[self::$_plotColour++]);
|
||||
if ($radarStyle == 'filled') {
|
||||
$seriesPlot->SetFillColor(self::$_colourSet[self::$_plotColour]);
|
||||
}
|
||||
$this->_formatPointMarker($seriesPlot,$marker);
|
||||
$seriesPlot->SetLegend($dataLabel);
|
||||
|
||||
$this->_graph->Add($seriesPlot);
|
||||
}
|
||||
} // function _renderPlotRadar()
|
||||
|
||||
|
||||
private function _renderPlotContour($groupID) {
|
||||
$contourStyle = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
|
||||
|
||||
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
|
||||
$seriesPlots = array();
|
||||
|
||||
$dataValues = array();
|
||||
// Loop through each data series in turn
|
||||
for($i = 0; $i < $seriesCount; ++$i) {
|
||||
$dataValuesY = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues();
|
||||
$dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
|
||||
|
||||
$dataValues[$i] = $dataValuesX;
|
||||
}
|
||||
$seriesPlot = new ContourPlot($dataValues);
|
||||
|
||||
$this->_graph->Add($seriesPlot);
|
||||
} // function _renderPlotContour()
|
||||
|
||||
|
||||
private function _renderPlotStock($groupID) {
|
||||
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
|
||||
$plotOrder = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotOrder();
|
||||
|
||||
$dataValues = array();
|
||||
// Loop through each data series in turn and build the plot arrays
|
||||
foreach($plotOrder as $i => $v) {
|
||||
$dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($v)->getDataValues();
|
||||
foreach($dataValuesX as $j => $dataValueX) {
|
||||
$dataValues[$plotOrder[$i]][$j] = $dataValueX;
|
||||
}
|
||||
}
|
||||
if(empty($dataValues)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$dataValuesPlot = array();
|
||||
// Flatten the plot arrays to a single dimensional array to work with jpgraph
|
||||
for($j = 0; $j < count($dataValues[0]); $j++) {
|
||||
for($i = 0; $i < $seriesCount; $i++) {
|
||||
$dataValuesPlot[] = $dataValues[$i][$j];
|
||||
}
|
||||
}
|
||||
|
||||
// Set the x-axis labels
|
||||
$labelCount = count($this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
|
||||
if ($labelCount > 0) {
|
||||
$datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
|
||||
$datasetLabels = $this->_formatDataSetLabels($groupID, $datasetLabels, $labelCount);
|
||||
$this->_graph->xaxis->SetTickLabels($datasetLabels);
|
||||
}
|
||||
|
||||
$seriesPlot = new StockPlot($dataValuesPlot);
|
||||
$seriesPlot->SetWidth(20);
|
||||
|
||||
$this->_graph->Add($seriesPlot);
|
||||
} // function _renderPlotStock()
|
||||
|
||||
|
||||
private function _renderAreaChart($groupCount, $dimensions = '2d') {
|
||||
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_line.php');
|
||||
|
||||
$this->_renderCartesianPlotArea();
|
||||
|
||||
for($i = 0; $i < $groupCount; ++$i) {
|
||||
$this->_renderPlotLine($i,True,False,$dimensions);
|
||||
}
|
||||
} // function _renderAreaChart()
|
||||
|
||||
|
||||
private function _renderLineChart($groupCount, $dimensions = '2d') {
|
||||
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_line.php');
|
||||
|
||||
$this->_renderCartesianPlotArea();
|
||||
|
||||
for($i = 0; $i < $groupCount; ++$i) {
|
||||
$this->_renderPlotLine($i,False,False,$dimensions);
|
||||
}
|
||||
} // function _renderLineChart()
|
||||
|
||||
|
||||
private function _renderBarChart($groupCount, $dimensions = '2d') {
|
||||
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_bar.php');
|
||||
|
||||
$this->_renderCartesianPlotArea();
|
||||
|
||||
for($i = 0; $i < $groupCount; ++$i) {
|
||||
$this->_renderPlotBar($i,$dimensions);
|
||||
}
|
||||
} // function _renderBarChart()
|
||||
|
||||
|
||||
private function _renderScatterChart($groupCount) {
|
||||
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_scatter.php');
|
||||
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_regstat.php');
|
||||
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_line.php');
|
||||
|
||||
$this->_renderCartesianPlotArea('linlin');
|
||||
|
||||
for($i = 0; $i < $groupCount; ++$i) {
|
||||
$this->_renderPlotScatter($i,false);
|
||||
}
|
||||
} // function _renderScatterChart()
|
||||
|
||||
|
||||
private function _renderBubbleChart($groupCount) {
|
||||
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_scatter.php');
|
||||
|
||||
$this->_renderCartesianPlotArea('linlin');
|
||||
|
||||
for($i = 0; $i < $groupCount; ++$i) {
|
||||
$this->_renderPlotScatter($i,true);
|
||||
}
|
||||
} // function _renderBubbleChart()
|
||||
|
||||
|
||||
private function _renderPieChart($groupCount, $dimensions = '2d', $doughnut = False, $multiplePlots = False) {
|
||||
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_pie.php');
|
||||
if ($dimensions == '3d') {
|
||||
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_pie3d.php');
|
||||
}
|
||||
|
||||
$this->_renderPiePlotArea($doughnut);
|
||||
|
||||
$iLimit = ($multiplePlots) ? $groupCount : 1;
|
||||
for($groupID = 0; $groupID < $iLimit; ++$groupID) {
|
||||
$grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
|
||||
$exploded = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
|
||||
if ($groupID == 0) {
|
||||
$labelCount = count($this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
|
||||
if ($labelCount > 0) {
|
||||
$datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
|
||||
$datasetLabels = $this->_formatDataSetLabels($groupID, $datasetLabels, $labelCount);
|
||||
}
|
||||
}
|
||||
|
||||
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
|
||||
$seriesPlots = array();
|
||||
// For pie charts, we only display the first series: doughnut charts generally display all series
|
||||
$jLimit = ($multiplePlots) ? $seriesCount : 1;
|
||||
// Loop through each data series in turn
|
||||
for($j = 0; $j < $jLimit; ++$j) {
|
||||
$dataValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($j)->getDataValues();
|
||||
|
||||
// Fill in any missing values in the $dataValues array
|
||||
$testCurrentIndex = 0;
|
||||
foreach($dataValues as $k => $dataValue) {
|
||||
while($k != $testCurrentIndex) {
|
||||
$dataValues[$testCurrentIndex] = null;
|
||||
++$testCurrentIndex;
|
||||
}
|
||||
++$testCurrentIndex;
|
||||
}
|
||||
|
||||
if ($dimensions == '3d') {
|
||||
$seriesPlot = new PiePlot3D($dataValues);
|
||||
} else {
|
||||
if ($doughnut) {
|
||||
$seriesPlot = new PiePlotC($dataValues);
|
||||
} else {
|
||||
$seriesPlot = new PiePlot($dataValues);
|
||||
}
|
||||
}
|
||||
|
||||
if ($multiplePlots) {
|
||||
$seriesPlot->SetSize(($jLimit-$j) / ($jLimit * 4));
|
||||
}
|
||||
|
||||
if ($doughnut) {
|
||||
$seriesPlot->SetMidColor('white');
|
||||
}
|
||||
|
||||
$seriesPlot->SetColor(self::$_colourSet[self::$_plotColour++]);
|
||||
if (count($datasetLabels) > 0)
|
||||
$seriesPlot->SetLabels(array_fill(0,count($datasetLabels),''));
|
||||
if ($dimensions != '3d') {
|
||||
$seriesPlot->SetGuideLines(false);
|
||||
}
|
||||
if ($j == 0) {
|
||||
if ($exploded) {
|
||||
$seriesPlot->ExplodeAll();
|
||||
}
|
||||
$seriesPlot->SetLegends($datasetLabels);
|
||||
}
|
||||
|
||||
$this->_graph->Add($seriesPlot);
|
||||
}
|
||||
}
|
||||
} // function _renderPieChart()
|
||||
|
||||
|
||||
private function _renderRadarChart($groupCount) {
|
||||
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_radar.php');
|
||||
|
||||
$this->_renderRadarPlotArea();
|
||||
|
||||
for($groupID = 0; $groupID < $groupCount; ++$groupID) {
|
||||
$this->_renderPlotRadar($groupID);
|
||||
}
|
||||
} // function _renderRadarChart()
|
||||
|
||||
|
||||
private function _renderStockChart($groupCount) {
|
||||
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_stock.php');
|
||||
|
||||
$this->_renderCartesianPlotArea('intint');
|
||||
|
||||
for($groupID = 0; $groupID < $groupCount; ++$groupID) {
|
||||
$this->_renderPlotStock($groupID);
|
||||
}
|
||||
} // function _renderStockChart()
|
||||
|
||||
|
||||
private function _renderContourChart($groupCount,$dimensions) {
|
||||
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_contour.php');
|
||||
|
||||
$this->_renderCartesianPlotArea('intint');
|
||||
|
||||
for($i = 0; $i < $groupCount; ++$i) {
|
||||
$this->_renderPlotContour($i);
|
||||
}
|
||||
} // function _renderContourChart()
|
||||
|
||||
|
||||
private function _renderCombinationChart($groupCount,$dimensions,$outputDestination) {
|
||||
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_line.php');
|
||||
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_bar.php');
|
||||
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_scatter.php');
|
||||
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_regstat.php');
|
||||
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_line.php');
|
||||
|
||||
$this->_renderCartesianPlotArea();
|
||||
|
||||
for($i = 0; $i < $groupCount; ++$i) {
|
||||
$dimensions = null;
|
||||
$chartType = $this->_chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType();
|
||||
switch ($chartType) {
|
||||
case 'area3DChart' :
|
||||
$dimensions = '3d';
|
||||
case 'areaChart' :
|
||||
$this->_renderPlotLine($i,True,True,$dimensions);
|
||||
break;
|
||||
case 'bar3DChart' :
|
||||
$dimensions = '3d';
|
||||
case 'barChart' :
|
||||
$this->_renderPlotBar($i,$dimensions);
|
||||
break;
|
||||
case 'line3DChart' :
|
||||
$dimensions = '3d';
|
||||
case 'lineChart' :
|
||||
$this->_renderPlotLine($i,False,True,$dimensions);
|
||||
break;
|
||||
case 'scatterChart' :
|
||||
$this->_renderPlotScatter($i,false);
|
||||
break;
|
||||
case 'bubbleChart' :
|
||||
$this->_renderPlotScatter($i,true);
|
||||
break;
|
||||
default :
|
||||
$this->_graph = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$this->_renderLegend();
|
||||
|
||||
$this->_graph->Stroke($outputDestination);
|
||||
return true;
|
||||
} // function _renderCombinationChart()
|
||||
|
||||
|
||||
public function render($outputDestination) {
|
||||
self::$_plotColour = 0;
|
||||
|
||||
$groupCount = $this->_chart->getPlotArea()->getPlotGroupCount();
|
||||
|
||||
$dimensions = null;
|
||||
if ($groupCount == 1) {
|
||||
$chartType = $this->_chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType();
|
||||
} else {
|
||||
$chartTypes = array();
|
||||
for($i = 0; $i < $groupCount; ++$i) {
|
||||
$chartTypes[] = $this->_chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType();
|
||||
}
|
||||
$chartTypes = array_unique($chartTypes);
|
||||
if (count($chartTypes) == 1) {
|
||||
$chartType = array_pop($chartTypes);
|
||||
} elseif (count($chartTypes) == 0) {
|
||||
echo 'Chart is not yet implemented<br />';
|
||||
return false;
|
||||
} else {
|
||||
return $this->_renderCombinationChart($groupCount,$dimensions,$outputDestination);
|
||||
}
|
||||
}
|
||||
|
||||
switch ($chartType) {
|
||||
case 'area3DChart' :
|
||||
$dimensions = '3d';
|
||||
case 'areaChart' :
|
||||
$this->_renderAreaChart($groupCount,$dimensions);
|
||||
break;
|
||||
case 'bar3DChart' :
|
||||
$dimensions = '3d';
|
||||
case 'barChart' :
|
||||
$this->_renderBarChart($groupCount,$dimensions);
|
||||
break;
|
||||
case 'line3DChart' :
|
||||
$dimensions = '3d';
|
||||
case 'lineChart' :
|
||||
$this->_renderLineChart($groupCount,$dimensions);
|
||||
break;
|
||||
case 'pie3DChart' :
|
||||
$dimensions = '3d';
|
||||
case 'pieChart' :
|
||||
$this->_renderPieChart($groupCount,$dimensions,False,False);
|
||||
break;
|
||||
case 'doughnut3DChart' :
|
||||
$dimensions = '3d';
|
||||
case 'doughnutChart' :
|
||||
$this->_renderPieChart($groupCount,$dimensions,True,True);
|
||||
break;
|
||||
case 'scatterChart' :
|
||||
$this->_renderScatterChart($groupCount);
|
||||
break;
|
||||
case 'bubbleChart' :
|
||||
$this->_renderBubbleChart($groupCount);
|
||||
break;
|
||||
case 'radarChart' :
|
||||
$this->_renderRadarChart($groupCount);
|
||||
break;
|
||||
case 'surface3DChart' :
|
||||
$dimensions = '3d';
|
||||
case 'surfaceChart' :
|
||||
$this->_renderContourChart($groupCount,$dimensions);
|
||||
break;
|
||||
case 'stockChart' :
|
||||
$this->_renderStockChart($groupCount,$dimensions);
|
||||
break;
|
||||
default :
|
||||
echo $chartType.' is not yet implemented<br />';
|
||||
return false;
|
||||
}
|
||||
$this->_renderLegend();
|
||||
|
||||
$this->_graph->Stroke($outputDestination);
|
||||
return true;
|
||||
} // function render()
|
||||
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Chart_Renderer_jpgraph
|
||||
*/
|
||||
public function __construct(PHPExcel_Chart $chart)
|
||||
{
|
||||
$this->_graph = null;
|
||||
$this->_chart = $chart;
|
||||
} // function __construct()
|
||||
|
||||
} // PHPExcel_Chart_Renderer_jpgraph
|
92
web/Application/Home/Common/Excel/PHPExcel/Chart/Title.php
Normal file
92
web/Application/Home/Common/Excel/PHPExcel/Chart/Title.php
Normal file
|
@ -0,0 +1,92 @@
|
|||
<?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_Title
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Chart
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Chart_Title
|
||||
{
|
||||
|
||||
/**
|
||||
* Title Caption
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_caption = null;
|
||||
|
||||
/**
|
||||
* Title Layout
|
||||
*
|
||||
* @var PHPExcel_Chart_Layout
|
||||
*/
|
||||
private $_layout = null;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Chart_Title
|
||||
*/
|
||||
public function __construct($caption = null, PHPExcel_Chart_Layout $layout = null)
|
||||
{
|
||||
$this->_caption = $caption;
|
||||
$this->_layout = $layout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get caption
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCaption() {
|
||||
return $this->_caption;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set caption
|
||||
*
|
||||
* @param string $caption
|
||||
* @return PHPExcel_Chart_Title
|
||||
*/
|
||||
public function setCaption($caption = null) {
|
||||
$this->_caption = $caption;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Layout
|
||||
*
|
||||
* @return PHPExcel_Chart_Layout
|
||||
*/
|
||||
public function getLayout() {
|
||||
return $this->_layout;
|
||||
}
|
||||
|
||||
}
|
327
web/Application/Home/Common/Excel/PHPExcel/Comment.php
Normal file
327
web/Application/Home/Common/Excel/PHPExcel/Comment.php
Normal file
|
@ -0,0 +1,327 @@
|
|||
<?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_Comment
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Comment implements PHPExcel_IComparable
|
||||
{
|
||||
/**
|
||||
* Author
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_author;
|
||||
|
||||
/**
|
||||
* Rich text comment
|
||||
*
|
||||
* @var PHPExcel_RichText
|
||||
*/
|
||||
private $_text;
|
||||
|
||||
/**
|
||||
* Comment width (CSS style, i.e. XXpx or YYpt)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_width = '96pt';
|
||||
|
||||
/**
|
||||
* Left margin (CSS style, i.e. XXpx or YYpt)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_marginLeft = '59.25pt';
|
||||
|
||||
/**
|
||||
* Top margin (CSS style, i.e. XXpx or YYpt)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_marginTop = '1.5pt';
|
||||
|
||||
/**
|
||||
* Visible
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_visible = false;
|
||||
|
||||
/**
|
||||
* Comment height (CSS style, i.e. XXpx or YYpt)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_height = '55.5pt';
|
||||
|
||||
/**
|
||||
* Comment fill color
|
||||
*
|
||||
* @var PHPExcel_Style_Color
|
||||
*/
|
||||
private $_fillColor;
|
||||
|
||||
/**
|
||||
* Alignment
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_alignment;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Comment
|
||||
*
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// Initialise variables
|
||||
$this->_author = 'Author';
|
||||
$this->_text = new PHPExcel_RichText();
|
||||
$this->_fillColor = new PHPExcel_Style_Color('FFFFFFE1');
|
||||
$this->_alignment = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Author
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAuthor() {
|
||||
return $this->_author;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Author
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_Comment
|
||||
*/
|
||||
public function setAuthor($pValue = '') {
|
||||
$this->_author = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Rich text comment
|
||||
*
|
||||
* @return PHPExcel_RichText
|
||||
*/
|
||||
public function getText() {
|
||||
return $this->_text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Rich text comment
|
||||
*
|
||||
* @param PHPExcel_RichText $pValue
|
||||
* @return PHPExcel_Comment
|
||||
*/
|
||||
public function setText(PHPExcel_RichText $pValue) {
|
||||
$this->_text = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get comment width (CSS style, i.e. XXpx or YYpt)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getWidth() {
|
||||
return $this->_width;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set comment width (CSS style, i.e. XXpx or YYpt)
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Comment
|
||||
*/
|
||||
public function setWidth($value = '96pt') {
|
||||
$this->_width = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get comment height (CSS style, i.e. XXpx or YYpt)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHeight() {
|
||||
return $this->_height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set comment height (CSS style, i.e. XXpx or YYpt)
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Comment
|
||||
*/
|
||||
public function setHeight($value = '55.5pt') {
|
||||
$this->_height = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get left margin (CSS style, i.e. XXpx or YYpt)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMarginLeft() {
|
||||
return $this->_marginLeft;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set left margin (CSS style, i.e. XXpx or YYpt)
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Comment
|
||||
*/
|
||||
public function setMarginLeft($value = '59.25pt') {
|
||||
$this->_marginLeft = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get top margin (CSS style, i.e. XXpx or YYpt)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMarginTop() {
|
||||
return $this->_marginTop;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set top margin (CSS style, i.e. XXpx or YYpt)
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Comment
|
||||
*/
|
||||
public function setMarginTop($value = '1.5pt') {
|
||||
$this->_marginTop = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the comment visible by default?
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getVisible() {
|
||||
return $this->_visible;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set comment default visibility
|
||||
*
|
||||
* @param boolean $value
|
||||
* @return PHPExcel_Comment
|
||||
*/
|
||||
public function setVisible($value = false) {
|
||||
$this->_visible = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fill color
|
||||
*
|
||||
* @return PHPExcel_Style_Color
|
||||
*/
|
||||
public function getFillColor() {
|
||||
return $this->_fillColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Alignment
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_Comment
|
||||
*/
|
||||
public function setAlignment($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL) {
|
||||
$this->_alignment = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Alignment
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAlignment() {
|
||||
return $this->_alignment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get hash code
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode() {
|
||||
return md5(
|
||||
$this->_author
|
||||
. $this->_text->getHashCode()
|
||||
. $this->_width
|
||||
. $this->_height
|
||||
. $this->_marginLeft
|
||||
. $this->_marginTop
|
||||
. ($this->_visible ? 1 : 0)
|
||||
. $this->_fillColor->getHashCode()
|
||||
. $this->_alignment
|
||||
. __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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert to string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString() {
|
||||
return $this->_text->getPlainText();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,587 @@
|
|||
<?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_DocumentProperties
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_DocumentProperties
|
||||
{
|
||||
/** constants */
|
||||
const PROPERTY_TYPE_BOOLEAN = 'b';
|
||||
const PROPERTY_TYPE_INTEGER = 'i';
|
||||
const PROPERTY_TYPE_FLOAT = 'f';
|
||||
const PROPERTY_TYPE_DATE = 'd';
|
||||
const PROPERTY_TYPE_STRING = 's';
|
||||
const PROPERTY_TYPE_UNKNOWN = 'u';
|
||||
|
||||
/**
|
||||
* Creator
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_creator = 'Unknown Creator';
|
||||
|
||||
/**
|
||||
* LastModifiedBy
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_lastModifiedBy;
|
||||
|
||||
/**
|
||||
* Created
|
||||
*
|
||||
* @var datetime
|
||||
*/
|
||||
private $_created;
|
||||
|
||||
/**
|
||||
* Modified
|
||||
*
|
||||
* @var datetime
|
||||
*/
|
||||
private $_modified;
|
||||
|
||||
/**
|
||||
* Title
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_title = 'Untitled Spreadsheet';
|
||||
|
||||
/**
|
||||
* Description
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_description = '';
|
||||
|
||||
/**
|
||||
* Subject
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_subject = '';
|
||||
|
||||
/**
|
||||
* Keywords
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_keywords = '';
|
||||
|
||||
/**
|
||||
* Category
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_category = '';
|
||||
|
||||
/**
|
||||
* Manager
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_manager = '';
|
||||
|
||||
/**
|
||||
* Company
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_company = 'Microsoft Corporation';
|
||||
|
||||
/**
|
||||
* Custom Properties
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_customProperties = array();
|
||||
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// Initialise values
|
||||
$this->_lastModifiedBy = $this->_creator;
|
||||
$this->_created = time();
|
||||
$this->_modified = time();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Creator
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCreator() {
|
||||
return $this->_creator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Creator
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setCreator($pValue = '') {
|
||||
$this->_creator = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Last Modified By
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLastModifiedBy() {
|
||||
return $this->_lastModifiedBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Last Modified By
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setLastModifiedBy($pValue = '') {
|
||||
$this->_lastModifiedBy = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Created
|
||||
*
|
||||
* @return datetime
|
||||
*/
|
||||
public function getCreated() {
|
||||
return $this->_created;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Created
|
||||
*
|
||||
* @param datetime $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setCreated($pValue = null) {
|
||||
if ($pValue === NULL) {
|
||||
$pValue = time();
|
||||
} elseif (is_string($pValue)) {
|
||||
if (is_numeric($pValue)) {
|
||||
$pValue = intval($pValue);
|
||||
} else {
|
||||
$pValue = strtotime($pValue);
|
||||
}
|
||||
}
|
||||
|
||||
$this->_created = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Modified
|
||||
*
|
||||
* @return datetime
|
||||
*/
|
||||
public function getModified() {
|
||||
return $this->_modified;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Modified
|
||||
*
|
||||
* @param datetime $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setModified($pValue = null) {
|
||||
if ($pValue === NULL) {
|
||||
$pValue = time();
|
||||
} elseif (is_string($pValue)) {
|
||||
if (is_numeric($pValue)) {
|
||||
$pValue = intval($pValue);
|
||||
} else {
|
||||
$pValue = strtotime($pValue);
|
||||
}
|
||||
}
|
||||
|
||||
$this->_modified = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Title
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle() {
|
||||
return $this->_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Title
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setTitle($pValue = '') {
|
||||
$this->_title = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Description
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription() {
|
||||
return $this->_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Description
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setDescription($pValue = '') {
|
||||
$this->_description = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Subject
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSubject() {
|
||||
return $this->_subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Subject
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setSubject($pValue = '') {
|
||||
$this->_subject = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Keywords
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getKeywords() {
|
||||
return $this->_keywords;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Keywords
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setKeywords($pValue = '') {
|
||||
$this->_keywords = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Category
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCategory() {
|
||||
return $this->_category;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Category
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setCategory($pValue = '') {
|
||||
$this->_category = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Company
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCompany() {
|
||||
return $this->_company;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Company
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setCompany($pValue = '') {
|
||||
$this->_company = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Manager
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getManager() {
|
||||
return $this->_manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Manager
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setManager($pValue = '') {
|
||||
$this->_manager = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a List of Custom Property Names
|
||||
*
|
||||
* @return array of string
|
||||
*/
|
||||
public function getCustomProperties() {
|
||||
return array_keys($this->_customProperties);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a Custom Property is defined
|
||||
*
|
||||
* @param string $propertyName
|
||||
* @return boolean
|
||||
*/
|
||||
public function isCustomPropertySet($propertyName) {
|
||||
return isset($this->_customProperties[$propertyName]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a Custom Property Value
|
||||
*
|
||||
* @param string $propertyName
|
||||
* @return string
|
||||
*/
|
||||
public function getCustomPropertyValue($propertyName) {
|
||||
if (isset($this->_customProperties[$propertyName])) {
|
||||
return $this->_customProperties[$propertyName]['value'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a Custom Property Type
|
||||
*
|
||||
* @param string $propertyName
|
||||
* @return string
|
||||
*/
|
||||
public function getCustomPropertyType($propertyName) {
|
||||
if (isset($this->_customProperties[$propertyName])) {
|
||||
return $this->_customProperties[$propertyName]['type'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a Custom Property
|
||||
*
|
||||
* @param string $propertyName
|
||||
* @param mixed $propertyValue
|
||||
* @param string $propertyType
|
||||
* 'i' : Integer
|
||||
* 'f' : Floating Point
|
||||
* 's' : String
|
||||
* 'd' : Date/Time
|
||||
* 'b' : Boolean
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setCustomProperty($propertyName,$propertyValue='',$propertyType=NULL) {
|
||||
if (($propertyType === NULL) || (!in_array($propertyType,array(self::PROPERTY_TYPE_INTEGER,
|
||||
self::PROPERTY_TYPE_FLOAT,
|
||||
self::PROPERTY_TYPE_STRING,
|
||||
self::PROPERTY_TYPE_DATE,
|
||||
self::PROPERTY_TYPE_BOOLEAN)))) {
|
||||
if ($propertyValue === NULL) {
|
||||
$propertyType = self::PROPERTY_TYPE_STRING;
|
||||
} elseif (is_float($propertyValue)) {
|
||||
$propertyType = self::PROPERTY_TYPE_FLOAT;
|
||||
} elseif(is_int($propertyValue)) {
|
||||
$propertyType = self::PROPERTY_TYPE_INTEGER;
|
||||
} elseif (is_bool($propertyValue)) {
|
||||
$propertyType = self::PROPERTY_TYPE_BOOLEAN;
|
||||
} else {
|
||||
$propertyType = self::PROPERTY_TYPE_STRING;
|
||||
}
|
||||
}
|
||||
|
||||
$this->_customProperties[$propertyName] = array('value' => $propertyValue, 'type' => $propertyType);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function convertProperty($propertyValue,$propertyType) {
|
||||
switch ($propertyType) {
|
||||
case 'empty' : // Empty
|
||||
return '';
|
||||
break;
|
||||
case 'null' : // Null
|
||||
return NULL;
|
||||
break;
|
||||
case 'i1' : // 1-Byte Signed Integer
|
||||
case 'i2' : // 2-Byte Signed Integer
|
||||
case 'i4' : // 4-Byte Signed Integer
|
||||
case 'i8' : // 8-Byte Signed Integer
|
||||
case 'int' : // Integer
|
||||
return (int) $propertyValue;
|
||||
break;
|
||||
case 'ui1' : // 1-Byte Unsigned Integer
|
||||
case 'ui2' : // 2-Byte Unsigned Integer
|
||||
case 'ui4' : // 4-Byte Unsigned Integer
|
||||
case 'ui8' : // 8-Byte Unsigned Integer
|
||||
case 'uint' : // Unsigned Integer
|
||||
return abs((int) $propertyValue);
|
||||
break;
|
||||
case 'r4' : // 4-Byte Real Number
|
||||
case 'r8' : // 8-Byte Real Number
|
||||
case 'decimal' : // Decimal
|
||||
return (float) $propertyValue;
|
||||
break;
|
||||
case 'lpstr' : // LPSTR
|
||||
case 'lpwstr' : // LPWSTR
|
||||
case 'bstr' : // Basic String
|
||||
return $propertyValue;
|
||||
break;
|
||||
case 'date' : // Date and Time
|
||||
case 'filetime' : // File Time
|
||||
return strtotime($propertyValue);
|
||||
break;
|
||||
case 'bool' : // Boolean
|
||||
return ($propertyValue == 'true') ? True : False;
|
||||
break;
|
||||
case 'cy' : // Currency
|
||||
case 'error' : // Error Status Code
|
||||
case 'vector' : // Vector
|
||||
case 'array' : // Array
|
||||
case 'blob' : // Binary Blob
|
||||
case 'oblob' : // Binary Blob Object
|
||||
case 'stream' : // Binary Stream
|
||||
case 'ostream' : // Binary Stream Object
|
||||
case 'storage' : // Binary Storage
|
||||
case 'ostorage' : // Binary Storage Object
|
||||
case 'vstream' : // Binary Versioned Stream
|
||||
case 'clsid' : // Class ID
|
||||
case 'cf' : // Clipboard Data
|
||||
return $propertyValue;
|
||||
break;
|
||||
}
|
||||
return $propertyValue;
|
||||
}
|
||||
|
||||
public static function convertPropertyType($propertyType) {
|
||||
switch ($propertyType) {
|
||||
case 'i1' : // 1-Byte Signed Integer
|
||||
case 'i2' : // 2-Byte Signed Integer
|
||||
case 'i4' : // 4-Byte Signed Integer
|
||||
case 'i8' : // 8-Byte Signed Integer
|
||||
case 'int' : // Integer
|
||||
case 'ui1' : // 1-Byte Unsigned Integer
|
||||
case 'ui2' : // 2-Byte Unsigned Integer
|
||||
case 'ui4' : // 4-Byte Unsigned Integer
|
||||
case 'ui8' : // 8-Byte Unsigned Integer
|
||||
case 'uint' : // Unsigned Integer
|
||||
return self::PROPERTY_TYPE_INTEGER;
|
||||
break;
|
||||
case 'r4' : // 4-Byte Real Number
|
||||
case 'r8' : // 8-Byte Real Number
|
||||
case 'decimal' : // Decimal
|
||||
return self::PROPERTY_TYPE_FLOAT;
|
||||
break;
|
||||
case 'empty' : // Empty
|
||||
case 'null' : // Null
|
||||
case 'lpstr' : // LPSTR
|
||||
case 'lpwstr' : // LPWSTR
|
||||
case 'bstr' : // Basic String
|
||||
return self::PROPERTY_TYPE_STRING;
|
||||
break;
|
||||
case 'date' : // Date and Time
|
||||
case 'filetime' : // File Time
|
||||
return self::PROPERTY_TYPE_DATE;
|
||||
break;
|
||||
case 'bool' : // Boolean
|
||||
return self::PROPERTY_TYPE_BOOLEAN;
|
||||
break;
|
||||
case 'cy' : // Currency
|
||||
case 'error' : // Error Status Code
|
||||
case 'vector' : // Vector
|
||||
case 'array' : // Array
|
||||
case 'blob' : // Binary Blob
|
||||
case 'oblob' : // Binary Blob Object
|
||||
case 'stream' : // Binary Stream
|
||||
case 'ostream' : // Binary Stream Object
|
||||
case 'storage' : // Binary Storage
|
||||
case 'ostorage' : // Binary Storage Object
|
||||
case 'vstream' : // Binary Versioned Stream
|
||||
case 'clsid' : // Class ID
|
||||
case 'cf' : // Clipboard Data
|
||||
return self::PROPERTY_TYPE_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
return self::PROPERTY_TYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
}
|
218
web/Application/Home/Common/Excel/PHPExcel/DocumentSecurity.php
Normal file
218
web/Application/Home/Common/Excel/PHPExcel/DocumentSecurity.php
Normal file
|
@ -0,0 +1,218 @@
|
|||
<?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_DocumentSecurity
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_DocumentSecurity
|
||||
{
|
||||
/**
|
||||
* LockRevision
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_lockRevision;
|
||||
|
||||
/**
|
||||
* LockStructure
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_lockStructure;
|
||||
|
||||
/**
|
||||
* LockWindows
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_lockWindows;
|
||||
|
||||
/**
|
||||
* RevisionsPassword
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_revisionsPassword;
|
||||
|
||||
/**
|
||||
* WorkbookPassword
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_workbookPassword;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_DocumentSecurity
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// Initialise values
|
||||
$this->_lockRevision = false;
|
||||
$this->_lockStructure = false;
|
||||
$this->_lockWindows = false;
|
||||
$this->_revisionsPassword = '';
|
||||
$this->_workbookPassword = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Is some sort of dcument security enabled?
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function isSecurityEnabled() {
|
||||
return $this->_lockRevision ||
|
||||
$this->_lockStructure ||
|
||||
$this->_lockWindows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get LockRevision
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getLockRevision() {
|
||||
return $this->_lockRevision;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set LockRevision
|
||||
*
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_DocumentSecurity
|
||||
*/
|
||||
function setLockRevision($pValue = false) {
|
||||
$this->_lockRevision = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get LockStructure
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getLockStructure() {
|
||||
return $this->_lockStructure;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set LockStructure
|
||||
*
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_DocumentSecurity
|
||||
*/
|
||||
function setLockStructure($pValue = false) {
|
||||
$this->_lockStructure = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get LockWindows
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getLockWindows() {
|
||||
return $this->_lockWindows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set LockWindows
|
||||
*
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_DocumentSecurity
|
||||
*/
|
||||
function setLockWindows($pValue = false) {
|
||||
$this->_lockWindows = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get RevisionsPassword (hashed)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getRevisionsPassword() {
|
||||
return $this->_revisionsPassword;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set RevisionsPassword
|
||||
*
|
||||
* @param string $pValue
|
||||
* @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
|
||||
* @return PHPExcel_DocumentSecurity
|
||||
*/
|
||||
function setRevisionsPassword($pValue = '', $pAlreadyHashed = false) {
|
||||
if (!$pAlreadyHashed) {
|
||||
$pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
|
||||
}
|
||||
$this->_revisionsPassword = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get WorkbookPassword (hashed)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getWorkbookPassword() {
|
||||
return $this->_workbookPassword;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set WorkbookPassword
|
||||
*
|
||||
* @param string $pValue
|
||||
* @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
|
||||
* @return PHPExcel_DocumentSecurity
|
||||
*/
|
||||
function setWorkbookPassword($pValue = '', $pAlreadyHashed = false) {
|
||||
if (!$pAlreadyHashed) {
|
||||
$pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
|
||||
}
|
||||
$this->_workbookPassword = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
52
web/Application/Home/Common/Excel/PHPExcel/Exception.php
Normal file
52
web/Application/Home/Common/Excel/PHPExcel/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
|
||||
* @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_Exception
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Exception extends 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;
|
||||
}
|
||||
}
|
202
web/Application/Home/Common/Excel/PHPExcel/HashTable.php
Normal file
202
web/Application/Home/Common/Excel/PHPExcel/HashTable.php
Normal file
|
@ -0,0 +1,202 @@
|
|||
<?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_HashTable
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_HashTable
|
||||
{
|
||||
/**
|
||||
* HashTable elements
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $_items = array();
|
||||
|
||||
/**
|
||||
* HashTable key map
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $_keyMap = array();
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_HashTable
|
||||
*
|
||||
* @param PHPExcel_IComparable[] $pSource Optional source array to create HashTable from
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function __construct($pSource = null)
|
||||
{
|
||||
if ($pSource !== NULL) {
|
||||
// Create HashTable
|
||||
$this->addFromSource($pSource);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add HashTable items from source
|
||||
*
|
||||
* @param PHPExcel_IComparable[] $pSource Source array to create HashTable from
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function addFromSource($pSource = null) {
|
||||
// Check if an array was passed
|
||||
if ($pSource == null) {
|
||||
return;
|
||||
} else if (!is_array($pSource)) {
|
||||
throw new PHPExcel_Exception('Invalid array parameter passed.');
|
||||
}
|
||||
|
||||
foreach ($pSource as $item) {
|
||||
$this->add($item);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add HashTable item
|
||||
*
|
||||
* @param PHPExcel_IComparable $pSource Item to add
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function add(PHPExcel_IComparable $pSource = null) {
|
||||
$hash = $pSource->getHashCode();
|
||||
if (!isset($this->_items[$hash])) {
|
||||
$this->_items[$hash] = $pSource;
|
||||
$this->_keyMap[count($this->_items) - 1] = $hash;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove HashTable item
|
||||
*
|
||||
* @param PHPExcel_IComparable $pSource Item to remove
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function remove(PHPExcel_IComparable $pSource = null) {
|
||||
$hash = $pSource->getHashCode();
|
||||
if (isset($this->_items[$hash])) {
|
||||
unset($this->_items[$hash]);
|
||||
|
||||
$deleteKey = -1;
|
||||
foreach ($this->_keyMap as $key => $value) {
|
||||
if ($deleteKey >= 0) {
|
||||
$this->_keyMap[$key - 1] = $value;
|
||||
}
|
||||
|
||||
if ($value == $hash) {
|
||||
$deleteKey = $key;
|
||||
}
|
||||
}
|
||||
unset($this->_keyMap[count($this->_keyMap) - 1]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear HashTable
|
||||
*
|
||||
*/
|
||||
public function clear() {
|
||||
$this->_items = array();
|
||||
$this->_keyMap = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Count
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function count() {
|
||||
return count($this->_items);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get index for hash code
|
||||
*
|
||||
* @param string $pHashCode
|
||||
* @return int Index
|
||||
*/
|
||||
public function getIndexForHashCode($pHashCode = '') {
|
||||
return array_search($pHashCode, $this->_keyMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get by index
|
||||
*
|
||||
* @param int $pIndex
|
||||
* @return PHPExcel_IComparable
|
||||
*
|
||||
*/
|
||||
public function getByIndex($pIndex = 0) {
|
||||
if (isset($this->_keyMap[$pIndex])) {
|
||||
return $this->getByHashCode( $this->_keyMap[$pIndex] );
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get by hashcode
|
||||
*
|
||||
* @param string $pHashCode
|
||||
* @return PHPExcel_IComparable
|
||||
*
|
||||
*/
|
||||
public function getByHashCode($pHashCode = '') {
|
||||
if (isset($this->_items[$pHashCode])) {
|
||||
return $this->_items[$pHashCode];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* HashTable to array
|
||||
*
|
||||
* @return PHPExcel_IComparable[]
|
||||
*/
|
||||
public function toArray() {
|
||||
return $this->_items;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
762
web/Application/Home/Common/Excel/PHPExcel/Helper/HTML.php
Normal file
762
web/Application/Home/Common/Excel/PHPExcel/Helper/HTML.php
Normal file
|
@ -0,0 +1,762 @@
|
|||
<?php
|
||||
|
||||
class PHPExcel_Helper_HTML
|
||||
{
|
||||
protected static $colourMap = array(
|
||||
'aliceblue' => 'f0f8ff',
|
||||
'antiquewhite' => 'faebd7',
|
||||
'antiquewhite1' => 'ffefdb',
|
||||
'antiquewhite2' => 'eedfcc',
|
||||
'antiquewhite3' => 'cdc0b0',
|
||||
'antiquewhite4' => '8b8378',
|
||||
'aqua' => '00ffff',
|
||||
'aquamarine1' => '7fffd4',
|
||||
'aquamarine2' => '76eec6',
|
||||
'aquamarine4' => '458b74',
|
||||
'azure1' => 'f0ffff',
|
||||
'azure2' => 'e0eeee',
|
||||
'azure3' => 'c1cdcd',
|
||||
'azure4' => '838b8b',
|
||||
'beige' => 'f5f5dc',
|
||||
'bisque1' => 'ffe4c4',
|
||||
'bisque2' => 'eed5b7',
|
||||
'bisque3' => 'cdb79e',
|
||||
'bisque4' => '8b7d6b',
|
||||
'black' => '000000',
|
||||
'blanchedalmond' => 'ffebcd',
|
||||
'blue' => '0000ff',
|
||||
'blue1' => '0000ff',
|
||||
'blue2' => '0000ee',
|
||||
'blue4' => '00008b',
|
||||
'blueviolet' => '8a2be2',
|
||||
'brown' => 'a52a2a',
|
||||
'brown1' => 'ff4040',
|
||||
'brown2' => 'ee3b3b',
|
||||
'brown3' => 'cd3333',
|
||||
'brown4' => '8b2323',
|
||||
'burlywood' => 'deb887',
|
||||
'burlywood1' => 'ffd39b',
|
||||
'burlywood2' => 'eec591',
|
||||
'burlywood3' => 'cdaa7d',
|
||||
'burlywood4' => '8b7355',
|
||||
'cadetblue' => '5f9ea0',
|
||||
'cadetblue1' => '98f5ff',
|
||||
'cadetblue2' => '8ee5ee',
|
||||
'cadetblue3' => '7ac5cd',
|
||||
'cadetblue4' => '53868b',
|
||||
'chartreuse1' => '7fff00',
|
||||
'chartreuse2' => '76ee00',
|
||||
'chartreuse3' => '66cd00',
|
||||
'chartreuse4' => '458b00',
|
||||
'chocolate' => 'd2691e',
|
||||
'chocolate1' => 'ff7f24',
|
||||
'chocolate2' => 'ee7621',
|
||||
'chocolate3' => 'cd661d',
|
||||
'coral' => 'ff7f50',
|
||||
'coral1' => 'ff7256',
|
||||
'coral2' => 'ee6a50',
|
||||
'coral3' => 'cd5b45',
|
||||
'coral4' => '8b3e2f',
|
||||
'cornflowerblue' => '6495ed',
|
||||
'cornsilk1' => 'fff8dc',
|
||||
'cornsilk2' => 'eee8cd',
|
||||
'cornsilk3' => 'cdc8b1',
|
||||
'cornsilk4' => '8b8878',
|
||||
'cyan1' => '00ffff',
|
||||
'cyan2' => '00eeee',
|
||||
'cyan3' => '00cdcd',
|
||||
'cyan4' => '008b8b',
|
||||
'darkgoldenrod' => 'b8860b',
|
||||
'darkgoldenrod1' => 'ffb90f',
|
||||
'darkgoldenrod2' => 'eead0e',
|
||||
'darkgoldenrod3' => 'cd950c',
|
||||
'darkgoldenrod4' => '8b6508',
|
||||
'darkgreen' => '006400',
|
||||
'darkkhaki' => 'bdb76b',
|
||||
'darkolivegreen' => '556b2f',
|
||||
'darkolivegreen1' => 'caff70',
|
||||
'darkolivegreen2' => 'bcee68',
|
||||
'darkolivegreen3' => 'a2cd5a',
|
||||
'darkolivegreen4' => '6e8b3d',
|
||||
'darkorange' => 'ff8c00',
|
||||
'darkorange1' => 'ff7f00',
|
||||
'darkorange2' => 'ee7600',
|
||||
'darkorange3' => 'cd6600',
|
||||
'darkorange4' => '8b4500',
|
||||
'darkorchid' => '9932cc',
|
||||
'darkorchid1' => 'bf3eff',
|
||||
'darkorchid2' => 'b23aee',
|
||||
'darkorchid3' => '9a32cd',
|
||||
'darkorchid4' => '68228b',
|
||||
'darksalmon' => 'e9967a',
|
||||
'darkseagreen' => '8fbc8f',
|
||||
'darkseagreen1' => 'c1ffc1',
|
||||
'darkseagreen2' => 'b4eeb4',
|
||||
'darkseagreen3' => '9bcd9b',
|
||||
'darkseagreen4' => '698b69',
|
||||
'darkslateblue' => '483d8b',
|
||||
'darkslategray' => '2f4f4f',
|
||||
'darkslategray1' => '97ffff',
|
||||
'darkslategray2' => '8deeee',
|
||||
'darkslategray3' => '79cdcd',
|
||||
'darkslategray4' => '528b8b',
|
||||
'darkturquoise' => '00ced1',
|
||||
'darkviolet' => '9400d3',
|
||||
'deeppink1' => 'ff1493',
|
||||
'deeppink2' => 'ee1289',
|
||||
'deeppink3' => 'cd1076',
|
||||
'deeppink4' => '8b0a50',
|
||||
'deepskyblue1' => '00bfff',
|
||||
'deepskyblue2' => '00b2ee',
|
||||
'deepskyblue3' => '009acd',
|
||||
'deepskyblue4' => '00688b',
|
||||
'dimgray' => '696969',
|
||||
'dodgerblue1' => '1e90ff',
|
||||
'dodgerblue2' => '1c86ee',
|
||||
'dodgerblue3' => '1874cd',
|
||||
'dodgerblue4' => '104e8b',
|
||||
'firebrick' => 'b22222',
|
||||
'firebrick1' => 'ff3030',
|
||||
'firebrick2' => 'ee2c2c',
|
||||
'firebrick3' => 'cd2626',
|
||||
'firebrick4' => '8b1a1a',
|
||||
'floralwhite' => 'fffaf0',
|
||||
'forestgreen' => '228b22',
|
||||
'fuchsia' => 'ff00ff',
|
||||
'gainsboro' => 'dcdcdc',
|
||||
'ghostwhite' => 'f8f8ff',
|
||||
'gold1' => 'ffd700',
|
||||
'gold2' => 'eec900',
|
||||
'gold3' => 'cdad00',
|
||||
'gold4' => '8b7500',
|
||||
'goldenrod' => 'daa520',
|
||||
'goldenrod1' => 'ffc125',
|
||||
'goldenrod2' => 'eeb422',
|
||||
'goldenrod3' => 'cd9b1d',
|
||||
'goldenrod4' => '8b6914',
|
||||
'gray' => 'bebebe',
|
||||
'gray1' => '030303',
|
||||
'gray10' => '1a1a1a',
|
||||
'gray11' => '1c1c1c',
|
||||
'gray12' => '1f1f1f',
|
||||
'gray13' => '212121',
|
||||
'gray14' => '242424',
|
||||
'gray15' => '262626',
|
||||
'gray16' => '292929',
|
||||
'gray17' => '2b2b2b',
|
||||
'gray18' => '2e2e2e',
|
||||
'gray19' => '303030',
|
||||
'gray2' => '050505',
|
||||
'gray20' => '333333',
|
||||
'gray21' => '363636',
|
||||
'gray22' => '383838',
|
||||
'gray23' => '3b3b3b',
|
||||
'gray24' => '3d3d3d',
|
||||
'gray25' => '404040',
|
||||
'gray26' => '424242',
|
||||
'gray27' => '454545',
|
||||
'gray28' => '474747',
|
||||
'gray29' => '4a4a4a',
|
||||
'gray3' => '080808',
|
||||
'gray30' => '4d4d4d',
|
||||
'gray31' => '4f4f4f',
|
||||
'gray32' => '525252',
|
||||
'gray33' => '545454',
|
||||
'gray34' => '575757',
|
||||
'gray35' => '595959',
|
||||
'gray36' => '5c5c5c',
|
||||
'gray37' => '5e5e5e',
|
||||
'gray38' => '616161',
|
||||
'gray39' => '636363',
|
||||
'gray4' => '0a0a0a',
|
||||
'gray40' => '666666',
|
||||
'gray41' => '696969',
|
||||
'gray42' => '6b6b6b',
|
||||
'gray43' => '6e6e6e',
|
||||
'gray44' => '707070',
|
||||
'gray45' => '737373',
|
||||
'gray46' => '757575',
|
||||
'gray47' => '787878',
|
||||
'gray48' => '7a7a7a',
|
||||
'gray49' => '7d7d7d',
|
||||
'gray5' => '0d0d0d',
|
||||
'gray50' => '7f7f7f',
|
||||
'gray51' => '828282',
|
||||
'gray52' => '858585',
|
||||
'gray53' => '878787',
|
||||
'gray54' => '8a8a8a',
|
||||
'gray55' => '8c8c8c',
|
||||
'gray56' => '8f8f8f',
|
||||
'gray57' => '919191',
|
||||
'gray58' => '949494',
|
||||
'gray59' => '969696',
|
||||
'gray6' => '0f0f0f',
|
||||
'gray60' => '999999',
|
||||
'gray61' => '9c9c9c',
|
||||
'gray62' => '9e9e9e',
|
||||
'gray63' => 'a1a1a1',
|
||||
'gray64' => 'a3a3a3',
|
||||
'gray65' => 'a6a6a6',
|
||||
'gray66' => 'a8a8a8',
|
||||
'gray67' => 'ababab',
|
||||
'gray68' => 'adadad',
|
||||
'gray69' => 'b0b0b0',
|
||||
'gray7' => '121212',
|
||||
'gray70' => 'b3b3b3',
|
||||
'gray71' => 'b5b5b5',
|
||||
'gray72' => 'b8b8b8',
|
||||
'gray73' => 'bababa',
|
||||
'gray74' => 'bdbdbd',
|
||||
'gray75' => 'bfbfbf',
|
||||
'gray76' => 'c2c2c2',
|
||||
'gray77' => 'c4c4c4',
|
||||
'gray78' => 'c7c7c7',
|
||||
'gray79' => 'c9c9c9',
|
||||
'gray8' => '141414',
|
||||
'gray80' => 'cccccc',
|
||||
'gray81' => 'cfcfcf',
|
||||
'gray82' => 'd1d1d1',
|
||||
'gray83' => 'd4d4d4',
|
||||
'gray84' => 'd6d6d6',
|
||||
'gray85' => 'd9d9d9',
|
||||
'gray86' => 'dbdbdb',
|
||||
'gray87' => 'dedede',
|
||||
'gray88' => 'e0e0e0',
|
||||
'gray89' => 'e3e3e3',
|
||||
'gray9' => '171717',
|
||||
'gray90' => 'e5e5e5',
|
||||
'gray91' => 'e8e8e8',
|
||||
'gray92' => 'ebebeb',
|
||||
'gray93' => 'ededed',
|
||||
'gray94' => 'f0f0f0',
|
||||
'gray95' => 'f2f2f2',
|
||||
'gray97' => 'f7f7f7',
|
||||
'gray98' => 'fafafa',
|
||||
'gray99' => 'fcfcfc',
|
||||
'green' => '00ff00',
|
||||
'green1' => '00ff00',
|
||||
'green2' => '00ee00',
|
||||
'green3' => '00cd00',
|
||||
'green4' => '008b00',
|
||||
'greenyellow' => 'adff2f',
|
||||
'honeydew1' => 'f0fff0',
|
||||
'honeydew2' => 'e0eee0',
|
||||
'honeydew3' => 'c1cdc1',
|
||||
'honeydew4' => '838b83',
|
||||
'hotpink' => 'ff69b4',
|
||||
'hotpink1' => 'ff6eb4',
|
||||
'hotpink2' => 'ee6aa7',
|
||||
'hotpink3' => 'cd6090',
|
||||
'hotpink4' => '8b3a62',
|
||||
'indianred' => 'cd5c5c',
|
||||
'indianred1' => 'ff6a6a',
|
||||
'indianred2' => 'ee6363',
|
||||
'indianred3' => 'cd5555',
|
||||
'indianred4' => '8b3a3a',
|
||||
'ivory1' => 'fffff0',
|
||||
'ivory2' => 'eeeee0',
|
||||
'ivory3' => 'cdcdc1',
|
||||
'ivory4' => '8b8b83',
|
||||
'khaki' => 'f0e68c',
|
||||
'khaki1' => 'fff68f',
|
||||
'khaki2' => 'eee685',
|
||||
'khaki3' => 'cdc673',
|
||||
'khaki4' => '8b864e',
|
||||
'lavender' => 'e6e6fa',
|
||||
'lavenderblush1' => 'fff0f5',
|
||||
'lavenderblush2' => 'eee0e5',
|
||||
'lavenderblush3' => 'cdc1c5',
|
||||
'lavenderblush4' => '8b8386',
|
||||
'lawngreen' => '7cfc00',
|
||||
'lemonchiffon1' => 'fffacd',
|
||||
'lemonchiffon2' => 'eee9bf',
|
||||
'lemonchiffon3' => 'cdc9a5',
|
||||
'lemonchiffon4' => '8b8970',
|
||||
'light' => 'eedd82',
|
||||
'lightblue' => 'add8e6',
|
||||
'lightblue1' => 'bfefff',
|
||||
'lightblue2' => 'b2dfee',
|
||||
'lightblue3' => '9ac0cd',
|
||||
'lightblue4' => '68838b',
|
||||
'lightcoral' => 'f08080',
|
||||
'lightcyan1' => 'e0ffff',
|
||||
'lightcyan2' => 'd1eeee',
|
||||
'lightcyan3' => 'b4cdcd',
|
||||
'lightcyan4' => '7a8b8b',
|
||||
'lightgoldenrod1' => 'ffec8b',
|
||||
'lightgoldenrod2' => 'eedc82',
|
||||
'lightgoldenrod3' => 'cdbe70',
|
||||
'lightgoldenrod4' => '8b814c',
|
||||
'lightgoldenrodyellow' => 'fafad2',
|
||||
'lightgray' => 'd3d3d3',
|
||||
'lightpink' => 'ffb6c1',
|
||||
'lightpink1' => 'ffaeb9',
|
||||
'lightpink2' => 'eea2ad',
|
||||
'lightpink3' => 'cd8c95',
|
||||
'lightpink4' => '8b5f65',
|
||||
'lightsalmon1' => 'ffa07a',
|
||||
'lightsalmon2' => 'ee9572',
|
||||
'lightsalmon3' => 'cd8162',
|
||||
'lightsalmon4' => '8b5742',
|
||||
'lightseagreen' => '20b2aa',
|
||||
'lightskyblue' => '87cefa',
|
||||
'lightskyblue1' => 'b0e2ff',
|
||||
'lightskyblue2' => 'a4d3ee',
|
||||
'lightskyblue3' => '8db6cd',
|
||||
'lightskyblue4' => '607b8b',
|
||||
'lightslateblue' => '8470ff',
|
||||
'lightslategray' => '778899',
|
||||
'lightsteelblue' => 'b0c4de',
|
||||
'lightsteelblue1' => 'cae1ff',
|
||||
'lightsteelblue2' => 'bcd2ee',
|
||||
'lightsteelblue3' => 'a2b5cd',
|
||||
'lightsteelblue4' => '6e7b8b',
|
||||
'lightyellow1' => 'ffffe0',
|
||||
'lightyellow2' => 'eeeed1',
|
||||
'lightyellow3' => 'cdcdb4',
|
||||
'lightyellow4' => '8b8b7a',
|
||||
'lime' => '00ff00',
|
||||
'limegreen' => '32cd32',
|
||||
'linen' => 'faf0e6',
|
||||
'magenta' => 'ff00ff',
|
||||
'magenta2' => 'ee00ee',
|
||||
'magenta3' => 'cd00cd',
|
||||
'magenta4' => '8b008b',
|
||||
'maroon' => 'b03060',
|
||||
'maroon1' => 'ff34b3',
|
||||
'maroon2' => 'ee30a7',
|
||||
'maroon3' => 'cd2990',
|
||||
'maroon4' => '8b1c62',
|
||||
'medium' => '66cdaa',
|
||||
'mediumaquamarine' => '66cdaa',
|
||||
'mediumblue' => '0000cd',
|
||||
'mediumorchid' => 'ba55d3',
|
||||
'mediumorchid1' => 'e066ff',
|
||||
'mediumorchid2' => 'd15fee',
|
||||
'mediumorchid3' => 'b452cd',
|
||||
'mediumorchid4' => '7a378b',
|
||||
'mediumpurple' => '9370db',
|
||||
'mediumpurple1' => 'ab82ff',
|
||||
'mediumpurple2' => '9f79ee',
|
||||
'mediumpurple3' => '8968cd',
|
||||
'mediumpurple4' => '5d478b',
|
||||
'mediumseagreen' => '3cb371',
|
||||
'mediumslateblue' => '7b68ee',
|
||||
'mediumspringgreen' => '00fa9a',
|
||||
'mediumturquoise' => '48d1cc',
|
||||
'mediumvioletred' => 'c71585',
|
||||
'midnightblue' => '191970',
|
||||
'mintcream' => 'f5fffa',
|
||||
'mistyrose1' => 'ffe4e1',
|
||||
'mistyrose2' => 'eed5d2',
|
||||
'mistyrose3' => 'cdb7b5',
|
||||
'mistyrose4' => '8b7d7b',
|
||||
'moccasin' => 'ffe4b5',
|
||||
'navajowhite1' => 'ffdead',
|
||||
'navajowhite2' => 'eecfa1',
|
||||
'navajowhite3' => 'cdb38b',
|
||||
'navajowhite4' => '8b795e',
|
||||
'navy' => '000080',
|
||||
'navyblue' => '000080',
|
||||
'oldlace' => 'fdf5e6',
|
||||
'olive' => '808000',
|
||||
'olivedrab' => '6b8e23',
|
||||
'olivedrab1' => 'c0ff3e',
|
||||
'olivedrab2' => 'b3ee3a',
|
||||
'olivedrab4' => '698b22',
|
||||
'orange' => 'ffa500',
|
||||
'orange1' => 'ffa500',
|
||||
'orange2' => 'ee9a00',
|
||||
'orange3' => 'cd8500',
|
||||
'orange4' => '8b5a00',
|
||||
'orangered1' => 'ff4500',
|
||||
'orangered2' => 'ee4000',
|
||||
'orangered3' => 'cd3700',
|
||||
'orangered4' => '8b2500',
|
||||
'orchid' => 'da70d6',
|
||||
'orchid1' => 'ff83fa',
|
||||
'orchid2' => 'ee7ae9',
|
||||
'orchid3' => 'cd69c9',
|
||||
'orchid4' => '8b4789',
|
||||
'pale' => 'db7093',
|
||||
'palegoldenrod' => 'eee8aa',
|
||||
'palegreen' => '98fb98',
|
||||
'palegreen1' => '9aff9a',
|
||||
'palegreen2' => '90ee90',
|
||||
'palegreen3' => '7ccd7c',
|
||||
'palegreen4' => '548b54',
|
||||
'paleturquoise' => 'afeeee',
|
||||
'paleturquoise1' => 'bbffff',
|
||||
'paleturquoise2' => 'aeeeee',
|
||||
'paleturquoise3' => '96cdcd',
|
||||
'paleturquoise4' => '668b8b',
|
||||
'palevioletred' => 'db7093',
|
||||
'palevioletred1' => 'ff82ab',
|
||||
'palevioletred2' => 'ee799f',
|
||||
'palevioletred3' => 'cd6889',
|
||||
'palevioletred4' => '8b475d',
|
||||
'papayawhip' => 'ffefd5',
|
||||
'peachpuff1' => 'ffdab9',
|
||||
'peachpuff2' => 'eecbad',
|
||||
'peachpuff3' => 'cdaf95',
|
||||
'peachpuff4' => '8b7765',
|
||||
'pink' => 'ffc0cb',
|
||||
'pink1' => 'ffb5c5',
|
||||
'pink2' => 'eea9b8',
|
||||
'pink3' => 'cd919e',
|
||||
'pink4' => '8b636c',
|
||||
'plum' => 'dda0dd',
|
||||
'plum1' => 'ffbbff',
|
||||
'plum2' => 'eeaeee',
|
||||
'plum3' => 'cd96cd',
|
||||
'plum4' => '8b668b',
|
||||
'powderblue' => 'b0e0e6',
|
||||
'purple' => 'a020f0',
|
||||
'rebeccapurple' => '663399',
|
||||
'purple1' => '9b30ff',
|
||||
'purple2' => '912cee',
|
||||
'purple3' => '7d26cd',
|
||||
'purple4' => '551a8b',
|
||||
'red' => 'ff0000',
|
||||
'red1' => 'ff0000',
|
||||
'red2' => 'ee0000',
|
||||
'red3' => 'cd0000',
|
||||
'red4' => '8b0000',
|
||||
'rosybrown' => 'bc8f8f',
|
||||
'rosybrown1' => 'ffc1c1',
|
||||
'rosybrown2' => 'eeb4b4',
|
||||
'rosybrown3' => 'cd9b9b',
|
||||
'rosybrown4' => '8b6969',
|
||||
'royalblue' => '4169e1',
|
||||
'royalblue1' => '4876ff',
|
||||
'royalblue2' => '436eee',
|
||||
'royalblue3' => '3a5fcd',
|
||||
'royalblue4' => '27408b',
|
||||
'saddlebrown' => '8b4513',
|
||||
'salmon' => 'fa8072',
|
||||
'salmon1' => 'ff8c69',
|
||||
'salmon2' => 'ee8262',
|
||||
'salmon3' => 'cd7054',
|
||||
'salmon4' => '8b4c39',
|
||||
'sandybrown' => 'f4a460',
|
||||
'seagreen1' => '54ff9f',
|
||||
'seagreen2' => '4eee94',
|
||||
'seagreen3' => '43cd80',
|
||||
'seagreen4' => '2e8b57',
|
||||
'seashell1' => 'fff5ee',
|
||||
'seashell2' => 'eee5de',
|
||||
'seashell3' => 'cdc5bf',
|
||||
'seashell4' => '8b8682',
|
||||
'sienna' => 'a0522d',
|
||||
'sienna1' => 'ff8247',
|
||||
'sienna2' => 'ee7942',
|
||||
'sienna3' => 'cd6839',
|
||||
'sienna4' => '8b4726',
|
||||
'silver' => 'c0c0c0',
|
||||
'skyblue' => '87ceeb',
|
||||
'skyblue1' => '87ceff',
|
||||
'skyblue2' => '7ec0ee',
|
||||
'skyblue3' => '6ca6cd',
|
||||
'skyblue4' => '4a708b',
|
||||
'slateblue' => '6a5acd',
|
||||
'slateblue1' => '836fff',
|
||||
'slateblue2' => '7a67ee',
|
||||
'slateblue3' => '6959cd',
|
||||
'slateblue4' => '473c8b',
|
||||
'slategray' => '708090',
|
||||
'slategray1' => 'c6e2ff',
|
||||
'slategray2' => 'b9d3ee',
|
||||
'slategray3' => '9fb6cd',
|
||||
'slategray4' => '6c7b8b',
|
||||
'snow1' => 'fffafa',
|
||||
'snow2' => 'eee9e9',
|
||||
'snow3' => 'cdc9c9',
|
||||
'snow4' => '8b8989',
|
||||
'springgreen1' => '00ff7f',
|
||||
'springgreen2' => '00ee76',
|
||||
'springgreen3' => '00cd66',
|
||||
'springgreen4' => '008b45',
|
||||
'steelblue' => '4682b4',
|
||||
'steelblue1' => '63b8ff',
|
||||
'steelblue2' => '5cacee',
|
||||
'steelblue3' => '4f94cd',
|
||||
'steelblue4' => '36648b',
|
||||
'tan' => 'd2b48c',
|
||||
'tan1' => 'ffa54f',
|
||||
'tan2' => 'ee9a49',
|
||||
'tan3' => 'cd853f',
|
||||
'tan4' => '8b5a2b',
|
||||
'teal' => '008080',
|
||||
'thistle' => 'd8bfd8',
|
||||
'thistle1' => 'ffe1ff',
|
||||
'thistle2' => 'eed2ee',
|
||||
'thistle3' => 'cdb5cd',
|
||||
'thistle4' => '8b7b8b',
|
||||
'tomato1' => 'ff6347',
|
||||
'tomato2' => 'ee5c42',
|
||||
'tomato3' => 'cd4f39',
|
||||
'tomato4' => '8b3626',
|
||||
'turquoise' => '40e0d0',
|
||||
'turquoise1' => '00f5ff',
|
||||
'turquoise2' => '00e5ee',
|
||||
'turquoise3' => '00c5cd',
|
||||
'turquoise4' => '00868b',
|
||||
'violet' => 'ee82ee',
|
||||
'violetred' => 'd02090',
|
||||
'violetred1' => 'ff3e96',
|
||||
'violetred2' => 'ee3a8c',
|
||||
'violetred3' => 'cd3278',
|
||||
'violetred4' => '8b2252',
|
||||
'wheat' => 'f5deb3',
|
||||
'wheat1' => 'ffe7ba',
|
||||
'wheat2' => 'eed8ae',
|
||||
'wheat3' => 'cdba96',
|
||||
'wheat4' => '8b7e66',
|
||||
'white' => 'ffffff',
|
||||
'whitesmoke' => 'f5f5f5',
|
||||
'yellow' => 'ffff00',
|
||||
'yellow1' => 'ffff00',
|
||||
'yellow2' => 'eeee00',
|
||||
'yellow3' => 'cdcd00',
|
||||
'yellow4' => '8b8b00',
|
||||
'yellowgreen' => '9acd32',
|
||||
);
|
||||
|
||||
protected $face;
|
||||
protected $size;
|
||||
protected $color;
|
||||
|
||||
protected $bold = false;
|
||||
protected $italic = false;
|
||||
protected $underline = false;
|
||||
protected $superscript = false;
|
||||
protected $subscript = false;
|
||||
protected $strikethrough = false;
|
||||
|
||||
protected $startTagCallbacks = array(
|
||||
'font' => 'startFontTag',
|
||||
'b' => 'startBoldTag',
|
||||
'strong' => 'startBoldTag',
|
||||
'i' => 'startItalicTag',
|
||||
'em' => 'startItalicTag',
|
||||
'u' => 'startUnderlineTag',
|
||||
'ins' => 'startUnderlineTag',
|
||||
'del' => 'startStrikethruTag',
|
||||
'sup' => 'startSuperscriptTag',
|
||||
'sub' => 'startSubscriptTag',
|
||||
);
|
||||
|
||||
protected $endTagCallbacks = array(
|
||||
'font' => 'endFontTag',
|
||||
'b' => 'endBoldTag',
|
||||
'strong' => 'endBoldTag',
|
||||
'i' => 'endItalicTag',
|
||||
'em' => 'endItalicTag',
|
||||
'u' => 'endUnderlineTag',
|
||||
'ins' => 'endUnderlineTag',
|
||||
'del' => 'endStrikethruTag',
|
||||
'sup' => 'endSuperscriptTag',
|
||||
'sub' => 'endSubscriptTag',
|
||||
'br' => 'breakTag',
|
||||
'p' => 'breakTag',
|
||||
'h1' => 'breakTag',
|
||||
'h2' => 'breakTag',
|
||||
'h3' => 'breakTag',
|
||||
'h4' => 'breakTag',
|
||||
'h5' => 'breakTag',
|
||||
'h6' => 'breakTag',
|
||||
);
|
||||
|
||||
protected $stack = array();
|
||||
|
||||
protected $stringData = '';
|
||||
|
||||
protected $richTextObject;
|
||||
|
||||
protected function initialise() {
|
||||
$this->face = $this->size = $this->color = null;
|
||||
$this->bold = $this->italic = $this->underline = $this->superscript = $this->subscript = $this->strikethrough = false;
|
||||
|
||||
$this->stack = array();
|
||||
|
||||
$this->stringData = '';
|
||||
}
|
||||
|
||||
public function toRichTextObject($html) {
|
||||
$this->initialise();
|
||||
|
||||
// Create a new DOM object
|
||||
$dom = new domDocument;
|
||||
// Load the HTML file into the DOM object
|
||||
// Note the use of error suppression, because typically this will be an html fragment, so not fully valid markup
|
||||
$loaded = @$dom->loadHTML($html);
|
||||
|
||||
// Discard excess white space
|
||||
$dom->preserveWhiteSpace = false;
|
||||
|
||||
$this->richTextObject = new PHPExcel_RichText();;
|
||||
$this->parseElements($dom);
|
||||
return $this->richTextObject;
|
||||
}
|
||||
|
||||
protected function buildTextRun() {
|
||||
$text = $this->stringData;
|
||||
if (trim($text) === '')
|
||||
return;
|
||||
|
||||
$richtextRun = $this->richTextObject->createTextRun($this->stringData);
|
||||
if ($this->face) {
|
||||
$richtextRun->getFont()->setName($this->face);
|
||||
}
|
||||
if ($this->size) {
|
||||
$richtextRun->getFont()->setSize($this->size);
|
||||
}
|
||||
if ($this->color) {
|
||||
$richtextRun->getFont()->setColor( new PHPExcel_Style_Color( 'ff' . $this->color ) );
|
||||
}
|
||||
if ($this->bold) {
|
||||
$richtextRun->getFont()->setBold(true);
|
||||
}
|
||||
if ($this->italic) {
|
||||
$richtextRun->getFont()->setItalic(true);
|
||||
}
|
||||
if ($this->underline) {
|
||||
$richtextRun->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
|
||||
}
|
||||
if ($this->superscript) {
|
||||
$richtextRun->getFont()->setSuperScript(true);
|
||||
}
|
||||
if ($this->subscript) {
|
||||
$richtextRun->getFont()->setSubScript(true);
|
||||
}
|
||||
if ($this->strikethrough) {
|
||||
$richtextRun->getFont()->setStrikethrough(true);
|
||||
}
|
||||
$this->stringData = '';
|
||||
}
|
||||
|
||||
protected function rgbToColour($rgb) {
|
||||
preg_match_all('/\d+/', $rgb, $values);
|
||||
foreach($values[0] as &$value) {
|
||||
$value = str_pad(dechex($value), 2, '0', STR_PAD_LEFT);
|
||||
}
|
||||
return implode($values[0]);
|
||||
}
|
||||
|
||||
protected function colourNameLookup($rgb) {
|
||||
return self::$colourMap[$rgb];
|
||||
}
|
||||
|
||||
protected function startFontTag($tag) {
|
||||
foreach ($tag->attributes as $attribute) {
|
||||
$attributeName = strtolower($attribute->name);
|
||||
$attributeValue = $attribute->value;
|
||||
|
||||
if ($attributeName == 'color') {
|
||||
if (preg_match('/rgb\s*\(/', $attributeValue)) {
|
||||
$this->$attributeName = $this->rgbToColour($attributeValue);
|
||||
} elseif(strpos(trim($attributeValue), '#') === 0) {
|
||||
$this->$attributeName = ltrim($attributeValue, '#');
|
||||
} else {
|
||||
$this->$attributeName = $this->colourNameLookup($attributeValue);
|
||||
}
|
||||
} else {
|
||||
$this->$attributeName = $attributeValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function endFontTag() {
|
||||
$this->face = $this->size = $this->color = null;
|
||||
}
|
||||
|
||||
protected function startBoldTag() {
|
||||
$this->bold = true;
|
||||
}
|
||||
|
||||
protected function endBoldTag() {
|
||||
$this->bold = false;
|
||||
}
|
||||
|
||||
protected function startItalicTag() {
|
||||
$this->italic = true;
|
||||
}
|
||||
|
||||
protected function endItalicTag() {
|
||||
$this->italic = false;
|
||||
}
|
||||
|
||||
protected function startUnderlineTag() {
|
||||
$this->underline = true;
|
||||
}
|
||||
|
||||
protected function endUnderlineTag() {
|
||||
$this->underline = false;
|
||||
}
|
||||
|
||||
protected function startSubscriptTag() {
|
||||
$this->subscript = true;
|
||||
}
|
||||
|
||||
protected function endSubscriptTag() {
|
||||
$this->subscript = false;
|
||||
}
|
||||
|
||||
protected function startSuperscriptTag() {
|
||||
$this->superscript = true;
|
||||
}
|
||||
|
||||
protected function endSuperscriptTag() {
|
||||
$this->superscript = false;
|
||||
}
|
||||
|
||||
protected function startStrikethruTag() {
|
||||
$this->strikethrough = true;
|
||||
}
|
||||
|
||||
protected function endStrikethruTag() {
|
||||
$this->strikethrough = false;
|
||||
}
|
||||
|
||||
protected function breakTag() {
|
||||
$this->stringData .= PHP_EOL;
|
||||
}
|
||||
|
||||
protected function parseTextNode(DOMText $textNode) {
|
||||
$domText = preg_replace('/\s+/u', ' ', ltrim($textNode->nodeValue));
|
||||
$this->stringData .= $domText;
|
||||
$this->buildTextRun();
|
||||
}
|
||||
|
||||
protected function handleCallback($element, $callbackTag, $callbacks) {
|
||||
if (isset($callbacks[$callbackTag])) {
|
||||
$elementHandler = $callbacks[$callbackTag];
|
||||
if (method_exists($this, $elementHandler)) {
|
||||
call_user_func(array($this, $elementHandler), $element);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function parseElementNode(DOMElement $element) {
|
||||
$callbackTag = strtolower($element->nodeName);
|
||||
$this->stack[] = $callbackTag;
|
||||
|
||||
$this->handleCallback($element, $callbackTag, $this->startTagCallbacks);
|
||||
|
||||
$this->parseElements($element);
|
||||
$this->stringData .= ' ';
|
||||
array_pop($this->stack);
|
||||
|
||||
$this->handleCallback($element, $callbackTag, $this->endTagCallbacks);
|
||||
}
|
||||
|
||||
protected function parseElements(DOMNode $element) {
|
||||
foreach ($element->childNodes as $child) {
|
||||
if ($child instanceof DOMText) {
|
||||
$this->parseTextNode($child);
|
||||
} elseif ($child instanceof DOMElement) {
|
||||
$this->parseElementNode($child);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
43
web/Application/Home/Common/Excel/PHPExcel/IComparable.php
Normal file
43
web/Application/Home/Common/Excel/PHPExcel/IComparable.php
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
/**
|
||||
* 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_IComparable
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
interface PHPExcel_IComparable
|
||||
{
|
||||
/**
|
||||
* Get hash code
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode();
|
||||
|
||||
}
|
288
web/Application/Home/Common/Excel/PHPExcel/IOFactory.php
Normal file
288
web/Application/Home/Common/Excel/PHPExcel/IOFactory.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
|
||||
* @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_IOFactory
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_IOFactory
|
||||
{
|
||||
/**
|
||||
* Search locations
|
||||
*
|
||||
* @var array
|
||||
* @access private
|
||||
* @static
|
||||
*/
|
||||
private static $_searchLocations = array(
|
||||
array( 'type' => 'IWriter', 'path' => 'PHPExcel/Writer/{0}.php', 'class' => 'PHPExcel_Writer_{0}' ),
|
||||
array( 'type' => 'IReader', 'path' => 'PHPExcel/Reader/{0}.php', 'class' => 'PHPExcel_Reader_{0}' )
|
||||
);
|
||||
|
||||
/**
|
||||
* Autoresolve classes
|
||||
*
|
||||
* @var array
|
||||
* @access private
|
||||
* @static
|
||||
*/
|
||||
private static $_autoResolveClasses = array(
|
||||
'Excel2007',
|
||||
'Excel5',
|
||||
'Excel2003XML',
|
||||
'OOCalc',
|
||||
'SYLK',
|
||||
'Gnumeric',
|
||||
'HTML',
|
||||
'CSV',
|
||||
);
|
||||
|
||||
/**
|
||||
* Private constructor for PHPExcel_IOFactory
|
||||
*/
|
||||
private function __construct() { }
|
||||
|
||||
/**
|
||||
* Get search locations
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public static function getSearchLocations() {
|
||||
return self::$_searchLocations;
|
||||
} // function getSearchLocations()
|
||||
|
||||
/**
|
||||
* Set search locations
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @param array $value
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public static function setSearchLocations($value) {
|
||||
if (is_array($value)) {
|
||||
self::$_searchLocations = $value;
|
||||
} else {
|
||||
throw new PHPExcel_Reader_Exception('Invalid parameter passed.');
|
||||
}
|
||||
} // function setSearchLocations()
|
||||
|
||||
/**
|
||||
* Add search location
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @param string $type Example: IWriter
|
||||
* @param string $location Example: PHPExcel/Writer/{0}.php
|
||||
* @param string $classname Example: PHPExcel_Writer_{0}
|
||||
*/
|
||||
public static function addSearchLocation($type = '', $location = '', $classname = '') {
|
||||
self::$_searchLocations[] = array( 'type' => $type, 'path' => $location, 'class' => $classname );
|
||||
} // function addSearchLocation()
|
||||
|
||||
/**
|
||||
* Create PHPExcel_Writer_IWriter
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @param PHPExcel $phpExcel
|
||||
* @param string $writerType Example: Excel2007
|
||||
* @return PHPExcel_Writer_IWriter
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public static function createWriter(PHPExcel $phpExcel, $writerType = '') {
|
||||
// Search type
|
||||
$searchType = 'IWriter';
|
||||
|
||||
// Include class
|
||||
foreach (self::$_searchLocations as $searchLocation) {
|
||||
if ($searchLocation['type'] == $searchType) {
|
||||
$className = str_replace('{0}', $writerType, $searchLocation['class']);
|
||||
|
||||
$instance = new $className($phpExcel);
|
||||
if ($instance !== NULL) {
|
||||
return $instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Nothing found...
|
||||
throw new PHPExcel_Reader_Exception("No $searchType found for type $writerType");
|
||||
} // function createWriter()
|
||||
|
||||
/**
|
||||
* Create PHPExcel_Reader_IReader
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @param string $readerType Example: Excel2007
|
||||
* @return PHPExcel_Reader_IReader
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public static function createReader($readerType = '') {
|
||||
// Search type
|
||||
$searchType = 'IReader';
|
||||
|
||||
// Include class
|
||||
foreach (self::$_searchLocations as $searchLocation) {
|
||||
if ($searchLocation['type'] == $searchType) {
|
||||
$className = str_replace('{0}', $readerType, $searchLocation['class']);
|
||||
|
||||
$instance = new $className();
|
||||
if ($instance !== NULL) {
|
||||
return $instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Nothing found...
|
||||
throw new PHPExcel_Reader_Exception("No $searchType found for type $readerType");
|
||||
} // function createReader()
|
||||
|
||||
/**
|
||||
* Loads PHPExcel from file using automatic PHPExcel_Reader_IReader resolution
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @param string $pFilename The name of the spreadsheet file
|
||||
* @return PHPExcel
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public static function load($pFilename) {
|
||||
$reader = self::createReaderForFile($pFilename);
|
||||
return $reader->load($pFilename);
|
||||
} // function load()
|
||||
|
||||
/**
|
||||
* Identify file type using automatic PHPExcel_Reader_IReader resolution
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @param string $pFilename The name of the spreadsheet file to identify
|
||||
* @return string
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public static function identify($pFilename) {
|
||||
$reader = self::createReaderForFile($pFilename);
|
||||
$className = get_class($reader);
|
||||
$classType = explode('_',$className);
|
||||
unset($reader);
|
||||
return array_pop($classType);
|
||||
} // function identify()
|
||||
|
||||
/**
|
||||
* Create PHPExcel_Reader_IReader for file using automatic PHPExcel_Reader_IReader resolution
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @param string $pFilename The name of the spreadsheet file
|
||||
* @return PHPExcel_Reader_IReader
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public static function createReaderForFile($pFilename) {
|
||||
|
||||
// First, lucky guess by inspecting file extension
|
||||
$pathinfo = pathinfo($pFilename);
|
||||
|
||||
$extensionType = NULL;
|
||||
if (isset($pathinfo['extension'])) {
|
||||
switch (strtolower($pathinfo['extension'])) {
|
||||
case 'xlsx': // Excel (OfficeOpenXML) Spreadsheet
|
||||
case 'xlsm': // Excel (OfficeOpenXML) Macro Spreadsheet (macros will be discarded)
|
||||
case 'xltx': // Excel (OfficeOpenXML) Template
|
||||
case 'xltm': // Excel (OfficeOpenXML) Macro Template (macros will be discarded)
|
||||
$extensionType = 'Excel2007';
|
||||
break;
|
||||
case 'xls': // Excel (BIFF) Spreadsheet
|
||||
case 'xlt': // Excel (BIFF) Template
|
||||
$extensionType = 'Excel5';
|
||||
break;
|
||||
case 'ods': // Open/Libre Offic Calc
|
||||
case 'ots': // Open/Libre Offic Calc Template
|
||||
$extensionType = 'OOCalc';
|
||||
break;
|
||||
case 'slk':
|
||||
$extensionType = 'SYLK';
|
||||
break;
|
||||
case 'xml': // Excel 2003 SpreadSheetML
|
||||
$extensionType = 'Excel2003XML';
|
||||
break;
|
||||
case 'gnumeric':
|
||||
$extensionType = 'Gnumeric';
|
||||
break;
|
||||
case 'htm':
|
||||
case 'html':
|
||||
$extensionType = 'HTML';
|
||||
break;
|
||||
case 'csv':
|
||||
// Do nothing
|
||||
// We must not try to use CSV reader since it loads
|
||||
// all files including Excel files etc.
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if ($extensionType !== NULL) {
|
||||
$reader = self::createReader($extensionType);
|
||||
// Let's see if we are lucky
|
||||
if (isset($reader) && $reader->canRead($pFilename)) {
|
||||
return $reader;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we reach here then "lucky guess" didn't give any result
|
||||
// Try walking through all the options in self::$_autoResolveClasses
|
||||
foreach (self::$_autoResolveClasses as $autoResolveClass) {
|
||||
// Ignore our original guess, we know that won't work
|
||||
if ($autoResolveClass !== $extensionType) {
|
||||
$reader = self::createReader($autoResolveClass);
|
||||
if ($reader->canRead($pFilename)) {
|
||||
return $reader;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw new PHPExcel_Reader_Exception('Unable to identify a reader for this file');
|
||||
} // function createReaderForFile()
|
||||
}
|
246
web/Application/Home/Common/Excel/PHPExcel/NamedRange.php
Normal file
246
web/Application/Home/Common/Excel/PHPExcel/NamedRange.php
Normal file
|
@ -0,0 +1,246 @@
|
|||
<?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_NamedRange
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_NamedRange
|
||||
{
|
||||
/**
|
||||
* Range name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_name;
|
||||
|
||||
/**
|
||||
* Worksheet on which the named range can be resolved
|
||||
*
|
||||
* @var PHPExcel_Worksheet
|
||||
*/
|
||||
private $_worksheet;
|
||||
|
||||
/**
|
||||
* Range of the referenced cells
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_range;
|
||||
|
||||
/**
|
||||
* Is the named range local? (i.e. can only be used on $this->_worksheet)
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $_localOnly;
|
||||
|
||||
/**
|
||||
* Scope
|
||||
*
|
||||
* @var PHPExcel_Worksheet
|
||||
*/
|
||||
private $_scope;
|
||||
|
||||
/**
|
||||
* Create a new NamedRange
|
||||
*
|
||||
* @param string $pName
|
||||
* @param PHPExcel_Worksheet $pWorksheet
|
||||
* @param string $pRange
|
||||
* @param bool $pLocalOnly
|
||||
* @param PHPExcel_Worksheet|null $pScope Scope. Only applies when $pLocalOnly = true. Null for global scope.
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function __construct($pName = null, PHPExcel_Worksheet $pWorksheet, $pRange = 'A1', $pLocalOnly = false, $pScope = null)
|
||||
{
|
||||
// Validate data
|
||||
if (($pName === NULL) || ($pWorksheet === NULL) || ($pRange === NULL)) {
|
||||
throw new PHPExcel_Exception('Parameters can not be null.');
|
||||
}
|
||||
|
||||
// Set local members
|
||||
$this->_name = $pName;
|
||||
$this->_worksheet = $pWorksheet;
|
||||
$this->_range = $pRange;
|
||||
$this->_localOnly = $pLocalOnly;
|
||||
$this->_scope = ($pLocalOnly == true) ?
|
||||
(($pScope == null) ? $pWorksheet : $pScope) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName() {
|
||||
return $this->_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_NamedRange
|
||||
*/
|
||||
public function setName($value = null) {
|
||||
if ($value !== NULL) {
|
||||
// Old title
|
||||
$oldTitle = $this->_name;
|
||||
|
||||
// Re-attach
|
||||
if ($this->_worksheet !== NULL) {
|
||||
$this->_worksheet->getParent()->removeNamedRange($this->_name,$this->_worksheet);
|
||||
}
|
||||
$this->_name = $value;
|
||||
|
||||
if ($this->_worksheet !== NULL) {
|
||||
$this->_worksheet->getParent()->addNamedRange($this);
|
||||
}
|
||||
|
||||
// New title
|
||||
$newTitle = $this->_name;
|
||||
PHPExcel_ReferenceHelper::getInstance()->updateNamedFormulas($this->_worksheet->getParent(), $oldTitle, $newTitle);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get worksheet
|
||||
*
|
||||
* @return PHPExcel_Worksheet
|
||||
*/
|
||||
public function getWorksheet() {
|
||||
return $this->_worksheet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set worksheet
|
||||
*
|
||||
* @param PHPExcel_Worksheet $value
|
||||
* @return PHPExcel_NamedRange
|
||||
*/
|
||||
public function setWorksheet(PHPExcel_Worksheet $value = null) {
|
||||
if ($value !== NULL) {
|
||||
$this->_worksheet = $value;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get range
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRange() {
|
||||
return $this->_range;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set range
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_NamedRange
|
||||
*/
|
||||
public function setRange($value = null) {
|
||||
if ($value !== NULL) {
|
||||
$this->_range = $value;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get localOnly
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getLocalOnly() {
|
||||
return $this->_localOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set localOnly
|
||||
*
|
||||
* @param bool $value
|
||||
* @return PHPExcel_NamedRange
|
||||
*/
|
||||
public function setLocalOnly($value = false) {
|
||||
$this->_localOnly = $value;
|
||||
$this->_scope = $value ? $this->_worksheet : null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get scope
|
||||
*
|
||||
* @return PHPExcel_Worksheet|null
|
||||
*/
|
||||
public function getScope() {
|
||||
return $this->_scope;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set scope
|
||||
*
|
||||
* @param PHPExcel_Worksheet|null $value
|
||||
* @return PHPExcel_NamedRange
|
||||
*/
|
||||
public function setScope(PHPExcel_Worksheet $value = null) {
|
||||
$this->_scope = $value;
|
||||
$this->_localOnly = ($value == null) ? false : true;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve a named range to a regular cell range
|
||||
*
|
||||
* @param string $pNamedRange Named range
|
||||
* @param PHPExcel_Worksheet|null $pSheet Scope. Use null for global scope
|
||||
* @return PHPExcel_NamedRange
|
||||
*/
|
||||
public static function resolveRange($pNamedRange = '', PHPExcel_Worksheet $pSheet) {
|
||||
return $pSheet->getParent()->getNamedRange($pNamedRange, $pSheet);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
255
web/Application/Home/Common/Excel/PHPExcel/Reader/Abstract.php
Normal file
255
web/Application/Home/Common/Excel/PHPExcel/Reader/Abstract.php
Normal file
|
@ -0,0 +1,255 @@
|
|||
<?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_Reader
|
||||
* @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_Reader_Abstract
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
|
||||
{
|
||||
/**
|
||||
* Read data only?
|
||||
* Identifies whether the Reader should only read data values for cells, and ignore any formatting information;
|
||||
* or whether it should read both data and formatting
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_readDataOnly = FALSE;
|
||||
|
||||
/**
|
||||
* Read charts that are defined in the workbook?
|
||||
* Identifies whether the Reader should read the definitions for any charts that exist in the workbook;
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_includeCharts = FALSE;
|
||||
|
||||
/**
|
||||
* Restrict which sheets should be loaded?
|
||||
* This property holds an array of worksheet names to be loaded. If null, then all worksheets will be loaded.
|
||||
*
|
||||
* @var array of string
|
||||
*/
|
||||
protected $_loadSheetsOnly = NULL;
|
||||
|
||||
/**
|
||||
* PHPExcel_Reader_IReadFilter instance
|
||||
*
|
||||
* @var PHPExcel_Reader_IReadFilter
|
||||
*/
|
||||
protected $_readFilter = NULL;
|
||||
|
||||
protected $_fileHandle = NULL;
|
||||
|
||||
|
||||
/**
|
||||
* Read data only?
|
||||
* If this is true, then the Reader will only read data values for cells, it will not read any formatting information.
|
||||
* If false (the default) it will read data and formatting.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getReadDataOnly() {
|
||||
return $this->_readDataOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set read data only
|
||||
* Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information.
|
||||
* Set to false (the default) to advise the Reader to read both data and formatting for cells.
|
||||
*
|
||||
* @param boolean $pValue
|
||||
*
|
||||
* @return PHPExcel_Reader_IReader
|
||||
*/
|
||||
public function setReadDataOnly($pValue = FALSE) {
|
||||
$this->_readDataOnly = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read charts in workbook?
|
||||
* If this is true, then the Reader will include any charts that exist in the workbook.
|
||||
* Note that a ReadDataOnly value of false overrides, and charts won't be read regardless of the IncludeCharts value.
|
||||
* If false (the default) it will ignore any charts defined in the workbook file.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getIncludeCharts() {
|
||||
return $this->_includeCharts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set read charts in workbook
|
||||
* Set to true, to advise the Reader to include any charts that exist in the workbook.
|
||||
* Note that a ReadDataOnly value of false overrides, and charts won't be read regardless of the IncludeCharts value.
|
||||
* Set to false (the default) to discard charts.
|
||||
*
|
||||
* @param boolean $pValue
|
||||
*
|
||||
* @return PHPExcel_Reader_IReader
|
||||
*/
|
||||
public function setIncludeCharts($pValue = FALSE) {
|
||||
$this->_includeCharts = (boolean) $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get which sheets to load
|
||||
* Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null
|
||||
* indicating that all worksheets in the workbook should be loaded.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getLoadSheetsOnly()
|
||||
{
|
||||
return $this->_loadSheetsOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set which sheets to load
|
||||
*
|
||||
* @param mixed $value
|
||||
* This should be either an array of worksheet names to be loaded, or a string containing a single worksheet name.
|
||||
* If NULL, then it tells the Reader to read all worksheets in the workbook
|
||||
*
|
||||
* @return PHPExcel_Reader_IReader
|
||||
*/
|
||||
public function setLoadSheetsOnly($value = NULL)
|
||||
{
|
||||
if ($value === NULL)
|
||||
return $this->setLoadAllSheets();
|
||||
|
||||
$this->_loadSheetsOnly = is_array($value) ?
|
||||
$value : array($value);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set all sheets to load
|
||||
* Tells the Reader to load all worksheets from the workbook.
|
||||
*
|
||||
* @return PHPExcel_Reader_IReader
|
||||
*/
|
||||
public function setLoadAllSheets()
|
||||
{
|
||||
$this->_loadSheetsOnly = NULL;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read filter
|
||||
*
|
||||
* @return PHPExcel_Reader_IReadFilter
|
||||
*/
|
||||
public function getReadFilter() {
|
||||
return $this->_readFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set read filter
|
||||
*
|
||||
* @param PHPExcel_Reader_IReadFilter $pValue
|
||||
* @return PHPExcel_Reader_IReader
|
||||
*/
|
||||
public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) {
|
||||
$this->_readFilter = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open file for reading
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
* @return resource
|
||||
*/
|
||||
protected function _openFile($pFilename)
|
||||
{
|
||||
// Check if file exists
|
||||
if (!file_exists($pFilename) || !is_readable($pFilename)) {
|
||||
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
}
|
||||
|
||||
// Open file
|
||||
$this->_fileHandle = fopen($pFilename, 'r');
|
||||
if ($this->_fileHandle === FALSE) {
|
||||
throw new PHPExcel_Reader_Exception("Could not open file " . $pFilename . " for reading.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Can the current PHPExcel_Reader_IReader read the file?
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @return boolean
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public function canRead($pFilename)
|
||||
{
|
||||
// Check if file exists
|
||||
try {
|
||||
$this->_openFile($pFilename);
|
||||
} catch (Exception $e) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$readable = $this->_isValidFormat();
|
||||
fclose ($this->_fileHandle);
|
||||
return $readable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Scan theXML for use of <!ENTITY to prevent XXE/XEE attacks
|
||||
*
|
||||
* @param string $xml
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public function securityScan($xml)
|
||||
{
|
||||
$pattern = '/\\0?' . implode('\\0?', str_split('<!DOCTYPE')) . '\\0?/';
|
||||
if (preg_match($pattern, $xml)) {
|
||||
throw new PHPExcel_Reader_Exception('Detected use of ENTITY in XML, spreadsheet file load() aborted to prevent XXE/XEE attacks');
|
||||
}
|
||||
return $xml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Scan theXML for use of <!ENTITY to prevent XXE/XEE attacks
|
||||
*
|
||||
* @param string $filestream
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public function securityScanFile($filestream)
|
||||
{
|
||||
return $this->securityScan(file_get_contents($filestream));
|
||||
}
|
||||
}
|
387
web/Application/Home/Common/Excel/PHPExcel/Reader/CSV.php
Normal file
387
web/Application/Home/Common/Excel/PHPExcel/Reader/CSV.php
Normal file
|
@ -0,0 +1,387 @@
|
|||
<?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_Reader
|
||||
* @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_Reader_CSV
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
|
||||
{
|
||||
/**
|
||||
* Input encoding
|
||||
*
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
private $_inputEncoding = 'UTF-8';
|
||||
|
||||
/**
|
||||
* Delimiter
|
||||
*
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
private $_delimiter = ',';
|
||||
|
||||
/**
|
||||
* Enclosure
|
||||
*
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
private $_enclosure = '"';
|
||||
|
||||
/**
|
||||
* Sheet index to read
|
||||
*
|
||||
* @access private
|
||||
* @var int
|
||||
*/
|
||||
private $_sheetIndex = 0;
|
||||
|
||||
/**
|
||||
* Load rows contiguously
|
||||
*
|
||||
* @access private
|
||||
* @var int
|
||||
*/
|
||||
private $_contiguous = false;
|
||||
|
||||
/**
|
||||
* Row counter for loading rows contiguously
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_contiguousRow = -1;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Reader_CSV
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate that the current file is a CSV file
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function _isValidFormat()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set input encoding
|
||||
*
|
||||
* @param string $pValue Input encoding
|
||||
*/
|
||||
public function setInputEncoding($pValue = 'UTF-8')
|
||||
{
|
||||
$this->_inputEncoding = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get input encoding
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getInputEncoding()
|
||||
{
|
||||
return $this->_inputEncoding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Move filepointer past any BOM marker
|
||||
*
|
||||
*/
|
||||
protected function _skipBOM()
|
||||
{
|
||||
rewind($this->_fileHandle);
|
||||
|
||||
switch ($this->_inputEncoding) {
|
||||
case 'UTF-8':
|
||||
fgets($this->_fileHandle, 4) == "\xEF\xBB\xBF" ?
|
||||
fseek($this->_fileHandle, 3) : fseek($this->_fileHandle, 0);
|
||||
break;
|
||||
case 'UTF-16LE':
|
||||
fgets($this->_fileHandle, 3) == "\xFF\xFE" ?
|
||||
fseek($this->_fileHandle, 2) : fseek($this->_fileHandle, 0);
|
||||
break;
|
||||
case 'UTF-16BE':
|
||||
fgets($this->_fileHandle, 3) == "\xFE\xFF" ?
|
||||
fseek($this->_fileHandle, 2) : fseek($this->_fileHandle, 0);
|
||||
break;
|
||||
case 'UTF-32LE':
|
||||
fgets($this->_fileHandle, 5) == "\xFF\xFE\x00\x00" ?
|
||||
fseek($this->_fileHandle, 4) : fseek($this->_fileHandle, 0);
|
||||
break;
|
||||
case 'UTF-32BE':
|
||||
fgets($this->_fileHandle, 5) == "\x00\x00\xFE\xFF" ?
|
||||
fseek($this->_fileHandle, 4) : fseek($this->_fileHandle, 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public function listWorksheetInfo($pFilename)
|
||||
{
|
||||
// Open file
|
||||
$this->_openFile($pFilename);
|
||||
if (!$this->_isValidFormat()) {
|
||||
fclose ($this->_fileHandle);
|
||||
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
|
||||
}
|
||||
$fileHandle = $this->_fileHandle;
|
||||
|
||||
// Skip BOM, if any
|
||||
$this->_skipBOM();
|
||||
|
||||
$escapeEnclosures = array( "\\" . $this->_enclosure, $this->_enclosure . $this->_enclosure );
|
||||
|
||||
$worksheetInfo = array();
|
||||
$worksheetInfo[0]['worksheetName'] = 'Worksheet';
|
||||
$worksheetInfo[0]['lastColumnLetter'] = 'A';
|
||||
$worksheetInfo[0]['lastColumnIndex'] = 0;
|
||||
$worksheetInfo[0]['totalRows'] = 0;
|
||||
$worksheetInfo[0]['totalColumns'] = 0;
|
||||
|
||||
// Loop through each line of the file in turn
|
||||
while (($rowData = fgetcsv($fileHandle, 0, $this->_delimiter, $this->_enclosure)) !== FALSE) {
|
||||
$worksheetInfo[0]['totalRows']++;
|
||||
$worksheetInfo[0]['lastColumnIndex'] = max($worksheetInfo[0]['lastColumnIndex'], count($rowData) - 1);
|
||||
}
|
||||
|
||||
$worksheetInfo[0]['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($worksheetInfo[0]['lastColumnIndex']);
|
||||
$worksheetInfo[0]['totalColumns'] = $worksheetInfo[0]['lastColumnIndex'] + 1;
|
||||
|
||||
// Close file
|
||||
fclose($fileHandle);
|
||||
|
||||
return $worksheetInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads PHPExcel from file
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @return PHPExcel
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public function load($pFilename)
|
||||
{
|
||||
// Create new PHPExcel
|
||||
$objPHPExcel = new PHPExcel();
|
||||
|
||||
// Load into this instance
|
||||
return $this->loadIntoExisting($pFilename, $objPHPExcel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads PHPExcel from file into PHPExcel instance
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @param PHPExcel $objPHPExcel
|
||||
* @return PHPExcel
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
*/
|
||||
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
||||
{
|
||||
$lineEnding = ini_get('auto_detect_line_endings');
|
||||
ini_set('auto_detect_line_endings', true);
|
||||
|
||||
// Open file
|
||||
$this->_openFile($pFilename);
|
||||
if (!$this->_isValidFormat()) {
|
||||
fclose ($this->_fileHandle);
|
||||
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
|
||||
}
|
||||
$fileHandle = $this->_fileHandle;
|
||||
|
||||
// Skip BOM, if any
|
||||
$this->_skipBOM();
|
||||
|
||||
// Create new PHPExcel object
|
||||
while ($objPHPExcel->getSheetCount() <= $this->_sheetIndex) {
|
||||
$objPHPExcel->createSheet();
|
||||
}
|
||||
$sheet = $objPHPExcel->setActiveSheetIndex($this->_sheetIndex);
|
||||
|
||||
$escapeEnclosures = array( "\\" . $this->_enclosure,
|
||||
$this->_enclosure . $this->_enclosure
|
||||
);
|
||||
|
||||
// Set our starting row based on whether we're in contiguous mode or not
|
||||
$currentRow = 1;
|
||||
if ($this->_contiguous) {
|
||||
$currentRow = ($this->_contiguousRow == -1) ? $sheet->getHighestRow(): $this->_contiguousRow;
|
||||
}
|
||||
|
||||
// Loop through each line of the file in turn
|
||||
while (($rowData = fgetcsv($fileHandle, 0, $this->_delimiter, $this->_enclosure)) !== FALSE) {
|
||||
$columnLetter = 'A';
|
||||
foreach($rowData as $rowDatum) {
|
||||
if ($rowDatum != '' && $this->_readFilter->readCell($columnLetter, $currentRow)) {
|
||||
// Unescape enclosures
|
||||
$rowDatum = str_replace($escapeEnclosures, $this->_enclosure, $rowDatum);
|
||||
|
||||
// Convert encoding if necessary
|
||||
if ($this->_inputEncoding !== 'UTF-8') {
|
||||
$rowDatum = PHPExcel_Shared_String::ConvertEncoding($rowDatum, 'UTF-8', $this->_inputEncoding);
|
||||
}
|
||||
|
||||
// Set cell value
|
||||
$sheet->getCell($columnLetter . $currentRow)->setValue($rowDatum);
|
||||
}
|
||||
++$columnLetter;
|
||||
}
|
||||
++$currentRow;
|
||||
}
|
||||
|
||||
// Close file
|
||||
fclose($fileHandle);
|
||||
|
||||
if ($this->_contiguous) {
|
||||
$this->_contiguousRow = $currentRow;
|
||||
}
|
||||
|
||||
ini_set('auto_detect_line_endings', $lineEnding);
|
||||
|
||||
// Return
|
||||
return $objPHPExcel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get delimiter
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDelimiter() {
|
||||
return $this->_delimiter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set delimiter
|
||||
*
|
||||
* @param string $pValue Delimiter, defaults to ,
|
||||
* @return PHPExcel_Reader_CSV
|
||||
*/
|
||||
public function setDelimiter($pValue = ',') {
|
||||
$this->_delimiter = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get enclosure
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEnclosure() {
|
||||
return $this->_enclosure;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set enclosure
|
||||
*
|
||||
* @param string $pValue Enclosure, defaults to "
|
||||
* @return PHPExcel_Reader_CSV
|
||||
*/
|
||||
public function setEnclosure($pValue = '"') {
|
||||
if ($pValue == '') {
|
||||
$pValue = '"';
|
||||
}
|
||||
$this->_enclosure = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sheet index
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getSheetIndex() {
|
||||
return $this->_sheetIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sheet index
|
||||
*
|
||||
* @param integer $pValue Sheet index
|
||||
* @return PHPExcel_Reader_CSV
|
||||
*/
|
||||
public function setSheetIndex($pValue = 0) {
|
||||
$this->_sheetIndex = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Contiguous
|
||||
*
|
||||
* @param boolean $contiguous
|
||||
*/
|
||||
public function setContiguous($contiguous = FALSE)
|
||||
{
|
||||
$this->_contiguous = (bool) $contiguous;
|
||||
if (!$contiguous) {
|
||||
$this->_contiguousRow = -1;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Contiguous
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getContiguous() {
|
||||
return $this->_contiguous;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
<?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_Reader
|
||||
* @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_Reader_DefaultReadFilter
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Reader_DefaultReadFilter implements PHPExcel_Reader_IReadFilter
|
||||
{
|
||||
/**
|
||||
* Should this cell be read?
|
||||
*
|
||||
* @param $column String column index
|
||||
* @param $row Row index
|
||||
* @param $worksheetName Optional worksheet name
|
||||
* @return boolean
|
||||
*/
|
||||
public function readCell($column, $row, $worksheetName = '') {
|
||||
return true;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue