Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dokuwiki
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BRIC
dokuwiki
Commits
5c967d3d
Commit
5c967d3d
authored
11 years ago
by
Christopher Smith
Browse files
Options
Downloads
Patches
Plain Diff
add csv export functionality to the user manager
parent
65f0aa62
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/plugins/usermanager/admin.php
+38
-1
38 additions, 1 deletion
lib/plugins/usermanager/admin.php
lib/plugins/usermanager/lang/en/lang.php
+2
-0
2 additions, 0 deletions
lib/plugins/usermanager/lang/en/lang.php
with
40 additions
and
1 deletion
lib/plugins/usermanager/admin.php
+
38
−
1
View file @
5c967d3d
...
...
@@ -101,6 +101,7 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin {
case
"search"
:
$this
->
_setFilter
(
$param
);
$this
->
_start
=
0
;
break
;
case
"export"
:
$this
->
_export
();
break
;
}
$this
->
_user_total
=
$this
->
_auth
->
canDo
(
'getUserCount'
)
?
$this
->
_auth
->
getUserCount
(
$this
->
_filter
)
:
-
1
;
...
...
@@ -133,6 +134,7 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin {
$delete_disable
=
$this
->
_auth
->
canDo
(
'delUser'
)
?
''
:
'disabled="disabled"'
;
$editable
=
$this
->
_auth
->
canDo
(
'UserMod'
);
$export_label
=
empty
(
$this
->
_filter
)
?
$this
->
lang
[
'export_all'
]
:
$this
->
lang
[
export_filtered
];
print
$this
->
locale_xhtml
(
'intro'
);
print
$this
->
locale_xhtml
(
'list'
);
...
...
@@ -196,7 +198,10 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin {
ptln
(
" <input type=
\"
submit
\"
name=
\"
fn[next]
\"
"
.
$page_buttons
[
'next'
]
.
" class=
\"
button
\"
value=
\"
"
.
$this
->
lang
[
'next'
]
.
"
\"
/>"
);
ptln
(
" <input type=
\"
submit
\"
name=
\"
fn[last]
\"
"
.
$page_buttons
[
'last'
]
.
" class=
\"
button
\"
value=
\"
"
.
$this
->
lang
[
'last'
]
.
"
\"
/>"
);
ptln
(
" </span>"
);
ptln
(
" <input type=
\"
submit
\"
name=
\"
fn[search][clear]
\"
class=
\"
button
\"
value=
\"
"
.
$this
->
lang
[
'clear'
]
.
"
\"
/>"
);
if
(
!
empty
(
$this
->
_filter
))
{
ptln
(
" <input type=
\"
submit
\"
name=
\"
fn[search][clear]
\"
class=
\"
button
\"
value=
\"
"
.
$this
->
lang
[
'clear'
]
.
"
\"
/>"
);
}
ptln
(
" <input type=
\"
submit
\"
name=
\"
fn[export]
\"
class=
\"
button
\"
value=
\"
"
.
$export_label
.
"
\"
/>"
);
ptln
(
" <input type=
\"
hidden
\"
name=
\"
do
\"
value=
\"
admin
\"
/>"
);
ptln
(
" <input type=
\"
hidden
\"
name=
\"
page
\"
value=
\"
usermanager
\"
/>"
);
...
...
@@ -629,4 +634,36 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin {
return
$buttons
;
}
/*
* export a list of users in csv format using the current filter criteria
*/
function
_export
()
{
// list of users for export - based on current filter criteria
$user_list
=
$this
->
_auth
->
retrieveUsers
(
0
,
0
,
$this
->
_filter
);
$column_headings
=
array
(
$this
->
lang
[
"user_id"
],
$this
->
lang
[
"user_name"
],
$this
->
lang
[
"user_mail"
],
$this
->
lang
[
"user_groups"
]
);
// ==============================================================================================
// GENERATE OUTPUT
// normal headers for downloading...
header
(
'Content-type: text/csv;charset=utf-8'
);
header
(
'Content-Disposition: attachment; filename="wikiusers.csv"'
);
# // for debugging assistance, send as text plain to the browser
# header('Content-type: text/plain;charset=utf-8');
// output the csv
$fd
=
fopen
(
'php://output'
,
'w'
);
fputcsv
(
$fd
,
$column_headings
);
foreach
(
$user_list
as
$user
=>
$info
)
{
$line
=
array
(
$user
,
$info
[
'name'
],
$info
[
'mail'
],
join
(
','
,
$info
[
'grps'
]));
fputcsv
(
$fd
,
$line
);
}
fclose
(
$fd
);
die
;
}
}
This diff is collapsed.
Click to expand it.
lib/plugins/usermanager/lang/en/lang.php
+
2
−
0
View file @
5c967d3d
...
...
@@ -31,6 +31,8 @@ $lang['search'] = 'Search';
$lang
[
'search_prompt'
]
=
'Perform search'
;
$lang
[
'clear'
]
=
'Reset Search Filter'
;
$lang
[
'filter'
]
=
'Filter'
;
$lang
[
'export_all'
]
=
'Export All Users (CSV)'
;
$lang
[
'export_filtered'
]
=
'Export Filtered User list (CSV)'
;
$lang
[
'summary'
]
=
'Displaying users %1$d-%2$d of %3$d found. %4$d users total.'
;
$lang
[
'nonefound'
]
=
'No users found. %d users total.'
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment