我想在课程概述块中的课程标题下面显示课程摘要文本。我将如何访问和显示这些信息?
发布于 2014-05-16 12:53:01
似乎没有显示摘要的选项。
显示课程名称和链接的代码位于
function course_overview() in /blocks/course_overview/renderer.php如果你寻找$coursefullname,你应该会看到这样的东西
$coursefullname = format_string($course->fullname, true, $course->id);
$link = html_writer::link($courseurl, $coursefullname, $attributes);
$html .= $this->output->heading($link, 2, 'title');所以你需要添加这样的东西
$html .= $course->summary;$course>摘要通常包含大量html,如果您想删除它,则使用以下内容
$html .= format_string($course->summary);发布于 2014-11-14 17:42:18
如果前面的内容不起作用,请尝试如下:
global $DB;
$result = $DB->get_field("course", "summary", array("id"=>$course->id));
$html .= $result;在Moodle论坛上找到:https://moodle.org/mod/forum/discuss.php?d=148324#p1002697
发布于 2015-09-01 01:10:01
我将这段代码放在第112行后的一行(moodle 2.9.1) (/moodle/block/course_概括/renderer.php),您能试一下吗?
$link = html_writer::link($courseurl, $coursefullname, $attributes);
$html .= $this->output->heading($link, 2, 'title');
//start new code
global $DB;
$result = $DB->get_field("course", "summary", array("id"=>$course->id));
$modinfo = get_fast_modinfo(1);
$context = context_course::instance($course->id);
$section = $modinfo->get_section_info(1);
$summarytext = file_rewrite_pluginfile_urls($result,
'pluginfile.php',
$context->id,
'course',
'summary','');
$html .= $summarytext;
//end new code
} else {
$html .= $this->output->heading(html_writer::link(
new moodle_url('/auth/mnet/jump.php', array('hostid' => $course->hostid, 'wantsurl' => '/course/view.php?id='.$course->remoteid)),
format_string($course->shortname, true), $attributes) . ' (' . format_string($course->hostname) . ')', 2, 'title');
}
https://stackoverflow.com/questions/23690245
复制相似问题