Skip to content

Commit

Permalink
MDL-68076 core: new admin settings related to user feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
rezaies committed Jun 3, 2020
1 parent 2e324c1 commit 2cbe9ea
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 0 deletions.
3 changes: 3 additions & 0 deletions admin/settings/top.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
'admin'));
$ADMIN->add('root', $moodleservices);

$userfeedback = new admin_settingpage('userfeedback', new lang_string('feedbacksettings', 'admin'));
$ADMIN->add('root', $userfeedback);

if ($hassiteconfig) {
$optionalsubsystems = new admin_settingpage('optionalsubsystems', new lang_string('advancedfeatures', 'admin'));
$ADMIN->add('root', $optionalsubsystems);
Expand Down
49 changes: 49 additions & 0 deletions admin/settings/userfeedback.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?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/>.

/**
* This file contains call to feedback settings
*
* @package core
* @copyright 2020 Shamim Rezaie <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

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

if ($hassiteconfig) {

$userfeedback->add(new admin_setting_configcheckbox('enableuserfeedback',
new lang_string('enableuserfeedback', 'admin'),
new lang_string('enableuserfeedback_desc', 'admin'), 1, 1, 0));

$options = [
core_userfeedback::REMIND_AFTER_UPGRADE => new lang_string('userfeedbackafterupgrade', 'admin'),
core_userfeedback::REMIND_PERIODICALLY => new lang_string('userfeedbackperiodically', 'admin'),
core_userfeedback::REMIND_NEVER => new lang_string('never'),
];
$userfeedback->add(new admin_setting_configselect('userfeedback_nextreminder',
new lang_string('userfeedbacknextreminder', 'admin'),
new lang_string('userfeedbacknextreminder_desc', 'admin'), 1, $options));
$userfeedback->hide_if('userfeedback_nextreminder', 'enableuserfeedback');

$userfeedback->add(new admin_setting_configtext('userfeedback_remindafter',
new lang_string('userfeedbackremindafter', 'admin'),
new lang_string('userfeedbackremindafter_desc', 'admin'), 90, PARAM_INT));
$userfeedback->hide_if('userfeedback_remindafter', 'enableuserfeedback');
$userfeedback->hide_if('userfeedback_remindafter', 'userfeedback_nextreminder', 'eq', 3);

}
9 changes: 9 additions & 0 deletions lang/en/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,8 @@
$string['enablesearchareas'] = 'Enable search areas';
$string['enablestats'] = 'Enable statistics';
$string['enabletrusttext'] = 'Enable trusted content';
$string['enableuserfeedback'] = 'Enable feedback about Moodle';
$string['enableuserfeedback_desc'] = 'If enabled, a \'Give feedback\' link is displayed in a Dashboard alert and in the footer for users to give feedback about the Moodle LMS to Moodle HQ. The Dashboard alert also has a \'Remind me later\' option.';
$string['enablewebservices'] = 'Enable web services';
$string['enablewsdocumentation'] = 'Web services documentation';
$string['enrolinstancedefaults'] = 'Enrolment instance defaults';
Expand Down Expand Up @@ -578,6 +580,7 @@
$string['extendedusernamechars'] = 'Allow extended characters in usernames';
$string['extramemorylimit'] = 'Extra PHP memory limit';
$string['fatalsessionautostart'] = '<p>Serious configuration error detected, please notify server administrator.</p><p> To operate properly, Moodle requires that administrator changes PHP settings.</p><p><code>session.auto_start</code> must be set to <code>off</code>.</p><p>This setting is controlled by editing <code>php.ini</code>, Apache/IIS <br />configuration or <code>.htaccess</code> file on the server.</p>';
$string['feedbacksettings'] = 'Feedback settings';
$string['filescleanupperiod'] = 'Clean up trash pool files';
$string['filescleanupperiod_help'] = 'How often trash pool files are deleted. These are files that are associated with a context that no longer exists, for example when a course is deleted. Please note: This setting can result in missing files in a course which is backed up, deleted and then restored if the setting \'Include files\' (backup_auto_files) in \'Automated backup settings\' is disabled.';
$string['fileconversioncleanuptask'] = 'Cleanup of temporary records for file conversions.';
Expand Down Expand Up @@ -1413,6 +1416,12 @@
$string['user'] = 'User';
$string['userbulk'] = 'Bulk user actions';
$string['userbulkdownload'] = 'Export users as';
$string['userfeedbackafterupgrade'] = 'After every major upgrade';
$string['userfeedbacknextreminder'] = 'Next feedback reminder';
$string['userfeedbacknextreminder_desc'] = 'When should we ask the user to give feedback again?';
$string['userfeedbackperiodically'] = 'Periodically';
$string['userfeedbackremindafter'] = 'Show reminder after';
$string['userfeedbackremindafter_desc'] = 'Remind users again to give feedback after the given number of days.';
$string['userimagesdisabled'] = 'Profile user images are disabled';
$string['userlist'] = 'Browse list of users';
$string['userdefaultpreferences'] = 'User default preferences';
Expand Down
48 changes: 48 additions & 0 deletions lib/classes/userfeedback.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?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/>.

/**
* This file contains the core_userfeedback class
*
* @package core
* @copyright 2020 Shamim Rezaie <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

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

/**
* This Class contains helper functions for user feedback functionality.
*
* @copyright 2020 Shamim Rezaie <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class core_userfeedback {
/**
* @var int Ask user to give feedback a few days after each major upgrade.
*/
public const REMIND_AFTER_UPGRADE = 1;

/**
* @var int Ask user to give feedback periodically.
*/
public const REMIND_PERIODICALLY = 2;

/**
* @var int Do not ask user to give feedback.
*/
public const REMIND_NEVER = 3;
}

0 comments on commit 2cbe9ea

Please sign in to comment.