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


PHP navigation_node::get_content方法代码示例

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


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

示例1: render_navigation_node

    protected function render_navigation_node(navigation_node $item) {
        $content = $item->get_content();
        $title = $item->get_title();
        if ($item->icon instanceof renderable && !$item->hideicon) {
            $icon = $this->render($item->icon);
            $content = $icon.$content; // use CSS for spacing of icons
        }
        if ($item->helpbutton !== null) {
            $content = trim($item->helpbutton).html_writer::tag('span', $content, array('class'=>'clearhelpbutton'));
        }
        if ($content === '') {
            return '';
        }
        if ($item->action instanceof action_link) {
            //TODO: to be replaced with something else
            $link = $item->action;
            if ($item->hidden) {
                $link->add_class('dimmed');
            }
            $content = $this->render($link);
        } else if ($item->action instanceof moodle_url) {
            $attributes = array();
            if ($title !== '') {
                $attributes['title'] = $title;
            }
            if ($item->hidden) {
                $attributes['class'] = 'dimmed_text';
            }
            $content = html_writer::link($item->action, $content, $attributes);

        } else if (is_string($item->action) || empty($item->action)) {
            $attributes = array();
            if ($title !== '') {
                $attributes['title'] = $title;
            }
            if ($item->hidden) {
                $attributes['class'] = 'dimmed_text';
            }
            $content = html_writer::tag('span', $content, $attributes);
        }
        return $content;
    }
开发者ID:roelmann,项目名称:Flexi_ii,代码行数:42,代码来源:renderers.php

示例2: render_navigation_node

    /**
     * Renders a navigation node object.
     *
     * @param navigation_node $item The navigation node to render.
     * @return string HTML fragment
     */
    protected function render_navigation_node(navigation_node $item) {
        $content = $item->get_content();
        $title = $item->get_title();
        if ($item->icon instanceof renderable && !$item->hideicon) {
            $icon = $this->render($item->icon);
            $content = $icon.$content; // use CSS for spacing of icons
        }
        if ($item->helpbutton !== null) {
            $content = trim($item->helpbutton).html_writer::tag('span', $content, array('class'=>'clearhelpbutton', 'tabindex'=>'0'));
        }
        if ($content === '') {
            return '';
        }
        if ($item->action instanceof action_link) {
            $link = $item->action;
            if ($item->hidden) {
                $link->add_class('dimmed');
            }
            if (!empty($content)) {
                // Providing there is content we will use that for the link content.
                $link->text = $content;
            }
            $content = $this->render($link);
        } else if ($item->action instanceof moodle_url) {
            $attributes = array();
            if ($title !== '') {
                $attributes['title'] = $title;
            }
            if ($item->hidden) {
                $attributes['class'] = 'dimmed_text';
            }
            $content = html_writer::link($item->action, $content, $attributes);

        } else if (is_string($item->action) || empty($item->action)) {
            $attributes = array('tabindex'=>'0'); //add tab support to span but still maintain character stream sequence.
            if ($title !== '') {
                $attributes['title'] = $title;
            }
            if ($item->hidden) {
                $attributes['class'] = 'dimmed_text';
            }
            $content = html_writer::tag('span', $content, $attributes);
        }
        return $content;
    }
开发者ID:afgal,项目名称:moodle-1,代码行数:51,代码来源:outputrenderers.php

示例3: render_navigation_node

 public function render_navigation_node(navigation_node $node, $expansionlimit, $hr = false)
 {
     $content = '';
     if ($node->children->count()) {
         $content = $this->navigation_node($node->children, array('class' => ''), $expansionlimit);
         $span = html_writer::tag('span', $node->get_content(), array('class' => 'item_name'));
         $p = html_writer::tag('p', $span, array('class' => 'cm_tree_item tree_item branch'));
         $collapsed = "";
         if (!in_array(md5($node->get_content()), $this->session)) {
             $collapsed = "collapsed";
         }
         $app = '';
         if ($hr) {
             $app = html_writer::empty_tag('hr');
         }
         $content = html_writer::tag('li', $app . $p . $content, array('class' => "type_system depth_2 contains_branch {$collapsed}"));
     }
     return $content;
 }
开发者ID:edwinphillips,项目名称:moodle-block_course_menu,代码行数:19,代码来源:renderer.php


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