Merge branch 'MDL-86062-500' of https://github.com/andrewnicols/moodle into MOODLE_500_STABLE

This commit is contained in:
Huong Nguyen
2025-07-31 10:20:57 +07:00
2 changed files with 17 additions and 22 deletions
+1 -18
View File
@@ -45,24 +45,7 @@ define('CHOICE_DISPLAY_VERTICAL', '1');
define('CHOICE_EVENT_TYPE_OPEN', 'open');
define('CHOICE_EVENT_TYPE_CLOSE', 'close');
/** @global array $CHOICE_PUBLISH */
global $CHOICE_PUBLISH;
$CHOICE_PUBLISH = array (CHOICE_PUBLISH_ANONYMOUS => get_string('publishanonymous', 'choice'),
CHOICE_PUBLISH_NAMES => get_string('publishnames', 'choice'));
/** @global array $CHOICE_SHOWRESULTS */
global $CHOICE_SHOWRESULTS;
$CHOICE_SHOWRESULTS = array (CHOICE_SHOWRESULTS_NOT => get_string('publishnot', 'choice'),
CHOICE_SHOWRESULTS_AFTER_ANSWER => get_string('publishafteranswer', 'choice'),
CHOICE_SHOWRESULTS_AFTER_CLOSE => get_string('publishafterclose', 'choice'),
CHOICE_SHOWRESULTS_ALWAYS => get_string('publishalways', 'choice'));
/** @global array $CHOICE_DISPLAY */
global $CHOICE_DISPLAY;
$CHOICE_DISPLAY = array (CHOICE_DISPLAY_HORIZONTAL => get_string('displayhorizontal', 'choice'),
CHOICE_DISPLAY_VERTICAL => get_string('displayvertical','choice'));
/// Standard functions /////////////////////////////////////////////////////////
// Standard functions.
/**
* @global object
+16 -4
View File
@@ -8,7 +8,7 @@ require_once ($CFG->dirroot.'/course/moodleform_mod.php');
class mod_choice_mod_form extends moodleform_mod {
function definition() {
global $CFG, $CHOICE_SHOWRESULTS, $CHOICE_PUBLISH, $CHOICE_DISPLAY, $DB;
global $CFG, $DB;
$mform =& $this->_form;
@@ -26,7 +26,10 @@ class mod_choice_mod_form extends moodleform_mod {
$this->standard_intro_elements(get_string('description', 'choice'));
$mform->addElement('select', 'display', get_string("displaymode","choice"), $CHOICE_DISPLAY);
$mform->addElement('select', 'display', get_string("displaymode", "choice"), [
CHOICE_DISPLAY_HORIZONTAL => get_string('displayhorizontal', 'choice'),
CHOICE_DISPLAY_VERTICAL => get_string('displayvertical', 'choice'),
]);
//-------------------------------------------------------------------------------
$mform->addElement('header', 'optionhdr', get_string('options', 'choice'));
@@ -94,9 +97,18 @@ class mod_choice_mod_form extends moodleform_mod {
//-------------------------------------------------------------------------------
$mform->addElement('header', 'resultshdr', get_string('results', 'choice'));
$mform->addElement('select', 'showresults', get_string("publish", "choice"), $CHOICE_SHOWRESULTS);
$mform->addElement('select', 'showresults', get_string("publish", "choice"), [
CHOICE_SHOWRESULTS_NOT => get_string('publishnot', 'choice'),
CHOICE_SHOWRESULTS_AFTER_ANSWER => get_string('publishafteranswer', 'choice'),
CHOICE_SHOWRESULTS_AFTER_CLOSE => get_string('publishafterclose', 'choice'),
CHOICE_SHOWRESULTS_ALWAYS => get_string('publishalways', 'choice'),
]);
$mform->addElement('select', 'publish', get_string("privacy", "choice"), [
CHOICE_PUBLISH_ANONYMOUS => get_string('publishanonymous', 'choice'),
CHOICE_PUBLISH_NAMES => get_string('publishnames', 'choice'),
]);
$mform->addElement('select', 'publish', get_string("privacy", "choice"), $CHOICE_PUBLISH);
$mform->hideIf('publish', 'showresults', 'eq', 0);
$mform->addElement('selectyesno', 'showunanswered', get_string("showunanswered", "choice"));