Now glossary pivot should be working fine under every charset.

This commit is contained in:
stronk7 2006-01-07 12:11:52 +00:00
parent 5112f02cbe
commit 7123515431
2 changed files with 10 additions and 5 deletions

View file

@ -34,6 +34,9 @@
require_course_login($course, true, $cm); require_course_login($course, true, $cm);
/// Loading the textlib singleton instance. We are going to need it.
$textlib = textlib_get_instance();
if (!isteacher($course->id) and !$glossary->allowprintview) { if (!isteacher($course->id) and !$glossary->allowprintview) {
notice(get_string('printviewnotallowed', 'glossary')); notice(get_string('printviewnotallowed', 'glossary'));
} }
@ -150,15 +153,16 @@
// Setting the pivot for the current entry // Setting the pivot for the current entry
$pivot = $entry->pivot; $pivot = $entry->pivot;
if ( !$fullpivot ) { if ( !$fullpivot ) {
$pivot = substr($pivot, 0, 1); $pivot = $textlib->substr($pivot, 0, 1, current_charset());
$upperpivot = $textlib->strtoupper($pivot, current_charset());
} }
// If there's group break // If there's group break
if ( $currentpivot != strtoupper($pivot) ) { if ( $currentpivot != $upperpivot ) {
// print the group break if apply // print the group break if apply
if ( $printpivot ) { if ( $printpivot ) {
$currentpivot = strtoupper($pivot); $currentpivot = $upperpivot;
$pivottoshow = $currentpivot; $pivottoshow = $currentpivot;
if ( isset($entry->uid) ) { if ( isset($entry->uid) ) {

View file

@ -320,14 +320,15 @@
$pivot = $entry->pivot; $pivot = $entry->pivot;
if ( !$fullpivot ) { if ( !$fullpivot ) {
$pivot = $textlib->substr($pivot, 0, 1, current_charset()); $pivot = $textlib->substr($pivot, 0, 1, current_charset());
$upperpivot = $textlib->strtoupper($pivot, current_charset());
} }
/// if there's a group break /// if there's a group break
if ( $currentpivot != strtoupper($pivot) ) { if ( $currentpivot != $upperpivot ) {
// print the group break if apply // print the group break if apply
if ( $printpivot ) { if ( $printpivot ) {
$currentpivot = strtoupper($pivot); $currentpivot = $upperpivot;
echo '<div>'; echo '<div>';
echo '<table cellspacing="0" class="categoryheader">'; echo '<table cellspacing="0" class="categoryheader">';