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


PHP navigation_node::add方法代码示例

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


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

示例1: booktool_wordimport_extend_settings_navigation

/**
 * Adds module specific settings to the settings block
 *
 * @param settings_navigation $settings The settings navigation object
 * @param navigation_node $node The node to add module settings to
 */
function booktool_wordimport_extend_settings_navigation(settings_navigation $settings, navigation_node $node)
{
    global $PAGE;
    if ($PAGE->cm->modname !== 'book') {
        return;
    }
    $params = $PAGE->url->params();
    if (empty($params['id']) and empty($params['cmid'])) {
        return;
    }
    if (empty($PAGE->cm->context)) {
        $PAGE->cm->context = get_context_module::instance($PAGE->cm->instance);
    }
    if (!(has_capability('booktool/wordimport:import', $PAGE->cm->context) and has_capability('mod/book:edit', $PAGE->cm->context))) {
        return;
    }
    // Configure Import link, and pass in the current chapter in case the insert should happen here rather than at the end.
    $url1 = new moodle_url('/mod/book/tool/wordimport/index.php', array('id' => $PAGE->cm->id, 'chapterid' => $params['chapterid']));
    $node->add(get_string('importchapters', 'booktool_wordimport'), $url1, navigation_node::TYPE_SETTING, null, null, new pix_icon('f/document', '', 'moodle', array('class' => 'iconsmall', 'title' => '')));
    // Configure Export links for book and current chapter.
    $url2 = new moodle_url('/mod/book/tool/wordimport/index.php', array('id' => $PAGE->cm->id, 'action' => 'export'));
    $node->add(get_string('exportbook', 'booktool_wordimport'), $url2, navigation_node::TYPE_SETTING, null, null, new pix_icon('f/document', '', 'moodle', array('class' => 'iconsmall', 'title' => '')));
    $url3 = new moodle_url('/mod/book/tool/wordimport/index.php', array('id' => $PAGE->cm->id, 'chapterid' => $params['chapterid'], 'action' => 'export'));
    $node->add(get_string('exportchapter', 'booktool_wordimport'), $url3, navigation_node::TYPE_SETTING, null, null, new pix_icon('f/document', '', 'moodle', array('class' => 'iconsmall', 'title' => '')));
}
开发者ID:ecampbell,项目名称:moodle-booktool_wordimport,代码行数:31,代码来源:lib.php

示例2: report_outline_extend_navigation_user

/**
 * This function extends the course navigation with the report items
 *
 * @param navigation_node $navigation The navigation node to extend
 * @param stdClass $user
 * @param stdClass $course The course to object for the report
 */
function report_outline_extend_navigation_user($navigation, $user, $course)
{
    if (report_outline_can_access_user_report($user, $course)) {
        $url = new moodle_url('/report/outline/user.php', array('id' => $user->id, 'course' => $course->id, 'mode' => 'outline'));
        $navigation->add(get_string('outlinereport'), $url);
        $url = new moodle_url('/report/outline/user.php', array('id' => $user->id, 'course' => $course->id, 'mode' => 'complete'));
        $navigation->add(get_string('completereport'), $url);
    }
}
开发者ID:Hirenvaghasiya,项目名称:moodle,代码行数:16,代码来源:lib.php

示例3: report_loglive_extend_navigation_course

/**
 * This function extends the navigation with the report items
 *
 * @global stdClass $CFG
 * @global core_renderer $OUTPUT
 * @param navigation_node $navigation The navigation node to extend
 * @param stdClass        $course     The course to object for the report
 * @param context         $context    The context of the course
 */
function report_loglive_extend_navigation_course($navigation, $course, $context)
{
    if (has_capability('report/loglive:view', $context)) {
        $url = new moodle_url('/report/loglive/index.php', array('id' => $course->id));
        $navigation->add(get_string('pluginname', 'report_loglive'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/report', ''));
    }
}
开发者ID:evltuma,项目名称:moodle,代码行数:16,代码来源:lib.php

示例4: test_node_remove

 public function test_node_remove()
 {
     $this->setup_node();
     $remove1 = $this->node->add('child to remove 1', null, navigation_node::TYPE_CUSTOM, null, 'remove1');
     $remove2 = $this->node->add('child to remove 2', null, navigation_node::TYPE_CUSTOM, null, 'remove2');
     $remove3 = $remove2->add('child to remove 3', null, navigation_node::TYPE_CUSTOM, null, 'remove3');
     $this->assertInstanceOf('navigation_node', $remove1);
     $this->assertInstanceOf('navigation_node', $remove2);
     $this->assertInstanceOf('navigation_node', $remove3);
     $this->assertInstanceOf('navigation_node', $this->node->get('remove1'));
     $this->assertInstanceOf('navigation_node', $this->node->get('remove2'));
     $this->assertInstanceOf('navigation_node', $remove2->get('remove3'));
     // Remove element and make sure this is no longer a child.
     $this->assertTrue($remove1->remove());
     $this->assertFalse($this->node->get('remove1'));
     $this->assertFalse(in_array('remove1', $this->node->get_children_key_list(), true));
     // Make sure that we can insert element after removal.
     $insertelement = navigation_node::create('extra element 4', null, navigation_node::TYPE_CUSTOM, null, 'element4');
     $this->node->add_node($insertelement, 'remove2');
     $this->assertNotEmpty($this->node->get('element4'));
     // Remove more elements.
     $this->assertTrue($this->node->get('remove2')->remove());
     $this->assertFalse($this->node->get('remove2'));
     // Make sure that we can add element after removal.
     $this->node->add('extra element 5', null, navigation_node::TYPE_CUSTOM, null, 'element5');
     $this->assertNotEmpty($this->node->get('element5'));
     $this->assertTrue($remove2->get('remove3')->remove());
     $this->assertFalse($this->node->get('remove1'));
     $this->assertFalse($this->node->get('remove2'));
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:30,代码来源:navigationlib_test.php

示例5: engagement_report_extend_navigation

/**
 * This function extends the navigation with the report items
 *
 * @param navigation_node $navigation The navigation node to extend
 * @param stdClass $course The course to object for the report
 * @param stdClass $context The context of the course
 */
function engagement_report_extend_navigation($navigation, $course, $context)
{
    if (has_capability('report/engagement:view', $context)) {
        $url = new moodle_url('/course/report/engagement/index.php', array('id' => $course->id));
        $navigation->add(get_string('pluginname', 'coursereport_engagement'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/report', ''));
    }
}
开发者ID:netspotau,项目名称:moodle-coursereport_engagement,代码行数:14,代码来源:lib.php

示例6: booktool_print_extend_settings_navigation

/**
 * Adds module specific settings to the settings block
 *
 * @param settings_navigation $settings The settings navigation object
 * @param navigation_node $node The node to add module settings to
 */
function booktool_print_extend_settings_navigation(settings_navigation $settings, navigation_node $node)
{
    global $USER, $PAGE, $CFG, $DB, $OUTPUT;
    $params = $PAGE->url->params();
    if (empty($params['id']) or empty($params['chapterid'])) {
        return;
    }
    if (has_capability('booktool/print:print', $PAGE->cm->context)) {
        $url1 = new moodle_url('/mod/book/tool/print/index.php', array('id' => $params['id']));
        $url2 = new moodle_url('/mod/book/tool/print/index.php', array('id' => $params['id'], 'chapterid' => $params['chapterid']));
        $action = new action_link($url1, get_string('printbook', 'booktool_print'), new popup_action('click', $url1));
        $node->add(get_string('printbook', 'booktool_print'), $action, navigation_node::TYPE_SETTING, null, null, new pix_icon('book', '', 'booktool_print', array('class' => 'icon')));
        $action = new action_link($url2, get_string('printchapter', 'booktool_print'), new popup_action('click', $url2));
        $node->add(get_string('printchapter', 'booktool_print'), $action, navigation_node::TYPE_SETTING, null, null, new pix_icon('chapter', '', 'booktool_print', array('class' => 'icon')));
    }
}
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:22,代码来源:lib.php

示例7: report_configreports_extend_navigation_course

/**
 * This function extends the coursenavigation with the report items
 *
 * @param navigation_node $navigation The navigation node to extend
 * @param stdClass $course The course to object for the report
 * @param stdClass $context The context of the course
 */
function report_configreports_extend_navigation_course($navigation, $course, $context)
{
    if ($myreports = report_configreports_get_my_reports($course, $context)) {
        foreach ($myreports as $report) {
            $navigation->add($report['name'], $report['url'], navigation_node::TYPE_SETTING, null, null, new pix_icon('i/report', ''));
        }
    }
}
开发者ID:nickkoeppen,项目名称:moodle-report_configreports,代码行数:15,代码来源:lib.php

示例8: report_loglive_extend_navigation_course

/**
 * This function extends the navigation with the report items
 *
 * @global stdClass $CFG
 * @global core_renderer $OUTPUT
 * @param navigation_node $navigation The navigation node to extend
 * @param stdClass        $course     The course to object for the report
 * @param stdClass        $context    The context of the course
 */
function report_loglive_extend_navigation_course($navigation, $course, $context) {
    global $CFG, $OUTPUT;
    if (has_capability('report/loglive:view', $context)) {
        $url = new moodle_url('/report/loglive/index.php', array('id'=>$course->id, 'inpopup'=>1));
        $action = new action_link($url, get_string('pluginname', 'report_loglive'), new popup_action('click', $url));
        $navigation->add('', $action, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/report', ''));
    }
}
开发者ID:JP-Git,项目名称:moodle,代码行数:17,代码来源:lib.php

示例9: participation_report_extend_navigation

/**
 * This function extends the navigation with the report items
 *
 * @param navigation_node $navigation The navigation node to extend
 * @param stdClass $course The course to object for the report
 * @param stdClass $context The context of the course
 */
function participation_report_extend_navigation($navigation, $course, $context)
{
    global $CFG, $OUTPUT;
    if (has_capability('coursereport/participation:view', $context)) {
        $url = new moodle_url('/course/report/participation/index.php', array('id' => $course->id));
        $navigation->add(get_string('participationreport'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/report', ''));
    }
}
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:15,代码来源:lib.php

示例10: booktool_importhtml_extend_settings_navigation

/**
 * Adds module specific settings to the settings block
 *
 * @param settings_navigation $settings The settings navigation object
 * @param navigation_node $node The node to add module settings to
 */
function booktool_importhtml_extend_settings_navigation(settings_navigation $settings, navigation_node $node)
{
    global $PAGE;
    if (has_capability('booktool/importhtml:import', $PAGE->cm->context)) {
        $url = new moodle_url('/mod/book/tool/importhtml/index.php', array('id' => $PAGE->cm->id));
        $node->add(get_string('import', 'booktool_importhtml'), $url, navigation_node::TYPE_SETTING, null, null, null);
    }
}
开发者ID:pzhu2004,项目名称:moodle,代码行数:14,代码来源:lib.php

示例11: report_configurablereports_extend_navigation_user

/**
 * This function extends the course navigation with the report items
 *
 * @param navigation_node $navigation The navigation node to extend
 * @param stdClass $user
 * @param stdClass $course The course to object for the report
 */
function report_configurablereports_extend_navigation_user($navigation, $user, $course)
{
    return;
    //TODO: this plugin was not linked from navigation in 2.0, let's keep it that way for now --skodak
    if (report_configurablereports_can_access_user_report($user, $course)) {
        $url = new moodle_url('/report/configurablereports/index.php', array('userid' => $user->id, 'id' => $course->id));
        $navigation->add(get_string('pluginname', 'report_configurablereports'), $url);
    }
}
开发者ID:nadavkav,项目名称:moodle-block_configurablereports,代码行数:16,代码来源:lib.php

示例12: booktool_exportimscp_extend_settings_navigation

/**
 * Adds module specific settings to the settings block
 *
 * @param settings_navigation $settings The settings navigation object
 * @param navigation_node $node The node to add module settings to
 */
function booktool_exportimscp_extend_settings_navigation(settings_navigation $settings, navigation_node $node)
{
    global $PAGE;
    if (has_capability('booktool/exportimscp:export', $PAGE->cm->context)) {
        $url = new moodle_url('/mod/book/tool/exportimscp/index.php', array('id' => $PAGE->cm->id));
        $icon = new pix_icon('generate', '', 'booktool_exportimscp', array('class' => 'icon'));
        $node->add(get_string('generateimscp', 'booktool_exportimscp'), $url, navigation_node::TYPE_SETTING, null, null, $icon);
    }
}
开发者ID:evltuma,项目名称:moodle,代码行数:15,代码来源:lib.php

示例13: report_completion_extend_navigation_user

/**
 * This function extends the course navigation with the report items
 *
 * @param navigation_node $navigation The navigation node to extend
 * @param stdClass $user
 * @param stdClass $course The course to object for the report
 */
function report_completion_extend_navigation_user($navigation, $user, $course)
{
    return;
    //TODO: this plugin was not linked from navigation in 2.0, let's keep it that way for now --skodak
    if (report_completion_can_access_user_report($user, $course)) {
        $url = new moodle_url('/report/completion/user.php', array('id' => $user->id, 'course' => $course->id));
        $navigation->add(get_string('coursecompletion'), $url);
    }
}
开发者ID:evltuma,项目名称:moodle,代码行数:16,代码来源:lib.php

示例14: report_teacherreport_extend_navigation_user

/**
 * This function extends the navigation with the report items
 *
 * @param navigation_node $navigation The navigation node to extend
 * @param stdClass $course The course to object for the report
 * @param stdClass $context The context of the course
 */
function report_teacherreport_extend_navigation_user($navigation, $user, $course)
{
    global $CFG, $DB, $PAGE, $USER;
    $context = context_user::instance($USER->id);
    if (has_capability('report/teacherreport:view', $context)) {
        $url = new moodle_url('/report/teacherreport/index.php', array('userid' => $USER->id));
        $navigation->add(get_string('pluginname', 'report_teacherreport'), $url, navigation_node::TYPE_SETTING, null, null, null);
    }
}
开发者ID:AmineBENCHEIKHBRAHIM,项目名称:Moodle-Reporting-Plugin,代码行数:16,代码来源:lib.php

示例15: report_stats_extend_navigation_user

/**
 * This function extends the course navigation with the report items
 *
 * @param navigation_node $navigation The navigation node to extend
 * @param stdClass $user
 * @param stdClass $course The course to object for the report
 */
function report_stats_extend_navigation_user($navigation, $user, $course) {
    global $CFG;
    if (!empty($CFG->enablestats)) {
        return;
    }
    if (report_stats_can_access_user_report($user, $course)) {
        $url = new moodle_url('/report/stats/user.php', array('id'=>$user->id, 'course'=>$course->id));
        $navigation->add(get_string('stats'), $url);
    }
}
开发者ID:nigeli,项目名称:moodle,代码行数:17,代码来源:lib.php


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