diff --git a/lang/en/condition.php b/lang/en/condition.php index 5851e6e1f61..a888d8c7747 100644 --- a/lang/en/condition.php +++ b/lang/en/condition.php @@ -47,7 +47,10 @@ $string['completion_fail'] = 'must be complete with fail grade'; $string['completion_incomplete'] = 'must not be marked complete'; $string['completion_pass'] = 'must be complete with pass grade'; $string['configenableavailability'] = 'When enabled, this lets you set conditions (based on date, grade, or completion) that control whether an activity or resource can be accessed.'; +$string['contains'] = 'contains'; +$string['doesnotcontain'] = 'doesn\'t contain'; $string['enableavailability'] = 'Enable conditional access'; +$string['endswith'] = 'ends with'; $string['fielddeclaredmultipletimes'] = 'You can not declare the same field more than once per activity.'; $string['grade_atleast'] = 'must be at least'; $string['gradecondition'] = 'Grade condition'; @@ -62,6 +65,9 @@ $string['grade_upto'] = 'and less than'; $string['gradeitembutnolimits'] = 'You must enter an upper or lower limit, or both.'; $string['gradelimitsbutnoitem'] = 'You must choose a grade item.'; $string['gradesmustbenumeric'] = 'The minimum and maximum grades must be numeric (or blank).'; +$string['isempty'] = 'is empty'; +$string['isequalto'] = 'is equal to'; +$string['isnotempty'] = 'is not empty'; $string['none'] = '(none)'; $string['notavailableyet'] = 'Not available yet'; $string['requires_completion_0'] = 'Not available unless the activity {$a} is incomplete.'; @@ -76,13 +82,20 @@ $string['requires_grade_any'] = 'Not available until you have a grade in libdir.'/completionlib.php'); @@ -583,12 +587,13 @@ abstract class condition_info_base { */ public static function get_condition_user_field_operators() { return array( - OP_CONTAINS => get_string('contains', 'filters'), - OP_DOES_NOT_CONTAIN => get_string('doesnotcontain', 'filters'), - OP_IS_EQUAL_TO => get_string('isequalto', 'filters'), - OP_STARTS_WITH => get_string('startswith', 'filters'), - OP_ENDS_WITH => get_string('endswith', 'filters'), - OP_IS_EMPTY => get_string('isempty', 'filters') + OP_CONTAINS => get_string('contains', 'condition'), + OP_DOES_NOT_CONTAIN => get_string('doesnotcontain', 'condition'), + OP_IS_EQUAL_TO => get_string('isequalto', 'condition'), + OP_STARTS_WITH => get_string('startswith', 'condition'), + OP_ENDS_WITH => get_string('endswith', 'condition'), + OP_IS_EMPTY => get_string('isempty', 'condition'), + OP_IS_NOT_EMPTY => get_string('isnotempty', 'condition'), ); } @@ -801,9 +806,9 @@ abstract class condition_info_base { foreach ($this->item->conditionsfield as $field => $details) { $a = new stdclass; $a->field = $details->fieldname; - $a->operator = get_string($details->operator, 'filters'); + $a->operator = get_string($details->operator, 'condition'); $a->value = $details->value; - $information .= get_string('requires_user_field_restriction', 'condition', $a) . ' '; + $information .= get_string('requires_user_field', 'condition', $a) . ' '; } } @@ -1008,9 +1013,8 @@ abstract class condition_info_base { $available = false; $a = new stdClass(); $a->field = $details->fieldname; - $a->operator = get_string($details->operator, 'filters'); $a->value = $details->value; - $information .= get_string('requires_user_field_restriction', 'condition', $a) . ' '; + $information .= get_string('requires_user_field_'.$details->operator, 'condition', $a) . ' '; } } } @@ -1224,6 +1228,11 @@ abstract class condition_info_base { $fieldconditionmet = false; } break; + case OP_IS_NOT_EMPTY: // is not empty + if (empty($uservalue)) { + $fieldconditionmet = false; + } + break; } return $fieldconditionmet; }