From 2c8cb30c38e4d9ab9b21c7ffc4cabe5edae21154 Mon Sep 17 00:00:00 2001 From: moodler Date: Fri, 22 Aug 2003 14:55:38 +0000 Subject: [PATCH] Activities can now be drag-and-dropped within side blocks! --- course/lib.php | 43 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/course/lib.php b/course/lib.php index dd29fe0a45..83e1da88b7 100644 --- a/course/lib.php +++ b/course/lib.php @@ -464,9 +464,12 @@ function set_section_visible($courseid, $sectionnumber, $visibility) { function print_section_block($heading, $course, $section, $mods, $modnames, $modnamesused, $absolute=true, $width="100%") { - global $CFG; + global $CFG, $USER, $THEME; static $isteacher; static $isediting; + static $ismoving; + static $strmovehere; + static $strmovefull; if (!isset($isteacher)) { $isteacher = isteacher($course->id); @@ -474,6 +477,9 @@ function print_section_block($heading, $course, $section, $mods, $modnames, $mod if (!isset($isediting)) { $isediting = isediting($course->id); } + if (!isset($ismoving)) { + $ismoving = ismoving($course->id); + } $modinfo = unserialize($course->modinfo); $moddata = array(); @@ -484,15 +490,39 @@ function print_section_block($heading, $course, $section, $mods, $modnames, $mod $sectionmods = explode(",", $section->sequence); + if ($ismoving) { + $strmovehere = get_string("movehere"); + $strmovefull = get_string("movefull", "", "'$USER->activitycopyname'"); + $stractivityclipboard = $USER->activitycopyname; + $strcancel= get_string("cancel"); + if (empty($THEME->custompix)) { + $pixpath = "$CFG->wwwroot/pix"; + } else { + $pixpath = "$CFG->wwwroot/theme/$CFG->theme/pix"; + } + $modicon[] = " "; + $moddata[] = "$USER->activitycopyname (wwwroot/course/mod.php?cancelcopy=true\">$strcancel)"; + } + foreach ($sectionmods as $modnumber) { if (empty($mods[$modnumber])) { continue; } $mod = $mods[$modnumber]; - if ($isediting) { - $editbuttons = make_editing_buttons($mod->id, $absolute, $mod->visible, false); + if ($isediting and !$ismoving) { + $editbuttons = "
".make_editing_buttons($mod->id, $absolute, $mod->visible, true); + } else { + $editbuttons = ""; } if ($mod->visible or $isteacher) { + if ($ismoving) { + if ($mod->id == $USER->activitycopy) { + continue; + } + $modicon[] = ""; + $moddata[] = " -> wwwroot/course/mod.php?moveto=$mod->id\">$strmovehere"; + } $instancename = urldecode($modinfo[$modnumber]->name); $linkcss = $mod->visible ? "" : " class=\"dimmed\" "; if (!empty($modinfo[$modnumber]->extra)) { @@ -505,10 +535,15 @@ function print_section_block($heading, $course, $section, $mods, $modnames, $mod " height=\"16\" width=\"16\" alt=\"$mod->modfullname\">"; $moddata[] = "modfullname\" $linkcss $extra". "href=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">$instancename". - "
$editbuttons"; + "$editbuttons"; } } } + if ($ismoving) { + $modicon[] = ""; + $moddata[] = " -> wwwroot/course/mod.php?movetosection=$section->id\">$strmovehere"; + } if ($isediting) { $editmenu = popup_form("$CFG->wwwroot/course/mod.php?id=$course->id&section=$section->section&add=", $modnames, "section0", "", get_string("add")."...", "mods", get_string("activities"), true); -- 2.39.5