mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
Merge branch 'MDL-38035-master' of git://github.com/sammarshallou/moodle
This commit is contained in:
commit
1d962a1984
@ -54,6 +54,7 @@ class editsection_form extends moodleform {
|
||||
|
||||
$mform = $this->_form;
|
||||
$course = $this->_customdata['course'];
|
||||
$context = context_course::instance($course->id);
|
||||
|
||||
if (!empty($CFG->enableavailability)) {
|
||||
$mform->addElement('header', 'availabilityconditions', get_string('availabilityconditions', 'condition'));
|
||||
@ -65,7 +66,6 @@ class editsection_form extends moodleform {
|
||||
$options[0] = get_string('none');
|
||||
if ($groupings = $DB->get_records('groupings', array('courseid' => $course->id))) {
|
||||
foreach ($groupings as $grouping) {
|
||||
$context = context_course::instance($course->id);
|
||||
$options[$grouping->id] = format_string(
|
||||
$grouping->name, true, array('context' => $context));
|
||||
}
|
||||
@ -122,7 +122,7 @@ class editsection_form extends moodleform {
|
||||
|
||||
// Conditions based on user fields
|
||||
$operators = condition_info::get_condition_user_field_operators();
|
||||
$useroptions = condition_info::get_condition_user_fields();
|
||||
$useroptions = condition_info::get_condition_user_fields(array('context' => $context));
|
||||
asort($useroptions);
|
||||
|
||||
$useroptions = array(0 => $strcondnone) + $useroptions;
|
||||
|
@ -564,7 +564,8 @@ abstract class moodleform_mod extends moodleform {
|
||||
|
||||
// Conditions based on user fields
|
||||
$operators = condition_info::get_condition_user_field_operators();
|
||||
$useroptions = condition_info::get_condition_user_fields();
|
||||
$useroptions = condition_info::get_condition_user_fields(
|
||||
array('context' => $this->context));
|
||||
asort($useroptions);
|
||||
|
||||
$useroptions = array(0 => $strnone) + $useroptions;
|
||||
|
@ -599,12 +599,17 @@ abstract class condition_info_base {
|
||||
}
|
||||
|
||||
/**
|
||||
* The user fields we can compare
|
||||
* Returns list of user fields that can be compared.
|
||||
*
|
||||
* @global moodle_database $DB
|
||||
* If you specify $formatoptions, then format_string will be called on the
|
||||
* custom field names. This is necessary for multilang support to work so
|
||||
* you should include this parameter unless you are going to format the
|
||||
* text later.
|
||||
*
|
||||
* @param array $formatoptions Passed to format_string if provided
|
||||
* @return array Associative array from user field constants to display name
|
||||
*/
|
||||
public static function get_condition_user_fields() {
|
||||
public static function get_condition_user_fields($formatoptions = null) {
|
||||
global $DB;
|
||||
|
||||
$userfields = array(
|
||||
@ -630,7 +635,11 @@ abstract class condition_info_base {
|
||||
// Go through the custom profile fields now
|
||||
if ($user_info_fields = $DB->get_records('user_info_field')) {
|
||||
foreach ($user_info_fields as $field) {
|
||||
$userfields[$field->id] = $field->name;
|
||||
if ($formatoptions) {
|
||||
$userfields[$field->id] = format_string($field->name, true, $formatoptions);
|
||||
} else {
|
||||
$userfields[$field->id] = $field->name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user