切换导航条
此项目
正在载入...
登录
何书鹏
/
recruit
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
pppscn
6 years ago
提交者
Karson
6 years ago
提交
f011bf6da2162f06b4130b11f54b5ba11ba45c67
1 个父辈
366bc786
改进build_toolbar的import支持模版下载
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
35 行增加
和
3 行删除
application/admin/common.php
public/template/.gitkeep
application/admin/common.php
查看文件 @
f011bf6
...
...
@@ -113,7 +113,7 @@ if (!function_exists('build_toolbar')) {
'add'
=>
[
'javascript:;'
,
'btn btn-success btn-add'
,
'fa fa-plus'
,
__
(
'Add'
),
__
(
'Add'
)],
'edit'
=>
[
'javascript:;'
,
'btn btn-success btn-edit btn-disabled disabled'
,
'fa fa-pencil'
,
__
(
'Edit'
),
__
(
'Edit'
)],
'del'
=>
[
'javascript:;'
,
'btn btn-danger btn-del btn-disabled disabled'
,
'fa fa-trash'
,
__
(
'Delete'
),
__
(
'Delete'
)],
'import'
=>
[
'javascript:;'
,
'btn btn-
danger
btn-import'
,
'fa fa-upload'
,
__
(
'Import'
),
__
(
'Import'
)],
'import'
=>
[
'javascript:;'
,
'btn btn-
info
btn-import'
,
'fa fa-upload'
,
__
(
'Import'
),
__
(
'Import'
)],
];
$btnAttr
=
array_merge
(
$btnAttr
,
$attr
);
$html
=
[];
...
...
@@ -123,8 +123,39 @@ if (!function_exists('build_toolbar')) {
continue
;
}
list
(
$href
,
$class
,
$icon
,
$text
,
$title
)
=
$btnAttr
[
$v
];
$extend
=
$v
==
'import'
?
'id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"'
:
''
;
$html
[]
=
'<a href="'
.
$href
.
'" class="'
.
$class
.
'" title="'
.
$title
.
'" '
.
$extend
.
'><i class="'
.
$icon
.
'"></i> '
.
$text
.
'</a>'
;
//$extend = $v == 'import' ? 'id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"' : '';
//$html[] = '<a href="' . $href . '" class="' . $class . '" title="' . $title . '" ' . $extend . '><i class="' . $icon . '"></i> ' . $text . '</a>';
if
(
$v
==
'import'
)
{
$template
=
str_replace
(
'/'
,
'_'
,
$controller
);
$download
=
''
;
if
(
file_exists
(
"./template/
{
$template
}
.xlsx"
))
{
$download
.=
"
\n
<li><a href=
\"
/template/
{
$template
}
.xlsx
\"
target=
\"
_blank
\"
>XLSX模版</a></li>"
;
}
if
(
file_exists
(
"./template/
{
$template
}
.xls"
))
{
$download
.=
"
\n
<li><a href=
\"
/template/
{
$template
}
.xls
\"
target=
\"
_blank
\"
>XLS模版</a></li>"
;
}
if
(
file_exists
(
"./template/
{
$template
}
.csv"
))
{
$download
.=
empty
(
$download
)
?
''
:
"
\n
<li class=
\"
divider
\"
></li>"
;
$download
.=
"
\n
<li><a href=
\"
/template/
{
$template
}
.csv
\"
target=
\"
_blank
\"
>CSV模版</a></li>"
;
}
$download
.=
empty
(
$download
)
?
''
:
"
\n
"
;
if
(
!
empty
(
$download
))
{
$html
[]
=
<<<EOT
<div class="btn-group">
<button type="button" href="{$href}" class="btn btn-info btn-import" title="{$title}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="{$icon}"></i> {$text}</button>
<button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown" title="下载批量导入模版">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" role="menu">{$download}</ul>
</div>
EOT;
}
else
{
$html
[]
=
'<a href="'
.
$href
.
'" class="'
.
$class
.
'" title="'
.
$title
.
'" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="'
.
$icon
.
'"></i> '
.
$text
.
'</a>'
;
}
}
else
{
$html
[]
=
'<a href="'
.
$href
.
'" class="'
.
$class
.
'" title="'
.
$title
.
'"><i class="'
.
$icon
.
'"></i> '
.
$text
.
'</a>'
;
}
}
return
implode
(
' '
,
$html
);
}
...
...
public/template/.gitkeep
0 → 100644
查看文件 @
f011bf6
...
...
请
注册
或
登录
后发表评论