]> git.mjollnir.org Git - moodle.git/commitdiff
Activities can now be drag-and-dropped within side blocks!
authormoodler <moodler>
Fri, 22 Aug 2003 14:55:38 +0000 (14:55 +0000)
committermoodler <moodler>
Fri, 22 Aug 2003 14:55:38 +0000 (14:55 +0000)
course/lib.php

index dd29fe0a45a789a179960a0140ec56e758c22fc9..83e1da88b751b348888f712dcf8b3a0472ee2bca 100644 (file)
@@ -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[] = "&nbsp;<img align=bottom src=\"$pixpath/t/move.gif\" height=\"11\" width=\"11\">";
+            $moddata[] = "$USER->activitycopyname&nbsp;(<a href=\"$CFG->wwwroot/course/mod.php?cancelcopy=true\">$strcancel</a>)";
+        }
+
         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 = "<br />".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[] = "<font size=\"2\"> -> <a title=\"$strmovefull\"".
+                                 " href=\"$CFG->wwwroot/course/mod.php?moveto=$mod->id\"><b>$strmovehere</b></a></font>";
+                }
                 $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[] = "<a title=\"$mod->modfullname\" $linkcss $extra".
                              "href=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">$instancename</a>".
-                             "<br />$editbuttons";
+                             "$editbuttons";
             }
         }
     }
+    if ($ismoving) {
+        $modicon[] = "";
+        $moddata[] = "<font size=\"2\"> -> <a title=\"$strmovefull\"".
+                     " href=\"$CFG->wwwroot/course/mod.php?movetosection=$section->id\"><b>$strmovehere</b></a></font>";
+    }
     if ($isediting) {
         $editmenu = popup_form("$CFG->wwwroot/course/mod.php?id=$course->id&amp;section=$section->section&add=", 
                    $modnames, "section0", "", get_string("add")."...", "mods", get_string("activities"), true);