Browse Source

Merge pull request #82 from andil-elearning/allow_manage

Implements enrolments management
SABERES_37_STABLE
Flotter Totte 7 years ago
committed by GitHub
parent
commit
580ad76357
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      db/access.php
  2. 1
      lang/en/enrol_apply.php
  3. 8
      lib.php

10
db/access.php

@ -49,6 +49,16 @@ $capabilities = array(
)
),
/* Manage enrolments of users. */
'enrol/apply:manage' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => array(
'manager' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
)
),
/* Unenrol a user */
'enrol/apply:unenrol' => array(
'captype' => 'write',

1
lang/en/enrol_apply.php

@ -81,6 +81,7 @@ $string['status'] = 'Allow Course enrol confirmation';
$string['confirmenrol'] = 'Manage application';
$string['apply:config'] = 'Configure apply enrol instances';
$string['apply:manage'] = 'Manage user enrolments';
$string['apply:manageapplications'] = 'Manage apply enrolment';
$string['apply:unenrol'] = 'Cancel users from the course';
$string['apply:unenrolself'] = 'Cancel self from the course';

8
lib.php

@ -59,6 +59,10 @@ class enrol_apply_plugin extends enrol_plugin {
}
return parent::allow_unenrol_user($instance, $ue);
}
public function allow_manage(stdClass $instance) {
// Users with manage cap may tweak period and status.
return true;
}
/**
* Returns link to page which may be used to add new instance of enrolment plugin in course.
* Multiple instances supported.
@ -213,6 +217,10 @@ class enrol_apply_plugin extends enrol_plugin {
$url,
array('class' => 'unenrollink', 'rel' => $ue->id));
}
if ($this->allow_manage($instance) && has_capability("enrol/apply:manage", $context)) {
$url = new moodle_url('/enrol/editenrolment.php', $params);
$actions[] = new user_enrolment_action(new pix_icon('t/edit', ''), get_string('edit'), $url, array('class'=>'editenrollink', 'rel'=>$ue->id));
}
return $actions;
}

Loading…
Cancel
Save