Initial commit: MeetLet Adobe Connect Bridge Marketplace edition (Moodle plugin).
Single-plugin source tree for mod_meetletacbmarketplace — admin, licensing, and marketplace integration. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
|
||||
/**
|
||||
* Ajax endpoint: activate / recheck / deactivate MeetLet site registration.
|
||||
*
|
||||
* @package mod_meetletacbmarketplace
|
||||
* @copyright 2026 MeetLet
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
define('AJAX_SCRIPT', true);
|
||||
|
||||
require_once('../../../config.php');
|
||||
|
||||
use mod_meetletacbmarketplace\registration\error_mapper;
|
||||
use mod_meetletacbmarketplace\registration\manager;
|
||||
use mod_meetletacbmarketplace\registration\registration_exception;
|
||||
|
||||
require_login();
|
||||
require_capability('moodle/site:config', context_system::instance());
|
||||
require_sesskey();
|
||||
|
||||
$action = required_param('action', PARAM_ALPHA);
|
||||
$apiurl = optional_param('registration_api_url', '', PARAM_URL);
|
||||
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
|
||||
try {
|
||||
if ($apiurl !== '') {
|
||||
set_config(manager::CONFIG_API_URL, rtrim($apiurl, '/'), 'meetletacbmarketplace');
|
||||
}
|
||||
|
||||
if ($action === 'activate') {
|
||||
manager::activate();
|
||||
echo json_encode([
|
||||
'success' => true,
|
||||
'message' => get_string('registration_activated', 'meetletacbmarketplace'),
|
||||
'summary' => manager::status_summary(),
|
||||
]);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($action === 'recheck' || $action === 'refresh' || $action === 'validate') {
|
||||
manager::recheck(true);
|
||||
echo json_encode([
|
||||
'success' => true,
|
||||
'message' => get_string('registration_rechecked', 'meetletacbmarketplace'),
|
||||
'summary' => manager::status_summary(),
|
||||
]);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($action === 'deactivate') {
|
||||
manager::deactivate();
|
||||
echo json_encode([
|
||||
'success' => true,
|
||||
'message' => get_string('registration_deactivated', 'meetletacbmarketplace'),
|
||||
'summary' => manager::status_summary(),
|
||||
]);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($action === 'status') {
|
||||
echo json_encode([
|
||||
'success' => true,
|
||||
'summary' => manager::status_summary(),
|
||||
]);
|
||||
exit;
|
||||
}
|
||||
|
||||
throw new moodle_exception('invalidparameter');
|
||||
} catch (Throwable $e) {
|
||||
$ex = registration_exception::from_throwable($e);
|
||||
$mapped = error_mapper::from_exception($ex);
|
||||
echo json_encode([
|
||||
'success' => false,
|
||||
'error' => $mapped['message'] ?? $ex->get_api_message(),
|
||||
'error_code' => $ex->get_error_code(),
|
||||
'request_id' => $ex->get_request_id(),
|
||||
'summary' => manager::status_summary(),
|
||||
]);
|
||||
}
|
||||
Reference in New Issue
Block a user