| Línea 48... | Línea 48... | 
          
            | 48 |      *
 | 48 |      *
 | 
          
            | 49 |      * @param \stdClass $course Course object
 | 49 |      * @param \stdClass $course Course object
 | 
          
            | 50 |      * @param \cm_info $cm Course-module currently being edited (null if none)
 | 50 |      * @param \cm_info $cm Course-module currently being edited (null if none)
 | 
          
            | 51 |      * @param \section_info $section Section currently being edited (null if none)
 | 51 |      * @param \section_info $section Section currently being edited (null if none)
 | 
          
            | 52 |      */
 | 52 |      */
 | 
          
            | 53 |     protected function allow_add($course, \cm_info $cm = null,
 | 53 |     protected function allow_add($course, ?\cm_info $cm = null,
 | 
          
            | 54 |             \section_info $section = null) {
 | 54 |             ?\section_info $section = null) {
 | 
          
            | 55 |         return true;
 | 55 |         return true;
 | 
          
            | 56 |     }
 | 56 |     }
 | 
          
            | Línea 57... | Línea 57... | 
          
            | 57 |  
 | 57 |  
 | 
          
            | 58 |     /**
 | 58 |     /**
 | 
          
            | Línea 76... | Línea 76... | 
          
            | 76 |      * @param \stdClass $course Course object
 | 76 |      * @param \stdClass $course Course object
 | 
          
            | 77 |      * @param \cm_info $cm Course-module currently being edited (null if none)
 | 77 |      * @param \cm_info $cm Course-module currently being edited (null if none)
 | 
          
            | 78 |      * @param \section_info $section Section currently being edited (null if none)
 | 78 |      * @param \section_info $section Section currently being edited (null if none)
 | 
          
            | 79 |      * @return array Array of parameters for the JavaScript function
 | 79 |      * @return array Array of parameters for the JavaScript function
 | 
          
            | 80 |      */
 | 80 |      */
 | 
          
            | 81 |     protected function get_javascript_init_params($course, \cm_info $cm = null,
 | 81 |     protected function get_javascript_init_params($course, ?\cm_info $cm = null,
 | 
          
            | 82 |             \section_info $section = null) {
 | 82 |             ?\section_info $section = null) {
 | 
          
            | 83 |         return array();
 | 83 |         return array();
 | 
          
            | 84 |     }
 | 84 |     }
 | 
          
            | Línea 85... | Línea 85... | 
          
            | 85 |  
 | 85 |  
 | 
          
            | 86 |     /**
 | 86 |     /**
 | 
          
            | Línea 97... | Línea 97... | 
          
            | 97 |      *
 | 97 |      *
 | 
          
            | 98 |      * @param \stdClass $course Course object
 | 98 |      * @param \stdClass $course Course object
 | 
          
            | 99 |      * @param \cm_info $cm Course-module currently being edited (null if none)
 | 99 |      * @param \cm_info $cm Course-module currently being edited (null if none)
 | 
          
            | 100 |      * @param \section_info $section Section currently being edited (null if none)
 | 100 |      * @param \section_info $section Section currently being edited (null if none)
 | 
          
            | 101 |      */
 | 101 |      */
 | 
          
            | 102 |     public static function include_all_javascript($course, \cm_info $cm = null,
 | 102 |     public static function include_all_javascript($course, ?\cm_info $cm = null,
 | 
          
            | 103 |             \section_info $section = null) {
 | 103 |             ?\section_info $section = null) {
 | 
          
            | 104 |         global $PAGE;
 | 104 |         global $PAGE;
 | 
          
            | Línea 105... | Línea 105... | 
          
            | 105 |  
 | 105 |  
 | 
          
            | 106 |         // Prepare array of required YUI modules. It is bad for performance to
 | 106 |         // Prepare array of required YUI modules. It is bad for performance to
 | 
          
            | 107 |         // make multiple yui_module calls, so we group all the plugin modules
 | 107 |         // make multiple yui_module calls, so we group all the plugin modules
 | 
          
            | Línea 115... | Línea 115... | 
          
            | 115 |         $enabled = $pluginmanager->get_enabled_plugins('availability');
 | 115 |         $enabled = $pluginmanager->get_enabled_plugins('availability');
 | 
          
            | 116 |         $componentparams = new \stdClass();
 | 116 |         $componentparams = new \stdClass();
 | 
          
            | 117 |         foreach ($enabled as $plugin => $info) {
 | 117 |         foreach ($enabled as $plugin => $info) {
 | 
          
            | 118 |             // Create plugin front-end object.
 | 118 |             // Create plugin front-end object.
 | 
          
            | 119 |             $class = '\availability_' . $plugin . '\frontend';
 | 119 |             $class = '\availability_' . $plugin . '\frontend';
 | 
          
            | - |   | 120 |             if (!class_exists($class)) {
 | 
          
            | - |   | 121 |                 continue;
 | 
          
            | - |   | 122 |             }
 | 
          
            | - |   | 123 |  
 | 
          
            | - |   | 124 |             /** @var \core_availability\frontend $frontend */
 | 
          
            | 120 |             $frontend = new $class();
 | 125 |             $frontend = new $class();
 | 
          
            | Línea 121... | Línea 126... | 
          
            | 121 |  
 | 126 |  
 | 
          
            | 122 |             // Add to array of required YUI modules.
 | 127 |             // Add to array of required YUI modules.
 | 
          
            | 123 |             $component = $frontend->get_component();
 | 128 |             $component = $frontend->get_component();
 | 
          
            | Línea 124... | Línea 129... | 
          
            | 124 |             $modules[] = 'moodle-' . $component . '-form';
 | 129 |             $modules[] = 'moodle-' . $component . '-form';
 | 
          
            | 125 |  
 | 130 |  
 | 
          
            | - |   | 131 |             // Get parameters for this plugin.
 | 
          
            | 126 |             // Get parameters for this plugin.
 | 132 |             $componentparams->{$plugin} = [
 | 
          
            | 127 |             $componentparams->{$plugin} = array($component,
 | 133 |                 $component,
 | 
          
            | - |   | 134 |                 $frontend->allow_add($course, $cm, $section),
 | 
          
            | - |   | 135 |                 $frontend->get_javascript_init_params($course, $cm, $section),
 | 
          
            | Línea 128... | Línea 136... | 
          
            | 128 |                     $frontend->allow_add($course, $cm, $section),
 | 136 |                 get_config('availability_' . $plugin, 'defaultdisplaymode'),
 | 
          
            | 129 |                     $frontend->get_javascript_init_params($course, $cm, $section));
 | 137 |             ];
 | 
          
            | 130 |  
 | 138 |  
 | 
          
            | 131 |             // Include strings for this plugin.
 | 139 |             // Include strings for this plugin.
 |