Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 11
Línea 60... Línea 60...
60
     * @return array
60
     * @return array
61
     */
61
     */
62
    public function get_options(): array {
62
    public function get_options(): array {
63
        $optionconfig = $this->get_configdata_property('options');
63
        $optionconfig = $this->get_configdata_property('options');
64
        if ($optionconfig) {
64
        if ($optionconfig) {
-
 
65
            $context = $this->get_handler()->get_configuration_context();
-
 
66
            $options = array_map(
-
 
67
                fn(string $option) => format_string($option, true, ['context' => $context]),
65
            $options = preg_split("/\s*\n\s*/", trim($optionconfig));
68
                preg_split("/\s*\n\s*/", trim($optionconfig), -1, PREG_SPLIT_NO_EMPTY),
-
 
69
            );
66
        } else {
70
        } else {
67
            $options = array();
71
            $options = array();
68
        }
72
        }
69
        return array_merge([''], $options);
73
        return array_merge([''], $options);
70
    }
74
    }
Línea 109... Línea 113...
109
    public function course_grouping_format_values($values): array {
113
    public function course_grouping_format_values($values): array {
110
        $options = $this->get_options();
114
        $options = $this->get_options();
111
        $ret = [];
115
        $ret = [];
112
        foreach ($values as $value) {
116
        foreach ($values as $value) {
113
            if (isset($options[$value])) {
117
            if (isset($options[$value])) {
114
                $ret[$value] = format_string($options[$value]);
118
                $ret[$value] = $options[$value];
115
            }
119
            }
116
        }
120
        }
117
        $ret[BLOCK_MYOVERVIEW_CUSTOMFIELD_EMPTY] = get_string('nocustomvalue', 'block_myoverview',
121
        $ret[BLOCK_MYOVERVIEW_CUSTOMFIELD_EMPTY] = get_string('nocustomvalue', 'block_myoverview',
118
            $this->get_formatted_name());
122
            $this->get_formatted_name());
119
        return $ret;
123
        return $ret;