Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 131... Línea 131...
131
        // Add the activity task, responsible for outputting
131
        // Add the activity task, responsible for outputting
132
        // all the module related information
132
        // all the module related information
133
        try {
133
        try {
134
            $plan->add_task(backup_factory::get_backup_activity_task($controller->get_format(), $id));
134
            $plan->add_task(backup_factory::get_backup_activity_task($controller->get_format(), $id));
Línea -... Línea 135...
-
 
135
 
-
 
136
            // Some activities may have delegated section integrations.
-
 
137
            self::build_delegated_section_plan($controller, $id);
135
 
138
 
136
            // For the given activity, add as many block tasks as necessary
139
            // For the given activity, add as many block tasks as necessary
137
            $blockids = backup_plan_dbops::get_blockids_from_moduleid($id);
140
            $blockids = backup_plan_dbops::get_blockids_from_moduleid($id);
138
            foreach ($blockids as $blockid) {
141
            foreach ($blockids as $blockid) {
139
                try {
142
                try {
Línea 149... Línea 152...
149
            $controller->log(get_string('error_course_module_not_found', 'backup', $id), backup::LOG_WARNING);
152
            $controller->log(get_string('error_course_module_not_found', 'backup', $id), backup::LOG_WARNING);
150
        }
153
        }
151
    }
154
    }
Línea 152... Línea 155...
152
 
155
 
-
 
156
    /**
-
 
157
     * Build a course module delegated section backup plan.
-
 
158
     * @param backup_controller $controller
-
 
159
     * @param int $cmid the parent course module id.
-
 
160
     */
-
 
161
    protected static function build_delegated_section_plan($controller, $cmid) {
-
 
162
        global $CFG, $DB;
-
 
163
 
-
 
164
        // Check moduleid exists.
-
 
165
        if (!$coursemodule = get_coursemodule_from_id(false, $cmid)) {
-
 
166
            $controller->log(get_string('error_course_module_not_found', 'backup', $cmid), backup::LOG_WARNING);
-
 
167
        }
-
 
168
        $classname = 'mod_' . $coursemodule->modname . '\courseformat\sectiondelegate';
-
 
169
        if (!class_exists($classname)) {
-
 
170
            return;
-
 
171
        }
-
 
172
        $sectionid = null;
-
 
173
        try {
-
 
174
            $sectionid = $classname::delegated_section_id($coursemodule);
-
 
175
        } catch (dml_exception $error) {
-
 
176
            $controller->log(get_string('error_delegate_section_not_found', 'backup', $cmid), backup::LOG_WARNING);
-
 
177
            return;
-
 
178
        }
-
 
179
 
-
 
180
        $plan = $controller->get_plan();
-
 
181
        $sectiontask = backup_factory::get_backup_section_task($controller->get_format(), $sectionid);
-
 
182
        $sectiontask->set_delegated_cm($cmid);
-
 
183
        $plan->add_task($sectiontask);
-
 
184
 
-
 
185
        // For the given section, add as many activity tasks as necessary.
-
 
186
        $coursemodules = backup_plan_dbops::get_modules_from_sectionid($sectionid);
-
 
187
        foreach ($coursemodules as $coursemodule) {
-
 
188
            if (plugin_supports('mod', $coursemodule->modname, FEATURE_BACKUP_MOODLE2)) {
-
 
189
                self::build_activity_plan($controller, $coursemodule->id);
-
 
190
            }
-
 
191
        }
-
 
192
    }
-
 
193
 
153
    /**
194
    /**
154
     * Build one 1-section backup
195
     * Build one 1-section backup
155
     */
196
     */
Línea 156... Línea 197...
156
    protected static function build_section_plan($controller, $id) {
197
    protected static function build_section_plan($controller, $id) {
Línea 183... Línea 224...
183
        // all the course related information
224
        // all the course related information
184
        $plan->add_task(backup_factory::get_backup_course_task($controller->get_format(), $id));
225
        $plan->add_task(backup_factory::get_backup_course_task($controller->get_format(), $id));
Línea 185... Línea 226...
185
 
226
 
186
        // For the given course, add as many section tasks as necessary
227
        // For the given course, add as many section tasks as necessary
187
        $sections = backup_plan_dbops::get_sections_from_courseid($id);
228
        $sections = backup_plan_dbops::get_sections_from_courseid($id);
-
 
229
        foreach ($sections as $sectionid) {
-
 
230
            // Delegated sections are not course responsability.
-
 
231
            $sectiondata = backup_plan_dbops::get_section_from_id($sectionid);
-
 
232
            if (!empty($sectiondata->component)) {
-
 
233
                continue;
188
        foreach ($sections as $section) {
234
            }
189
            self::build_section_plan($controller, $section);
235
            self::build_section_plan($controller, $sectionid);
Línea 190... Línea 236...
190
        }
236
        }
191
 
237
 
192
        // For the given course, add as many block tasks as necessary
238
        // For the given course, add as many block tasks as necessary