|
|
@ -137,6 +137,49 @@ class enrol_apply_plugin extends enrol_plugin { |
|
|
|
return $icons; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Is it possible to hide/show enrol instance via standard UI? |
|
|
|
* |
|
|
|
* @param stdClass $instance |
|
|
|
* @return bool |
|
|
|
*/ |
|
|
|
public function can_hide_show_instance($instance) { |
|
|
|
$context = context_course::instance($instance->courseid); |
|
|
|
return has_capability('enrol/apply:config', $context); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Is it possible to delete enrol instance via standard UI? |
|
|
|
* |
|
|
|
* @param stdClass $instance |
|
|
|
* @return bool |
|
|
|
*/ |
|
|
|
|
|
|
|
public function can_delete_instance($instance) { |
|
|
|
$context = context_course::instance($instance->courseid); |
|
|
|
return has_capability('enrol/apply:config', $context); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Sets up navigation entries. |
|
|
|
* |
|
|
|
* @param stdClass $instancesnode |
|
|
|
* @param stdClass $instance |
|
|
|
* @return void |
|
|
|
*/ |
|
|
|
public function add_course_navigation($instancesnode, stdClass $instance) { |
|
|
|
if ($instance->enrol !== 'apply') { |
|
|
|
throw new coding_exception('Invalid enrol instance type!'); |
|
|
|
} |
|
|
|
|
|
|
|
$context = context_course::instance($instance->courseid); |
|
|
|
if (has_capability('enrol/apply:config', $context)) { |
|
|
|
$managelink = new moodle_url('/enrol/apply/edit.php', array('courseid'=>$instance->courseid, 'id'=>$instance->id)); |
|
|
|
$instancesnode->add($this->get_instance_name($instance), $managelink, navigation_node::TYPE_SETTING); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public function get_user_enrolment_actions(course_enrolment_manager $manager, $ue) { |
|
|
|
$actions = array(); |
|
|
|
$context = $manager->get_context(); |
|
|
|