本文整理汇总了PHP中coursecat::get_courses方法的典型用法代码示例。如果您正苦于以下问题:PHP coursecat::get_courses方法的具体用法?PHP coursecat::get_courses怎么用?PHP coursecat::get_courses使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类coursecat
的用法示例。
在下文中一共展示了coursecat::get_courses方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: coursecat_category_content
/**
* Returns HTML to display the subcategories and courses in the given category
*
* This method is re-used by AJAX to expand content of not loaded category
*
* @param coursecat_helper $chelper various display options
* @param coursecat $coursecat
* @param int $depth depth of the category in the current tree
* @return string
*/
protected function coursecat_category_content(coursecat_helper $chelper, $coursecat, $depth)
{
$content = '';
// Subcategories
//$content .= $this->coursecat_subcategories($chelper, $coursecat, $depth);
// AUTO show courses: Courses will be shown expanded if this is not nested category,
// and number of courses no bigger than $CFG->courseswithsummarieslimit.
$showcoursesauto = $chelper->get_show_courses() == self::COURSECAT_SHOW_COURSES_AUTO;
if ($showcoursesauto && $depth) {
// this is definitely collapsed mode
$chelper->set_show_courses(self::COURSECAT_SHOW_COURSES_COLLAPSED);
}
// Courses
if ($chelper->get_show_courses() > core_course_renderer::COURSECAT_SHOW_COURSES_COUNT) {
$courses = array();
if (!$chelper->get_courses_display_option('nodisplay')) {
$courses = $coursecat->get_courses($chelper->get_courses_display_options());
}
if ($viewmoreurl = $chelper->get_courses_display_option('viewmoreurl')) {
// the option for 'View more' link was specified, display more link (if it is link to category view page, add category id)
if ($viewmoreurl->compare(new moodle_url('/local/template_course/index.php'), URL_MATCH_BASE)) {
$chelper->set_courses_display_option('viewmoreurl', new moodle_url($viewmoreurl, array('categoryid' => $coursecat->id)));
}
}
$content .= $this->coursecat_courses($chelper, $courses, $coursecat->get_courses_count());
}
if ($showcoursesauto) {
// restore the show_courses back to AUTO
$chelper->set_show_courses(self::COURSECAT_SHOW_COURSES_AUTO);
}
return $content;
}