Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 49... Línea 49...
49
        $help = '';
49
        $help = '';
50
        $sm = get_string_manager();
50
        $sm = get_string_manager();
51
        if ($sm->string_exists('modulename_help', $modname)) {
51
        if ($sm->string_exists('modulename_help', $modname)) {
52
            $help = get_string('modulename_help', $modname);
52
            $help = get_string('modulename_help', $modname);
53
            if ($sm->string_exists('modulename_link', $modname)) { // Link to further info in Moodle docs.
53
            if ($sm->string_exists('modulename_link', $modname)) { // Link to further info in Moodle docs.
-
 
54
                // The link is stored in a language file but should not be translated, use value for English.
54
                $link = get_string('modulename_link', $modname);
55
                $link = $sm->get_string('modulename_link', $modname, null, 'en');
-
 
56
                // The text 'More help' and other strings should be in the current language.
55
                $linktext = get_string('morehelp');
57
                $linktext = get_string('morehelp');
56
                $arialabel = get_string('morehelpaboutmodule', '', get_string('modulename', $modname));
58
                $arialabel = get_string('morehelpaboutmodule', '', get_string('modulename', $modname));
57
                $doclink = $OUTPUT->doc_link($link, $linktext, true, ['aria-label' => $arialabel]);
59
                $doclink = $OUTPUT->doc_link($link, $linktext, true, ['aria-label' => $arialabel]);
58
                $help .= \html_writer::tag('div', $doclink, ['class' => 'helpdoclink']);
60
                $help .= \html_writer::tag('div', $doclink, ['class' => 'helpdoclink']);
59
            }
61
            }
Línea 107... Línea 109...
107
        }
109
        }
108
        return $contentitems;
110
        return $contentitems;
109
    }
111
    }
Línea 110... Línea 112...
110
 
112
 
-
 
113
    /**
-
 
114
     * Filter out any modules that are not to be rendered or managed on the course page.
-
 
115
     *
-
 
116
     * @param content_item[] $contentitems items to be filtered
-
 
117
     * @return content_item[] filtered items
-
 
118
     */
-
 
119
    private static function filter_out_items_not_to_be_displayed(array $contentitems): array {
-
 
120
        return array_filter($contentitems, static function ($module) {
-
 
121
            [, $name] = core_component::normalize_component($module->get_component_name());
-
 
122
            return \course_modinfo::is_mod_type_visible_on_course($name);
-
 
123
        });
-
 
124
    }
-
 
125
 
111
    /**
126
    /**
112
     * Find all the available content items, not restricted to course or user.
127
     * Find all the available content items, not restricted to course or user.
113
     *
128
     *
114
     * @return array the array of content items.
129
     * @return array the array of content items.
115
     */
130
     */
Línea 165... Línea 180...
165
            } else {
180
            } else {
166
                // Neither callback was found, so just use the default module content item.
181
                // Neither callback was found, so just use the default module content item.
167
                $return[] = $contentitem;
182
                $return[] = $contentitem;
168
            }
183
            }
169
        }
184
        }
-
 
185
 
-
 
186
        // These module types are not to be rendered to the course page.
170
        return $return;
187
        return self::filter_out_items_not_to_be_displayed($return);
171
    }
188
    }
Línea 172... Línea 189...
172
 
189
 
173
    /**
190
    /**
174
     * Get the list of potential content items for the given course.
191
     * Get the list of potential content items for the given course.
Línea 239... Línea 256...
239
                // Callback was not found, so just use the default module content item.
256
                // Callback was not found, so just use the default module content item.
240
                $return[] = $contentitem;
257
                $return[] = $contentitem;
241
            }
258
            }
242
        }
259
        }
Línea -... Línea 260...
-
 
260
 
243
 
261
        // These module types are not to be rendered to the course page.
244
        return $return;
262
        return self::filter_out_items_not_to_be_displayed($return);
245
    }
263
    }