本文整理汇总了PHP中build_navigation函数的典型用法代码示例。如果您正苦于以下问题:PHP build_navigation函数的具体用法?PHP build_navigation怎么用?PHP build_navigation使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了build_navigation函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: print_header
function print_header($title, $morenavlinks = NULL, $bodytags = '', $meta = '', $extrabuttons = '')
{
global $USER, $CFG;
$this->init_full();
$replacements = array('%fullname%' => format_string($this->activityrecord->name));
foreach ($replacements as $search => $replace) {
$title = str_replace($search, $replace, $title);
}
if (empty($morenavlinks) && $this->user_allowed_editing()) {
// mmmm, tables
$buttons = '<table><tr>';
$buttons .= '<td>' . $extrabuttons . '</td>';
$buttons .= '<td>' . update_module_button(optional_param('clone', $this->modulerecord->id, PARAM_INT), $this->courserecord->id, get_string('modulename', $this->activityname)) . '</td>';
if (!empty($CFG->showblocksonmodpages)) {
$clonething = optional_param('clone', 0, PARAM_INT);
$clonething = $clonething ? '<input type="hidden" name="clone" value="' . $clonething . '" />' : '';
$buttons .= '<td><form ' . $CFG->frametarget . ' method="get" action="view.php"><div>' . '<input type="hidden" name="id" value="' . $this->modulerecord->id . '" />' . $clonething . '<input type="hidden" name="edit" value="' . ($this->user_is_editing() ? 'off' : 'on') . '" />' . '<input type="submit" value="' . get_string($this->user_is_editing() ? 'blockseditoff' : 'blocksediton') . '" /></div></form></td>';
}
$buttons .= '</tr></table>';
} else {
$buttons = $extrabuttons ? $extrabuttons : ' ';
}
if (empty($morenavlinks)) {
$morenavlinks = array();
}
$navigation = build_navigation($morenavlinks, $this->modulerecord);
print_header($title, $this->courserecord->fullname, $navigation, '', $meta, true, $buttons, navmenu($this->courserecord, $this->modulerecord), false, $bodytags);
}
示例2: resource_base
/**
* Constructor for the base resource class
*
* Constructor for the base resource class.
* If cmid is set create the cm, course, resource objects.
* and do some checks to make sure people can be here, and so on.
*
* @param cmid integer, the current course module id - not set for new resources
*/
function resource_base($cmid = 0)
{
global $CFG, $COURSE;
$this->navlinks = array();
if ($cmid) {
if (!($this->cm = get_coursemodule_from_id('resource', $cmid))) {
error("Course Module ID was incorrect");
}
if (!($this->course = get_record("course", "id", $this->cm->course))) {
error("Course is misconfigured");
}
if (!($this->resource = get_record("resource", "id", $this->cm->instance))) {
error("Resource ID was incorrect");
}
$this->strresource = get_string("modulename", "resource");
$this->strresources = get_string("modulenameplural", "resource");
if (!$this->cm->visible and !has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_MODULE, $this->cm->id))) {
$pagetitle = strip_tags($this->course->shortname . ': ' . $this->strresource);
$navigation = build_navigation($this->navlinks, $this->cm);
print_header($pagetitle, $this->course->fullname, $navigation, "", "", true, '', navmenu($this->course, $this->cm));
notice(get_string("activityiscurrentlyhidden"), "{$CFG->wwwroot}/course/view.php?id={$this->course->id}");
}
} else {
$this->course = $COURSE;
}
}
示例3: print_entry
function print_entry($course)
{
global $CFG, $USER;
$strloginto = get_string("loginto", "", $course->shortname);
$strcourses = get_string("courses");
$teacher = get_teacher($course->id);
if ((double) $course->cost < 0) {
$cost = (double) $CFG->enrol_cost;
} else {
$cost = (double) $course->cost;
}
if (abs($cost) < 0.01) {
// no cost, default to base class entry to course
$manual = enrolment_factory::factory('manual');
$manual->print_entry($course);
} else {
$navlinks = array();
$navlinks[] = array('name' => $strcourses, 'link' => "{$CFG->wwwroot}/course", 'type' => 'misc');
$navlinks[] = array('name' => $strloginto, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header($strloginto, $course->fullname, $navigation);
print_course($course, "80%");
if ($course->password) {
// Presenting two options
print_heading(get_string('costorkey', 'enrol_paypal'), 'center');
}
print_simple_box_start("center");
if ($USER->username == 'guest') {
// force login only for guest user, not real users with guest role
if (empty($CFG->loginhttps)) {
$wwwroot = $CFG->wwwroot;
} else {
// This actually is not so secure ;-), 'cause we're
// in unencrypted connection...
$wwwroot = str_replace("http://", "https://", $CFG->wwwroot);
}
echo '<div align="center"><p>' . get_string('paymentrequired') . '</p>';
echo '<p><b>' . get_string('cost') . ": {$CFG->enrol_currency} {$cost}" . '</b></p>';
echo '<p><a href="' . $wwwroot . '/login/">' . get_string('loginsite') . '</a></p>';
echo '</div>';
} else {
//Sanitise some fields before building the PayPal form
$coursefullname = $course->fullname;
$courseshortname = $course->shortname;
$userfullname = fullname($USER);
$userfirstname = $USER->firstname;
$userlastname = $USER->lastname;
$useraddress = $USER->address;
$usercity = $USER->city;
include $CFG->dirroot . '/enrol/paypal/enrol.html';
}
print_simple_box_end();
if ($course->password) {
// Second option
$password = '';
include $CFG->dirroot . '/enrol/manual/enrol.html';
}
print_footer();
}
}
示例4: url_print_header
/**
* Print url header.
* @param object $url
* @param object $cm
* @param object $course
* @return void
*/
function url_print_header($url, $cm, $course)
{
global $PAGE, $OUTPUT;
$PAGE->set_title($course->shortname . ': ' . $url->name);
$PAGE->set_heading($course->fullname);
$PAGE->set_activity_record($url);
$PAGE->set_button(update_module_button($cm->id, '', get_string('modulename', 'url')));
echo $OUTPUT->header(build_navigation('', $cm), navmenu($course, $cm));
}
示例5: print_header
/**
* Prints the page header.
*/
function print_header()
{
global $CFG, $USER, $PAGE;
require_once $CFG->libdir . '/blocklib.php';
require_once $CFG->dirroot . '/course/lib.php';
require_once $CFG->dirroot . '/my/pagelib.php';
/// My Moodle arguments:
$edit = optional_param('edit', -1, PARAM_BOOL);
$blockaction = optional_param('blockaction', '', PARAM_ALPHA);
$mymoodlestr = get_string('mymoodle', 'my');
if (isguest()) {
$wwwroot = $CFG->wwwroot . '/login/index.php';
if (!empty($CFG->loginhttps)) {
$wwwroot = str_replace('http:', 'https:', $wwwroot);
}
print_header($mymoodlestr);
notice_yesno(get_string('noguest', 'my') . '<br /><br />' . get_string('liketologin'), $wwwroot, $CFG->wwwroot);
print_footer();
die;
}
/// Add curriculum stylesheets...
if (file_exists($CFG->dirroot . '/curriculum/styles.css')) {
$CFG->stylesheets[] = $CFG->wwwroot . '/curriculum/styles.css';
}
/// Fool the page library into thinking we're in My Moodle.
$CFG->pagepath = $CFG->wwwroot . '/my/index.php';
$PAGE = page_create_instance($USER->id);
if ($section = optional_param('section', '', PARAM_ALPHAEXT)) {
$PAGE->section = $section;
}
$this->pageblocks = blocks_setup($PAGE, BLOCKS_PINNED_BOTH);
/// Make sure that the curriculum block is actually on this
/// user's My Moodle page instance.
if ($cablockid = get_field('block', 'id', 'name', 'curr_admin')) {
if (!record_exists('block_pinned', 'blockid', $cablockid, 'pagetype', 'my-index')) {
blocks_execute_action($PAGE, $this->pageblocks, 'add', (int) $cablockid, true, false);
}
}
if ($edit != -1 and $PAGE->user_allowed_editing()) {
$USER->editing = $edit;
}
//$PAGE->print_header($mymoodlestr);
$title = $this->get_title();
print_header($title, $title, build_navigation($this->get_navigation()));
echo '<table border="0" cellpadding="3" cellspacing="0" width="100%" id="layout-table">';
echo '<tr valign="top">';
$blocks_preferred_width = bounded_number(180, blocks_preferred_width($this->pageblocks[BLOCK_POS_LEFT]), 210);
if (blocks_have_content($this->pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing()) {
echo '<td style="vertical-align: top; width: ' . $blocks_preferred_width . 'px;" id="left-column">';
blocks_print_group($PAGE, $this->pageblocks, BLOCK_POS_LEFT);
echo '</td>';
}
echo '<td valign="top" id="middle-column">';
if (blocks_have_content($this->pageblocks, BLOCK_POS_CENTRE) || $PAGE->user_is_editing()) {
blocks_print_group($PAGE, $this->pageblocks, BLOCK_POS_CENTRE);
}
}
示例6: display
function display()
{
global $CFG;
$formatoptions = new object();
$formatoptions->noclean = true;
/// Are we displaying the course blocks?
if ($this->resource->options == 'showblocks') {
parent::display_course_blocks_start();
$entry = get_record('kaltura_entries', 'context', "R_" . "{$this->resource}->id");
if (trim(strip_tags($this->resource->alltext))) {
echo $entry->title;
$player_url = $CFG->wwwroot . '/mod/kaltura/kswfdoc.php?context=' . $this->course->id . '&entry_id=' . $resource->alltext;
$formatoptions = new object();
$formatoptions->noclean = true;
print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $this->course->id), "center");
if ($resource->alltext) {
echo '<input style="margin-top:20px;" type="button" value="View video presentation" onclick="kalturaInitModalBox(\'' . $player_url . '\', {width:780, height:400});">';
}
// echo embed_kaltura($resource->alltext,get_width($entry),get_height($entry),$entry->entry_type);
}
parent::display_course_blocks_end();
} else {
/// Set up generic stuff first, including checking for access
parent::display();
/// Set up some shorthand variables
$cm = $this->cm;
$course = $this->course;
$resource = $this->resource;
$entry = get_record('kaltura_entries', 'context', "R_" . "{$resource->id}");
$pagetitle = strip_tags($course->shortname . ': ' . format_string($resource->name));
$inpopup = optional_param('inpopup', '', PARAM_BOOL);
add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id);
$navigation = build_navigation($this->navlinks, $cm);
print_header($pagetitle, $course->fullname, $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm));
if (trim(strip_tags($this->resource->alltext))) {
echo $entry->title;
}
$formatoptions = new object();
$formatoptions->noclean = true;
print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $this->course->id), "center");
if (trim(strip_tags($this->resource->alltext))) {
$player_url = $CFG->wwwroot . '/mod/kaltura/kswfdoc.php?context=' . $this->course->id . '&entry_id=' . $resource->alltext;
if ($resource->alltext) {
echo '<input type="button" style="margin-top:20px;" value="View video presentation" onclick="kalturaInitModalBox(\'' . $player_url . '\', {width:780, height:400});">';
}
// echo embed_kaltura($resource->alltext,get_width($entry),get_height($entry),$entry->entry_type);
}
/* print_simple_box(format_text($resource->alltext, $resource->reference, $formatoptions, $course->id),
"center", "", "", "20");
*/
$strlastmodified = get_string("lastmodified");
echo "<div class=\"modified\">{$strlastmodified}: " . userdate($resource->timemodified) . "</div>";
print_footer($course);
}
}
示例7: print_grade_page_head_local
/**
* Prints the page headers, breadcrumb trail, page heading, (optional) dropdown navigation menu and
* (optional) navigation tabs for any gradebook page. All gradebook pages MUST use these functions
* in favour of the usual print_header(), print_header_simple(), print_heading() etc.
* !IMPORTANT! Use of tabs.php file in gradebook pages is forbidden unless tabs are switched off at
* the site level for the gradebook ($CFG->grade_navmethod = GRADE_NAVMETHOD_DROPDOWN).
*
* @param int $courseid
* @param string $active_type The type of the current page (report, settings, import, export, scales, outcomes, letters)
* @param string $active_plugin The plugin of the current page (grader, fullview etc...)
* @param string $heading The heading of the page. Tries to guess if none is given
* @param boolean $return Whether to return (true) or echo (false) the HTML generated by this function
* @param string $bodytags Additional attributes that will be added to the <body> tag
* @param string $buttons Additional buttons to display on the page
*
* @return string HTML code or nothing if $return == false
*/
function print_grade_page_head_local($courseid, $active_type, $active_plugin = null, $heading = false, $return = false, $bodytags = '', $buttons = false, $extracss = array())
{
global $CFG, $COURSE;
$strgrades = get_string('grades');
$plugin_info = grade_get_plugin_info($courseid, $active_type, $active_plugin);
// Determine the string of the active plugin
$stractive_plugin = $active_plugin ? $plugin_info['strings']['active_plugin_str'] : $heading;
$stractive_type = $plugin_info['strings'][$active_type];
$navlinks = array();
$first_link = '';
if ($active_type == 'settings' && $active_plugin != 'coursesettings') {
$first_link = $plugin_info['report'][$active_plugin]['link'];
} elseif ($active_type != 'report') {
$first_link = $CFG->wwwroot . '/grade/index.php?id=' . $COURSE->id;
}
if ($active_type == 'preferences') {
$CFG->stylesheets[] = $CFG->wwwroot . '/grade/report/styles.css';
}
foreach ($extracss as $css_url) {
$CFG->stylesheets[] = $css_url;
}
$navlinks[] = array('name' => $strgrades, 'link' => $first_link, 'type' => 'misc');
$active_type_link = '';
if (!empty($plugin_info[$active_type]['link']) && $plugin_info[$active_type]['link'] != qualified_me()) {
$active_type_link = $plugin_info[$active_type]['link'];
}
if (!empty($plugin_info[$active_type]['parent']['link'])) {
$active_type_link = $plugin_info[$active_type]['parent']['link'];
$navlinks[] = array('name' => $stractive_type, 'link' => $active_type_link, 'type' => 'misc');
}
if (empty($plugin_info[$active_type]['id'])) {
$navlinks[] = array('name' => $stractive_type, 'link' => $active_type_link, 'type' => 'misc');
}
$navlinks[] = array('name' => $stractive_plugin, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
$title = ': ' . $stractive_plugin;
if (empty($plugin_info[$active_type]['id']) || !empty($plugin_info[$active_type]['parent'])) {
$title = ': ' . $stractive_type . ': ' . $stractive_plugin;
}
$returnval = print_header_simple($strgrades . ': ' . $stractive_type, $title, $navigation, '', $bodytags, true, $buttons, navmenu($COURSE), false, '', $return);
// Guess heading if not given explicitly
if (!$heading) {
$heading = $stractive_plugin;
}
if ($CFG->grade_navmethod == GRADE_NAVMETHOD_COMBO || $CFG->grade_navmethod == GRADE_NAVMETHOD_DROPDOWN) {
$returnval .= print_grade_plugin_selector($plugin_info, $return);
}
$returnval .= print_heading($heading);
if ($CFG->grade_navmethod == GRADE_NAVMETHOD_COMBO || $CFG->grade_navmethod == GRADE_NAVMETHOD_TABS) {
$returnval .= grade_print_tabs($active_type, $active_plugin, $plugin_info, $return);
}
if ($return) {
return $returnval;
}
}
示例8: print_header
function print_header($title)
{
global $USER, $CFG;
$replacements = array('%fullname%' => get_string('mycollaboration', 'local'));
foreach ($replacements as $search => $replace) {
$title = str_replace($search, $replace, $title);
}
$site = get_site();
$nav = get_string('mycollaboration', 'local');
$header = $site->shortname . ': ' . $nav;
$navlinks = array(array('name' => $nav, 'link' => '', 'type' => 'misc'));
$navigation = build_navigation($navlinks);
print_header($title, $header, $navigation, '', '', true);
}
示例9: print_header
function print_header()
{
global $USER, $CFG;
$tagname = tag_display_name($this->tag_object);
$navlinks = array();
$navlinks[] = array('name' => get_string('tags', 'tag'), 'link' => "{$CFG->wwwroot}/tag/search.php", 'type' => '');
$navlinks[] = array('name' => $tagname, 'link' => '', 'type' => '');
$navigation = build_navigation($navlinks);
$title = get_string('tag', 'tag') . ' - ' . $tagname;
$button = '';
if ($this->user_allowed_editing()) {
$button = update_tag_button($this->id);
}
print_header_simple($title, '', $navigation, '', '', '', $button);
}
示例10: print_entry
/**
* Prints the entry form/page for this enrolment
*
* This is only called from course/enrol.php
* Most plugins will probably override this to print payment
* forms etc, or even just a notice to say that manual enrolment
* is disabled
*
* @param course current course object
*/
function print_entry($course)
{
global $CFG, $USER, $SESSION, $THEME;
$strloginto = get_string('loginto', '', $course->shortname);
$strcourses = get_string('courses');
$context = context_system::get_context();
$navlinks = array();
$navlinks[] = array('name' => $strcourses, 'link' => ".", 'type' => 'misc');
$navlinks[] = array('name' => $strloginto, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
// if we get here we are going to display the BUY COURSE message
print_header($strloginto, $course->fullname, $navigation, "form.password");
include "{$CFG->dirroot}/enrol/joomdle/enrol.html";
print_footer();
}
示例11: printHeader
public static function printHeader($title = '', $course_id = SITEID, $cache = false)
{
$navlinks = array();
if ($course_id != SITEID) {
$navlinks[] = array('name' => get_field('course', 'shortname', 'id', $course_id), 'link' => $GLOBALS['CFG']->wwwroot . '/course/view.php?id=' . $course_id, 'type' => 'title');
}
$navlinks[] = array('name' => $title, 'link' => '', 'type' => 'title');
print_header_simple($title, '', build_navigation($navlinks), '', '', $cache);
echo '<div style="float:right;">';
/* helpbutton('repository', sharing_cart_plugins::get_string('title', 'repository'),
'block_sharing_cart/plugins/repository', true, false, '', false);*/
echo '</div>';
echo '<div style="clear:both;"><!-- clear float --></div>';
print_heading($title);
}
示例12: print_header
function print_header($title)
{
global $USER;
$replacements = array('%fullname%' => get_string('mymoodle', 'my'));
foreach ($replacements as $search => $replace) {
$title = str_replace($search, $replace, $title);
}
$site = get_site();
$button = update_mymoodle_icon($USER->id);
$nav = get_string('mymoodle', 'my');
$header = $site->shortname . ': ' . $nav;
$navlinks = array(array('name' => $nav, 'link' => '', 'type' => 'misc'));
$navigation = build_navigation($navlinks);
$loggedinas = user_login_string($site);
print_header($title, $header, $navigation, '', '', true, $button, $loggedinas);
}
示例13: print_header_and_tabs
function print_header_and_tabs($cm, $course, $quiz, $reportmode = "overview", $meta = "")
{
global $CFG;
/// Define some strings
$strquizzes = get_string("modulenameplural", "quiz");
$strquiz = get_string("modulename", "quiz");
/// Print the page header
$navlinks = array();
$navlinks[] = array('name' => $strquizzes, 'link' => "index.php?id={$course->id}", 'type' => 'activity');
$navlinks[] = array('name' => format_string($quiz->name), 'link' => '', 'type' => 'activityinstance');
$navigation = build_navigation($navlinks);
print_header_simple(format_string($quiz->name), "", $navigation, '', $meta, true, update_module_button($cm->id, $course->id, $strquiz), navmenu($course, $cm));
/// Print the tabs
$currenttab = 'reports';
$mode = $reportmode;
require $CFG->dirroot . '/mod/quiz/tabs.php';
}
示例14: webquestscorm_print_header
function webquestscorm_print_header($name, $currenttab = '', $course = NULL, $cm = NULL, $cmid = 0)
{
global $CFG;
if ($cmid) {
if (!isset($cm)) {
if (!($cm = get_coursemodule_from_id('webquestscorm', $cmid))) {
error('Course Module ID was incorrect');
}
}
if (!isset($course)) {
if (!($course = get_record('course', 'id', $this->cm->course))) {
error('Course is misconfigured');
}
}
if (!isset($name)) {
if (!($webquestscorm = get_record('webquestscorm', 'id', $this->cm->instance))) {
error('webquestscorm ID was incorrect');
}
$name = $webquestscorm->name;
}
} else {
if (!isset($cm)) {
error('Course Module ID was incorrect');
}
if (!isset($course)) {
error('Course is misconfigured');
}
if (!isset($name)) {
error('webquestscorm name was incorrect');
}
}
$strwebquestscorms = get_string('modulenameplural', 'webquestscorm');
$strwebquestscorm = get_string('modulename', 'webquestscorm');
$strname = format_string($name);
$button = update_module_button($cm->id, $course->id, $strwebquestscorm);
$meta = '';
if ($CFG->version < 2007101500) {
print_header_simple(format_string($strname), "", "<a href=\"index.php?id={$course->id}\">{$strwebquestscorms}</a> -> " . format_string($name), "", "", true, update_module_button($cm->id, $course->id, $strwebquestscorm), navmenu($course, $cm));
} else {
$navigation = build_navigation('', $cm);
print_header($course->shortname . ':' . $strname, $course->fullname, $navigation, '', $meta, true, $button, navmenu($course, $cm));
}
print_heading(format_string($name, true));
require_once "tabs.php";
}
示例15: print_header_and_tabs
function print_header_and_tabs($cm, $course, $quiz, $reportmode = "overview")
{
global $CFG;
/// Define some strings
$strquizzes = get_string("modulenameplural", "quiz");
$strquiz = get_string("modulename", "quiz");
/// Print the page header
$navigation = build_navigation('', $cm);
print_header_simple(format_string($quiz->name), "", $navigation, '', '', true, update_module_button($cm->id, $course->id, $strquiz), navmenu($course, $cm));
/// Print the tabs
$currenttab = 'reports';
$mode = $reportmode;
require $CFG->dirroot . '/mod/quiz/tabs.php';
$course_context = get_context_instance(CONTEXT_COURSE, $course->id);
if (has_capability('gradereport/grader:view', $course_context) && has_capability('moodle/grade:viewall', $course_context)) {
echo '<div class="allcoursegrades"><a href="' . $CFG->wwwroot . '/grade/report/grader/index.php?id=' . $course->id . '">' . get_string('seeallcoursegrades', 'grades') . '</a></div>';
}
}