本文整理汇总了PHP中cm_info::get_formatted_content方法的典型用法代码示例。如果您正苦于以下问题:PHP cm_info::get_formatted_content方法的具体用法?PHP cm_info::get_formatted_content怎么用?PHP cm_info::get_formatted_content使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cm_info
的用法示例。
在下文中一共展示了cm_info::get_formatted_content方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: course_section_cm_text
/**
* Renders html to display the module content on the course page (i.e. text of the labels)
*
* @param cm_info $mod
* @param array $displayoptions
* @return string
*/
public function course_section_cm_text(cm_info $mod, $displayoptions = array())
{
$output = '';
if (!$mod->uservisible && empty($mod->availableinfo)) {
// nothing to be displayed to the user
return $output;
}
$content = $mod->get_formatted_content(array('overflowdiv' => true, 'noclean' => true));
$accesstext = '';
$textclasses = '';
if ($mod->uservisible) {
$conditionalhidden = $this->is_cm_conditionally_hidden($mod);
$accessiblebutdim = (!$mod->visible || $conditionalhidden) && has_capability('moodle/course:viewhiddenactivities', $mod->context);
if ($accessiblebutdim) {
$textclasses .= ' dimmed_text';
if ($conditionalhidden) {
$textclasses .= ' conditionalhidden';
}
// Show accessibility note only if user can access the module himself.
$accesstext = get_accesshide(get_string('hiddenfromstudents') . ':' . $mod->modfullname);
}
} else {
$textclasses .= ' dimmed_text';
}
if ($mod->url) {
if ($content) {
// If specified, display extra content after link.
$output = html_writer::tag('div', $content, array('class' => trim('contentafterlink ' . $textclasses)));
}
} else {
$groupinglabel = $mod->get_grouping_label($textclasses);
// No link, so display only content.
$output = html_writer::tag('div', $accesstext . $content . $groupinglabel, array('class' => 'contentwithoutlink ' . $textclasses));
}
return $output;
}
示例2: get_print_section_cm_text
/**
* Obtains shared data that is used in print_section when displaying a
* course-module entry.
*
* Deprecated. Instead of:
* list($content, $name) = get_print_section_cm_text($cm, $course);
* use:
* $content = $cm->get_formatted_content(array('overflowdiv' => true, 'noclean' => true));
* $name = $cm->get_formatted_name();
*
* @deprecated since 2.5
* @see cm_info::get_formatted_content()
* @see cm_info::get_formatted_name()
*
* This data is also used in other areas of the code.
* @param cm_info $cm Course-module data (must come from get_fast_modinfo)
* @param object $course (argument not used)
* @return array An array with the following values in this order:
* $content (optional extra content for after link),
* $instancename (text of link)
*/
function get_print_section_cm_text(cm_info $cm, $course)
{
debugging('Function get_print_section_cm_text() is deprecated. Please use ' . 'cm_info::get_formatted_content() and cm_info::get_formatted_name()', DEBUG_DEVELOPER);
return array($cm->get_formatted_content(array('overflowdiv' => true, 'noclean' => true)), $cm->get_formatted_name());
}
示例3: course_section_cm_text
/**
* Renders html to display the module content on the course page (i.e. text of the labels)
*
* @param cm_info $mod
* @param array $displayoptions
* @return string
*/
public function course_section_cm_text(cm_info $mod, $displayoptions = array())
{
$output = '';
if (!$mod->uservisible && (empty($mod->showavailability) || empty($mod->availableinfo))) {
// nothing to be displayed to the user
return $output;
}
$content = $mod->get_formatted_content(array('overflowdiv' => true, 'noclean' => true));
$conditionalhidden = $this->is_cm_conditionally_hidden($mod);
$accessiblebutdim = !$mod->visible || $conditionalhidden;
$textclasses = '';
$accesstext = '';
if ($accessiblebutdim) {
$textclasses .= ' dimmed_text';
if ($conditionalhidden) {
$textclasses .= ' conditionalhidden';
}
if ($mod->uservisible) {
// show accessibility note only if user can access the module himself
$accesstext = get_accesshide(get_string('hiddenfromstudents') . ': ');
}
}
if ($mod->get_url()) {
if ($content) {
// If specified, display extra content after link.
$output = html_writer::tag('div', $content, array('class' => trim('contentafterlink ' . $textclasses)));
}
} else {
// No link, so display only content.
$output = html_writer::tag('div', $accesstext . $content, array('class' => $textclasses));
}
return $output;
}