本文整理汇总了PHP中print_header函数的典型用法代码示例。如果您正苦于以下问题:PHP print_header函数的具体用法?PHP print_header怎么用?PHP print_header使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了print_header函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
}
示例2: print_header
public function print_header($title, $morebreadcrumbs = null, $navigation = '')
{
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 ($this->courserecord->id == SITEID) {
$breadcrumbs = array();
} else {
$breadcrumbs = array($this->courserecord->shortname => $CFG->wwwroot . '/course/view.php?id=' . $this->courserecord->id);
}
$breadcrumbs[get_string('modulenameplural', 'game')] = $CFG->wwwroot . '/mod/game/index.php?id=' . $this->courserecord->id;
$breadcrumbs[format_string($this->activityrecord->name)] = $CFG->wwwroot . '/mod/game/view.php?id=' . $this->modulerecord->id;
if (!empty($morebreadcrumbs)) {
$breadcrumbs = array_merge($breadcrumbs, $morebreadcrumbs);
}
if (empty($morebreadcrumbs) && $this->user_allowed_editing()) {
$buttons = '<table><tr><td>' . update_module_button($this->modulerecord->id, $this->courserecord->id, get_string('modulename', 'game')) . '</td>';
if (!empty($CFG->showblocksonmodpages)) {
$buttons .= '<td><form ' . $CFG->frametarget . ' method="get" action="view.php">' . '<div>' . '<input type="hidden" name="id" value="' . $this->modulerecord->id . '" />' . '<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 = ' ';
}
print_header($title, $this->courserecord->fullname, $navigation);
}
示例3: print_message
function print_message($msg)
{
print_header();
echo "\n<center>\n<table height=300>\n<tr><td align=center><font color=NAVY><b>\n {$msg}\n </b></font>\n </td>\n</tr>\n</table>\n\t";
print_footer();
exit;
}
示例4: show_header
function show_header()
{
global $CFG, $USER;
$swwwroot = htmlspecialchars($CFG->wwwroot);
$navtail = get_string('summary_title', ANNOTATION_STRINGS);
$navmiddle = "";
require_js(ANNOTATION_PATH . '/marginalia/3rd-party.js');
require_js(ANNOTATION_PATH . '/marginalia/log.js');
require_js(ANNOTATION_PATH . '/marginalia-config.js');
require_js(ANNOTATION_PATH . '/marginalia/domutil.js');
require_js(ANNOTATION_PATH . '/marginalia/prefs.js');
require_js(ANNOTATION_PATH . '/marginalia/rest-prefs.js');
require_js(ANNOTATION_PATH . '/marginalia/annotation.js');
require_js(ANNOTATION_PATH . '/marginalia/rest-annotate.js');
require_js(ANNOTATION_PATH . '/smartquote.js');
require_js(ANNOTATION_PATH . '/summary.js');
$meta = "<link rel='stylesheet' type='text/css' href='" . s(ANNOTATION_PATH) . "/summary-styles.php'/>\n";
if (null != $this->course && $this->course->category) {
print_header($this->course->shortname . ': ' . get_string('summary_title', ANNOTATION_STRINGS), $this->course->fullname, '<a href=' . $CFG->wwwroot . '/course/view.php?id=' . $this->course->id . '>' . $this->course->shortname . '</a> -> ' . $navtail, "", $meta, true, "", navmenu($this->course));
} elseif (null != $this->course) {
print_header($this->course->shortname . ': ' . get_string('summary_title', ANNOTATION_STRINGS), $this->course->fullname, $navtail, "", $meta, true, "", navmenu($this->course));
} else {
print_header(get_string('summary_title', ANNOTATION_STRINGS), null, "{$navtail}", "", $meta, true, "", null);
}
// echo $tagsHtml;
if (isloggedin()) {
$sannotationpath = s(ANNOTATION_PATH);
echo "<script language='JavaScript' type='text/javascript'>\n" . "var annotationService = new RestAnnotationService('{$sannotationpath}/annotate.php', { csrfCookie: 'MoodleSessionTest' } );\n" . "window.annotationSummary = new AnnotationSummary(annotationService" . ", '{$swwwroot}'" . ", '" . s($USER->username) . "');\n" . "window.preferences = new Preferences( new RestPreferenceService('{$sannotationpath}/user-preference.php' ) );\n" . "</script>\n";
}
}
示例5: confirm
/**
* Show a simple confirmation form
*/
public static function confirm($label)
{
if (is_post()) {
if (isset($_POST['confirm_yes'])) {
return true;
} else {
if (isset($_POST['confirm_no'])) {
return false;
}
}
}
?>
<?php
print_header();
?>
<div id="confirm_form">
<?php
\Meta\Core\Form::open();
?>
<h2><?php
echo $label;
?>
</h2>
<input type="submit" name="confirm_yes" value="Sim" />
<input type="submit" name="confirm_no" value="Nao" />
<?php
\Meta\Core\Form::close();
?>
</div>
<?php
print_footer();
?>
<?php
exit;
}
示例6: 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();
}
}
示例7: 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);
}
示例8: invalid_booking
function invalid_booking($message)
{
global $day, $month, $year, $area, $room;
print_header($day, $month, $year, $area, isset($room) ? $room : "");
echo "<h1>" . get_vocab('invalid_booking') . "</h1>\n";
echo "<p>{$message}</p>\n";
// Print footer and exit
print_footer(TRUE);
}
示例9: output_html
function output_html($result = array(), $arguments = array())
{
print_header();
print_table_head();
foreach ($result as $no => $line) {
print_table_line($no, $line['day'], $line['counter']);
}
print_footer();
}
示例10: 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);
}
}
示例11: 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;
$context = get_context_instance(CONTEXT_COURSE, $this->course->id);
$formatoptions = new object();
$formatoptions->noclean = true;
print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $this->course->id), "center");
if (has_capability('moodle/course:manageactivities', $context)) {
echo embed_kaltura($resource->alltext, get_width($entry), get_height($entry), $entry->entry_type, $entry->design, true);
} else {
echo embed_kaltura($resource->alltext, get_width($entry), get_height($entry), KalturaEntryType::MEDIA_CLIP, $entry->design, true);
}
}
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;
$context = get_context_instance(CONTEXT_COURSE, $this->course->id);
$formatoptions = new object();
$formatoptions->noclean = true;
print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $this->course->id), "center");
if (has_capability('moodle/course:manageactivities', $context)) {
echo embed_kaltura($resource->alltext, get_width($entry), get_height($entry), $entry->entry_type, $entry->design, true);
} else {
echo embed_kaltura($resource->alltext, get_width($entry), get_height($entry), KalturaEntryType::MEDIA_CLIP, $entry->design, true);
}
}
/* 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);
}
}
示例12: header_main
function header_main()
{
global $gbl, $sgbl, $login, $ghtml;
initProgram();
init_language();
print_meta_lan();
if ($login->isDefaultSkin()) {
print_header_old_default();
} else {
print_header();
}
}
示例13: rejudge_showresult
function rejudge_showresult($success = true)
{
print_header(get_string('notice'));
if ($success) {
$message = get_string('rejudgesuccess', 'assignment_onlinejudge');
} else {
$message = get_string('rejudgefailed', 'assignment_onlinejudge');
}
print_box($message, 'generalbox', 'notice');
close_window_button();
print_footer('none');
}
示例14: webquestscorm
/**
* Constructor for the webquestscorm class
*
* Constructor for the base assignment class.
* If cmid is set create the cm, course, assignment objects.
* If the assignment is hidden and the user is not a teacher then
* this prints a page header and notice.
*
* @param cmid integer, the current course module id - not set for new assignments
* @param assignment object, usually null, but if we have it we pass it to save db access
* @param cm object, usually null, but if we have it we pass it to save db access
* @param course object, usually null, but if we have it we pass it to save db access
*/
function webquestscorm($cmid = 0, $webquestscorm = NULL, $cm = NULL, $course = NULL)
{
global $CFG;
if ($cmid) {
if ($cm) {
$this->cm = $cm;
} else {
if (!($this->cm = get_coursemodule_from_id('webquestscorm', $cmid))) {
error('Course Module ID was incorrect');
}
}
$this->context = get_context_instance(CONTEXT_MODULE, $this->cm->id);
if ($course) {
$this->course = $course;
} else {
if (!($this->course = get_record('course', 'id', $this->cm->course))) {
error('Course is misconfigured');
}
}
if ($webquestscorm) {
$this->webquestscorm = $webquestscorm;
} else {
if (!($this->webquestscorm = get_record('webquestscorm', 'id', $this->cm->instance))) {
error('webquestscorm ID was incorrect');
}
}
$this->strwebquestscorm = get_string('modulename', 'webquestscorm');
$this->strwebquestscorms = get_string('modulenameplural', 'webquestscorm');
$this->strsubmissions = get_string('submissions', 'webquestscorm');
$this->strlastmodified = get_string('lastmodified');
if ($this->course->category) {
$this->navigation = "<a target=\"{$CFG->framename}\" href=\"{$CFG->wwwroot}/course/view.php?id={$this->course->id}\">{$this->course->shortname}</a> -> " . "<a target=\"{$CFG->framename}\" href=\"index.php?id={$this->course->id}\">{$this->strwebquestscorms}</a> ->";
} else {
$this->navigation = "<a target=\"{$CFG->framename}\" href=\"index.php?id={$this->course->id}\">{$this->strwebquestscorms}</a> ->";
}
$this->pagetitle = strip_tags($this->course->shortname . ': ' . $this->strwebquestscorm . ': ' . format_string($this->webquestscorm->name, true));
// visibility
$this->context = get_context_instance(CONTEXT_MODULE, $this->cm->id);
if (!$this->cm->visible and !has_capability('moodle/course:viewhiddenactivities', $this->context)) {
$this->pagetitle = strip_tags($this->course->shortname . ': ' . $this->strwebquestscorm);
print_header($this->pagetitle, $this->course->fullname, "{$this->navigation} {$this->strwebquestscorm}", "", "", true, '', navmenu($this->course, $this->cm));
notice(get_string("activityiscurrentlyhidden"), "{$CFG->wwwroot}/course/view.php?id={$this->course->id}");
}
$this->currentgroup = get_current_group($this->course->id);
$this->path = $CFG->dataroot . '/' . $this->cm->course . '/moddata/webquestscorm' . '/' . $this->cm->id;
}
if ($this->usehtmleditor = can_use_html_editor()) {
$this->defaultformat = FORMAT_HTML;
} else {
$this->defaultformat = FORMAT_MOODLE;
}
}
示例15: page_denied
function page_denied()
{
?>
<?php
print_header();
?>
<h3>You don't have permission to access this page.</h3>
<?php
print_footer();
?>
<?php
exit;
}