Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 132... Línea 132...
132
            foreach ($matches[0] as $i => $match) {
132
            foreach ($matches[0] as $i => $match) {
133
                if (strpos($matches[2][$i], ':') !== false or strpos($matches[2][$i], '@') !== false) {
133
                if (strpos($matches[2][$i], ':') !== false or strpos($matches[2][$i], '@') !== false) {
134
                    // it is either absolute or pluginfile link
134
                    // it is either absolute or pluginfile link
135
                    continue;
135
                    continue;
136
                }
136
                }
-
 
137
 
-
 
138
                [$path, $anchor] = array_pad(explode('#', $matches[2][$i], 2), 2, '');
-
 
139
                if (!empty($anchor)) {
-
 
140
                    $anchor = '#' . $anchor;
-
 
141
                }
-
 
142
 
137
                $chapterpath = dirname($chapter->importsrc).'/'.$matches[2][$i];
143
                $chapterpath = dirname($chapter->importsrc).'/'.$path;
138
                $chapterpath = toolbook_importhtml_fix_path($chapterpath);
144
                $chapterpath = toolbook_importhtml_fix_path($chapterpath);
139
                foreach ($allchapters as $target) {
145
                foreach ($allchapters as $target) {
140
                    if ($target->importsrc === $chapterpath) {
146
                    if ($target->importsrc === $chapterpath) {
141
                        $newcontent = str_replace($match, 'href="'.new moodle_url('/mod/book/view.php',
147
                        $newcontent = str_replace($match, 'href="' . new moodle_url('/mod/book/view.php',
142
                                array('id'=>$context->instanceid, 'chapterid'=>$target->id)).'"', $newcontent);
148
                            ['id' => $context->instanceid, 'chapterid' => $target->id]) . $anchor . '"', $newcontent);
143
                    }
149
                    }
144
                }
150
                }
145
            }
151
            }
146
        }
152
        }
147
        if ($newcontent !== $chapter->content) {
153
        if ($newcontent !== $chapter->content) {