mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
Small hack to see Table of Contents correctly both under UTF-8 and
ISO-8859-1 sites. We will delete this once Moodle was migrated to UTF-8.
This commit is contained in:
parent
1d317869c8
commit
52966535a1
1 changed files with 14 additions and 1 deletions
|
@ -628,18 +628,31 @@ class resource_ims extends resource_base {
|
|||
* from an specified parent to be used in the view of the IMS
|
||||
*/
|
||||
function ims_generate_toc($items, $resource, $page=0) {
|
||||
global $CFG;
|
||||
global $CFG,$SESSION;
|
||||
|
||||
$contents = '';
|
||||
|
||||
/// Configure links behaviour
|
||||
$fullurl = $CFG->wwwroot.'/mod/resource/view.php?r='.$resource->id.'&frameset=ims&page=';
|
||||
|
||||
/// Decide if we have to leave text in UTF-8, else convert to ISO-8859-1
|
||||
/// (interim solution until everything was migrated to UTF-8). Then we'll
|
||||
// delete this hack.
|
||||
$convert = true;
|
||||
if ($SESSION->encoding == 'UTF-8') {
|
||||
$convert = false;
|
||||
}
|
||||
|
||||
/// Iterate over items to build the menu
|
||||
$currlevel = 0;
|
||||
$currorder = 0;
|
||||
$endlevel = 0;
|
||||
foreach ($items as $item) {
|
||||
/// Convert text to ISO-8859-1 if specified (will remove this once utf-8 migration was complete- 1.6)
|
||||
if ($convert) {
|
||||
$item->title = utf8_decode($item->title);
|
||||
}
|
||||
|
||||
/// Skip pages until we arrive to $page
|
||||
if ($item->id < $page) {
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue