Skip to content

Commit

Permalink
Merge pull request #135 from catalyst/issue-134
Browse files Browse the repository at this point in the history
Put site wide event creation option behind a capability
  • Loading branch information
danmarsden authored Oct 24, 2023
2 parents 366727c + 6b0c911 commit fd8ed62
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
10 changes: 10 additions & 0 deletions db/access.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,14 @@
'manager' => CAP_ALLOW
),
),

// Ability to create site-wide events.
'mod/facetoface:createsitewideevent' => [
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => [
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
]
]
);
1 change: 1 addition & 0 deletions lang/en/facetoface.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@
$string['facetoface:addinstance'] = 'Add instance';
$string['facetoface:addattendees'] = 'Add attendees to a Face-to-Face session';
$string['facetoface:configurecancellation'] = 'Allow the configuration of sign-up cancellations, upon adding/editing a face-to-face activity.';
$string['facetoface:createsitewideevent'] = 'Allow creation of site wide calendar events';
$string['facetoface:editsessions'] = 'Add, edit, copy and delete Face-to-Face sessions';
$string['facetoface:overbook'] = 'Sign-up to full sessions.';
$string['facetoface:removeattendees'] = 'Remove attendees from a Face-to-Face session';
Expand Down
12 changes: 8 additions & 4 deletions mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,15 @@ public function definition() {

$mform->addElement('header', 'calendaroptions', get_string('calendaroptions', 'facetoface'));

$calendaroptions = array(
$calendaroptions = [
F2F_CAL_NONE => get_string('none'),
F2F_CAL_COURSE => get_string('course'),
F2F_CAL_SITE => get_string('site')
);
F2F_CAL_COURSE => get_string('course')
];

if (has_capability('mod/facetoface:createsitewideevent', $this->context)) {
$calendaroptions[F2F_CAL_SITE] = get_string('site');
}

$mform->addElement('select', 'showoncalendar', get_string('showoncalendar', 'facetoface'), $calendaroptions);
$mform->setDefault('showoncalendar', F2F_CAL_COURSE);
$mform->addHelpButton('showoncalendar', 'showoncalendar', 'facetoface');
Expand Down
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2023100200;
$plugin->version = 2023101900;
$plugin->requires = 2022031500; // Requires 4.0
$plugin->release = '2022101900';
$plugin->component = 'mod_facetoface';
Expand Down

0 comments on commit fd8ed62

Please sign in to comment.