Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
moodle
moodle
Commits
4b50765b
Commit
4b50765b
authored
Jul 24, 2017
by
Damyon Wiese
Browse files
MDL-59370 enrol: Kill the enrol/users page.
parent
f3625f47
Changes
12
Hide whitespace changes
Inline
Side-by-side
course/classes/management/helper.php
View file @
4b50765b
...
@@ -395,7 +395,7 @@ class helper {
...
@@ -395,7 +395,7 @@ class helper {
// Permissions.
// Permissions.
if
(
$course
->
can_review_enrolments
())
{
if
(
$course
->
can_review_enrolments
())
{
$actions
[
'enrolledusers'
]
=
array
(
$actions
[
'enrolledusers'
]
=
array
(
'url'
=>
new
\
moodle_url
(
'/
enrol/users
.php'
,
array
(
'id'
=>
$course
->
id
)),
'url'
=>
new
\
moodle_url
(
'/
user/index
.php'
,
array
(
'id'
=>
$course
->
id
)),
'string'
=>
\
get_string
(
'enrolledusers'
,
'enrol'
)
'string'
=>
\
get_string
(
'enrolledusers'
,
'enrol'
)
);
);
}
}
...
...
course/edit.php
View file @
4b50765b
...
@@ -175,7 +175,7 @@ if ($editform->is_cancelled()) {
...
@@ -175,7 +175,7 @@ if ($editform->is_cancelled()) {
if
(
$plugin
=
enrol_get_plugin
(
$instance
->
enrol
))
{
if
(
$plugin
=
enrol_get_plugin
(
$instance
->
enrol
))
{
if
(
$plugin
->
get_manual_enrol_link
(
$instance
))
{
if
(
$plugin
->
get_manual_enrol_link
(
$instance
))
{
// We know that the ajax enrol UI will have an option to enrol.
// We know that the ajax enrol UI will have an option to enrol.
$courseurl
=
new
moodle_url
(
'/
enrol/users
.php'
,
array
(
'id'
=>
$course
->
id
,
'newcourse'
=>
1
));
$courseurl
=
new
moodle_url
(
'/
user/index
.php'
,
array
(
'id'
=>
$course
->
id
,
'newcourse'
=>
1
));
break
;
break
;
}
}
}
}
...
...
enrol/bulkchange.php
deleted
100644 → 0
View file @
f3625f47
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle 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.
//
// Moodle 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 Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Bulk user enrolment processing.
*
* @package core_enrol
* @copyright 2011 Sam Hemelryk
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require
(
'../config.php'
);
require_once
(
"
$CFG->dirroot
/enrol/locallib.php"
);
require_once
(
"
$CFG->dirroot
/enrol/users_forms.php"
);
require_once
(
"
$CFG->dirroot
/enrol/renderer.php"
);
require_once
(
"
$CFG->dirroot
/group/lib.php"
);
$id
=
required_param
(
'id'
,
PARAM_INT
);
// course id
$bulkuserop
=
required_param
(
'bulkuserop'
,
PARAM_ALPHANUMEXT
);
$userids
=
required_param_array
(
'bulkuser'
,
PARAM_INT
);
$action
=
optional_param
(
'action'
,
''
,
PARAM_ALPHANUMEXT
);
$filter
=
optional_param
(
'ifilter'
,
0
,
PARAM_INT
);
$course
=
$DB
->
get_record
(
'course'
,
array
(
'id'
=>
$id
),
'*'
,
MUST_EXIST
);
$context
=
context_course
::
instance
(
$course
->
id
,
MUST_EXIST
);
if
(
$course
->
id
==
SITEID
)
{
redirect
(
new
moodle_url
(
'/'
));
}
require_login
(
$course
);
require_capability
(
'moodle/course:enrolreview'
,
$context
);
$PAGE
->
set_pagelayout
(
'admin'
);
$manager
=
new
course_enrolment_manager
(
$PAGE
,
$course
,
$filter
);
$table
=
new
course_enrolment_users_table
(
$manager
,
$PAGE
);
$returnurl
=
new
moodle_url
(
'/enrol/users.php'
,
$table
->
get_combined_url_params
());
$actionurl
=
new
moodle_url
(
'/enrol/bulkchange.php'
,
$table
->
get_combined_url_params
()
+
array
(
'bulkuserop'
=>
$bulkuserop
));
$PAGE
->
set_url
(
$actionurl
);
navigation_node
::
override_active_url
(
new
moodle_url
(
'/enrol/users.php'
,
array
(
'id'
=>
$id
)));
$ops
=
$table
->
get_bulk_user_enrolment_operations
();
if
(
!
array_key_exists
(
$bulkuserop
,
$ops
))
{
throw
new
moodle_exception
(
'invalidbulkenrolop'
);
}
$operation
=
$ops
[
$bulkuserop
];
// Prepare the properties of the form
$users
=
$manager
->
get_users_enrolments
(
$userids
);
// Get the form for the bulk operation
$mform
=
$operation
->
get_form
(
$actionurl
,
array
(
'users'
=>
$users
));
// If the mform is false then attempt an immediate process. This may be an immediate action that
// doesn't require user input OR confirmation.... who know what but maybe one day
if
(
$mform
===
false
)
{
if
(
$operation
->
process
(
$manager
,
$users
,
new
stdClass
))
{
redirect
(
$returnurl
);
}
else
{
print_error
(
'errorwithbulkoperation'
,
'enrol'
);
}
}
// Check if the bulk operation has been cancelled
if
(
$mform
->
is_cancelled
())
{
redirect
(
$returnurl
);
}
if
(
$mform
->
is_submitted
()
&&
$mform
->
is_validated
()
&&
confirm_sesskey
())
{
if
(
$operation
->
process
(
$manager
,
$users
,
$mform
->
get_data
()))
{
redirect
(
$returnurl
);
}
}
$pagetitle
=
get_string
(
'bulkuseroperation'
,
'enrol'
);
$PAGE
->
set_title
(
$pagetitle
);
$PAGE
->
set_heading
(
$pagetitle
);
echo
$OUTPUT
->
header
();
echo
$OUTPUT
->
heading
(
$operation
->
get_title
());
$mform
->
display
();
echo
$OUTPUT
->
footer
();
\ No newline at end of file
enrol/locallib.php
View file @
4b50765b
...
@@ -803,7 +803,7 @@ class course_enrolment_manager {
...
@@ -803,7 +803,7 @@ class course_enrolment_manager {
*/
*/
public
function
edit_enrolment
(
$userenrolment
,
$data
)
{
public
function
edit_enrolment
(
$userenrolment
,
$data
)
{
//Only allow editing if the user has the appropriate capability
//Only allow editing if the user has the appropriate capability
//Already checked in /
enrol/users
.php but checking again in case this function is called from elsewhere
//Already checked in /
user/index
.php but checking again in case this function is called from elsewhere
list
(
$instance
,
$plugin
)
=
$this
->
get_user_enrolment_components
(
$userenrolment
);
list
(
$instance
,
$plugin
)
=
$this
->
get_user_enrolment_components
(
$userenrolment
);
if
(
$instance
&&
$plugin
&&
$plugin
->
allow_manage
(
$instance
)
&&
has_capability
(
"enrol/
$instance->enrol
:manage"
,
$this
->
context
))
{
if
(
$instance
&&
$plugin
&&
$plugin
->
allow_manage
(
$instance
)
&&
has_capability
(
"enrol/
$instance->enrol
:manage"
,
$this
->
context
))
{
if
(
!
isset
(
$data
->
status
))
{
if
(
!
isset
(
$data
->
status
))
{
...
...
enrol/manual/manage.php
View file @
4b50765b
...
@@ -69,7 +69,7 @@ $PAGE->set_url('/enrol/manual/manage.php', array('enrolid'=>$instance->id));
...
@@ -69,7 +69,7 @@ $PAGE->set_url('/enrol/manual/manage.php', array('enrolid'=>$instance->id));
$PAGE
->
set_pagelayout
(
'admin'
);
$PAGE
->
set_pagelayout
(
'admin'
);
$PAGE
->
set_title
(
$enrol_manual
->
get_instance_name
(
$instance
));
$PAGE
->
set_title
(
$enrol_manual
->
get_instance_name
(
$instance
));
$PAGE
->
set_heading
(
$course
->
fullname
);
$PAGE
->
set_heading
(
$course
->
fullname
);
navigation_node
::
override_active_url
(
new
moodle_url
(
'/
enrol/users
.php'
,
array
(
'id'
=>
$course
->
id
)));
navigation_node
::
override_active_url
(
new
moodle_url
(
'/
user/index
.php'
,
array
(
'id'
=>
$course
->
id
)));
// Create the user selector objects.
// Create the user selector objects.
$options
=
array
(
'enrolid'
=>
$enrolid
,
'accesscontext'
=>
$context
);
$options
=
array
(
'enrolid'
=>
$enrolid
,
'accesscontext'
=>
$context
);
...
...
enrol/renderer.php
View file @
4b50765b
...
@@ -30,72 +30,6 @@
...
@@ -30,72 +30,6 @@
*/
*/
class
core_enrol_renderer
extends
plugin_renderer_base
{
class
core_enrol_renderer
extends
plugin_renderer_base
{
/**
* Renders a course enrolment table
*
* @param course_enrolment_table $table
* @param moodleform $mform Form that contains filter controls
* @return string
*/
public
function
render_course_enrolment_users_table
(
course_enrolment_users_table
$table
,
moodleform
$mform
)
{
$table
->
initialise_javascript
();
$buttons
=
$table
->
get_manual_enrol_buttons
();
$buttonhtml
=
''
;
if
(
count
(
$buttons
)
>
0
)
{
$buttonhtml
.
=
html_writer
::
start_tag
(
'div'
,
array
(
'class'
=>
'enrol_user_buttons enrol-users-page-action'
));
foreach
(
$buttons
as
$button
)
{
$buttonhtml
.
=
$this
->
render
(
$button
);
}
$buttonhtml
.
=
html_writer
::
end_tag
(
'div'
);
}
$content
=
''
;
if
(
!
empty
(
$buttonhtml
))
{
$content
.
=
$buttonhtml
;
}
$content
.
=
html_writer
::
start_tag
(
'div'
,
array
(
'class'
=>
'form-inline'
));
$content
.
=
$mform
->
render
();
$content
.
=
html_writer
::
end_tag
(
'div'
);
$content
.
=
$this
->
output
->
render
(
$table
->
get_paging_bar
());
// Check if the table has any bulk operations. If it does we want to wrap the table in a
// form so that we can capture and perform any required bulk operations.
if
(
$table
->
has_bulk_user_enrolment_operations
())
{
$content
.
=
html_writer
::
start_tag
(
'form'
,
array
(
'action'
=>
new
moodle_url
(
'/enrol/bulkchange.php'
),
'method'
=>
'post'
));
foreach
(
$table
->
get_combined_url_params
()
as
$key
=>
$value
)
{
if
(
$key
==
'action'
)
{
continue
;
}
$content
.
=
html_writer
::
empty_tag
(
'input'
,
array
(
'type'
=>
'hidden'
,
'name'
=>
$key
,
'value'
=>
$value
));
}
$content
.
=
html_writer
::
empty_tag
(
'input'
,
array
(
'type'
=>
'hidden'
,
'name'
=>
'action'
,
'value'
=>
'bulkchange'
));
$content
.
=
html_writer
::
table
(
$table
);
$content
.
=
html_writer
::
start_tag
(
'div'
,
array
(
'class'
=>
'singleselect bulkuserop'
));
$content
.
=
html_writer
::
start_tag
(
'select'
,
array
(
'name'
=>
'bulkuserop'
));
$content
.
=
html_writer
::
tag
(
'option'
,
get_string
(
'withselectedusers'
,
'enrol'
),
array
(
'value'
=>
''
));
$options
=
array
(
''
=>
get_string
(
'withselectedusers'
,
'enrol'
));
foreach
(
$table
->
get_bulk_user_enrolment_operations
()
as
$operation
)
{
$content
.
=
html_writer
::
tag
(
'option'
,
$operation
->
get_title
(),
array
(
'value'
=>
$operation
->
get_identifier
()));
}
$content
.
=
html_writer
::
end_tag
(
'select'
);
$content
.
=
html_writer
::
empty_tag
(
'input'
,
array
(
'type'
=>
'submit'
,
'value'
=>
get_string
(
'go'
)));
$content
.
=
html_writer
::
end_tag
(
'div'
);
$content
.
=
html_writer
::
end_tag
(
'form'
);
}
else
{
$content
.
=
html_writer
::
table
(
$table
);
}
$content
.
=
$this
->
output
->
render
(
$table
->
get_paging_bar
());
if
(
!
empty
(
$buttonhtml
))
{
$content
.
=
$buttonhtml
;
}
return
$content
;
}
/**
/**
* Renderers the enrol_user_button.
* Renderers the enrol_user_button.
*
*
...
...
enrol/upgrade.txt
View file @
4b50765b
This files describes API changes in /enrol/* - plugins,
This files describes API changes in /enrol/* - plugins,
information provided here is intended especially for developers.
information provided here is intended especially for developers.
=== 3.4 ===
* render_course_enrolment_users_table method has been removed from the renderer. The enrolled users page is now
combined with the participants page. /enrol/users.php no longer exists.
=== 3.3 ===
=== 3.3 ===
* External function core_enrol_external::get_users_courses now return the user progress, start and the end course dates.
* External function core_enrol_external::get_users_courses now return the user progress, start and the end course dates.
...
...
enrol/users.php
deleted
100644 → 0
View file @
f3625f47
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle 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.
//
// Moodle 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 Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Main course enrolment management UI, this is not compatible with frontpage course.
*
* @package core_enrol
* @copyright 2010 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require
(
'../config.php'
);
require_once
(
"
$CFG->dirroot
/enrol/locallib.php"
);
require_once
(
"
$CFG->dirroot
/enrol/users_forms.php"
);
require_once
(
"
$CFG->dirroot
/enrol/renderer.php"
);
require_once
(
"
$CFG->dirroot
/group/lib.php"
);
$id
=
required_param
(
'id'
,
PARAM_INT
);
// course id
$action
=
optional_param
(
'action'
,
''
,
PARAM_ALPHANUMEXT
);
$filter
=
optional_param
(
'ifilter'
,
0
,
PARAM_INT
);
$search
=
optional_param
(
'search'
,
''
,
PARAM_RAW
);
$role
=
optional_param
(
'role'
,
0
,
PARAM_INT
);
$fgroup
=
optional_param
(
'filtergroup'
,
0
,
PARAM_INT
);
$status
=
optional_param
(
'status'
,
-
1
,
PARAM_INT
);
$newcourse
=
optional_param
(
'newcourse'
,
false
,
PARAM_BOOL
);
// When users reset the form, redirect back to first page without other params.
if
(
optional_param
(
'resetbutton'
,
''
,
PARAM_RAW
)
!==
''
)
{
redirect
(
'users.php?id='
.
$id
.
'&newcourse='
.
$newcourse
);
}
$course
=
$DB
->
get_record
(
'course'
,
array
(
'id'
=>
$id
),
'*'
,
MUST_EXIST
);
$context
=
context_course
::
instance
(
$course
->
id
,
MUST_EXIST
);
if
(
$course
->
id
==
SITEID
)
{
redirect
(
new
moodle_url
(
'/'
));
}
require_login
(
$course
);
require_capability
(
'moodle/course:enrolreview'
,
$context
);
$PAGE
->
set_pagelayout
(
'admin'
);
$manager
=
new
course_enrolment_manager
(
$PAGE
,
$course
,
$filter
,
$role
,
$search
,
$fgroup
,
$status
);
$table
=
new
course_enrolment_users_table
(
$manager
,
$PAGE
);
$PAGE
->
set_url
(
'/enrol/users.php'
,
$manager
->
get_url_params
()
+
$table
->
get_url_params
()
+
array
(
'newcourse'
=>
$newcourse
));
navigation_node
::
override_active_url
(
new
moodle_url
(
'/enrol/users.php'
,
array
(
'id'
=>
$id
)));
// Check if there is an action to take
if
(
$action
)
{
// Check if the page is confirmed (and sesskey is correct)
$confirm
=
optional_param
(
'confirm'
,
false
,
PARAM_BOOL
)
&&
confirm_sesskey
();
$actiontaken
=
false
;
$pagetitle
=
''
;
$pageheading
=
''
;
$mform
=
null
;
$pagecontent
=
null
;
switch
(
$action
)
{
/**
* Removes a role from the user with this course
*/
case
'unassign'
:
if
(
has_capability
(
'moodle/role:assign'
,
$manager
->
get_context
()))
{
$role
=
required_param
(
'roleid'
,
PARAM_INT
);
$user
=
required_param
(
'user'
,
PARAM_INT
);
if
(
$confirm
&&
$manager
->
unassign_role_from_user
(
$user
,
$role
))
{
redirect
(
$PAGE
->
url
);
}
else
{
$user
=
$DB
->
get_record
(
'user'
,
array
(
'id'
=>
$user
),
'*'
,
MUST_EXIST
);
$allroles
=
$manager
->
get_all_roles
();
$role
=
$allroles
[
$role
];
$yesurl
=
new
moodle_url
(
$PAGE
->
url
,
array
(
'action'
=>
'unassign'
,
'roleid'
=>
$role
->
id
,
'user'
=>
$user
->
id
,
'confirm'
=>
1
,
'sesskey'
=>
sesskey
()));
$message
=
get_string
(
'unassignconfirm'
,
'role'
,
array
(
'user'
=>
fullname
(
$user
,
true
),
'role'
=>
$role
->
localname
));
$pagetitle
=
get_string
(
'unassignarole'
,
'role'
,
$role
->
localname
);
$pagecontent
=
$OUTPUT
->
confirm
(
$message
,
$yesurl
,
$PAGE
->
url
);
}
$actiontaken
=
true
;
}
break
;
/**
* Assigns a new role to a user enrolled within this course.
* A user must be enrolled in the course in order for this script to action
*/
case
'assign'
:
$user
=
$DB
->
get_record
(
'user'
,
array
(
'id'
=>
required_param
(
'user'
,
PARAM_INT
)),
'*'
,
MUST_EXIST
);
if
(
is_enrolled
(
$context
,
$user
)
&&
has_capability
(
'moodle/role:assign'
,
$manager
->
get_context
()))
{
$mform
=
new
enrol_users_assign_form
(
NULL
,
array
(
'user'
=>
$user
,
'course'
=>
$course
,
'assignable'
=>
$manager
->
get_assignable_roles
()));
$mform
->
set_data
(
$PAGE
->
url
->
params
());
$data
=
$mform
->
get_data
();
if
(
$mform
->
is_cancelled
()
||
(
$data
&&
array_key_exists
(
$data
->
roleid
,
$manager
->
get_assignable_roles
())
&&
$manager
->
assign_role_to_user
(
$data
->
roleid
,
$user
->
id
)))
{
redirect
(
$PAGE
->
url
);
}
else
{
$pagetitle
=
get_string
(
'assignroles'
,
'role'
);
}
$actiontaken
=
true
;
}
break
;
/**
* Removes the user from the given group
*/
case
'removemember'
:
if
(
has_capability
(
'moodle/course:managegroups'
,
$manager
->
get_context
()))
{
$groupid
=
required_param
(
'group'
,
PARAM_INT
);
$userid
=
required_param
(
'user'
,
PARAM_INT
);
$user
=
$DB
->
get_record
(
'user'
,
array
(
'id'
=>
$userid
),
'*'
,
MUST_EXIST
);
if
(
$confirm
&&
$manager
->
remove_user_from_group
(
$user
,
$groupid
))
{
redirect
(
$PAGE
->
url
);
}
else
{
$group
=
$manager
->
get_group
(
$groupid
);
if
(
!
$group
)
{
break
;
}
$yesurl
=
new
moodle_url
(
$PAGE
->
url
,
array
(
'action'
=>
'removemember'
,
'group'
=>
$groupid
,
'user'
=>
$userid
,
'confirm'
=>
1
,
'sesskey'
=>
sesskey
()));
$message
=
get_string
(
'removefromgroupconfirm'
,
'group'
,
array
(
'user'
=>
fullname
(
$user
,
true
),
'group'
=>
$group
->
name
));
$pagetitle
=
get_string
(
'removefromgroup'
,
'group'
,
$group
->
name
);
$pagecontent
=
$OUTPUT
->
confirm
(
$message
,
$yesurl
,
$PAGE
->
url
);
}
$actiontaken
=
true
;
}
break
;
/**
* Makes the user a member of a given group
*/
case
'addmember'
:
if
(
has_capability
(
'moodle/course:managegroups'
,
$manager
->
get_context
()))
{
$userid
=
required_param
(
'user'
,
PARAM_INT
);
$user
=
$DB
->
get_record
(
'user'
,
array
(
'id'
=>
$userid
),
'*'
,
MUST_EXIST
);
$mform
=
new
enrol_users_addmember_form
(
NULL
,
array
(
'user'
=>
$user
,
'course'
=>
$course
,
'allgroups'
=>
$manager
->
get_all_groups
()));
$mform
->
set_data
(
$PAGE
->
url
->
params
());
$data
=
$mform
->
get_data
();
if
(
$mform
->
is_cancelled
())
{
redirect
(
$PAGE
->
url
);
}
if
(
!
empty
(
$data
->
groupids
))
{
foreach
(
$data
->
groupids
as
$groupid
)
{
$manager
->
add_user_to_group
(
$user
,
$groupid
);
}
redirect
(
$PAGE
->
url
);
}
else
{
$pagetitle
=
get_string
(
'addgroup'
,
'group'
);
}
$actiontaken
=
true
;
}
break
;
}
// If we took an action display we need to display something special.
if
(
$actiontaken
)
{
if
(
empty
(
$pageheading
))
{
$pageheading
=
$pagetitle
;
}
$PAGE
->
set_title
(
$pagetitle
);
$PAGE
->
set_heading
(
$pageheading
);
echo
$OUTPUT
->
header
();
echo
$OUTPUT
->
heading
(
fullname
(
$user
));
if
(
!
is_null
(
$mform
))
{
$mform
->
display
();
}
else
{
echo
$pagecontent
;
}
echo
$OUTPUT
->
footer
();
exit
;
}
}
$renderer
=
$PAGE
->
get_renderer
(
'core_enrol'
);
$userdetails
=
array
(
'picture'
=>
false
,
'userfullnamedisplay'
=>
false
);
// Get all the user names in a reasonable default order.
$allusernames
=
get_all_user_name_fields
(
false
,
null
,
null
,
null
,
true
);
// Initialise the variable for the user's names in the table header.
$usernameheader
=
null
;
// Get the alternative full name format for users with the viewfullnames capability.
$fullusernames
=
$CFG
->
alternativefullnameformat
;
// If fullusernames is empty or accidentally set to language then fall back to default of just first and last name.
if
(
$fullusernames
==
'language'
||
empty
(
$fullusernames
))
{
// Set $a variables to return 'firstname' and 'lastname'.
$a
=
new
stdClass
();
$a
->
firstname
=
'firstname'
;
$a
->
lastname
=
'lastname'
;
// Getting the fullname display will ensure that the order in the language file is maintained.
$usernameheader
=
explode
(
' '
,
get_string
(
'fullnamedisplay'
,
null
,
$a
));
}
else
{
// If everything is as expected then put them in the order specified by the alternative full name format setting.
$usernameheader
=
order_in_string
(
$allusernames
,
$fullusernames
);
}
// Loop through each name and return the language string.
foreach
(
$usernameheader
as
$key
=>
$username
)
{
$userdetails
[
$username
]
=
get_string
(
$username
);
}
$extrafields
=
get_extra_user_fields
(
$context
);
foreach
(
$extrafields
as
$field
)
{
$userdetails
[
$field
]
=
get_user_field_name
(
$field
);
}
$fields
=
array
(
'userdetails'
=>
$userdetails
,
'lastcourseaccess'
=>
get_string
(
'lastcourseaccess'
),
'role'
=>
get_string
(
'roles'
,
'role'
),
'group'
=>
get_string
(
'groups'
,
'group'
),
'enrol'
=>
get_string
(
'enrolmentinstances'
,
'enrol'
)
);
// Remove hidden fields if the user has no access
if
(
!
has_capability
(
'moodle/course:viewhiddenuserfields'
,
$context
))
{
$hiddenfields
=
array_flip
(
explode
(
','
,
$CFG
->
hiddenuserfields
));
if
(
isset
(
$hiddenfields
[
'lastaccess'
]))
{
unset
(
$fields
[
'lastcourseaccess'
]);
}
if
(
isset
(
$hiddenfields
[
'groups'
]))
{
unset
(
$fields
[
'group'
]);
}
}
$filterform
=
new
enrol_users_filter_form
(
'users.php'
,
array
(
'manager'
=>
$manager
,
'id'
=>
$id
,
'newcourse'
=>
$newcourse
),
'get'
,
''
,
array
(
'id'
=>
'filterform'
));
$filterform
->
set_data
(
array
(
'search'
=>
$search
,
'ifilter'
=>
$filter
,
'role'
=>
$role
,
'filtergroup'
=>
$fgroup
,
'status'
=>
$status
));
$table
->
set_fields
(
$fields
,
$renderer
);
$canassign
=
has_capability
(
'moodle/role:assign'
,
$manager
->
get_context
());
$users
=
$manager
->
get_users_for_display
(
$manager
,
$table
->
sort
,
$table
->
sortdirection
,
$table
->
page
,
$table
->
perpage
);
foreach
(
$users
as
$userid
=>&
$user
)
{
$user
[
'picture'
]
=
$OUTPUT
->
render
(
$user
[
'picture'
]);
$user
[
'role'
]
=
$renderer
->
user_roles_and_actions
(
$userid
,
$user
[
'roles'
],
$manager
->
get_assignable_roles
(),
$canassign
,
$PAGE
->
url
);
$user
[
'group'
]
=
$renderer
->
user_groups_and_actions
(
$userid
,
$user
[
'groups'
],
$manager
->
get_all_groups
(),
has_capability
(
'moodle/course:managegroups'
,
$manager
->
get_context
()),
$PAGE
->
url
);
$user
[
'enrol'
]
=
$renderer
->
user_enrolments_and_actions
(
$user
[
'enrolments'
]);
}
$table
->
set_total_users
(
$manager
->
get_total_users
());
$table
->
set_users
(
$users
);
$PAGE
->
set_title
(
$PAGE
->
course
->
fullname
.
': '
.
get_string
(
'totalenrolledusers'
,
'enrol'
,
$manager
->
get_total_users
()));
$PAGE
->
set_heading
(
$PAGE
->
title
);
echo
$OUTPUT
->
header
();
echo
$OUTPUT
->
heading
(
get_string
(
'enrolledusers'
,
'enrol'
));
echo
$renderer
->
render_course_enrolment_users_table
(
$table
,
$filterform
);
if
(
$newcourse
==
1
)
{
echo
$OUTPUT
->
single_button
(
new
moodle_url
(
'/course/view.php'
,
array
(
'id'
=>
$id
)),
get_string
(
'proceedtocourse'
,
'enrol'
),
'GET'
,
array
(
'class'
=>
'enrol-users-page-action'
));
}
echo
$OUTPUT
->
footer
();
lib/classes/analytics/target/no_teaching.php
View file @
4b50765b
...
@@ -74,7 +74,7 @@ class no_teaching extends \core_analytics\local\target\binary {
...
@@ -74,7 +74,7 @@ class no_teaching extends \core_analytics\local\target\binary {
$url
,
$pix
,
get_string
(
'view'
));
$url
,
$pix
,
get_string
(
'view'
));
if
(
has_capability
(
'moodle/course:enrolreview'
,
$sampledata
[
'context'
]))
{
if
(
has_capability
(
'moodle/course:enrolreview'
,
$sampledata
[
'context'
]))
{
$url
=
new
\
moodle_url
(
'/
enrol/users
.php'
,
array
(
'id'
=>
$course
->
id
));
$url
=
new
\
moodle_url
(
'/
user/index
.php'
,
array
(
'id'
=>
$course
->
id
));
$pix
=
new
\
pix_icon
(
'i/enrolusers'
,
get_string
(
'enrolledusers'
,
'enrol'
));
$pix
=
new
\
pix_icon
(
'i/enrolusers'
,
get_string
(
'enrolledusers'
,
'enrol'
));
$actions
[
'enrolusers'
]
=
new
\
core_analytics\prediction_action
(
'enrolusers'
,
$prediction
,
$actions
[
'enrolusers'
]
=
new
\
core_analytics\prediction_action
(
'enrolusers'
,
$prediction
,
$url
,
$pix
,
get_string
(
'enrolledusers'
,
'enrol'
));
$url
,
$pix
,
get_string
(
'enrolledusers'
,
'enrol'
));
...
...
lib/classes/event/user_enrolment_created.php
View file @
4b50765b
...
@@ -75,7 +75,7 @@ class user_enrolment_created extends base {
...
@@ -75,7 +75,7 @@ class user_enrolment_created extends base {
* @return \moodle_url
* @return \moodle_url
*/
*/
public
function
get_url
()
{
public
function
get_url
()
{
return
new
\
moodle_url
(
'/
enrol/users
.php'
,
array
(
'id'
=>
$this
->
courseid
));
return
new
\
moodle_url
(
'/
user/index
.php'
,
array
(
'id'
=>
$this
->
courseid
));
}
}
/**
/**
...
...
lib/classes/event/user_enrolment_deleted.php
View file @
4b50765b
...
@@ -76,7 +76,7 @@ class user_enrolment_deleted extends base {
...
@@ -76,7 +76,7 @@ class user_enrolment_deleted extends base {
* @return \moodle_url
* @return \moodle_url
*/
*/
public
function
get_url
()
{
public
function
get_url
()
{
return
new
\
moodle_url
(
'/
enrol/users
.php'
,
array
(
'id'
=>
$this
->
courseid
));
return
new
\
moodle_url
(
'/
user/index
.php'
,
array
(
'id'
=>
$this
->
courseid
));
}
}
/**
/**
...
...
lib/enrollib.php
View file @
4b50765b
...
@@ -436,7 +436,7 @@ function enrol_add_course_navigation(navigation_node $coursenode, $course) {
...
@@ -436,7 +436,7 @@ function enrol_add_course_navigation(navigation_node $coursenode, $course) {
if
(
$course
->
id
!=
SITEID
)
{
if
(
$course
->
id
!=
SITEID
)
{
// list all participants - allows assigning roles, groups, etc.
// list all participants - allows assigning roles, groups, etc.
if
(
has_capability
(
'moodle/course:enrolreview'
,
$coursecontext
))
{
if
(
has_capability
(
'moodle/course:enrolreview'
,
$coursecontext
))
{
$url
=
new
moodle_url
(
'/
enrol/users
.php'
,
array
(
'id'
=>
$course
->
id
));
$url
=
new
moodle_url
(
'/
user/index
.php'
,
array
(
'id'
=>
$course
->
id
));
$usersnode
->
add
(
get_string
(
'enrolledusers'
,
'enrol'
),
$url
,
navigation_node
::
TYPE_SETTING
,
null
,
'review'
,
new
pix_icon
(
'i/enrolusers'
,
''
));
$usersnode
->
add
(
get_string
(
'enrolledusers'
,
'enrol'
),
$url
,
navigation_node
::
TYPE_SETTING
,
null
,
'review'
,
new
pix_icon
(
'i/enrolusers'
,
''
));
}
}
...
@@ -2873,7 +2873,7 @@ abstract class enrol_plugin {
...
@@ -2873,7 +2873,7 @@ abstract class enrol_plugin {
$a
->
course
=
format_string
(
$course
->
fullname
,
true
,
array
(
'context'
=>
$context
));
$a
->
course
=
format_string
(
$course
->
fullname
,
true
,
array
(
'context'
=>
$context
));
$a
->
threshold
=
get_string
(
'numdays'
,
''
,
$instance
->
expirythreshold
/
(
60
*
60
*
24
));
$a
->
threshold
=
get_string
(
'numdays'
,
''
,
$instance
->
expirythreshold
/
(
60
*
60
*
24
));
$a
->
users
=
implode
(
"
\n
"
,
$users
);
$a
->
users
=
implode
(
"
\n
"
,
$users
);
$a
->
extendurl
=
(
string
)
new
moodle_url
(
'/
enrol/users
.php'
,
array
(
'id'
=>
$instance
->
courseid
));
$a
->
extendurl
=
(
string
)
new
moodle_url
(
'/
user/index
.php'
,
array
(
'id'
=>
$instance
->
courseid
));
$subject
=
get_string
(
'expirymessageenrollersubject'
,
'enrol_'
.
$name
,
$a
);
$subject
=
get_string
(
'expirymessageenrollersubject'
,
'enrol_'
.
$name
,
$a
);
$body
=
get_string
(
'expirymessageenrollerbody'
,
'enrol_'
.
$name
,
$a
);
$body
=
get_string
(
'expirymessageenrollerbody'
,
'enrol_'
.
$name
,
$a
);
...
...
Write
Preview
Supports
Markdown
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