本文整理汇总了PHP中user_login_string函数的典型用法代码示例。如果您正苦于以下问题:PHP user_login_string函数的具体用法?PHP user_login_string怎么用?PHP user_login_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了user_login_string函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
$loggedinas = user_login_string($site);
print_header($title, $header, $nav, '', '', true, $button, $loggedinas);
}
示例2: print_header
function print_header($title)
{
global $USER, $CFG;
$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);
if (empty($CFG->langmenu)) {
$langmenu = '';
} else {
$currlang = current_language();
$langs = get_list_of_languages();
$langlabel = get_accesshide(get_string('language'));
$langmenu = popup_form($CFG->wwwroot . '/my/index.php?lang=', $langs, 'chooselang', $currlang, '', '', '', true, 'self', $langlabel);
}
print_header($title, $header, $navigation, '', '', true, $button, $loggedinas . $langmenu);
}
示例3: set_user_preference
set_user_preference('calendar_lookahead', $value);
}
break;
case 'persistflt':
set_user_preference('calendar_persistflt', intval($value));
break;
}
}
redirect('view.php?course=' . $course->id, get_string('changessaved'), 1);
exit;
}
$site = get_site();
$strcalendar = get_string('calendar', 'calendar');
$strpreferences = get_string('preferences', 'calendar');
$navlinks = array();
if ($course->id != SITEID) {
$navlinks[] = array('name' => $course->shortname, 'link' => "{$CFG->wwwroot}/course/view.php?id={$course->id}", 'type' => 'misc');
}
$navlinks[] = array('name' => $strpreferences, 'link' => 'view.php', 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header("{$site->shortname}: {$strcalendar}: {$strpreferences}", $strcalendar, $navigation, '', '', true, '', user_login_string($site));
print_heading($strpreferences);
print_simple_box_start("center");
$prefs->timeformat = get_user_preferences('calendar_timeformat', '');
$prefs->startwday = get_user_preferences('calendar_startwday', CALENDAR_STARTING_WEEKDAY);
$prefs->maxevents = get_user_preferences('calendar_maxevents', CALENDAR_UPCOMING_MAXEVENTS);
$prefs->lookahead = get_user_preferences('calendar_lookahead', CALENDAR_UPCOMING_DAYS);
$prefs->persistflt = get_user_preferences('calendar_persistflt', 0);
include './preferences.html';
print_simple_box_end();
print_footer($course);
示例4: groups_get_user_displayname
$nonmembers[$userid] = groups_get_user_displayname($userid, $courseid);
$potentialmemberscount++;
}
natcasesort($nonmembers);
// Print out the HTML
foreach ($nonmembers as $id => $name) {
$potentialmembersoptions .= "<option value=\"{$id}\">{$name}</option>\n";
}
} else {
$potentialmembersoptions .= '<option> </option>';
}
// Print the page and form
$strgroups = get_string('groups');
$strparticipants = get_string('participants');
$groupname = groups_get_group_displayname($groupid);
print_header("{$course->shortname}: {$strgroups}", $course->fullname, "<a href=\"{$CFG->wwwroot}/course/view.php?id={$courseid}\">{$course->shortname}</a> " . "-> <a href=\"{$CFG->wwwroot}/user/index.php?id={$courseid}\">{$strparticipants}</a> " . '-> <a href="' . format_string(groups_home_url($courseid, $groupid, $groupingid, false)) . "\">{$strgroups}</a>" . '-> ' . get_string('adduserstogroup', 'group'), '', '', true, '', user_login_string($course, $USER));
?>
<div id="addmembersform">
<h3 class="main"><?php
print_string('adduserstogroup', 'group');
echo " {$groupname}";
?>
</h3>
<form id="assignform" method="post" action="">
<div>
<input type="hidden" name="sesskey" value="<?php
p(sesskey());
?>
" />
<input type="hidden" name="courseid" value="<?php
示例5: calendar_set_filters
calendar_set_filters($courses, $groups, $users);
}
// Let's see if we are supposed to provide a referring course link
// but NOT for the "main page" course
if ($SESSION->cal_course_referer != SITEID && ($shortname = get_field('course', 'shortname', 'id', $SESSION->cal_course_referer)) !== false) {
require_login();
if (empty($course)) {
$course = get_record('course', 'id', $SESSION->cal_course_referer);
// Useful to have around
}
}
$strcalendar = get_string('calendar', 'calendar');
$prefsbutton = calendar_preferences_button();
// Print title and header
$navigation = build_navigation($navlinks);
print_header("{$site->shortname}: {$strcalendar}: {$pagetitle}", $strcalendar, $navigation, '', '', true, $prefsbutton, user_login_string($site));
echo calendar_overlib_html();
// Layout the whole page as three big columns.
echo '<table id="calendar" style="height:100%;">';
echo '<tr>';
// START: Main column
echo '<td class="maincalendar">';
echo '<div class="heightcontainer">';
switch ($view) {
case 'day':
calendar_show_day($day, $mon, $yr, $courses, $groups, $users, $courseid);
break;
case 'month':
calendar_show_month_detailed($mon, $yr, $courses, $groups, $users, $courseid);
break;
case 'upcoming':
示例6: optional_param
}
$edit = optional_param('edit', -1, PARAM_BOOL);
$blockaction = optional_param('blockaction', '', PARAM_ALPHA);
$PAGE->set_context(get_context_instance(CONTEXT_USER, $USER->id));
$PAGE->set_url('my/index.php');
$PAGE->set_blocks_editing_capability('moodle/my:manageblocks');
// Note: MDL-19010 there will be further changes to printing header and blocks.
// The code will be much nicer than this eventually.
$pageblocks = blocks_setup($PAGE, BLOCKS_PINNED_BOTH);
if ($edit != -1 and $PAGE->user_allowed_editing()) {
$USER->editing = $edit;
}
$button = update_mymoodle_icon($USER->id);
$header = $SITE->shortname . ': ' . $strmymoodle;
$navigation = build_navigation($strmymoodle);
$loggedinas = user_login_string();
if (empty($CFG->langmenu)) {
$langmenu = '';
} else {
$currlang = current_language();
$langs = get_list_of_languages();
$langlabel = get_accesshide(get_string('language'));
$langmenu = popup_form($CFG->wwwroot . '/my/index.php?lang=', $langs, 'chooselang', $currlang, '', '', '', true, 'self', $langlabel);
}
print_header($strmymoodle, $header, $navigation, '', '', true, $button, $loggedinas . $langmenu);
echo '<table id="layout-table">';
echo '<tr valign="top">';
$lt = empty($THEME->layouttable) ? array('left', 'middle', 'right') : $THEME->layouttable;
foreach ($lt as $column) {
switch ($column) {
case 'left':
示例7: setVisibility
function setVisibility(id, visibility) {
document.getElemenotById(id).style.display = visibility;
}
</script>
</head>
<body>
<?php
require_once '../../config.php';
$navlinks[] = array('name' => 'Sell Books', 'link' => null, 'type' => 'activityinstance');
$navigation = build_navigation($navlinks);
require_login();
// echo $OUTPUT->heading();
if (!$export) {
print_header('Sell Books Form', 'Sell Books Form', $navigation, '', '', true, '', user_login_string($SITE) . $langmenu);
}
require_once 'breadcrumb.php';
global $USER;
$action = optional_param('action', "", PARAM_ALPHANUM);
//get action
$book_id = optional_param('bookid', "", PARAM_ALPHANUM);
//get book id
require_once "tabs.php";
?>
<html>
<head>
<div
style="width: 600px; align: center; margin-left: 300px; margin-right: 100px;">
<?php
示例8: error
if (!($context = get_context_instance_by_id($contextid))) {
error('Incorrect context id');
}
if (!($course = $DB->get_record('course', array('id' => $courseid_1)))) {
echo "No course found for id=" . $courseid_1 . ".";
print_error('nocourseid');
}
require_login($courseid_1);
$pagename = get_string('letters', 'grades');
//
$navigation = grade_build_nav(__FILE__, $pagename, $courseid_1);
$navlinks[] = array('name' => "Graph", 'link' => null, 'type' => 'activityinstance');
$navigation = build_navigation($navlinks);
//print_header('Grader Report', 'Grader Report', $navigation, '', '', true, '', user_login_string($SITE).$langmenu);
//print_grade_plugin_selector($courseid_1, 'edit', 'graph');
print_header('Grade: Graph', 'Grade: Graph', $navigation, '', '', true, '', user_login_string($SITE) . $langmenu);
//print_grade_plugin_selector($courseid_1, 'edit', 'graph');
/*if ($context->contextlevel == CONTEXT_SYSTEM or $context->contextlevel == CONTEXT_COURSECAT) {
require_once $CFG->libdir.'/adminlib.php';
require_login();
admin_externalpage_setup('letters');
$admin = true;
} else if ($context->contextlevel == CONTEXT_COURSE) {
require_login($context->instanceid);
$admin = false;
} else {
error('Incorrect context level');
}
示例9: optional_param
$modname = optional_param('modname', '', PARAM_ALPHA);
// not used??
$modid = optional_param('modid', 'activity/All', PARAM_FILE);
// not a file, but looks like it anyway
$modaction = optional_param('modaction', '', PARAM_ALPHA);
// not used??
$chooserecent = optional_param('chooserecent', 0, PARAM_INT);
if (!($course = get_record("course", "id", $id))) {
error("That's an invalid course id");
}
require_login($course->id);
add_to_log($course->id, "course", "recent", "recent.php?id={$course->id}", "{$course->id}");
$strrecentactivity = get_string("recentactivity");
$meta = '<meta name="robots" content="none" />';
// prevent duplicate content in search engines MDL-7299
$loggedinas = user_login_string($course, $USER);
if (!empty($chooserecent)) {
$userinfo = get_string("allparticipants");
$dateinfo = get_string("alldays");
if ($user) {
if (!($u = get_record("user", "id", $user))) {
error("That's an invalid user!");
}
$userinfo = fullname($u);
}
if ($date) {
$dateinfo = userdate($date, get_string("strftimedaydate"));
}
if ($course->id != SITEID) {
print_header("{$course->shortname}: {$strrecentactivity}", $course->fullname, "<a href=\"view.php?id={$course->id}\">{$course->shortname}</a> ->\n <a href=\"recent.php?id={$course->id}\">{$strrecentactivity}</a> -> {$userinfo}, {$dateinfo}", "", $meta);
} else {
示例10: add_to_log
add_to_log(SITEID, 'course', 'view', 'view.php?id=' . SITEID, SITEID);
}
if (empty($CFG->langmenu)) {
$langmenu = '';
} else {
$currlang = current_language();
$langs = get_list_of_languages();
$langlabel = get_accesshide(get_string('language'));
$langmenu = popup_form($CFG->wwwroot . '/index.php?lang=', $langs, 'chooselang', $currlang, '', '', '', true, 'self', $langlabel);
}
$PAGE = page_create_object(PAGE_COURSE_VIEW, SITEID);
$pageblocks = blocks_setup($PAGE);
$editing = $PAGE->user_is_editing();
$preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), BLOCK_L_MAX_WIDTH);
$preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), BLOCK_R_MAX_WIDTH);
print_header($SITE->fullname, $SITE->fullname, 'home', '', '<meta name="description" content="' . s(strip_tags($SITE->summary)) . '" />', true, '', user_login_string($SITE) . $langmenu);
?>
<table id="layout-table" summary="layout">
<tr>
<?php
$lt = empty($THEME->layouttable) ? array('left', 'middle', 'right') : $THEME->layouttable;
foreach ($lt as $column) {
switch ($column) {
case 'left':
if (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $editing) {
echo '<td style="width: ' . $preferred_width_left . 'px;" id="left-column">';
print_container_start();
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
print_container_end();
示例11: print_footer
/**
* Can provide a course object to make the footer contain a link to
* to the course home page, otherwise the link will go to the site home
* @uses $USER
* @param mixed $course course object, used for course link button or
* 'none' means no user link, only docs link
* 'empty' means nothing printed in footer
* 'home' special frontpage footer
* @param object $usercourse course used in user link
* @param boolean $return output as string
* @return mixed string or void
*/
function print_footer($course = NULL, $usercourse = NULL, $return = false)
{
global $USER, $CFG, $THEME, $COURSE, $SITE, $PAGE;
if (defined('ADMIN_EXT_HEADER_PRINTED') and !defined('ADMIN_EXT_FOOTER_PRINTED')) {
admin_externalpage_print_footer();
return;
}
$PAGE->set_state(moodle_page::STATE_PRINTING_FOOTER);
/// Course links or special footer
if ($course) {
if ($course === 'empty') {
// special hack - sometimes we do not want even the docs link in footer
$output = '';
if (!empty($THEME->open_header_containers)) {
for ($i = 0; $i < $THEME->open_header_containers; $i++) {
$output .= print_container_end_all();
// containers opened from header
}
} else {
//1.8 theme compatibility
$output .= "\n</div>";
// content div
}
$output .= "\n</div>\n</body>\n</html>";
// close page div started in header
if ($return) {
return $output;
} else {
echo $output;
return;
}
} else {
if ($course === 'none') {
// Don't print any links etc
$homelink = '';
$loggedinas = '';
$home = false;
} else {
if ($course === 'home') {
// special case for site home page - please do not remove
$course = $SITE;
$homelink = '<div class="sitelink">' . '<a title="Moodle ' . $CFG->release . '" href="http://moodle.org/">' . '<img style="width:100px;height:30px" src="' . $CFG->wwwroot . '/pix/moodlelogo.gif" alt="moodlelogo" /></a></div>';
$home = true;
} else {
if ($course === 'upgrade') {
$home = false;
$loggedinas = '';
$homelink = '<div class="sitelink">' . '<a title="Moodle ' . $CFG->target_release . '" href="http://docs.moodle.org/en/Administrator_documentation" onclick="this.target=\'_blank\'">' . '<img style="width:100px;height:30px" src="' . $CFG->wwwroot . '/pix/moodlelogo.gif" alt="moodlelogo" /></a></div>';
} else {
$homelink = '<div class="homelink"><a ' . $CFG->frametarget . ' href="' . $CFG->wwwroot . '/course/view.php?id=' . $course->id . '">' . format_string($course->shortname) . '</a></div>';
$home = false;
}
}
}
}
} else {
$course = $SITE;
// Set course as site course by default
$homelink = '<div class="homelink"><a ' . $CFG->frametarget . ' href="' . $CFG->wwwroot . '/">' . get_string('home') . '</a></div>';
$home = false;
}
/// Set up some other navigation links (passed from print_header by ugly hack)
$menu = isset($THEME->menu) ? str_replace('navmenu', 'navmenufooter', $THEME->menu) : '';
$title = isset($THEME->title) ? $THEME->title : '';
$button = isset($THEME->button) ? $THEME->button : '';
$heading = isset($THEME->heading) ? $THEME->heading : '';
$navigation = isset($THEME->navigation) ? $THEME->navigation : '';
$navmenulist = isset($THEME->navmenulist) ? $THEME->navmenulist : '';
/// Set the user link if necessary
if (!$usercourse and is_object($course)) {
$usercourse = $course;
}
if (!isset($loggedinas)) {
$loggedinas = user_login_string($usercourse, $USER);
}
if ($loggedinas == $menu) {
$menu = '';
}
/// there should be exactly the same number of open containers as after the header
if ($THEME->open_header_containers != open_containers()) {
debugging('Unexpected number of open containers: ' . open_containers() . ', expecting ' . $THEME->open_header_containers, DEBUG_DEVELOPER);
}
/// Provide some performance info if required
$performanceinfo = '';
if (defined('MDL_PERF') || (!empty($CFG->perfdebug) and $CFG->perfdebug > 7)) {
$perf = get_performance_info();
if (defined('MDL_PERFTOLOG') && !function_exists('register_shutdown_function')) {
error_log("PERF: " . $perf['txt']);
//.........这里部分代码省略.........
示例12: get_string
}
}
// Print the page and form
$strgroups = get_string('groups');
$strparticipants = get_string('participants');
$stradduserstogroup = get_string('adduserstogroup', 'group');
$strusergroupmembership = get_string('usergroupmembership', 'group');
$groupname = format_string($group->name);
$navlinks = array();
$navlinks[] = array('name' => $strparticipants, 'link' => "{$CFG->wwwroot}/user/index.php?id={$courseid}", 'type' => 'misc');
$navlinks[] = array('name' => $strgroups, 'link' => "{$CFG->wwwroot}/group/index.php?id={$courseid}", 'type' => 'misc');
$navlinks[] = array('name' => $stradduserstogroup, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
$PAGE->requires->js('group/clientlib.js');
$PAGE->requires->js_function_call('init_add_remove_members_page');
print_header("{$course->shortname}: {$strgroups}", $course->fullname, $navigation, '', '', true, '', user_login_string($course, $USER));
check_theme_arrows();
?>
<div id="addmembersform">
<h3 class="main"><?php
print_string('adduserstogroup', 'group');
echo ": {$groupname}";
?>
</h3>
<form id="assignform" method="post" action="<?php
echo $CFG->wwwroot;
?>
/group/members.php?group=<?php
echo $groupid;
示例13: stripslashes_recursive
// no action
$title = '';
break;
}
$form = stripslashes_recursive($form);
if (!empty($SESSION->cal_course_referer)) {
// TODO: This is part of the Great $course Hack in Moodle. Replace it at some point.
$course = get_record('course', 'id', $SESSION->cal_course_referer);
} else {
$course = $site;
}
require_login($course, false);
$navlinks[] = $calendar_navlink;
$navlinks[] = array('name' => $title, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header($site->shortname . ': ' . $strcalendar . ': ' . $title, $strcalendar, $navigation, 'eventform.name', '', true, '', user_login_string($site));
echo calendar_overlib_html();
echo '<table id="calendar">';
echo '<tr><td class="maincalendar">';
switch ($action) {
case 'delete':
$confirm = optional_param('confirm', 0, PARAM_INT);
$repeats = optional_param('repeats', 0, PARAM_INT);
if ($confirm and confirm_sesskey()) {
// Kill it and redirect to day view
if (($event = get_record('event', 'id', $eventid)) !== false) {
if ($event->repeatid && $repeats) {
delete_records('event', 'repeatid', $event->repeatid);
add_to_log($event->courseid, 'calendar', 'delete all', '', $event->name);
} else {
delete_records('event', 'id', $eventid);