MDL-33442 Course: actions bring you back where you came from
authorFrederic Massart <fred@moodle.com>
Thu, 7 Jun 2012 01:29:40 +0000 (09:29 +0800)
committerFrederic Massart <fred@moodle.com>
Thu, 14 Jun 2012 09:07:57 +0000 (17:07 +0800)
course/format/renderer.php
course/mod.php
course/modduplicate.php
lang/en/moodle.php
theme/base/style/course.css
theme/standard/style/course.css

index e8d1418..b662e1e 100644 (file)
@@ -271,20 +271,27 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
      * @return string HTML to output.
      */
     protected function section_summary($section, $course, $mods) {
+        $classattr = 'section main section-summary clearfix';
+        $linkclasses = '';
+
         // If section is hidden then display grey section link
-        $classattr = 'section-summary clearfix';
-        If (!$section->visible) {
-            $classattr .= ' dimmed_text';
+        if (!$section->visible) {
+            $classattr .= ' hidden';
+            $linkclasses .= ' dimmed_text';
+        } else if ($this->is_section_current($section, $course)) {
+            $classattr .= ' current';
         }
 
         $o = '';
-        $o.= html_writer::start_tag('li', array('id' => 'section-'.$section->section,
-            'class' => $classattr));
+        $o .= html_writer::start_tag('li', array('id' => 'section-'.$section->section, 'class' => $classattr));
 
-        $title = get_section_name($course, $section);
-        $o.= html_writer::start_tag('a', array('href' => course_get_url($course, $section->section)));
-        $o.= $this->output->heading($title, 3, 'header section-title');
-        $o.= html_writer::end_tag('a');
+        $o .= html_writer::tag('div', '', array('class' => 'left side'));
+        $o .= html_writer::tag('div', '', array('class' => 'right side'));
+        $o .= html_writer::start_tag('div', array('class' => 'content'));
+
+        $title = html_writer::tag('a', get_section_name($course, $section),
+                array('href' => course_get_url($course, $section->section), 'class' => $linkclasses));
+        $o .= $this->output->heading($title, 3, 'section-title');
 
         $o.= html_writer::start_tag('div', array('class' => 'summarytext'));
         $o.= $this->format_summary_text($section);
@@ -293,7 +300,8 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
 
         $o.= $this->section_availability_message($section);
 
-        $o.= html_writer::end_tag('li');
+        $o .= html_writer::end_tag('div');
+        $o .= html_writer::end_tag('li');
 
         return $o;
     }
@@ -384,12 +392,10 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
                 )
             );
 
-            $strcancel= get_string('cancel');
-
-            $o.= html_writer::start_tag('li', array('class' => 'clipboard'));
+            $o.= html_writer::start_tag('div', array('class' => 'clipboard'));
             $o.= strip_tags(get_string('activityclipboard', '', $USER->activitycopyname));
             $o.= ' ('.html_writer::link($url, get_string('cancel')).')';
-            $o.= html_writer::end_tag('li');
+            $o.= html_writer::end_tag('div');
         }
 
         return $o;
@@ -518,6 +524,9 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
             return;
         }
 
+        // Copy activity clipboard..
+        echo $this->course_activity_clipboard($course, $displaysection);
+
         // General section if non-empty.
         $thissection = $sections[0];
         if ($thissection->summary or $thissection->sequence or $PAGE->user_is_editing()) {
@@ -549,9 +558,6 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
         $sectiontitle .= html_writer::end_tag('div');
         echo $sectiontitle;
 
-        // Copy activity clipboard..
-        echo $this->course_activity_clipboard($course, $displaysection);
-
         // Now the list of sections..
         echo $this->start_section_list();
 
index 9921d86..0dcfe10 100644 (file)
@@ -104,7 +104,8 @@ if (!empty($add)) {
         echo $OUTPUT->confirm(
             get_string('duplicateconfirm', 'core', $a),
             new single_button(
-                new moodle_url('/course/modduplicate.php', array('cmid' => $cm->id, 'course' => $course->id)),
+                new moodle_url('/course/modduplicate.php', array(
+                    'cmid' => $cm->id, 'course' => $course->id, 'sr' => $sectionreturn)),
                 get_string('continue'),
                 'post'),
             new single_button(
@@ -130,8 +131,7 @@ if (!empty($add)) {
     if (!$confirm or !confirm_sesskey()) {
         $fullmodulename = get_string('modulename', $cm->modname);
 
-        $optionsyes = array('confirm'=>1, 'delete'=>$cm->id, 'sesskey'=>sesskey());
-        $optionsno  = array('id'=>$cm->course);
+        $optionsyes = array('confirm'=>1, 'delete'=>$cm->id, 'sesskey'=>sesskey(), 'sr' => $sectionreturn);
 
         $strdeletecheck = get_string('deletecheck', '', $fullmodulename);
         $strdeletecheckfull = get_string('deletecheckfull', '', "$fullmodulename '$cm->name'");
@@ -145,7 +145,7 @@ if (!empty($add)) {
         // print_simple_box_start('center', '60%', '#FFAAAA', 20, 'noticebox');
         echo $OUTPUT->box_start('noticebox');
         $formcontinue = new single_button(new moodle_url("$CFG->wwwroot/course/mod.php", $optionsyes), get_string('yes'));
-        $formcancel = new single_button(new moodle_url($return, $optionsno), get_string('no'), 'get');
+        $formcancel = new single_button($return, get_string('no'), 'get');
         echo $OUTPUT->confirm($strdeletecheckfull, $formcontinue, $formcancel);
         echo $OUTPUT->box_end();
         echo $OUTPUT->footer();
@@ -226,9 +226,11 @@ if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
 
     moveto_module($cm, $section, $beforecm);
 
+    $sectionreturn = $USER->activitycopysectionreturn;
     unset($USER->activitycopy);
     unset($USER->activitycopycourse);
     unset($USER->activitycopyname);
+    unset($USER->activitycopysectionreturn);
 
     rebuild_course_cache($section->course);
 
@@ -340,9 +342,10 @@ if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
 
     $section = $DB->get_record('course_sections', array('id'=>$cm->section), '*', MUST_EXIST);
 
-    $USER->activitycopy       = $copy;
-    $USER->activitycopycourse = $cm->course;
-    $USER->activitycopyname   = $cm->name;
+    $USER->activitycopy              = $copy;
+    $USER->activitycopycourse        = $cm->course;
+    $USER->activitycopyname          = $cm->name;
+    $USER->activitycopysectionreturn = $sectionreturn;
 
     redirect(course_get_url($course, $sectionreturn));
 
index a9006b1..e08ea35 100644 (file)
@@ -32,8 +32,9 @@ require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php');
 require_once($CFG->dirroot . '/backup/util/includes/restore_includes.php');
 require_once($CFG->libdir . '/filelib.php');
 
-$cmid       = required_param('cmid',    PARAM_INT);
-$courseid   = required_param('course',  PARAM_INT);
+$cmid           = required_param('cmid', PARAM_INT);
+$courseid       = required_param('course', PARAM_INT);
+$sectionreturn  = optional_param('sr', 0, PARAM_INT);
 
 $course     = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
 $cm         = get_coursemodule_from_id('', $cmid, $course->id, true, MUST_EXIST);
@@ -131,16 +132,14 @@ if ($newcmid) {
             get_string('duplicatecontedit'),
             'get'),
         new single_button(
-            new moodle_url('/course/view.php#section-' . $cm->sectionnum, array('id' => $cm->course)),
+            course_get_url($course, $sectionreturn),
             get_string('duplicatecontcourse'),
             'get')
     );
 
 } else {
     echo $output->notification(get_string('duplicatesuccess', 'core', $a), 'notifysuccess');
-    echo $output->continue_button(
-        new moodle_url('/course/view.php#section-' . $cm->sectionnum, array('id' => $course->id))
-    );
+    echo $output->continue_button(course_get_url($course, $sectionreturn));
 }
 
 echo $output->footer();
index 224b741..ba5553c 100644 (file)
@@ -32,7 +32,7 @@ $string['activeusers'] = 'Active users';
 $string['activities'] = 'Activities';
 $string['activities_help'] = 'Activities, such as forums, quizzes and wikis, enable interactive content to be added to the course.';
 $string['activity'] = 'Activity';
-$string['activityclipboard'] = 'Moving this activity: <b>{$a}</b>';
+$string['activityclipboard'] = 'Moving this activity: {$a}';
 $string['activityiscurrentlyhidden'] = 'Sorry, this activity is currently hidden';
 $string['activitymodule'] = 'Activity module';
 $string['activitymodules'] = 'Activity modules';
index 0110ef8..aeabb0b 100644 (file)
@@ -13,6 +13,7 @@
 .course-content .section-summary .section-title  { margin: 2px 5px 2px 5px; }
 .course-content .section-summary .summarytext { margin: 2px 5px 2px 5px; }
 .course-content .section-summary .section-summary-activities .activity-count {margin-right: 10px;color: #AAA; font-size: 12px; margin-right: 15px;}
+.course-content .section-summary .summary { margin-top: 5px; }
 .course-content .single-section { margin-top: 1em; }
 .course-content .single-section .section-navigation { display: block; padding: 0.5em; margin-bottom: -0.5em; }
 .course-content .single-section .section-navigation .title { font-weight: bold; font-size: 108%; }
index 7381925..716e078 100644 (file)
@@ -40,6 +40,7 @@
 .path-course-view .weeks .current,
 .path-course-view .topics .current,
 .path-course-view .current td.side {background: #FFD991;}
+.path-course-view .section-summary.current {border-color: #FFD991;}
 .path-course-view .weeks .hidden,
 .path-course-view .topics .hidden,
 .path-course-view .hidden td.side {background: #DDDDDD;}