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


PHP cm_info::get_formatted_name方法代码示例

本文整理汇总了PHP中cm_info::get_formatted_name方法的典型用法代码示例。如果您正苦于以下问题:PHP cm_info::get_formatted_name方法的具体用法?PHP cm_info::get_formatted_name怎么用?PHP cm_info::get_formatted_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cm_info的用法示例。


在下文中一共展示了cm_info::get_formatted_name方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: navigation_add_activity

 /**
  * Adds a course module to the navigation node
  *
  * @param navigation_node $node
  * @param cm_info $cm
  * @return null|navigation_node
  */
 protected function navigation_add_activity(navigation_node $node, $cm)
 {
     if (!$cm->uservisible || !$cm->has_view()) {
         return null;
     }
     $activityname = $cm->get_formatted_name();
     $action = $cm->url;
     if ($cm->icon) {
         $icon = new pix_icon($cm->icon, $cm->modfullname, $cm->iconcomponent);
     } else {
         $icon = new pix_icon('icon', $cm->modfullname, $cm->modname);
     }
     $activitynode = $node->add($activityname, $action, navigation_node::TYPE_ACTIVITY, null, $cm->id, $icon);
     if (global_navigation::module_extends_navigation($cm->modname)) {
         $activitynode->nodetype = navigation_node::NODETYPE_BRANCH;
     } else {
         $activitynode->nodetype = navigation_node::NODETYPE_LEAF;
     }
     return $activitynode;
 }
开发者ID:etarrillo,项目名称:pvflbl,代码行数:27,代码来源:lib.php

示例2: course_section_cm_name_title

 /**
  * Renders html to display a name with the link to the course module on a course page
  *
  * If module is unavailable for user but still needs to be displayed
  * in the list, just the name is returned without a link
  *
  * Note, that for course modules that never have separate pages (i.e. labels)
  * this function return an empty string
  *
  * @param cm_info $mod
  * @param array $displayoptions
  * @return string
  */
 public function course_section_cm_name_title(cm_info $mod, $displayoptions = array())
 {
     $output = '';
     if (!$mod->uservisible && empty($mod->availableinfo)) {
         // Nothing to be displayed to the user.
         return $output;
     }
     $url = $mod->url;
     if (!$url) {
         return $output;
     }
     //Accessibility: for files get description via icon, this is very ugly hack!
     $instancename = $mod->get_formatted_name();
     $altname = $mod->modfullname;
     // Avoid unnecessary duplication: if e.g. a forum name already
     // includes the word forum (or Forum, etc) then it is unhelpful
     // to include that in the accessible description that is added.
     if (false !== strpos(core_text::strtolower($instancename), core_text::strtolower($altname))) {
         $altname = '';
     }
     // File type after name, for alphabetic lists (screen reader).
     if ($altname) {
         $altname = get_accesshide(' ' . $altname);
     }
     // For items which are hidden but available to current user
     // ($mod->uservisible), we show those as dimmed only if the user has
     // viewhiddenactivities, so that teachers see 'items which might not
     // be available to some students' dimmed but students do not see 'item
     // which is actually available to current student' dimmed.
     $linkclasses = '';
     $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) {
             $linkclasses .= ' dimmed';
             $textclasses .= ' dimmed_text';
             if ($conditionalhidden) {
                 $linkclasses .= ' conditionalhidden';
                 $textclasses .= ' conditionalhidden';
             }
             // Show accessibility note only if user can access the module himself.
             $accesstext = get_accesshide(get_string('hiddenfromstudents') . ':' . $mod->modfullname);
         }
     } else {
         $linkclasses .= ' dimmed';
         $textclasses .= ' dimmed_text';
     }
     // Get on-click attribute value if specified and decode the onclick - it
     // has already been encoded for display (puke).
     $onclick = htmlspecialchars_decode($mod->onclick, ENT_QUOTES);
     $groupinglabel = $mod->get_grouping_label($textclasses);
     // Display link itself.
     $activitylink = html_writer::empty_tag('img', array('src' => $mod->get_icon_url(), 'class' => 'iconlarge activityicon', 'alt' => ' ', 'role' => 'presentation')) . $accesstext . html_writer::tag('span', $instancename . $altname, array('class' => 'instancename'));
     if ($mod->uservisible) {
         $output .= html_writer::link($url, $activitylink, array('class' => $linkclasses, 'onclick' => $onclick)) . $groupinglabel;
     } else {
         // We may be displaying this just in order to show information
         // about visibility, without the actual link ($mod->uservisible)
         $output .= html_writer::tag('div', $activitylink, array('class' => $textclasses)) . $groupinglabel;
     }
     return $output;
 }
开发者ID:rushi963,项目名称:moodle,代码行数:77,代码来源:renderer.php

示例3: 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

示例4: course_section_cm_name

 /**
  * Renders html to display a name with the link to the course module on a course page
  *
  * If module is unavailable for user but still needs to be displayed
  * in the list, just the name is returned without a link
  *
  * Note, that for course modules that never have separate pages (i.e. labels)
  * this function return an empty string
  *
  * @param cm_info $mod
  * @param array $displayoptions
  * @return string
  */
 public function course_section_cm_name(cm_info $mod, $displayoptions = array())
 {
     global $CFG;
     $output = '';
     if (!$mod->uservisible && (empty($mod->showavailability) || empty($mod->availableinfo))) {
         // nothing to be displayed to the user
         return $output;
     }
     $url = $mod->get_url();
     if (!$url) {
         return $output;
     }
     //Accessibility: for files get description via icon, this is very ugly hack!
     $instancename = $mod->get_formatted_name();
     $altname = '';
     $altname = $mod->modfullname;
     // Avoid unnecessary duplication: if e.g. a forum name already
     // includes the word forum (or Forum, etc) then it is unhelpful
     // to include that in the accessible description that is added.
     if (false !== strpos(textlib::strtolower($instancename), textlib::strtolower($altname))) {
         $altname = '';
     }
     // File type after name, for alphabetic lists (screen reader).
     if ($altname) {
         $altname = get_accesshide(' ' . $altname);
     }
     $conditionalhidden = $this->is_cm_conditionally_hidden($mod);
     $accessiblebutdim = !$mod->visible || $conditionalhidden;
     $linkclasses = '';
     $accesstext = '';
     $textclasses = '';
     if ($accessiblebutdim) {
         $linkclasses .= ' dimmed';
         $textclasses .= ' dimmed_text';
         if ($conditionalhidden) {
             $linkclasses .= ' conditionalhidden';
             $textclasses .= ' conditionalhidden';
         }
         if ($mod->uservisible) {
             // show accessibility note only if user can access the module himself
             $accesstext = get_accesshide(get_string('hiddenfromstudents') . ': ');
         }
     }
     // Get on-click attribute value if specified and decode the onclick - it
     // has already been encoded for display (puke).
     $onclick = htmlspecialchars_decode($mod->get_on_click(), ENT_QUOTES);
     $groupinglabel = '';
     if (!empty($mod->groupingid) && has_capability('moodle/course:managegroups', context_course::instance($mod->course))) {
         $groupings = groups_get_all_groupings($mod->course);
         $groupinglabel = html_writer::tag('span', '(' . format_string($groupings[$mod->groupingid]->name) . ')', array('class' => 'groupinglabel ' . $textclasses));
     }
     // Display link itself.
     $activitylink = html_writer::empty_tag('img', array('src' => $mod->get_icon_url(), 'class' => 'iconlarge activityicon', 'alt' => $mod->modfullname)) . $accesstext . html_writer::tag('span', $instancename . $altname, array('class' => 'instancename'));
     if ($mod->uservisible) {
         $output .= html_writer::link($url, $activitylink, array('class' => $linkclasses, 'onclick' => $onclick)) . $groupinglabel;
     } else {
         // We may be displaying this just in order to show information
         // about visibility, without the actual link ($mod->uservisible)
         $output .= html_writer::tag('div', $activitylink, array('class' => $textclasses)) . $groupinglabel;
     }
     return $output;
 }
开发者ID:Burick,项目名称:moodle,代码行数:75,代码来源:renderer.php


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