Proyectos de Subversion Moodle

Rev

Rev 11 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 11 Rev 1441
Línea 20... Línea 20...
20
 * @package    format_singleactivity
20
 * @package    format_singleactivity
21
 * @copyright  2012 Marina Glancy
21
 * @copyright  2012 Marina Glancy
22
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
22
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23
 */
23
 */
Línea -... Línea 24...
-
 
24
 
-
 
25
use core_courseformat\sectiondelegate;
24
 
26
 
25
defined('MOODLE_INTERNAL') || die();
27
defined('MOODLE_INTERNAL') || die();
Línea 26... Línea 28...
26
require_once($CFG->dirroot. '/course/format/lib.php');
28
require_once($CFG->dirroot. '/course/format/lib.php');
27
 
29
 
Línea 286... Línea 288...
286
            if ($sectionnum && !empty($cmlist) && $firstorphanedcm === null) {
288
            if ($sectionnum && !empty($cmlist) && $firstorphanedcm === null) {
287
                $firstorphanedcm = reset($cmlist);
289
                $firstorphanedcm = reset($cmlist);
288
            }
290
            }
289
            foreach ($cmlist as $cmid) {
291
            foreach ($cmlist as $cmid) {
290
                if ($sectionnum > 1) {
292
                if ($sectionnum > 1) {
-
 
293
                    // These module types cannot be moved from section 0.
-
 
294
                    if (!$modinfo->cms[$cmid]->is_of_type_that_can_display()) {
-
 
295
                        continue;
-
 
296
                    }
291
                    moveto_module($modinfo->get_cm($cmid), $modinfo->get_section_info(1));
297
                    moveto_module($modinfo->get_cm($cmid), $modinfo->get_section_info(1));
292
                } else if (!$hasvisibleactivities && $sectionnum == 1 && $modinfo->get_cm($cmid)->visible) {
298
                } else if (!$hasvisibleactivities && $sectionnum == 1 && $modinfo->get_cm($cmid)->visible) {
293
                    $hasvisibleactivities = true;
299
                    $hasvisibleactivities = true;
294
                }
300
                }
295
            }
301
            }
296
        }
302
        }
297
        if (!empty($modinfo->sections[0])) {
303
        if (!empty($modinfo->sections[0])) {
298
            foreach ($modinfo->sections[0] as $cmid) {
304
            foreach ($modinfo->sections[0] as $cmid) {
-
 
305
                // These module types cannot be moved from section 0.
-
 
306
                if (!$modinfo->cms[$cmid]->is_of_type_that_can_display()) {
-
 
307
                    continue;
-
 
308
                }
299
                if (!$activity || $cmid != $activity->id) {
309
                if (!$activity || $cmid != $activity->id) {
300
                    moveto_module($modinfo->get_cm($cmid), $modinfo->get_section_info(1), $firstorphanedcm);
310
                    moveto_module($modinfo->get_cm($cmid), $modinfo->get_section_info(1), $firstorphanedcm);
301
                }
311
                }
302
            }
312
            }
303
        }
313
        }
Línea 336... Línea 346...
336
    }
346
    }
Línea 337... Línea 347...
337
 
347
 
338
    /**
348
    /**
339
     * Get the activities supported by the format.
349
     * Get the activities supported by the format.
340
     *
350
     *
-
 
351
     * Here we ignore the modules that do not have a page of their own or need sections,
341
     * Here we ignore the modules that do not have a page of their own, like the label.
352
     * like the label or subsection.
342
     *
353
     *
343
     * @return array array($module => $name of the module).
354
     * @return array array($module => $name of the module).
344
     */
355
     */
345
    public static function get_supported_activities() {
356
    public static function get_supported_activities() {
346
        $availabletypes = get_module_types_names();
357
        $availabletypes = get_module_types_names();
347
        foreach ($availabletypes as $module => $name) {
358
        foreach ($availabletypes as $module => $name) {
348
            if (plugin_supports('mod', $module, FEATURE_NO_VIEW_LINK, false)) {
359
            if (plugin_supports('mod', $module, FEATURE_NO_VIEW_LINK, false)) {
349
                unset($availabletypes[$module]);
360
                unset($availabletypes[$module]);
-
 
361
            }
-
 
362
            if (sectiondelegate::has_delegate_class('mod_' . $module)) {
-
 
363
                unset($availabletypes[$module]);
350
            }
364
            }
351
        }
365
        }
352
        return $availabletypes;
366
        return $availabletypes;
Línea 353... Línea 367...
353
    }
367
    }