Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 142... Línea 142...
142
        // as far as the module can be missing on restore
142
        // as far as the module can be missing on restore
143
        if ($task = restore_factory::get_restore_activity_task($infoactivity)) { // can be missing
143
        if ($task = restore_factory::get_restore_activity_task($infoactivity)) { // can be missing
144
            $plan->add_task($task);
144
            $plan->add_task($task);
145
            $controller->get_progress()->progress();
145
            $controller->get_progress()->progress();
Línea -... Línea 146...
-
 
146
 
-
 
147
            // Some activities may have delegated section integrations.
-
 
148
            self::build_delegated_section_plan($controller, $infoactivity->moduleid);
146
 
149
 
147
            // For the given activity path, add as many block tasks as necessary
150
            // For the given activity path, add as many block tasks as necessary
148
            // TODO: Add blocks, we need to introspect xml here
151
            // TODO: Add blocks, we need to introspect xml here
149
            $blocks = backup_general_helper::get_blocks_from_path($task->get_taskbasepath());
152
            $blocks = backup_general_helper::get_blocks_from_path($task->get_taskbasepath());
150
            foreach ($blocks as $basepath => $name) {
153
            foreach ($blocks as $basepath => $name) {
Línea 160... Línea 163...
160
        }
163
        }
Línea 161... Línea 164...
161
 
164
 
Línea 162... Línea 165...
162
    }
165
    }
-
 
166
 
-
 
167
    /**
-
 
168
     * Build a course module delegated section backup plan.
-
 
169
     * @param restore_controller $controller
-
 
170
     * @param int $cmid the parent course module id.
-
 
171
     */
-
 
172
    protected static function build_delegated_section_plan($controller, $cmid) {
-
 
173
        $info = $controller->get_info();
-
 
174
 
-
 
175
        // Find if some section depends on that course module.
-
 
176
        $delegatedsectionid = null;
-
 
177
        foreach ($info->sections as $sectionid => $section) {
-
 
178
            // Delegated sections are not course responsability.
-
 
179
            if (isset($section->parentcmid) && $section->parentcmid == $cmid) {
-
 
180
                $delegatedsectionid = $sectionid;
-
 
181
                break;
-
 
182
            }
-
 
183
        }
-
 
184
 
-
 
185
        if (!$delegatedsectionid) {
-
 
186
            return;
-
 
187
        }
-
 
188
        self::build_section_plan($controller, $delegatedsectionid);
-
 
189
    }
163
 
190
 
164
    /**
191
    /**
165
     * Restore one 1-section backup
192
     * Restore one 1-section backup
Línea 166... Línea 193...
166
     */
193
     */
Línea 213... Línea 240...
213
            }
240
            }
214
        }
241
        }
Línea 215... Línea 242...
215
 
242
 
216
        // For the given course, add as many section tasks as necessary
243
        // For the given course, add as many section tasks as necessary
-
 
244
        foreach ($info->sections as $sectionid => $section) {
-
 
245
            // Delegated sections are not course responsability.
-
 
246
            if (isset($section->parentcmid) && !empty($section->parentcmid)) {
-
 
247
                continue;
217
        foreach ($info->sections as $sectionid => $section) {
248
            }
218
            self::build_section_plan($controller, $sectionid);
249
            self::build_section_plan($controller, $sectionid);
219
        }
250
        }
220
    }
251
    }