本文整理汇总了PHP中navigation_node::add_node方法的典型用法代码示例。如果您正苦于以下问题:PHP navigation_node::add_node方法的具体用法?PHP navigation_node::add_node怎么用?PHP navigation_node::add_node使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类navigation_node
的用法示例。
在下文中一共展示了navigation_node::add_node方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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'));
}
示例2: tool_kent_extend_navigation_user_settings
/**
* This function extends the navigation with the tool items for user settings node.
*
* @param navigation_node $navigation The navigation node to extend
* @param stdClass $user The user object
* @param context $usercontext The context of the user
* @param stdClass $course The course to object for the tool
* @param context $coursecontext The context of the course
*/
function tool_kent_extend_navigation_user_settings($navigation, $user, $usercontext, $course, $coursecontext)
{
$url = new moodle_url('/local/kent/preferences.php');
$subsnode = navigation_node::create('Kent Preferences', $url, navigation_node::TYPE_SETTING, null, 'kent');
if (isset($subsnode) && !empty($navigation)) {
$navigation->add_node($subsnode);
}
}
示例3: tool_monitor_extend_navigation_user_settings
/**
* This function extends the navigation with the tool items for user settings node.
*
* @param navigation_node $navigation The navigation node to extend
* @param stdClass $user The user object
* @param context $usercontext The context of the user
* @param stdClass $course The course to object for the tool
* @param context $coursecontext The context of the course
*/
function tool_monitor_extend_navigation_user_settings($navigation, $user, $usercontext, $course, $coursecontext)
{
global $USER;
if ($USER->id == $user->id && has_capability('tool/monitor:subscribe', $coursecontext)) {
$url = new moodle_url('/admin/tool/monitor/index.php', array('courseid' => $course->id));
$subsnode = navigation_node::create(get_string('managesubscriptions', 'tool_monitor'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/settings', ''));
if (isset($subsnode) && !empty($navigation)) {
$navigation->add_node($subsnode);
}
}
}
示例4: tool_monitor_extend_navigation_user_settings
/**
* This function extends the navigation with the tool items for user settings node.
*
* @param navigation_node $navigation The navigation node to extend
* @param stdClass $user The user object
* @param context $usercontext The context of the user
* @param stdClass $course The course to object for the tool
* @param context $coursecontext The context of the course
*/
function tool_monitor_extend_navigation_user_settings($navigation, $user, $usercontext, $course, $coursecontext)
{
global $USER, $SITE;
// Don't show the setting if the event monitor isn't turned on. No access to other peoples subscriptions.
if (get_config('tool_monitor', 'enablemonitor') && $USER->id == $user->id) {
// Now let's check to see if the user has any courses / site rules that they can subscribe to.
if ($courses = tool_monitor_get_user_courses()) {
$url = new moodle_url('/admin/tool/monitor/index.php');
$subsnode = navigation_node::create(get_string('managesubscriptions', 'tool_monitor'), $url, navigation_node::TYPE_SETTING, null, 'monitor', new pix_icon('i/settings', ''));
if (isset($subsnode) && !empty($navigation)) {
$navigation->add_node($subsnode);
}
}
}
}
示例5: tool_monitor_extend_navigation_user_settings
/**
* This function extends the navigation with the tool items for user settings node.
*
* @param navigation_node $navigation The navigation node to extend
* @param stdClass $user The user object
* @param context $usercontext The context of the user
* @param stdClass $course The course to object for the tool
* @param context $coursecontext The context of the course
*/
function tool_monitor_extend_navigation_user_settings($navigation, $user, $usercontext, $course, $coursecontext)
{
global $USER, $SITE;
if ($USER->id == $user->id && (has_capability('tool/monitor:subscribe', $coursecontext) && get_config('tool_monitor', 'enablemonitor'))) {
// The $course->id will always be the course that corresponds to the current context.
$courseid = $course->id;
// A $course->id of $SITE->id might either be the frontpage or the site. So if we get the site ID back, check the...
// ...courseid parameter passed to the page so we can know if we are looking at the frontpage rules or site level rules.
if ($course->id == $SITE->id && optional_param('courseid', $course->id, PARAM_INT) == 0) {
$courseid = 0;
}
$url = new moodle_url('/admin/tool/monitor/index.php', array('courseid' => $courseid));
$subsnode = navigation_node::create(get_string('managesubscriptions', 'tool_monitor'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/settings', ''));
if (isset($subsnode) && !empty($navigation)) {
$navigation->add_node($subsnode);
}
}
}
示例6: test_add_before
public function test_add_before()
{
global $CFG;
// Create 3 nodes
$node1 = navigation_node::create('test_add_1', null, navigation_node::TYPE_CUSTOM, 'test 1', 'testadd1');
$node2 = navigation_node::create('test_add_2', null, navigation_node::TYPE_CUSTOM, 'test 2', 'testadd2');
$node3 = navigation_node::create('test_add_3', null, navigation_node::TYPE_CUSTOM, 'test 3', 'testadd3');
// Add node 2, then node 1 before 2, then node 3 at end
$this->node->add_node($node2);
$this->node->add_node($node1, 'testadd2');
$this->node->add_node($node3);
// Check the last 3 nodes are in 1, 2, 3 order and have those indexes
foreach ($this->node->children as $child) {
$keys[] = $child->key;
}
$this->assertEqual('testadd1', $keys[count($keys) - 3]);
$this->assertEqual('testadd2', $keys[count($keys) - 2]);
$this->assertEqual('testadd3', $keys[count($keys) - 1]);
}
示例7: tool_lp_extend_navigation_category_settings
/**
* This function extends the category navigation to add learning plan links.
*
* @param navigation_node $navigation The navigation node to extend
* @param context $coursecategorycontext The context of the course category
*/
function tool_lp_extend_navigation_category_settings($navigation, $coursecategorycontext)
{
if (!get_config('core_competency', 'enabled')) {
return false;
}
// We check permissions before renderring the links.
$templatereadcapability = \core_competency\template::can_read_context($coursecategorycontext);
$competencyreadcapability = \core_competency\competency_framework::can_read_context($coursecategorycontext);
if (!$templatereadcapability && !$competencyreadcapability) {
return false;
}
// The link to the learning plan page.
if ($templatereadcapability) {
$title = get_string('templates', 'tool_lp');
$path = new moodle_url("/admin/tool/lp/learningplans.php", array('pagecontextid' => $coursecategorycontext->id));
$settingsnode = navigation_node::create($title, $path, navigation_node::TYPE_SETTING, null, null, new pix_icon('competency', '', 'tool_lp'));
if (isset($settingsnode)) {
$navigation->add_node($settingsnode);
}
}
// The link to the competency frameworks page.
if ($competencyreadcapability) {
$title = get_string('competencyframeworks', 'tool_lp');
$path = new moodle_url("/admin/tool/lp/competencyframeworks.php", array('pagecontextid' => $coursecategorycontext->id));
$settingsnode = navigation_node::create($title, $path, navigation_node::TYPE_SETTING, null, null, new pix_icon('competency', '', 'tool_lp'));
if (isset($settingsnode)) {
$navigation->add_node($settingsnode);
}
}
}
示例8: studyplan_extend_settings_navigation
/**
* Extends the settings navigation with the studyplan settings
*
* This function is called when the context for the page is a studyplan module. This is not called by AJAX
* so it is safe to rely on the $PAGE.
*
* @param settings_navigation $settingsnav {@link settings_navigation}
* @param navigation_node $studyplannode {@link navigation_node}
*/
function studyplan_extend_settings_navigation(settings_navigation $settingsnav, navigation_node $studyplannode = null)
{
global $CFG, $PAGE;
if ($studyplannode == null) {
return;
}
if (!has_capability('mod/studyplan:review', context_module::instance($PAGE->cm->id))) {
return;
}
$str = "Review";
if (has_capability('mod/studyplan:assign', context_module::instance($PAGE->cm->id))) {
$str = "Review and Assign";
}
$url = new moodle_url('/mod/studyplan/review.php', array('id' => $PAGE->cm->id));
$node = navigation_node::create($str, $url, navigation_node::NODETYPE_LEAF, 'studyplan', 'studyplan');
if ($PAGE->url->compare($url, URL_MATCH_BASE)) {
$node->make_active();
}
$studyplannode->add_node($node);
}
示例9: quiz_extend_settings_navigation
/**
* This function extends the settings navigation block for the site.
*
* It is safe to rely on PAGE here as we will only ever be within the module
* context when this is called
*
* @param settings_navigation $settings
* @param navigation_node $quiznode
*/
function quiz_extend_settings_navigation($settings, $quiznode) {
global $PAGE, $CFG;
// Require {@link questionlib.php}
// Included here as we only ever want to include this file if we really need to.
require_once($CFG->libdir . '/questionlib.php');
// We want to add these new nodes after the Edit settings node, and before the
// Locally assigned roles node. Of course, both of those are controlled by capabilities.
$keys = $quiznode->get_children_key_list();
$beforekey = null;
$i = array_search('modedit', $keys);
if ($i === false and array_key_exists(0, $keys)) {
$beforekey = $keys[0];
} else if (array_key_exists($i + 1, $keys)) {
$beforekey = $keys[$i + 1];
}
if (has_capability('mod/quiz:manageoverrides', $PAGE->cm->context)) {
$url = new moodle_url('/mod/quiz/overrides.php', array('cmid'=>$PAGE->cm->id));
$node = navigation_node::create(get_string('groupoverrides', 'quiz'),
new moodle_url($url, array('mode'=>'group')),
navigation_node::TYPE_SETTING, null, 'mod_quiz_groupoverrides');
$quiznode->add_node($node, $beforekey);
$node = navigation_node::create(get_string('useroverrides', 'quiz'),
new moodle_url($url, array('mode'=>'user')),
navigation_node::TYPE_SETTING, null, 'mod_quiz_useroverrides');
$quiznode->add_node($node, $beforekey);
}
if (has_capability('mod/quiz:manage', $PAGE->cm->context)) {
$node = navigation_node::create(get_string('editquiz', 'quiz'),
new moodle_url('/mod/quiz/edit.php', array('cmid'=>$PAGE->cm->id)),
navigation_node::TYPE_SETTING, null, 'mod_quiz_edit',
new pix_icon('t/edit', ''));
$quiznode->add_node($node, $beforekey);
}
if (has_capability('mod/quiz:preview', $PAGE->cm->context)) {
$url = new moodle_url('/mod/quiz/startattempt.php',
array('cmid'=>$PAGE->cm->id, 'sesskey'=>sesskey()));
$node = navigation_node::create(get_string('preview', 'quiz'), $url,
navigation_node::TYPE_SETTING, null, 'mod_quiz_preview',
new pix_icon('t/preview', ''));
$quiznode->add_node($node, $beforekey);
}
question_extend_settings_navigation($quiznode, $PAGE->cm->context)->trim_if_empty();
}
示例10: vpl_extend_settings_navigation
function vpl_extend_settings_navigation(settings_navigation $settings, navigation_node $vplnode)
{
global $CFG, $PAGE, $USER;
if (!isset($PAGE->cm->id)) {
return;
}
$cmid = $PAGE->cm->id;
$context = context_module::instance($cmid);
$manager = has_capability(VPL_MANAGE_CAPABILITY, $context);
$setjails = has_capability(VPL_SETJAILS_CAPABILITY, $context);
if ($manager) {
$userid = optional_param('userid', NULL, PARAM_INT);
$strbasic = get_string('basic', VPL);
$strtestcases = get_string('testcases', VPL);
$strexecutionoptions = get_string('executionoptions', VPL);
$menustrexecutionoptions = get_string('menuexecutionoptions', VPL);
$strrequestedfiles = get_string('requestedfiles', VPL);
$strexecution = get_string('execution', VPL);
$vplindex = get_string('modulenameplural', VPL);
$klist = $vplnode->get_children_key_list();
if (count($klist) > 1) {
$fkn = $klist[1];
} else {
$fkn = null;
}
$parms = array('id' => $PAGE->cm->id);
$node = $vplnode->create($strtestcases, new moodle_url('/mod/vpl/forms/testcasesfile.php', array('id' => $PAGE->cm->id, 'edit' => 3)), navigation_node::TYPE_SETTING);
$vplnode->add_node($node, $fkn);
$node = $vplnode->create($strexecutionoptions, new moodle_url('/mod/vpl/forms/executionoptions.php', $parms), navigation_node::TYPE_SETTING);
$vplnode->add_node($node, $fkn);
$node = $vplnode->create($strrequestedfiles, new moodle_url('/mod/vpl/forms/requiredfiles.php', $parms), navigation_node::TYPE_SETTING);
$vplnode->add_node($node, $fkn);
$advance = $vplnode->create(get_string('advancedsettings'), null, navigation_node::TYPE_CONTAINER);
$vplnode->add_node($advance, $fkn);
$strexecutionlimits = get_string('maxresourcelimits', VPL);
$strexecutionfiles = get_string('executionfiles', VPL);
$menustrexecutionfiles = get_string('menuexecutionfiles', VPL);
$menustrexecutionlimits = get_string('menuresourcelimits', VPL);
$strvariations = get_string('variations', VPL);
$strexecutionkeepfiles = get_string('keepfiles', VPL);
$strexecutionlimits = get_string('maxresourcelimits', VPL);
$strcheckjails = get_string('check_jail_servers', VPL);
$strsetjails = get_string('local_jail_servers', VPL);
$menustrexecutionkeepfiles = get_string('menukeepfiles', VPL);
$menustrcheckjails = get_string('menucheck_jail_servers', VPL);
$menustrsetjails = get_string('menulocal_jail_servers', VPL);
$advance->add($strexecutionfiles, new moodle_url('/mod/vpl/forms/executionfiles.php', $parms), navigation_node::TYPE_SETTING);
$advance->add($strexecutionlimits, new moodle_url('/mod/vpl/forms/executionlimits.php', $parms), navigation_node::TYPE_SETTING);
$advance->add($strexecutionkeepfiles, new moodle_url('/mod/vpl/forms/executionkeepfiles.php', $parms), navigation_node::TYPE_SETTING);
$advance->add($strvariations, new moodle_url('/mod/vpl/forms/variations.php', $parms), navigation_node::TYPE_SETTING);
$advance->add($strcheckjails, new moodle_url('/mod/vpl/views/checkjailservers.php', $parms), navigation_node::TYPE_SETTING);
if ($setjails) {
$advance->add($strsetjails, new moodle_url('/mod/vpl/forms/local_jail_servers.php', $parms), navigation_node::TYPE_SETTING);
}
$testact = $vplnode->create(get_string('test', VPL), null, navigation_node::TYPE_CONTAINER);
$vplnode->add_node($testact, $fkn);
$strdescription = get_string('description', VPL);
$strsubmission = get_string('submission', VPL);
$stredit = get_string('edit', VPL);
$parmsuser = array('id' => $PAGE->cm->id, 'userid' => $USER->id);
$strsubmissionview = get_string('submissionview', VPL);
$testact->add($strsubmission, new moodle_url('/mod/vpl/forms/submission.php', $parms), navigation_node::TYPE_SETTING);
$testact->add($stredit, new moodle_url('/mod/vpl/forms/edit.php', $parms), navigation_node::TYPE_SETTING);
$testact->add($strsubmissionview, new moodle_url('/mod/vpl/forms/submissionview.php', $parms), navigation_node::TYPE_SETTING);
$testact->add(get_string('grade'), new moodle_url('/mod/vpl/forms/gradesubmission.php', $parmsuser), navigation_node::TYPE_SETTING);
$testact->add(get_string('previoussubmissionslist', VPL), new moodle_url('/mod/vpl/views/previoussubmissionslist.php', $parmsuser), navigation_node::TYPE_SETTING);
$nodeindex = $vplnode->create($vplindex, new moodle_url('/mod/vpl/index.php', array('id' => $PAGE->cm->course)), navigation_node::TYPE_SETTING);
$vplnode->add_node($nodeindex, $fkn);
}
}
示例11: tool_recyclebin_extend_navigation_category_settings
/**
* Adds a recycle bin link to the course admin menu.
*
* @param navigation_node $navigation The navigation node to extend
* @param context $context The context of the course
* @return void|null return null if we don't want to display the node.
*/
function tool_recyclebin_extend_navigation_category_settings($navigation, $context)
{
global $PAGE;
// Check if it is enabled.
if (!\tool_recyclebin\category_bin::is_enabled()) {
return null;
}
$categorybin = new \tool_recyclebin\category_bin($context->instanceid);
// Check we can view the recycle bin.
if (!$categorybin->can_view()) {
return null;
}
$url = null;
$settingnode = null;
// Add a link to the category recyclebin.
$url = new moodle_url('/admin/tool/recyclebin/index.php', array('contextid' => $context->id));
// If we are set to auto-hide, check the number of items.
$autohide = get_config('tool_recyclebin', 'autohide');
if ($autohide) {
$items = $categorybin->get_items();
if (empty($items)) {
return null;
}
}
// Add the recyclebin link.
$pluginname = get_string('pluginname', 'tool_recyclebin');
$node = navigation_node::create($pluginname, $url, navigation_node::NODETYPE_LEAF, 'tool_recyclebin', 'tool_recyclebin', new pix_icon('trash', $pluginname, 'tool_recyclebin'));
if ($PAGE->url->compare($url, URL_MATCH_BASE)) {
$node->make_active();
}
$navigation->add_node($node);
}
示例12: offlinequiz_extend_settings_navigation
/**
* This function extends the settings navigation block for the site.
*
* It is safe to rely on PAGE here as we will only ever be within the module
* context when this is called
*
* @param settings_navigation $settings
* @param navigation_node $offlinequiznode
*/
function offlinequiz_extend_settings_navigation($settings, $offlinequiznode)
{
global $PAGE, $CFG;
// Included here as we only ever want to include this file if we really need to.
require_once $CFG->libdir . '/questionlib.php';
// We want to add these new nodes after the Edit settings node, and before the
// Locally assigned roles node. Of course, both of those are controlled by capabilities.
$keys = $offlinequiznode->get_children_key_list();
$beforekey = null;
$i = array_search('modedit', $keys);
if ($i === false and array_key_exists(0, $keys)) {
$beforekey = $keys[0];
} else {
if (array_key_exists($i + 1, $keys)) {
$beforekey = $keys[$i + 1];
}
}
if (has_capability('mod/offlinequiz:manage', $PAGE->cm->context)) {
$node = navigation_node::create(get_string('groupquestions', 'offlinequiz'), new moodle_url('/mod/offlinequiz/edit.php', array('cmid' => $PAGE->cm->id)), navigation_node::TYPE_SETTING, null, 'mod_offlinequiz_edit', new pix_icon('i/questions', ''));
$offlinequiznode->add_node($node, $beforekey);
$node = navigation_node::create(get_string('createofflinequiz', 'offlinequiz'), new moodle_url('/mod/offlinequiz/createquiz.php', array('id' => $PAGE->cm->id)), navigation_node::TYPE_SETTING, null, 'mod_offlinequiz_createpdfs', new pix_icon('f/text', ''));
$offlinequiznode->add_node($node, $beforekey);
$node = navigation_node::create(get_string('participantslists', 'offlinequiz'), new moodle_url('/mod/offlinequiz/participants.php', array('id' => $PAGE->cm->id)), navigation_node::TYPE_SETTING, null, 'mod_offlinequiz_participants', new pix_icon('i/group', ''));
$offlinequiznode->add_node($node, $beforekey);
$node = navigation_node::create(get_string('results', 'offlinequiz'), new moodle_url('/mod/offlinequiz/report.php', array('id' => $PAGE->cm->id, 'mode' => 'overview')), navigation_node::TYPE_SETTING, null, 'mod_offlinequiz_results', new pix_icon('i/grades', ''));
$offlinequiznode->add_node($node, $beforekey);
}
question_extend_settings_navigation($offlinequiznode, $PAGE->cm->context)->trim_if_empty();
}
示例13: treasurehunt_extend_settings_navigation
/**
* Extends the settings navigation with the treasurehunt settings
*
* This function is called when the context for the page is a treasurehunt module. This is not called by AJAX
* so it is safe to rely on the $PAGE.
*
* @param settings_navigation $settingsnav complete settings navigation tree
* @param navigation_node $treasurehuntnode treasurehunt administration node
*/
function treasurehunt_extend_settings_navigation(settings_navigation $settingsnav, navigation_node $treasurehuntnode = null)
{
global $PAGE;
// We want to add these new nodes after the Edit settings node, and before the
// Locally assigned roles node. Of course, both of those are controlled by capabilities.
$keys = $treasurehuntnode->get_children_key_list();
$beforekey = null;
$i = array_search('modedit', $keys);
if ($i === false and array_key_exists(0, $keys)) {
$beforekey = $keys[0];
} else {
if (array_key_exists($i + 1, $keys)) {
$beforekey = $keys[$i + 1];
}
}
if (has_capability('mod/treasurehunt:managetreasurehunt', $PAGE->cm->context)) {
$node = navigation_node::create(get_string('edittreasurehunt', 'treasurehunt'), new moodle_url('/mod/treasurehunt/edit.php', array('id' => $PAGE->cm->id)), navigation_node::TYPE_SETTING, null, 'mod_treasurehunt_edit', new pix_icon('t/edit', ''));
$treasurehuntnode->add_node($node, $beforekey);
}
}
示例14: rcontent_extend_settings_navigation
/**
* This function extends the settings navigation block for the site.
*
* It is safe to rely on PAGE here as we will only ever be within the module
* context when this is called
*
* @param settings_navigation $settings
* @param navigation_node $node
* @return void
*/
function rcontent_extend_settings_navigation($settings, $node)
{
global $CFG, $PAGE, $DB;
// We want to add these new nodes after the Edit settings node, and before the
// Locally assigned roles node. Of course, both of those are controlled by capabilities.
$keys = $node->get_children_key_list();
$beforekey = null;
$i = array_search('modedit', $keys);
if ($i === false and array_key_exists(0, $keys)) {
$beforekey = $keys[0];
} else {
if (array_key_exists($i + 1, $keys)) {
$beforekey = $keys[$i + 1];
}
}
if (has_any_capability(array('mod/rcontent:viewreport'), $PAGE->cm->context)) {
require_once $CFG->dirroot . '/mod/rcontent/report/reportlib.php';
$url = new moodle_url('/mod/rcontent/report.php', array('id' => $PAGE->cm->id));
$reportnode = $node->add_node(navigation_node::create(get_string('results', 'rcontent'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/report', '')), $beforekey);
$reportlist = rcontent_report_list();
if (!empty($reportlist)) {
foreach ($reportlist as $report) {
$url = new moodle_url('/mod/rcontent/report/' . $report . '/index.php', array('id' => $PAGE->cm->id));
$reportnode->add_node(navigation_node::create(get_string($report, 'rcontent_' . $report), $url, navigation_node::TYPE_SETTING, null, 'rcontent_report_' . $report, new pix_icon('i/item', '')));
}
} else {
if (file_exists($CFG->dirroot . '/blocks/rgrade/rgrade_table.php')) {
$rcontent = $DB->get_record('rcontent', array('id' => $PAGE->cm->instance));
if ($rcontent->bookid) {
$reportnode->add_node(navigation_node::create(get_string('rgrade', 'block_rgrade'), new moodle_url('/blocks/rgrade/rgrade_table.php', array('courseid' => $PAGE->course->id, 'bookid' => $rcontent->bookid)), navigation_node::TYPE_SETTING, null, 'rcontent_report_rgrade', new pix_icon('i/item', '')));
}
}
}
}
}
示例15: geogebra_extend_settings_navigation
/**
* Extends the settings navigation with the geogebra settings
*
* This function is called when the context for the page is a geogebra module. This is not called by AJAX
* so it is safe to rely on the $PAGE.
*
* @param settings_navigation $settingsnav {@link settings_navigation}
* @param navigation_node $geogebranode {@link navigation_node}
*/
function geogebra_extend_settings_navigation(settings_navigation $settingsnav, navigation_node $geogebranode = null)
{
global $PAGE;
$keys = $geogebranode->get_children_key_list();
$beforekey = null;
$i = array_search('modedit', $keys);
if ($i === false and array_key_exists(0, $keys)) {
$beforekey = $keys[0];
} else {
if (array_key_exists($i + 1, $keys)) {
$beforekey = $keys[$i + 1];
}
}
//if (has_capability('moodle/grade:viewall', $PAGE->context)) {
$node = navigation_node::create(get_string('preview_geogebra', 'geogebra'), new moodle_url('/mod/geogebra/view.php', array('id' => $PAGE->cm->id, 'action' => 'preview')), navigation_node::TYPE_SETTING, null, 'mod_preview_geogebra_preview', new pix_icon('i/preview', ''));
$geogebranode->add_node($node, $beforekey);
$url = new moodle_url('/mod/geogebra/report.php', array('id' => $PAGE->cm->id));
$reportnode = $geogebranode->add_node(navigation_node::create(get_string('results', 'geogebra'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/report', '')), $beforekey);
//}
}