forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-68076 core: new admin settings related to user feedback
- Loading branch information
Showing
4 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |