MDL-11082 Improved groups upgrade performance 1.8x -> 1.9; thanks Eloy for telling...
[moodle-pu.git] / mod / lesson / action / move.php
blobfb296e753027d672fa491fe9d423a73e77284218
1 <?php // $Id$
2 /**
3 * Action that displays an interface for moving a page
5 * @version $Id$
6 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
7 * @package lesson
8 **/
10 $pageid = required_param('pageid', PARAM_INT);
11 $title = get_field("lesson_pages", "title", "id", $pageid);
12 print_heading(get_string("moving", "lesson", format_string($title)));
14 if (!$page = get_record_select("lesson_pages", "lessonid = $lesson->id AND prevpageid = 0")) {
15 error("Move: first page not found");
18 echo "<center><table cellpadding=\"5\" border=\"1\">\n";
19 echo "<tr><td><a href=\"lesson.php?id=$cm->id&amp;sesskey=".$USER->sesskey."&amp;action=moveit&amp;pageid=$pageid&amp;after=0\"><small>".
20 get_string("movepagehere", "lesson")."</small></a></td></tr>\n";
21 while (true) {
22 if ($page->id != $pageid) {
23 if (!$title = trim(format_string($page->title))) {
24 $title = "<< ".get_string("notitle", "lesson")." >>";
26 echo "<tr><td><b>$title</b></td></tr>\n";
27 echo "<tr><td><a href=\"lesson.php?id=$cm->id&amp;sesskey=".$USER->sesskey."&amp;action=moveit&amp;pageid=$pageid&amp;after={$page->id}\"><small>".
28 get_string("movepagehere", "lesson")."</small></a></td></tr>\n";
30 if ($page->nextpageid) {
31 if (!$page = get_record("lesson_pages", "id", $page->nextpageid)) {
32 error("Teacher view: Next page not found!");
34 } else {
35 // last page reached
36 break;
39 echo "</table>\n";