/// Define variables used in page
$site = get_site();
- if (empty($CFG->langmenu)) {
- $langmenu = "";
- } else {
- $currlang = current_language();
- $langs = get_list_of_languages();
- $select = html_select::make_popup_form("$CFG->httpswwwroot/login/index.php", 'lang', $langs, 'chooselang', $currlang);
- $select->nothinglabel = false;
- $select->set_label(get_accesshide(get_string('language')));
- $langmenu = '<div class="langmenu">'.$OUTPUT->select($select).'</div>';
- }
-
$loginsite = get_string("loginsite");
$loginurl = (!empty($CFG->alternateloginurl)) ? $CFG->alternateloginurl : '';
$PAGE->set_title("$site->fullname: $loginsite");
$PAGE->set_heading($site->fullname);
$PAGE->set_focuscontrol('idp');
- $PAGE->set_headingmenu($langmenu);
echo $OUTPUT->header();
include("index_form.html");
$PAGE->navbar->add($title);
$PAGE->set_title($site->shortname.': '.$strcalendar.': '.$title);
$PAGE->set_heading($strcalendar);
-$PAGE->set_headingmenu(user_login_string($site));
echo $OUTPUT->header();
echo $OUTPUT->box_start('eventlist');
$PAGE->navbar->add($title);
$PAGE->set_title($site->shortname.': '.$strcalendar.': '.$title);
$PAGE->set_heading($strcalendar);
-$PAGE->set_headingmenu(user_login_string($site));
echo $OUTPUT->header();
$PAGE->set_title($site->shortname.': '.$strcalendar.': '.$pagetitle);
$PAGE->set_heading($strcalendar);
-$PAGE->set_headingmenu(user_login_string($site));
$PAGE->set_button($prefsbutton);
$PAGE->set_focuscontrol('eventform.name');
$PAGE->set_title("$site->shortname: $strcalendar: $strpreferences");
$PAGE->set_heading($strcalendar);
-$PAGE->set_headingmenu(user_login_string($site));
echo $OUTPUT->header();
// Print title and header
$PAGE->set_title("$site->shortname: $strcalendar: $pagetitle");
$PAGE->set_heading($strcalendar);
-$PAGE->set_headingmenu(user_login_string($site));
$PAGE->set_button($prefsbutton);
$PAGE->requires->yui2_lib('animation');
$PAGE->set_heading('Course info');
$PAGE->set_course($course);
$PAGE->navbar->add(get_string('summary'));
- $PAGE->set_headingmenu(user_login_string());
echo $OUTPUT->header();
echo $OUTPUT->heading('<a href="view.php?id='.$course->id.'">'.format_string($course->fullname) . '</a><br />(' . format_string($course->shortname) . ')');
$PAGE->set_title(get_string('course') . ': ' . $course->fullname);
$PAGE->set_heading($course->fullname);
$PAGE->set_button($buttons);
- //TODO: MDL-21123 this should be done in course page layout, not here with this ugly hack!
- //$PAGE->set_headingmenu(user_login_string($course, $USER));
echo $OUTPUT->header();
if ($completion->is_enabled() && ajaxenabled()) {
/// Print header
$PAGE->set_title("$course->shortname: $strgroups");
$PAGE->set_heading($course->fullname);
-$PAGE->set_headingmenu(user_login_string($course, $USER));
echo $OUTPUT->header();
?>
/// Print header
$PAGE->set_title("$course->shortname: $strgroups");
$PAGE->set_heading($course->fullname);
-$PAGE->set_headingmenu(user_login_string($course, $USER));
echo $OUTPUT->header();
?>
$PAGE->set_pagetype('site-index');
$PAGE->set_course($SITE);
- if (empty($CFG->langmenu)) {
- $langmenu = '';
- } else {
- $currlang = current_language();
- $langs = get_list_of_languages();
-
- $select = html_select::make_popup_form($CFG->wwwroot .'/index.php', 'lang', $langs, 'chooselang', $currlang);
- $select->nothinglabel = false;
- $select->set_label(get_accesshide(get_string('language')));
- //TODO: MDL-21123
- $langmenu = '<div class="langmenu">'.$OUTPUT->select($select).'</div>';
- }
$PAGE->set_other_editing_capability('moodle/course:manageactivities');
$PAGE->set_url('');
$PAGE->set_docs_path('');
$editing = $PAGE->user_is_editing();
$PAGE->set_title($SITE->fullname);
$PAGE->set_heading($SITE->fullname);
- $PAGE->set_headingmenu($langmenu);
- echo $OUTPUT->header($langmenu);
+ echo $OUTPUT->header();
/// Print Section
if ($SITE->numsections > 0) {
}
}
+/**
+ * Returns text to be displayed to the user which reflects their login status
+ *
+ * @global object
+ * @global object
+ * @global object
+ * @global object
+ * @uses CONTEXT_COURSE
+ * @param course $course {@link $COURSE} object containing course information
+ * @param user $user {@link $USER} object containing user information
+ * @return string HTML
+ */
+function user_login_string($course='ignored', $user='ignored') {
+ debugging('user_login_info() has been deprecated. User login info is now handled via themes layouts.');
+ return '';
+}
+
/**
* Prints a nice side block with an optional header. The content can either
* be a block of HTML or a list of text with optional icons.
$selectedurl = $baseurl->out(false, array($name => $selected), false);
}
- if (!($baseurl instanceof moodle_url)) {
- $baseurl = new moodle_url($baseurl);
- }
-
// Replace real value by formatted URLs
foreach ($options as $value => $label) {
$options[$baseurl->out(false, array($name => $value), false)] = $label;
* @return string HTML fragment.
*/
public function login_info() {
- global $USER;
- return user_login_string($this->page->course, $USER);
+ global $USER, $CFG, $DB;
+
+ if (during_initial_install()) {
+ return '';
+ }
+
+ $course = $this->page->course;
+
+ if (session_is_loggedinas()) {
+ $realuser = session_get_realuser();
+ $fullname = fullname($realuser, true);
+ $realuserinfo = " [<a $CFG->frametarget
+ href=\"$CFG->wwwroot/course/loginas.php?id=$course->id&return=1&sesskey=".sesskey()."\">$fullname</a>] ";
+ } else {
+ $realuserinfo = '';
+ }
+
+ $loginurl = get_login_url();
+
+ if (empty($course->id)) {
+ // $course->id is not defined during installation
+ return '';
+ } else if (!empty($USER->id)) {
+ $context = get_context_instance(CONTEXT_COURSE, $course->id);
+
+ $fullname = fullname($USER, true);
+ $username = "<a $CFG->frametarget href=\"$CFG->wwwroot/user/view.php?id=$USER->id&course=$course->id\">$fullname</a>";
+ if (is_mnet_remote_user($USER) and $idprovider = $DB->get_record('mnet_host', array('id'=>$USER->mnethostid))) {
+ $username .= " from <a $CFG->frametarget href=\"{$idprovider->wwwroot}\">{$idprovider->name}</a>";
+ }
+ if (isset($USER->username) && $USER->username == 'guest') {
+ $loggedinas = $realuserinfo.get_string('loggedinasguest').
+ " (<a $CFG->frametarget href=\"$loginurl\">".get_string('login').'</a>)';
+ } else if (!empty($USER->access['rsw'][$context->path])) {
+ $rolename = '';
+ if ($role = $DB->get_record('role', array('id'=>$USER->access['rsw'][$context->path]))) {
+ $rolename = ': '.format_string($role->name);
+ }
+ $loggedinas = get_string('loggedinas', 'moodle', $username).$rolename.
+ " (<a $CFG->frametarget
+ href=\"$CFG->wwwroot/course/view.php?id=$course->id&switchrole=0&sesskey=".sesskey()."\">".get_string('switchrolereturn').'</a>)';
+ } else {
+ $loggedinas = $realuserinfo.get_string('loggedinas', 'moodle', $username).' '.
+ " (<a $CFG->frametarget href=\"$CFG->wwwroot/login/logout.php?sesskey=".sesskey()."\">".get_string('logout').'</a>)';
+ }
+ } else {
+ $loggedinas = get_string('loggedinnot', 'moodle').
+ " (<a $CFG->frametarget href=\"$loginurl\">".get_string('login').'</a>)';
+ }
+
+ $loggedinas = '<div class="logininfo">'.$loggedinas.'</div>';
+
+ if (isset($SESSION->justloggedin)) {
+ unset($SESSION->justloggedin);
+ if (!empty($CFG->displayloginfailures)) {
+ if (!empty($USER->username) and $USER->username != 'guest') {
+ if ($count = count_login_failures($CFG->displayloginfailures, $USER->username, $USER->lastlogin)) {
+ $loggedinas .= ' <div class="loginfailures">';
+ if (empty($count->accounts)) {
+ $loggedinas .= get_string('failedloginattempts', '', $count);
+ } else {
+ $loggedinas .= get_string('failedloginattemptsall', '', $count);
+ }
+ if (has_capability('coursereport/log:view', get_context_instance(CONTEXT_SYSTEM))) {
+ $loggedinas .= ' (<a href="'.$CFG->wwwroot.'/course/report/log/index.php'.
+ '?chooselog=1&id=1&modid=site_errors">'.get_string('logs').'</a>)';
+ }
+ $loggedinas .= '</div>';
+ }
+ }
+ }
+ }
+
+ return $loggedinas;
}
/**
return $this->opencontainers->pop_all_but_last($shouldbenone);
}
+ /**
+ * Returns lang menu or '', this method also checks forcing of languages in courses.
+ * @return string
+ */
+ public function lang_menu() {
+ global $CFG;
+
+ if (empty($CFG->langmenu)) {
+ return '';
+ }
+
+ if ($this->page->course != SITEID and !empty($this->page->course->lang)) {
+ // do not show lang menu if language forced
+ return '';
+ }
+
+ $currlang = current_language();
+ $langs = get_list_of_languages();
+
+ if (count($langs) < 2) {
+ return '';
+ }
+
+ $select = html_select::make_popup_form($this->page->url, 'lang', $langs, 'chooselang', $currlang);
+ $select->nothinglabel = false;
+ $select->set_label(get_accesshide(get_string('language')));
+ return '<div class="langmenu">'.$this->select($select).'</div>';
+ }
+
/**
* Output the row of editing icons for a block, as defined by the controls array.
* @param array $controls an array like {@link block_contents::$controls}.
* @param moodle_action_icon $icon A moodle_action_icon object
* @return string HTML fragment
*/
- public function action_icon($icon) {
+ public function action_icon(moodle_action_icon $icon) {
$icon = clone($icon);
$icon->prepare($this, $this->page, $this->target);
$imageoutput = $this->image($icon->image);
$uri .= $this->host ? $this->host : '';
$uri .= $this->port ? ':'.$this->port : '';
$uri .= $this->path ? $this->path : '';
+
if (!$omitquerystring) {
$querystring = $this->get_query_string($overrideparams, $escaped);
if ($querystring) {
@header('Accept-Ranges: none');
}
-/**
- * Returns text to be displayed to the user which reflects their login status
- *
- * @global object
- * @global object
- * @global object
- * @global object
- * @uses CONTEXT_COURSE
- * @param course $course {@link $COURSE} object containing course information
- * @param user $user {@link $USER} object containing user information
- * @return string HTML
- */
-function user_login_string($course=NULL, $user=NULL) {
- global $USER, $CFG, $SITE, $DB;
-
- if (during_initial_install()) {
- return '';
- }
-
- if (empty($user) and !empty($USER->id)) {
- $user = $USER;
- }
-
- if (empty($course)) {
- $course = $SITE;
- }
-
- if (session_is_loggedinas()) {
- $realuser = session_get_realuser();
- $fullname = fullname($realuser, true);
- $realuserinfo = " [<a $CFG->frametarget
- href=\"$CFG->wwwroot/course/loginas.php?id=$course->id&return=1&sesskey=".sesskey()."\">$fullname</a>] ";
- } else {
- $realuserinfo = '';
- }
-
- $loginurl = get_login_url();
-
- if (empty($course->id)) {
- // $course->id is not defined during installation
- return '';
- } else if (!empty($user->id)) {
- $context = get_context_instance(CONTEXT_COURSE, $course->id);
-
- $fullname = fullname($user, true);
- $username = "<a $CFG->frametarget href=\"$CFG->wwwroot/user/view.php?id=$user->id&course=$course->id\">$fullname</a>";
- if (is_mnet_remote_user($user) and $idprovider = $DB->get_record('mnet_host', array('id'=>$user->mnethostid))) {
- $username .= " from <a $CFG->frametarget href=\"{$idprovider->wwwroot}\">{$idprovider->name}</a>";
- }
- if (isset($user->username) && $user->username == 'guest') {
- $loggedinas = $realuserinfo.get_string('loggedinasguest').
- " (<a $CFG->frametarget href=\"$loginurl\">".get_string('login').'</a>)';
- } else if (!empty($user->access['rsw'][$context->path])) {
- $rolename = '';
- if ($role = $DB->get_record('role', array('id'=>$user->access['rsw'][$context->path]))) {
- $rolename = ': '.format_string($role->name);
- }
- $loggedinas = get_string('loggedinas', 'moodle', $username).$rolename.
- " (<a $CFG->frametarget
- href=\"$CFG->wwwroot/course/view.php?id=$course->id&switchrole=0&sesskey=".sesskey()."\">".get_string('switchrolereturn').'</a>)';
- } else {
- $loggedinas = $realuserinfo.get_string('loggedinas', 'moodle', $username).' '.
- " (<a $CFG->frametarget href=\"$CFG->wwwroot/login/logout.php?sesskey=".sesskey()."\">".get_string('logout').'</a>)';
- }
- } else {
- $loggedinas = get_string('loggedinnot', 'moodle').
- " (<a $CFG->frametarget href=\"$loginurl\">".get_string('login').'</a>)';
- }
-
- $loggedinas = '<div class="logininfo">'.$loggedinas.'</div>';
-
- if (isset($SESSION->justloggedin)) {
- unset($SESSION->justloggedin);
- if (!empty($CFG->displayloginfailures)) {
- if (!empty($USER->username) and $USER->username != 'guest') {
- if ($count = count_login_failures($CFG->displayloginfailures, $USER->username, $USER->lastlogin)) {
- $loggedinas .= ' <div class="loginfailures">';
- if (empty($count->accounts)) {
- $loggedinas .= get_string('failedloginattempts', '', $count);
- } else {
- $loggedinas .= get_string('failedloginattemptsall', '', $count);
- }
- if (has_capability('coursereport/log:view', get_context_instance(CONTEXT_SYSTEM))) {
- $loggedinas .= ' (<a href="'.$CFG->wwwroot.'/course/report/log/index.php'.
- '?chooselog=1&id=1&modid=site_errors">'.get_string('logs').'</a>)';
- }
- $loggedinas .= '</div>';
- }
- }
- }
- }
-
- return $loggedinas;
-}
-
/**
* Return the right arrow with text ('next'), and optionally embedded in a link.
*
$PAGE->set_url("$CFG->httpswwwroot/login/index.php");
+
/// Define variables used in page
$site = get_site();
-if (empty($CFG->langmenu)) {
- $langmenu = "";
-} else {
- $currlang = current_language();
- $langs = get_list_of_languages();
- $select = html_select::make_popup_form("$CFG->httpswwwroot/login/index.php", 'lang', $langs, 'chooselang', $currlang);
- $select->nothinglabel = false;
- $select->set_label(get_accesshide(get_string('language')));
- $langmenu = $OUTPUT->select($select);
-}
-
$loginsite = get_string("loginsite");
$PAGE->navbar->add($loginsite);
$days2expire = $userauth->password_expire($USER->username);
$PAGE->set_title("$site->fullname: $loginsite");
$PAGE->set_heading("$site->fullname");
- $PAGE->set_headingmenu("<div class=\"langmenu\">$langmenu</div>");
if (intval($days2expire) > 0 && intval($days2expire) < intval($userauth->config->expiration_warning)) {
echo $OUTPUT->header();
echo $OUTPUT->confirm(get_string('auth_passwordwillexpire', 'auth', $days2expire), $passwordchangeurl, $urltogo);
$PAGE->set_title("$site->fullname: $loginsite");
$PAGE->set_heading("$site->fullname");
-$PAGE->set_headingmenu("<div class=\"langmenu\">$langmenu</div>");
$PAGE->set_focuscontrol($focus);
echo $OUTPUT->header();
$newaccount = get_string('newaccount');
$login = get_string('login');
-if (empty($CFG->langmenu)) {
- $langmenu = '';
-} else {
- $currlang = current_language();
- $langs = get_list_of_languages();
- $select = html_select::make_popup_form("$CFG->wwwroot/login/signup.php", 'lang', $langs, 'chooselang', $currlang);
- $select->nothinglabel = false;
- $langmenu = $OUTPUT->select($select);
-}
-
$PAGE->navbar->add($login);
$PAGE->navbar->add($newaccount);
$PAGE->set_url(new moodle_url($CFG->wwwroot.'/login/signup.php'));
$PAGE->set_title($newaccount);
$PAGE->set_heading($newaccount);
$PAGE->set_focuscontrol($mform_signup->focus());
-$PAGE->set_headingmenu("<div class=\"langmenu\">$langmenu</div>");
echo $OUTPUT->header();
$mform_signup->display();
$heading = $course->fullname;
$button = '<div style="font-size:0.75em;">'.$button.'</div>';
- $loggedinas = '<span class="logininfo">'.user_login_string($course, $USER).'</span>';
$PAGE->set_title($title);
$PAGE->set_heading($heading);
$PAGE->set_button($button);
- $PAGE->set_headingmenu($loggedinas);
$time = time();
$hppassword = optional_param('hppassword', '', PARAM_RAW);
$header = $SITE->shortname . ': ' . $strmymoodle;
$PAGE->navbar->add($strmymoodle);
- $loggedinas = user_login_string();
-
- if (empty($CFG->langmenu)) {
- $langmenu = '';
- } else {
- $currlang = current_language();
- $langs = get_list_of_languages();
- $select = html_select::make_popup_form($CFG->wwwroot .'/my/index.php', 'lang', $langs, 'chooselang', $currlang);
- $select->nothinglabel = false;
- $select->set_label(get_accesshide(get_string('language')));
- $langmenu = $OUTPUT->select($select);
- }
$PAGE->set_title($strmymoodle);
$PAGE->set_heading($header);
$PAGE->set_button($button);
- $PAGE->set_headingmenu($loggedinas . $langmenu);
echo $OUTPUT->header();
/// The main overview in the middle of the page
'file' => 'general.php',
'regions' => array('side-pre', 'side-post'),
'defaultregion' => 'side-post',
+ 'options' => array('langmenu'=>true),
),
'coursecategory' => array(
'theme' => 'base',
'file' => 'general.php',
'regions' => array('side-pre', 'side-post'),
'defaultregion' => 'side-post',
+ 'options' => array('langmenu'=>true),
),
// My public page
'mypublic' => array(
'theme' => 'base',
'file' => 'general.php',
'regions' => array(),
+ 'options' => array('langmenu'=>true),
),
// Pages that appear in pop-up windows - no navigation, no blocks, no header.
<div id="header-home" class="clearfix">
<h1 class="headermain"><?php echo $PAGE->heading ?></h1>
<div class="headermenu"><?php
- if ($PAGE->headingmenu) {
- echo $PAGE->headingmenu;
- } else {
echo $OUTPUT->login_info();
- }
+ echo $OUTPUT->lang_menu();
+ echo $PAGE->headingmenu;
?></div>
</div>
<!-- END OF HEADER -->
<?php if ($PAGE->heading) { ?>
<div id="header" class="clearfix">
<h1 class="headermain"><?php echo $PAGE->heading ?></h1>
- <div class="headermenu"><?php echo $PAGE->headingmenu ?></div>
+ <div class="headermenu"><?php
+ echo $OUTPUT->login_info();
+ if (!empty($PAGE->layout_options['langmenu'])) {
+ echo $OUTPUT->lang_menu();
+ }
+ echo $PAGE->headingmenu
+ ?></div>
</div>
<?php } ?>
'file' => 'normal.php',
'regions' => array('side-pre', 'side-post'),
'defaultregion' => 'side-post',
+ 'options' => array('langmenu'=>true),
),
'coursecategory' => array(
'theme' => 'base',
'file' => 'normal.php',
'regions' => array('side-pre', 'side-post'),
'defaultregion' => 'side-post',
+ 'options' => array('langmenu'=>true),
),
// My public page
'mypublic' => array(
'theme' => 'standard',
'file' => 'normal.php',
'regions' => array(),
+ 'options' => array('langmenu'=>true),
),
// Pages that appear in pop-up windows - no navigation, no blocks, no header.
<?php if ($PAGE->heading) { ?>
<div id="header" class="clearfix">
<h1 class="headermain"><?php echo $PAGE->heading ?></h1>
- <div class="headermenu"><?php echo $PAGE->headingmenu ?></div>
+ <div class="headermenu"><?php
+ echo $OUTPUT->login_info();
+ if (!empty($PAGE->layout_options['langmenu'])) {
+ echo $OUTPUT->lang_menu();
+ }
+ echo $PAGE->headingmenu
+ ?></div>
</div>
<?php } ?>
<div id="header-home" class="clearfix">
<h1 class="headermain"><?php echo $PAGE->heading ?></h1>
<div class="headermenu"><?php
- echo $OUTPUT->login_info();
- if ($PAGE->headingmenu) {
+ echo $OUTPUT->login_info();
+ echo $OUTPUT->lang_menu();
echo $PAGE->headingmenu;
- }
?></div>
</div>
<hr />
<?php if ($PAGE->heading) { ?>
<div id="header" class="clearfix">
<h1 class="headermain"><?php echo $PAGE->heading ?></h1>
- <div class="headermenu"><?php echo $PAGE->headingmenu ?></div>
+ <div class="headermenu"><?php
+ echo $OUTPUT->login_info();
+ if (!empty($PAGE->layout_options['langmenu'])) {
+ echo $OUTPUT->lang_menu();
+ }
+ echo $PAGE->headingmenu
+ ?></div>
</div>
<?php } ?>