Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 2175... Línea 2175...
2175
    if ($ignorefilters || ($isvaliduser && calendar_show_event_type(CALENDAR_EVENT_USER, $user))) {
2175
    if ($ignorefilters || ($isvaliduser && calendar_show_event_type(CALENDAR_EVENT_USER, $user))) {
2176
        $userid = $user->id;
2176
        $userid = $user->id;
2177
    }
2177
    }
Línea 2178... Línea 2178...
2178
 
2178
 
2179
    if (!empty($courseeventsfrom) && (calendar_show_event_type(CALENDAR_EVENT_GROUP, $user) || $ignorefilters)) {
-
 
2180
 
-
 
2181
        if (count($courseeventsfrom) == 1) {
-
 
2182
            $course = reset($courseeventsfrom);
2179
    if (!empty($courseeventsfrom) && (calendar_show_event_type(CALENDAR_EVENT_GROUP, $user) || $ignorefilters)) {
2183
            if (has_any_capability($allgroupscaps, \context_course::instance($course->id))) {
2180
        if (!empty($CFG->calendar_adminseesall) && has_any_capability($allgroupscaps, \context_system::instance())) {
2184
                $coursegroups = groups_get_all_groups($course->id, 0, 0, 'g.id');
2181
            $group = true;
2185
                $group = array_keys($coursegroups);
2182
        } else if ($isvaliduser) {
2186
            }
2183
            $groupids = [];
2187
        }
2184
            foreach ($courseeventsfrom as $courseid => $course) {
2188
        if ($group === false) {
2185
                if ($course->groupmode != NOGROUPS || !$course->groupmodeforce) {
2189
            if (!empty($CFG->calendar_adminseesall) && has_any_capability($allgroupscaps, \context_system::instance())) {
2186
                    if (has_all_capabilities($allgroupscaps, \context_course::instance($courseid))) {
2190
                $group = true;
2187
                        // User can access all groups in this course.
2191
            } else if ($isvaliduser) {
2188
                        // Get all the groups in this course.
2192
                $groupids = array();
2189
                        $coursegroups = groups_get_all_groups($course->id, 0, 0, 'g.id');
-
 
2190
                        $groupids = array_merge($groupids, array_keys($coursegroups));
2193
                foreach ($courseeventsfrom as $courseid => $course) {
2191
                    } else {
2194
                    if ($course->groupmode != NOGROUPS || !$course->groupmodeforce) {
2192
                        // User can only access their own groups.
2195
                        // If this course has groups, show events from all of those related to the current user.
2193
                        // Get the groups the user is in.
2196
                        $coursegroups = groups_get_user_groups($course->id, $user->id);
2194
                        $coursegroups = groups_get_user_groups($course->id, $user->id);
2197
                        $groupids = array_merge($groupids, $coursegroups['0']);
2195
                        $groupids = array_merge($groupids, $coursegroups['0']);
2198
                    }
2196
                    }
-
 
2197
                }
2199
                }
2198
            }
2200
                if (!empty($groupids)) {
2199
            if (!empty($groupids)) {
2201
                    $group = $groupids;
-
 
2202
                }
2200
                $group = $groupids;
2203
            }
2201
            }
2204
        }
2202
        }
2205
    }
2203
    }
2206
    if (empty($courses)) {
2204
    if (empty($courses)) {