function context_to_string_translator::generate_context_to_string_array in Quiz 6.5
Same name and namespace in other branches
- 6.6 includes/moodle/lib/questionlib.php \context_to_string_translator::generate_context_to_string_array()
1 call to context_to_string_translator::generate_context_to_string_array()
- context_to_string_translator::context_to_string_translator in includes/
moodle/ lib/ questionlib.php
File
- includes/
moodle/ lib/ questionlib.php, line 2145
Class
Code
function generate_context_to_string_array($contexts) {
if (!$this->contexttostringarray) {
$catno = 1;
foreach ($contexts as $context) {
switch ($context->contextlevel) {
case CONTEXT_MODULE:
$contextstring = 'module';
break;
case CONTEXT_COURSE:
$contextstring = 'course';
break;
case CONTEXT_COURSECAT:
$contextstring = "cat{$catno}";
$catno++;
break;
case CONTEXT_SYSTEM:
$contextstring = 'system';
break;
}
$this->contexttostringarray[$context->id] = $contextstring;
}
}
}