当前位置: 首页>>代码示例>>PHP>>正文


PHP cm_info::get_formatted_content方法代码示例

本文整理汇总了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;
 }
开发者ID:rushi963,项目名称:moodle,代码行数:43,代码来源:renderer.php

示例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());
}
开发者ID:Hirenvaghasiya,项目名称:moodle,代码行数:26,代码来源:deprecatedlib.php

示例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;
 }
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:40,代码来源:renderer.php


注:本文中的cm_info::get_formatted_content方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。