Skip to content

Commit

Permalink
MDL-59756 enrol: Swap positions of edit and unenrol actions
Browse files Browse the repository at this point in the history
  • Loading branch information
junpataleta committed Aug 11, 2017
1 parent f3625f4 commit 00aba5e
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 30 deletions.
12 changes: 6 additions & 6 deletions enrol/flatfile/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,18 +130,18 @@ public function get_user_enrolment_actions(course_enrolment_manager $manager, $u
$instance = $ue->enrolmentinstance;
$params = $manager->get_moodlepage()->url->params();
$params['ue'] = $ue->id;
if ($this->allow_unenrol_user($instance, $ue) && has_capability("enrol/flatfile:unenrol", $context)) {
$url = new moodle_url('/enrol/unenroluser.php', $params);
$actionparams = array('class' => 'unenrollink', 'rel' => $ue->id, 'data-action' => ENROL_ACTION_UNENROL);
$actions[] = new user_enrolment_action(new pix_icon('t/delete', get_string('unenrol', 'enrol')),
get_string('unenrol', 'enrol'), $url, $actionparams);
}
if ($this->allow_manage($instance) && has_capability("enrol/flatfile:manage", $context)) {
$url = new moodle_url('/enrol/editenrolment.php', $params);
$actionparams = array('class' => 'editenrollink', 'rel' => $ue->id, 'data-action' => ENROL_ACTION_EDIT);
$actions[] = new user_enrolment_action(new pix_icon('t/edit', get_string('editenrolment', 'enrol')),
get_string('editenrolment', 'enrol'), $url, $actionparams);
}
if ($this->allow_unenrol_user($instance, $ue) && has_capability("enrol/flatfile:unenrol", $context)) {
$url = new moodle_url('/enrol/unenroluser.php', $params);
$actionparams = array('class' => 'unenrollink', 'rel' => $ue->id, 'data-action' => ENROL_ACTION_UNENROL);
$actions[] = new user_enrolment_action(new pix_icon('t/delete', get_string('unenrol', 'enrol')),
get_string('unenrol', 'enrol'), $url, $actionparams);
}
return $actions;
}

Expand Down
12 changes: 6 additions & 6 deletions enrol/lti/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -390,18 +390,18 @@ public function get_user_enrolment_actions(course_enrolment_manager $manager, $u
$instance = $ue->enrolmentinstance;
$params = $manager->get_moodlepage()->url->params();
$params['ue'] = $ue->id;
if ($this->allow_manage($instance) && has_capability("enrol/lti:manage", $context)) {
$url = new moodle_url('/enrol/editenrolment.php', $params);
$actionparams = array('class' => 'editenrollink', 'rel' => $ue->id, 'data-action' => ENROL_ACTION_EDIT);
$actions[] = new user_enrolment_action(new pix_icon('t/edit', get_string('editenrolment', 'enrol')),
get_string('editenrolment', 'enrol'), $url, $actionparams);
}
if ($this->allow_unenrol_user($instance, $ue) && has_capability("enrol/lti:unenrol", $context)) {
$url = new moodle_url('/enrol/unenroluser.php', $params);
$actionparams = array('class' => 'unenrollink', 'rel' => $ue->id, 'data-action' => ENROL_ACTION_UNENROL);
$actions[] = new user_enrolment_action(new pix_icon('t/delete', get_string('unenrol', 'enrol')),
get_string('unenrol', 'enrol'), $url, $actionparams);
}
if ($this->allow_manage($instance) && has_capability("enrol/lti:manage", $context)) {
$url = new moodle_url('/enrol/editenrolment.php', $params);
$actionparams = array('class' => 'editenrollink', 'rel' => $ue->id, 'data-action' => ENROL_ACTION_EDIT);
$actions[] = new user_enrolment_action(new pix_icon('t/edit', get_string('editenrolment', 'enrol')),
get_string('editenrolment', 'enrol'), $url, $actionparam);
}
return $actions;
}

Expand Down
12 changes: 6 additions & 6 deletions enrol/manual/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -374,18 +374,18 @@ public function get_user_enrolment_actions(course_enrolment_manager $manager, $u
$instance = $ue->enrolmentinstance;
$params = $manager->get_moodlepage()->url->params();
$params['ue'] = $ue->id;
if ($this->allow_unenrol_user($instance, $ue) && has_capability("enrol/manual:unenrol", $context)) {
$url = new moodle_url('/enrol/unenroluser.php', $params);
$actionparams = array('class' => 'unenrollink', 'rel' => $ue->id, 'data-action' => ENROL_ACTION_UNENROL);
$actions[] = new user_enrolment_action(new pix_icon('t/delete', get_string('unenrol', 'enrol')),
get_string('unenrol', 'enrol'), $url, $actionparams);
}
if ($this->allow_manage($instance) && has_capability("enrol/manual:manage", $context)) {
$url = new moodle_url('/enrol/editenrolment.php', $params);
$actionparams = array('class' => 'editenrollink', 'rel' => $ue->id, 'data-action' => ENROL_ACTION_EDIT);
$actions[] = new user_enrolment_action(new pix_icon('t/edit', get_string('editenrolment', 'enrol')),
get_string('editenrolment', 'enrol'), $url, $actionparams);
}
if ($this->allow_unenrol_user($instance, $ue) && has_capability("enrol/manual:unenrol", $context)) {
$url = new moodle_url('/enrol/unenroluser.php', $params);
$actionparams = array('class' => 'unenrollink', 'rel' => $ue->id, 'data-action' => ENROL_ACTION_UNENROL);
$actions[] = new user_enrolment_action(new pix_icon('t/delete', get_string('unenrol', 'enrol')),
get_string('unenrol', 'enrol'), $url, $actionparams);
}
return $actions;
}

Expand Down
12 changes: 6 additions & 6 deletions enrol/paypal/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,18 +289,18 @@ public function get_user_enrolment_actions(course_enrolment_manager $manager, $u
$instance = $ue->enrolmentinstance;
$params = $manager->get_moodlepage()->url->params();
$params['ue'] = $ue->id;
if ($this->allow_unenrol($instance) && has_capability("enrol/paypal:unenrol", $context)) {
$url = new moodle_url('/enrol/unenroluser.php', $params);
$actionparams = array('class' => 'unenrollink', 'rel' => $ue->id, 'data-action' => ENROL_ACTION_UNENROL);
$actions[] = new user_enrolment_action(new pix_icon('t/delete', get_string('unenrol', 'enrol')),
get_string('unenrol', 'enrol'), $url, $actionparams);
}
if ($this->allow_manage($instance) && has_capability("enrol/paypal:manage", $context)) {
$url = new moodle_url('/enrol/editenrolment.php', $params);
$actionparams = array('class' => 'editenrollink', 'rel' => $ue->id, 'data-action' => ENROL_ACTION_EDIT);
$actions[] = new user_enrolment_action(new pix_icon('t/edit', get_string('editenrolment', 'enrol')),
get_string('editenrolment', 'enrol'), $url, $actionparams);
}
if ($this->allow_unenrol($instance) && has_capability("enrol/paypal:unenrol", $context)) {
$url = new moodle_url('/enrol/unenroluser.php', $params);
$actionparams = array('class' => 'unenrollink', 'rel' => $ue->id, 'data-action' => ENROL_ACTION_UNENROL);
$actions[] = new user_enrolment_action(new pix_icon('t/delete', get_string('unenrol', 'enrol')),
get_string('unenrol', 'enrol'), $url, $actionparams);
}
return $actions;
}

Expand Down
12 changes: 6 additions & 6 deletions enrol/self/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -534,18 +534,18 @@ public function get_user_enrolment_actions(course_enrolment_manager $manager, $u
$instance = $ue->enrolmentinstance;
$params = $manager->get_moodlepage()->url->params();
$params['ue'] = $ue->id;
if ($this->allow_unenrol($instance) && has_capability("enrol/self:unenrol", $context)) {
$url = new moodle_url('/enrol/unenroluser.php', $params);
$actionparams = array('class' => 'unenrollink', 'rel' => $ue->id, 'data-action' => ENROL_ACTION_UNENROL);
$actions[] = new user_enrolment_action(new pix_icon('t/delete', get_string('unenrol', 'enrol')),
get_string('unenrol', 'enrol'), $url, $actionparams);
}
if ($this->allow_manage($instance) && has_capability("enrol/self:manage", $context)) {
$url = new moodle_url('/enrol/editenrolment.php', $params);
$actionparams = array('class' => 'editenrollink', 'rel' => $ue->id, 'data-action' => ENROL_ACTION_EDIT);
$actions[] = new user_enrolment_action(new pix_icon('t/edit', get_string('editenrolment', 'enrol')),
get_string('editenrolment', 'enrol'), $url, $actionparams);
}
if ($this->allow_unenrol($instance) && has_capability("enrol/self:unenrol", $context)) {
$url = new moodle_url('/enrol/unenroluser.php', $params);
$actionparams = array('class' => 'unenrollink', 'rel' => $ue->id, 'data-action' => ENROL_ACTION_UNENROL);
$actions[] = new user_enrolment_action(new pix_icon('t/delete', get_string('unenrol', 'enrol')),
get_string('unenrol', 'enrol'), $url, $actionparams);
}
return $actions;
}

Expand Down

0 comments on commit 00aba5e

Please sign in to comment.