Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taskonsite-архив-перенесен
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitry Korolev
taskonsite-архив-перенесен
Commits
140451ed
Commit
140451ed
authored
Mar 11, 2019
by
john
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
3009
parent
1c19a163
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
316 additions
and
316 deletions
+316
-316
backend/web/plugins/editormd/documentation.js
backend/web/plugins/editormd/documentation.js
+1
-1
backend/web/plugins/editormd/examples/php/editormd.uploader.class.php
...plugins/editormd/examples/php/editormd.uploader.class.php
+279
-311
backend/web/plugins/editormd/examples/php/upload.php
backend/web/plugins/editormd/examples/php/upload.php
+2
-2
common/modules/documentation/controllers/DocumentationAdminController.php
...ocumentation/controllers/DocumentationAdminController.php
+32
-0
common/modules/documentation/models/DocList.php
common/modules/documentation/models/DocList.php
+1
-1
common/modules/documentation/views/documentation-admin/index.php
...modules/documentation/views/documentation-admin/index.php
+1
-1
No files found.
backend/web/plugins/editormd/documentation.js
View file @
140451ed
...
@@ -35,7 +35,7 @@ $(function ()
...
@@ -35,7 +35,7 @@ $(function ()
imageUpload
:
true
,
imageUpload
:
true
,
imageFormats
:
[
"
jpg
"
,
"
jpeg
"
,
"
gif
"
,
"
png
"
,
"
bmp
"
,
"
webp
"
],
imageFormats
:
[
"
jpg
"
,
"
jpeg
"
,
"
gif
"
,
"
png
"
,
"
bmp
"
,
"
webp
"
],
imageUploadURL
:
"
./php/upload.php
"
,
imageUploadURL
:
"
/documentation/documentation-admin/upload
"
,
onload
:
function
()
onload
:
function
()
{
{
console
.
log
(
'
onload
'
,
this
);
console
.
log
(
'
onload
'
,
this
);
...
...
backend/web/plugins/editormd/examples/php/editormd.uploader.class.php
View file @
140451ed
<?php
<?php
/**
/**
*
*
* Editor.md PHP简易上传类(仅供演示用,生产环境使用还需谨慎考虑)
* Editor.md PHP简易上传类(仅供演示用,生产环境使用还需谨慎考虑)
*
*
* @FileName: editormd.uploader.class.php
* @FileName: editormd.uploader.class.php
* @Auther: Pandao
* @Auther: Pandao
* @E-mail: pandao@vip.qq.com
* @E-mail: pandao@vip.qq.com
* @CreateTime: 2015-02-13 23:31:32
* @CreateTime: 2015-02-13 23:31:32
* @UpdateTime: 2015-06-02 15:36:23
* @UpdateTime: 2015-06-02 15:36:23
* Copyright@2015 Editor.md all right reserved.
* Copyright@2015 Editor.md all right reserved.
*/
*/
class
EditorMdUploader
class
EditorMdUploader
{
public
$files
;
// $_FILES数组
public
$fileExit
;
// 文件扩展名
public
$saveName
;
// 最终保存的文件名
public
$saveURL
;
// 最终保存URL地址
public
$savePath
;
// 保存本地文件路径
public
$randomLength
=
''
;
// 生成随机文件名的长度,当为日期时为日期的格式
public
$randomNameType
=
1
;
// 生成随机的形式, NULL为保留原文件名, 1生成随机字符串, 2生成日期文件名
public
$formats
=
array
(
// 允许上传的文件格式
'gif'
,
'jpg'
,
'jpeg'
,
'png'
,
'bmp'
);
public
$maxSize
=
1024
;
// 最大上传文件大小,单位KB
public
$cover
=
true
;
// 是否覆盖同名文件, 1覆盖,0不覆盖
public
$redirect
=
false
;
// 是否进行URL跳转
public
$redirectURL
=
""
;
// 上传成功或出错后要转到的URL
public
$errors
=
array
(
// 错误信息
'empty'
=>
'上传文件不能为空'
,
'format'
=>
'上传的文件格式不符合规定'
,
'maxsize'
=>
'上传的文件太大'
,
'unwritable'
=>
'保存目录不可写,请更改权限'
,
'not_exist'
=>
'保存目录不存在'
,
'same_file'
=>
'已经有相同的文件存在'
);
/**
* 构造函数,初始化对象
*
* @access public
* @param string $savePath 最终保存的本地路径
* @param string $saveURL 最终保存的URL地址
* @param string $formats 允许上传的文件格式
* @param Number $randomNameType 是否生成随机文件名及形式
* @param Intiger/string $randomLength 生成随机文件名字符的长度
* @param boolean $cover 是否覆盖相同文件
* @param Intiger $maxSize 允许最大的上传文件大小,以KB为单位
* @return viod
*/
public
function
__construct
(
$savePath
,
$saveURL
,
$formats
,
$randomNameType
=
1
,
$randomLength
=
''
,
$cover
=
true
,
$maxSize
=
1024
)
{
{
public
$files
;
// $_FILES数组
$this
->
savePath
=
$savePath
;
public
$fileExit
;
// 文件扩展名
$this
->
saveURL
=
$saveURL
;
public
$saveName
;
// 最终保存的文件名
$this
->
formats
=
$formats
;
public
$saveURL
;
// 最终保存URL地址
$this
->
maxSize
=
$maxSize
;
public
$savePath
;
// 保存本地文件路径
$this
->
cover
=
$cover
;
public
$randomLength
=
''
;
// 生成随机文件名的长度,当为日期时为日期的格式
$this
->
randomNameType
=
$randomNameType
;
public
$randomNameType
=
1
;
// 生成随机的形式, NULL为保留原文件名, 1生成随机字符串, 2生成日期文件名
$this
->
randomLength
=
$randomLength
;
public
$formats
=
array
(
// 允许上传的文件格式
}
'gif'
,
'jpg'
,
'jpeg'
,
'png'
,
'bmp'
);
public
$maxSize
=
1024
;
// 最大上传文件大小,单位KB
public
$cover
=
true
;
// 是否覆盖同名文件, 1覆盖,0不覆盖
public
$redirect
=
false
;
// 是否进行URL跳转
public
$redirectURL
=
""
;
// 上传成功或出错后要转到的URL
public
$errors
=
array
(
// 错误信息
'empty'
=>
'上传文件不能为空'
,
'format'
=>
'上传的文件格式不符合规定'
,
'maxsize'
=>
'上传的文件太大'
,
'unwritable'
=>
'保存目录不可写,请更改权限'
,
'not_exist'
=>
'保存目录不存在'
,
'same_file'
=>
'已经有相同的文件存在'
);
/**
/**
* 构造函数,初始化对象
* 配置参数函数
*
*
* @access public
* @access public
* @param string $savePath 最终保存的本地路径
* @param array $configs 配置项数组
* @param string $saveURL 最终保存的URL地址
* @return void
* @param string $formats 允许上传的文件格式
*/
* @param Number $randomNameType 是否生成随机文件名及形式
public
function
config
(
$configs
)
* @param Intiger/string $randomLength 生成随机文件名字符的长度
{
* @param boolean $cover 是否覆盖相同文件
foreach
(
$configs
as
$key
=>
$value
)
{
* @param Intiger $maxSize 允许最大的上传文件大小,以KB为单位
$this
->
$key
=
$value
;
* @return viod
*/
public
function
__construct
(
$savePath
,
$saveURL
,
$formats
,
$randomNameType
=
1
,
$randomLength
=
''
,
$cover
=
true
,
$maxSize
=
1024
)
{
$this
->
savePath
=
$savePath
;
$this
->
saveURL
=
$saveURL
;
$this
->
formats
=
$formats
;
$this
->
maxSize
=
$maxSize
;
$this
->
cover
=
$cover
;
$this
->
randomNameType
=
$randomNameType
;
$this
->
randomLength
=
$randomLength
;
}
}
}
/**
/**
* 配置参数函数
* 执行文件上传
*
*
* @access public
* @access public
* @param array $configs 配置项数组
* @param string $name fileInput's name
* @return void
* @return boolean 返回是否上传成功的布尔值
*/
*/
public
function
upload
(
$name
)
public
function
config
(
$configs
)
{
{
if
(
empty
(
$_FILES
[
$name
][
'name'
]))
{
//上传文件为空时
foreach
(
$configs
as
$key
=>
$value
)
$this
->
message
(
$this
->
errors
[
'empty'
]);
{
$this
->
$key
=
$value
;
return
false
;
}
}
}
/**
$this
->
files
=
$_FILES
[
$name
];
* 执行文件上传
*
* @access public
* @param string $name fileInput's name
* @return boolean 返回是否上传成功的布尔值
*/
public
function
upload
(
$name
)
{
if
(
empty
(
$_FILES
[
$name
][
'name'
]))
//上传文件为空时
{
$this
->
message
(
$this
->
errors
[
'empty'
]);
return
false
;
}
$this
->
files
=
$_FILES
[
$name
];
if
(
!
file_exists
(
$this
->
savePath
))
//目录不存在
{
$this
->
message
(
$this
->
errors
[
'not_exist'
]);
return
false
;
}
if
(
!
is_writable
(
$this
->
savePath
))
//目录不可写
if
(
!
file_exists
(
$this
->
savePath
))
{
//目录不存在
{
$this
->
message
(
$this
->
errors
[
'not_exist'
]);
$this
->
message
(
$this
->
errors
[
'unwritable'
]);
return
false
;
}
$this
->
fileExt
=
$this
->
getFileExt
(
$this
->
files
[
"name"
]);
//取得扩展名
return
false
;
$this
->
setSeveName
();
return
$this
->
moveFile
();
}
}
/**
if
(
!
is_writable
(
$this
->
savePath
))
{
//目录不可写
* 检查并移动上传文件
$this
->
message
(
$this
->
errors
[
'unwritable'
]);
*
* @access private
* @return boolean
*/
private
function
moveFile
()
{
$files
=
$this
->
files
;
if
(
$this
->
formats
!=
""
&&
!
in_array
(
$this
->
fileExt
,
$this
->
formats
))
{
$formats
=
implode
(
','
,
$this
->
formats
);
$message
=
"您上传的文件"
.
$files
[
"name"
]
.
"是"
.
$this
->
fileExt
.
"格式的,系统不允许上传,您只能上传"
.
$formats
.
"格式的文件。"
;
$this
->
message
(
$message
);
return
false
;
}
if
(
$files
[
"size"
]
/
1024
>
$this
->
maxSize
)
return
false
;
{
}
$message
=
"您上传的 "
.
$files
[
"name"
]
.
",文件大小超出了系统限定值"
.
$this
->
maxSize
.
" KB,不能上传。"
;
$this
->
message
(
$message
);
return
false
;
}
if
(
!
$this
->
cover
)
//当不能覆盖时
$this
->
fileExt
=
$this
->
getFileExt
(
$this
->
files
[
"name"
]);
//取得扩展名
{
if
(
file_exists
(
$this
->
savePath
.
$this
->
saveName
))
//有相同的文件存在
$this
->
setSeveName
();
{
$this
->
message
(
$this
->
saveName
.
$this
->
errors
[
'same_file'
]);
return
$this
->
moveFile
();
}
return
false
;
}
/**
}
* 检查并移动上传文件
*
* @access private
* @return boolean
*/
private
function
moveFile
()
{
$files
=
$this
->
files
;
if
(
$this
->
formats
!=
""
&&
!
in_array
(
$this
->
fileExt
,
$this
->
formats
))
{
$formats
=
implode
(
','
,
$this
->
formats
);
$message
=
"您上传的文件"
.
$files
[
"name"
]
.
"是"
.
$this
->
fileExt
.
"格式的,系统不允许上传,您只能上传"
.
$formats
.
"格式的文件。"
;
$this
->
message
(
$message
);
return
false
;
}
if
(
$files
[
"size"
]
/
1024
>
$this
->
maxSize
)
{
$message
=
"您上传的 "
.
$files
[
"name"
]
.
",文件大小超出了系统限定值"
.
$this
->
maxSize
.
" KB,不能上传。"
;
$this
->
message
(
$message
);
return
false
;
}
if
(
!
$this
->
cover
)
{
//当不能覆盖时
if
(
file_exists
(
$this
->
savePath
.
$this
->
saveName
))
{
//有相同的文件存在
$this
->
message
(
$this
->
saveName
.
$this
->
errors
[
'same_file'
]);
if
(
!@
move_uploaded_file
(
$files
[
"tmp_name"
],
iconv
(
"utf-8"
,
"gbk"
,
$this
->
savePath
.
$this
->
saveName
)))
{
switch
(
$files
[
"errors"
])
{
case
'0'
:
$message
=
"文件上传成功"
;
break
;
case
'1'
:
$message
=
"上传的文件超过了 php.ini 中 upload_max_filesize 选项限制的值"
;
break
;
case
'2'
:
$message
=
"上传文件的大小超过了 HTML 表单中 MAX_FILE_SIZE 选项指定的值"
;
break
;
case
'3'
:
$message
=
"文件只有部分被上传"
;
break
;
case
'4'
:
$message
=
"没有文件被上传"
;
break
;
case
'6'
:
$message
=
"找不到临时目录"
;
break
;
case
'7'
:
$message
=
"写文件到硬盘时出错"
;
break
;
case
'8'
:
$message
=
"某个扩展停止了文件的上传"
;
break
;
case
'999'
:
default
:
$message
=
"未知错误,请检查文件是否损坏、是否超大等原因。"
;
break
;
}
$this
->
message
(
$message
);
return
false
;
return
false
;
}
}
@
unlink
(
$files
[
"tmp_name"
]);
//删除临时文件
return
true
;
}
}
/**
if
(
!@
move_uploaded_file
(
$files
[
"tmp_name"
],
$this
->
savePath
.
DIRECTORY_SEPARATOR
.
$this
->
saveName
))
{
* 生成随机文件名函数
switch
(
$files
[
"error"
])
{
*
case
'0'
:
* @access private
$message
=
"Загрузка файла успешно завершена"
;
* @return string $fileName 返回生成的文件名字符串
break
;
*/
case
'1'
:
private
function
randomFileName
()
$message
=
"Загруженный файл превышает значение параметра upload_max_filesize в php.ini"
;
{
break
;
if
(
$this
->
randomNameType
==
1
)
// 生成时间格式文件名
{
case
'2'
:
date_default_timezone_set
(
'PRC'
);
//设置时区
$message
=
"Размер загружаемого файла превышает значение, указанное параметром MAX_FILE_SIZE в форме HTML"
;
break
;
$date
=
date
(
$this
->
randomLength
);
$fileName
=
$date
.
"_"
.
mt_rand
(
10000
,
99999
);
case
'3'
:
}
$message
=
"Загружена только часть файла"
;
elseif
(
$this
->
randomNameType
==
2
)
// 生成随机字符文件名
break
;
{
$chars
=
'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz'
;
case
'4'
:
$max
=
strlen
(
$chars
)
-
1
;
$message
=
"Файлы не были загружены"
;
mt_srand
((
double
)
microtime
()
*
1000000
);
break
;
for
(
$i
=
0
;
$i
<
$this
->
randomLength
;
$i
++
)
case
'6'
:
{
$message
=
"Временный каталог не найден"
;
$fileName
.=
$chars
[
mt_rand
(
0
,
$max
)];
break
;
}
}
case
'7'
:
else
$message
=
"Ошибка записи файла на жесткий диск"
;
{
break
;
$fileName
=
''
;
case
'8'
:
$message
=
"Расширение перестало загружать файлы"
;
break
;
case
'999'
:
default
:
$message
=
"Неизвестная ошибка, проверьте, не поврежден ли файл, не слишком ли он большой и т. Д."
;
break
;
}
}
return
$fileName
;
$this
->
message
(
$message
);
return
false
;
}
}
/**
@
unlink
(
$files
[
"tmp_name"
]);
//删除临时文件
* 组成最终保存的完整路径及文件名
*
return
true
;
* @access private
}
* @return void
*/
/**
* 生成随机文件名函数
private
function
setSeveName
()
*
{
* @access private
$this
->
saveName
=
$this
->
randomFileName
()
.
"."
.
$this
->
fileExt
;
* @return string $fileName 返回生成的文件名字符串
*/
if
(
$this
->
saveName
==
''
)
//如果没生成随机文件名,就保留原文件名
private
function
randomFileName
()
{
{
$this
->
saveName
=
$this
->
files
[
'name'
];
$fileName
=
''
;
if
(
$this
->
randomNameType
==
1
)
{
// 生成时间格式文件名
date_default_timezone_set
(
'PRC'
);
//设置时区
$date
=
date
(
$this
->
randomLength
);
$fileName
=
$date
.
"_"
.
mt_rand
(
10000
,
99999
);
}
elseif
(
$this
->
randomNameType
==
2
)
{
// 生成随机字符文件名
$chars
=
'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz'
;
$max
=
strlen
(
$chars
)
-
1
;
mt_srand
((
double
)
microtime
()
*
1000000
);
for
(
$i
=
0
;
$i
<
$this
->
randomLength
;
$i
++
)
{
$fileName
.=
$chars
[
mt_rand
(
0
,
$max
)];
}
}
}
}
else
{
$fileName
=
''
;
/**
* 取得保存的文件名,用于数据库存储
*
* @access public
* @return string
*/
public
function
getSeveName
()
{
return
$this
->
saveName
;
}
/**
* 获取文件后缀名函数
*
* @access public
* @return string
*/
public
function
getFileExt
(
$fileName
)
{
return
trim
(
strtolower
(
substr
(
strrchr
(
$fileName
,
'.'
),
1
)));
}
/**
* 上传成功或出错后跳转
*
* @access public
* @param array $configs 配置项数组
* @return void
*/
public
function
redirect
()
{
header
(
'location: '
.
$this
->
redirectURL
);
}
}
/**
return
$fileName
;
* 错误提示函数
}
*
* @access public
/**
* @return void
* 组成最终保存的完整路径及文件名
*/
*
* @access private
public
function
message
(
$message
,
$success
=
0
)
* @return void
{
*/
$array
=
array
(
private
function
setSeveName
()
'success'
=>
$success
{
);
$this
->
saveName
=
$this
->
randomFileName
()
.
"."
.
$this
->
fileExt
;
$url
=
$this
->
saveURL
.
$this
->
saveName
;
if
(
$this
->
saveName
==
''
)
{
//如果没生成随机文件名,就保留原文件名
$this
->
saveName
=
$this
->
files
[
'name'
];
// 适用于跨域上传时,跳转到中介页面等
}
if
(
$this
->
redirect
)
}
{
$this
->
redirectURL
.=
"&success="
.
$success
.
"&message="
.
$message
;
/**
* 取得保存的文件名,用于数据库存储
if
(
$success
==
1
)
*
{
* @access public
$this
->
redirectURL
.=
'&url='
.
$url
;
* @return string
}
*/
public
function
getSeveName
()
$this
->
redirect
();
{
return
$this
->
saveName
;
}
/**
* 获取文件后缀名函数
*
* @access public
* @return string
*/
public
function
getFileExt
(
$fileName
)
{
return
trim
(
strtolower
(
substr
(
strrchr
(
$fileName
,
'.'
),
1
)));
}
/**
* 上传成功或出错后跳转
*
* @access public
* @param array $configs 配置项数组
* @return void
*/
public
function
redirect
()
{
header
(
'location: '
.
$this
->
redirectURL
);
}
/**
* 错误提示函数
*
* @access public
* @return void
*/
public
function
message
(
$message
,
$success
=
0
)
{
$array
=
array
(
'success'
=>
$success
);
$url
=
$this
->
saveURL
.
$this
->
saveName
;
// 适用于跨域上传时,跳转到中介页面等
if
(
$this
->
redirect
)
{
$this
->
redirectURL
.=
"&success="
.
$success
.
"&message="
.
$message
;
if
(
$success
==
1
)
{
$this
->
redirectURL
.=
'&url='
.
$url
;
}
}
else
{
$this
->
redirect
();
if
(
$success
==
1
)
}
else
{
{
if
(
$success
==
1
)
{
$array
[
'url'
]
=
$url
;
$array
[
'url'
]
=
$url
;
}
}
else
{
else
$array
[
'message'
]
=
$message
;
{
$array
[
'message'
]
=
$message
;
}
echo
json_encode
(
$array
);
}
}
echo
json_encode
(
$array
);
}
}
}
}
}
backend/web/plugins/editormd/examples/php/upload.php
View file @
140451ed
...
@@ -41,11 +41,11 @@
...
@@ -41,11 +41,11 @@
if
(
$imageUploader
->
upload
(
$name
))
if
(
$imageUploader
->
upload
(
$name
))
{
{
$imageUploader
->
message
(
'
上传成功!
'
,
1
);
$imageUploader
->
message
(
'
Загружен успешно!
'
,
1
);
}
}
else
else
{
{
$imageUploader
->
message
(
'
上传失败!
'
,
0
);
$imageUploader
->
message
(
'
Загрузка не удалась!
'
,
0
);
}
}
}
}
?>
?>
\ No newline at end of file
common/modules/documentation/controllers/DocumentationAdminController.php
View file @
140451ed
...
@@ -24,6 +24,7 @@ class DocumentationAdminController extends AdminController
...
@@ -24,6 +24,7 @@ class DocumentationAdminController extends AdminController
'Update'
=>
'Редактирование контента'
,
'Update'
=>
'Редактирование контента'
,
'Delete'
=>
'Удаление контента'
,
'Delete'
=>
'Удаление контента'
,
'View'
=>
'Просмотр контента'
,
'View'
=>
'Просмотр контента'
,
'Upload'
=>
'Загрузка картинок'
,
];
];
}
}
...
@@ -235,4 +236,35 @@ class DocumentationAdminController extends AdminController
...
@@ -235,4 +236,35 @@ class DocumentationAdminController extends AdminController
}
}
}
}
public
function
actionUpload
()
{
require
(
\yii\helpers\FileHelper
::
normalizePath
(
\Yii
::
getAlias
(
'@webroot'
)
.
DIRECTORY_SEPARATOR
.
'plugins'
.
DIRECTORY_SEPARATOR
.
'editormd'
.
DIRECTORY_SEPARATOR
.
'examples'
.
DIRECTORY_SEPARATOR
.
'php'
.
DIRECTORY_SEPARATOR
.
'editormd.uploader.class.php'
));
$savePath
=
\yii\helpers\FileHelper
::
normalizePath
(
\Yii
::
getAlias
(
'@frontend'
)
.
DIRECTORY_SEPARATOR
.
'web'
.
DIRECTORY_SEPARATOR
.
'uploads'
.
DIRECTORY_SEPARATOR
.
'documentation'
.
DIRECTORY_SEPARATOR
);
$saveURL
=
Yii
::
$app
->
params
[
'frontUrl'
]
.
'/uploads/documentation/'
;
$formats
=
array
(
'image'
=>
array
(
'gif'
,
'jpg'
,
'jpeg'
,
'png'
,
'bmp'
)
);
$name
=
'editormd-image-file'
;
if
(
isset
(
$_FILES
[
$name
]))
{
$imageUploader
=
new
\EditorMdUploader
(
$savePath
,
$saveURL
,
$formats
[
'image'
],
false
);
// Ymdhis表示按日期生成文件名,利用date()函数
$imageUploader
->
config
(
array
(
'maxSize'
=>
1024
,
// 允许上传的最大文件大小,以KB为单位,默认值为1024
'randomNameType'
=>
2
,
'randomLength'
=>
20
,
'cover'
=>
true
// 是否覆盖同名文件,默认为true
));
if
(
$imageUploader
->
upload
(
$name
))
{
$imageUploader
->
message
(
'Загружен успешно!'
,
1
);
}
else
{
$imageUploader
->
message
(
'Загрузка не удалась!'
,
0
);
}
}
}
}
}
common/modules/documentation/models/DocList.php
View file @
140451ed
...
@@ -139,7 +139,7 @@ class DocList extends \yii\db\ActiveRecord
...
@@ -139,7 +139,7 @@ class DocList extends \yii\db\ActiveRecord
$list
=
[];
$list
=
[];
$thisLevel
=
DocList
::
find
()
->
where
([
'='
,
'parent_id'
,
$parent_id
])
->
orderBy
([
'position'
=>
SORT_ASC
])
->
all
();
$thisLevel
=
DocList
::
find
()
->
where
([
'='
,
'parent_id'
,
$parent_id
])
->
orderBy
([
'position'
=>
SORT_ASC
])
->
all
();
foreach
(
$thisLevel
as
$level
)
{
foreach
(
$thisLevel
as
$level
)
{
if
(
$updated
->
id
==
$level
->
id
&&
!
$ignore
)
if
(
$updated
&&
$updated
->
id
==
$level
->
id
&&
!
$ignore
)
continue
;
continue
;
$l
=
''
;
$l
=
''
;
...
...
common/modules/documentation/views/documentation-admin/index.php
View file @
140451ed
...
@@ -43,7 +43,7 @@ use common\modules\documentation\models\DocList;
...
@@ -43,7 +43,7 @@ use common\modules\documentation\models\DocList;
],
],
[
[
'class'
=>
'common\components\ColorActionColumn'
,
'class'
=>
'common\components\ColorActionColumn'
,
'template'
=>
'{
view} {
update} {delete}'
,
'template'
=>
'{update} {delete}'
,
// 'buttons' => [
// 'buttons' => [
// 'copy' => function ($url, $model, $key) {
// 'copy' => function ($url, $model, $key) {
// return '<a href="' . Url::toRoute(['copy', 'id' => $model->id]) . '">' . Html::beginTag('i', [
// return '<a href="' . Url::toRoute(['copy', 'id' => $model->id]) . '">' . Html::beginTag('i', [
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment