Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 147... Línea 147...
147
    }
147
    }
Línea 148... Línea 148...
148
 
148
 
149
    /**
149
    /**
150
     * Display the name of the profile field.
150
     * Display the name of the profile field.
-
 
151
     *
151
     *
152
     * @param bool $escape
152
     * @return string
153
     * @return string
153
     */
154
     */
154
    public function display_name(): string {
155
    public function display_name(bool $escape = true): string {
-
 
156
        return format_string($this->field->name, true, [
155
        return format_text($this->field->name, FORMAT_MOODLE, [
157
            'context' => context_system::instance(),
156
            'para' => false,
158
            'escape' => $escape,
157
        ]);
159
        ]);
Línea 158... Línea 160...
158
    }
160
    }
159
 
161
 
Línea 468... Línea 470...
468
                    return true;
470
                    return true;
469
                } else if ($this->userid == $USER->id) {
471
                } else if ($this->userid == $USER->id) {
470
                    return true;
472
                    return true;
471
                } else if ($this->userid > 0) {
473
                } else if ($this->userid > 0) {
472
                    return has_capability('moodle/user:viewalldetails', $context);
474
                    return has_capability('moodle/user:viewalldetails', $context);
-
 
475
                } else if ($context instanceof context_course) {
-
 
476
                    return has_capability('moodle/site:viewuseridentity', $context);
473
                } else {
477
                } else {
-
 
478
                    // Fall back to the global course object.
474
                    $coursecontext = context_course::instance($COURSE->id);
479
                    $coursecontext = context_course::instance($COURSE->id);
475
                    return has_capability('moodle/site:viewuseridentity', $coursecontext);
480
                    return has_capability('moodle/site:viewuseridentity', $coursecontext);
476
                }
481
                }
477
            case PROFILE_VISIBLE_ALL:
482
            case PROFILE_VISIBLE_ALL:
478
                return true;
483
                return true;
Línea 1006... Línea 1011...
1006
        foreach ($category as $field) {
1011
        foreach ($category as $field) {
1007
            $categoryname = $field->get_category_name();
1012
            $categoryname = $field->get_category_name();
1008
            if (!isset($data[$categoryname])) {
1013
            if (!isset($data[$categoryname])) {
1009
                $data[$categoryname] = [];
1014
                $data[$categoryname] = [];
1010
            }
1015
            }
1011
            $data[$categoryname][$field->inputname] = $field->field->name;
1016
            $data[$categoryname][$field->inputname] = $field->display_name();
1012
        }
1017
        }
1013
    }
1018
    }
1014
    return $data;
1019
    return $data;
1015
}
1020
}