Merge branch 'MDL-32870' of git://github.com/jmvedrine/moodle
authorMarina Glancy <marina@moodle.com>
Tue, 7 Oct 2014 09:16:56 +0000 (17:16 +0800)
committerMarina Glancy <marina@moodle.com>
Tue, 7 Oct 2014 09:16:56 +0000 (17:16 +0800)
1  2 
mod/lesson/lib.php

diff --combined mod/lesson/lib.php
@@@ -738,26 -738,14 +738,26 @@@ function lesson_get_extra_capabilities(
   */
  function lesson_supports($feature) {
      switch($feature) {
 -        case FEATURE_GROUPS:                  return false;
 -        case FEATURE_GROUPINGS:               return false;
 -        case FEATURE_MOD_INTRO:               return false;
 -        case FEATURE_COMPLETION_TRACKS_VIEWS: return true;
 -        case FEATURE_GRADE_HAS_GRADE:         return true;
 -        case FEATURE_GRADE_OUTCOMES:          return true;
 -        case FEATURE_BACKUP_MOODLE2:          return true;
 -        default: return null;
 +        case FEATURE_GROUPS:
 +            return false;
 +        case FEATURE_GROUPINGS:
 +            return false;
 +        case FEATURE_GROUPMEMBERSONLY:
 +            return true;
 +        case FEATURE_MOD_INTRO:
 +            return true;
 +        case FEATURE_COMPLETION_TRACKS_VIEWS:
 +            return true;
 +        case FEATURE_GRADE_HAS_GRADE:
 +            return true;
 +        case FEATURE_GRADE_OUTCOMES:
 +            return true;
 +        case FEATURE_BACKUP_MOODLE2:
 +            return true;
 +        case FEATURE_SHOW_DESCRIPTION:
 +            return true;
 +        default:
 +            return null;
      }
  }
  
@@@ -877,6 -865,13 +877,13 @@@ function lesson_pluginfile($course, $cm
          }
          $fullpath = "/$context->id/mod_lesson/$filearea/$pageid/".implode('/', $args);
  
+     } else if ($filearea === 'page_answers' || $filearea === 'page_responses') {
+         $itemid = (int)array_shift($args);
+         if (!$pageanswers = $DB->get_record('lesson_answers', array('id' => $itemid))) {
+             return false;
+         }
+         $fullpath = "/$context->id/mod_lesson/$filearea/$itemid/".implode('/', $args);
      } else if ($filearea === 'mediafile') {
          if (count($args) > 1) {
              // Remove the itemid when it appears to be part of the arguments. If there is only one argument
@@@ -909,6 -904,8 +916,8 @@@ function lesson_get_file_areas() 
      $areas = array();
      $areas['page_contents'] = get_string('pagecontents', 'mod_lesson');
      $areas['mediafile'] = get_string('mediafile', 'mod_lesson');
+     $areas['page_answers'] = get_string('pageanswers', 'mod_lesson');
+     $areas['page_responses'] = get_string('pageresponses', 'mod_lesson');
      return $areas;
  }