本文整理汇总了PHP中format_base::course_content_header方法的典型用法代码示例。如果您正苦于以下问题:PHP format_base::course_content_header方法的具体用法?PHP format_base::course_content_header怎么用?PHP format_base::course_content_header使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类format_base
的用法示例。
在下文中一共展示了format_base::course_content_header方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: course_content_header
/**
* Course-specific information to be output immediately above content on any course page
*
* See {@link format_base::course_header()} for usage
*
* @return null|renderable null for no output or object with data for plugin renderer
*/
public function course_content_header()
{
global $PAGE;
// if we are on course view page for particular section, return 'back to parent' control
if ($this->get_viewed_section()) {
$section = $this->get_section($this->get_viewed_section());
if ($section->parent) {
$sr = $this->find_collapsed_parent($section->parent);
$text = new lang_string('backtosection', 'format_flexsections', $this->get_section_name($section->parent));
} else {
$sr = 0;
$text = new lang_string('backtocourse', 'format_flexsections', $this->get_course()->fullname);
}
$url = $this->get_view_url($section->section, array('sr' => $sr));
return new format_flexsections_edit_control('backto', $url, strip_tags($text));
}
// if we are on module view page, return 'back to section' control
if ($PAGE->context && $PAGE->context->contextlevel == CONTEXT_MODULE && $PAGE->cm) {
$sectionnum = $PAGE->cm->sectionnum;
if ($sectionnum) {
$text = new lang_string('backtosection', 'format_flexsections', $this->get_section_name($sectionnum));
} else {
$text = new lang_string('backtocourse', 'format_flexsections', $this->get_course()->fullname);
}
return new format_flexsections_edit_control('backto', $this->get_view_url($sectionnum), strip_tags($text));
}
return parent::course_content_header();
}