Rename marketplace plugin to meetletacbfree (mdl_modules.name limit + CI table prefixes)
This commit is contained in:
@@ -17,12 +17,12 @@
|
||||
/**
|
||||
* Role-based feature access matrix (site + activity).
|
||||
*
|
||||
* @package mod_meetletacbmarketplace
|
||||
* @package mod_meetletacbfree
|
||||
* @copyright 2026 MeetLet
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace mod_meetletacbmarketplace\local;
|
||||
namespace mod_meetletacbfree\local;
|
||||
|
||||
use context;
|
||||
use stdClass;
|
||||
@@ -42,7 +42,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* AND optional site/activity visibility switch when mapped.
|
||||
*
|
||||
* Do NOT grant access via Moodle capabilities alone (except the base
|
||||
* mod/meetletacbmarketplace:view gate to open the activity page).
|
||||
* mod/meetletacbfree:view gate to open the activity page).
|
||||
* Do NOT special-case admins/hosts outside the matrix.
|
||||
*
|
||||
* Adding a new feature:
|
||||
@@ -245,7 +245,7 @@ class featureaccess {
|
||||
* Whether the activity form may show a per-activity access matrix.
|
||||
*/
|
||||
public static function activity_override_enabled(): bool {
|
||||
$raw = get_config('meetletacbmarketplace', 'activity_featureaccess');
|
||||
$raw = get_config('meetletacbfree', 'activity_featureaccess');
|
||||
if ($raw === false || $raw === null || $raw === '') {
|
||||
return true;
|
||||
}
|
||||
@@ -302,7 +302,7 @@ class featureaccess {
|
||||
* @return array<string,array<string,int>>
|
||||
*/
|
||||
public static function site_matrix(): array {
|
||||
$raw = get_config('meetletacbmarketplace', 'featureaccess');
|
||||
$raw = get_config('meetletacbfree', 'featureaccess');
|
||||
if ($raw === false || $raw === null || $raw === '') {
|
||||
return self::builtin_defaults();
|
||||
}
|
||||
@@ -374,7 +374,7 @@ class featureaccess {
|
||||
* Use this for tabs, buttons, links, and web-service actions.
|
||||
*/
|
||||
public static function allowed(string $feature, context $context, ?stdClass $activity = null, ?int $userid = null): bool {
|
||||
if (!\mod_meetletacbmarketplace\registration\manager::is_registered()) {
|
||||
if (!\mod_meetletacbfree\registration\manager::is_registered()) {
|
||||
return false;
|
||||
}
|
||||
$vis = self::visibility_feature($feature);
|
||||
@@ -388,21 +388,21 @@ class featureaccess {
|
||||
* Require allowed() or throw.
|
||||
*/
|
||||
public static function require_feature(string $feature, context $context, ?stdClass $activity = null): void {
|
||||
\mod_meetletacbmarketplace\registration\manager::require_registered();
|
||||
\mod_meetletacbfree\registration\manager::require_registered();
|
||||
if (self::allowed($feature, $context, $activity)) {
|
||||
return;
|
||||
}
|
||||
$vis = self::visibility_feature($feature);
|
||||
if ($vis !== null && !config::show_feature($vis, $activity)) {
|
||||
throw new \moodle_exception('featuredisabled', 'meetletacbmarketplace');
|
||||
throw new \moodle_exception('featuredisabled', 'meetletacbfree');
|
||||
}
|
||||
throw new \moodle_exception('nopermissions', 'error', '', self::feature_label($feature));
|
||||
}
|
||||
|
||||
public static function feature_label(string $feature): string {
|
||||
$key = 'accessfeature_' . $feature;
|
||||
if (get_string_manager()->string_exists($key, 'meetletacbmarketplace')) {
|
||||
return get_string($key, 'meetletacbmarketplace');
|
||||
if (get_string_manager()->string_exists($key, 'meetletacbfree')) {
|
||||
return get_string($key, 'meetletacbfree');
|
||||
}
|
||||
return $feature;
|
||||
}
|
||||
@@ -430,7 +430,7 @@ class featureaccess {
|
||||
}
|
||||
|
||||
protected static function view_capability_for_context(context $context): string {
|
||||
return 'mod/meetletacbmarketplace:view';
|
||||
return 'mod/meetletacbfree:view';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -444,14 +444,14 @@ class featureaccess {
|
||||
$matrix = self::normalize($matrix);
|
||||
$roles = self::role_labels();
|
||||
$features = self::feature_labels();
|
||||
$strtogglerow = get_string('accessmatrix_toggle_row', 'meetletacbmarketplace');
|
||||
$strtogglecol = get_string('accessmatrix_toggle_col', 'meetletacbmarketplace');
|
||||
$strall = get_string('accessmatrix_all', 'meetletacbmarketplace');
|
||||
$strtogglerow = get_string('accessmatrix_toggle_row', 'meetletacbfree');
|
||||
$strtogglecol = get_string('accessmatrix_toggle_col', 'meetletacbfree');
|
||||
$strall = get_string('accessmatrix_all', 'meetletacbfree');
|
||||
|
||||
$html = \html_writer::start_div('meetlet-access-matrix', ['data-meetlet-access-matrix' => '1']);
|
||||
$html .= \html_writer::start_tag('table', ['class' => 'generaltable meetlet-access-table']);
|
||||
|
||||
$head = \html_writer::tag('th', get_string('accessrole', 'meetletacbmarketplace'));
|
||||
$head = \html_writer::tag('th', get_string('accessrole', 'meetletacbfree'));
|
||||
foreach ($features as $fkey => $flabel) {
|
||||
$toggle = \html_writer::tag('button', s($strall), [
|
||||
'type' => 'button',
|
||||
|
||||
Reference in New Issue
Block a user