Gitlab CSE Unil

Commit 4e4f98e2 authored by M. Chardon's avatar M. Chardon
Browse files

correction bug restauration

parent 303c4abb
......@@ -45,22 +45,17 @@ class backup_assignfeedback_editpdfplus_subplugin extends backup_subplugin {
$subpluginwrapper = new backup_nested_element($this->get_recommended_name());
$subpluginelementfiles = new backup_nested_element('feedback_editpdfplus_files', null, array('gradeid'));
$subpluginelementannotations = new backup_nested_element('feedback_editpdfplus_annotations');
$subpluginelementannotation = new backup_nested_element('annotation', null, array('gradeid', 'pageno', 'type', 'x', 'y', 'endx', 'endy', 'colour', 'path', 'draft'));
$subpluginelementcomments = new backup_nested_element('feedback_editpdfplus_comments');
$subpluginelementcomment = new backup_nested_element('comment', null, array('gradeid', 'pageno', 'x', 'y', 'width', 'rawtext', 'colour', 'draft'));
$subpluginelementannotation = new backup_nested_element('feedback_editpdfplus_annotation', null, array('gradeid', 'pageno', 'type', 'x', 'y', 'endx', 'endy', 'colour', 'path', 'draft'));
// Connect XML elements into the tree.
$subplugin->add_child($subpluginwrapper);
$subpluginelementannotations->add_child($subpluginelementannotation);
$subpluginelementcomments->add_child($subpluginelementcomment);
$subpluginwrapper->add_child($subpluginelementfiles);
$subpluginwrapper->add_child($subpluginelementannotations);
$subpluginwrapper->add_child($subpluginelementcomments);
// Set source to populate the data.
$subpluginelementfiles->set_source_sql('SELECT id AS gradeid from {assign_grades} where id = :gradeid', array('gradeid' => backup::VAR_PARENTID));
$subpluginelementannotation->set_source_table('assignfeedback_editpp_annot', array('gradeid' => backup::VAR_PARENTID));
$subpluginelementcomment->set_source_table('assignfeedback_editpp_cmnt', array('gradeid' => backup::VAR_PARENTID));
// We only need to backup the files in the final pdf area, and the readonly page images - the others can be regenerated.
$subpluginelementfiles->annotate_files('assignfeedback_editpdfplus',
\assignfeedback_editpdfplus\document_services::FINAL_PDF_FILEAREA, 'gradeid');
......
......@@ -50,11 +50,8 @@ class restore_assignfeedback_editpdfplus_subplugin extends restore_subplugin {
$paths[] = new restore_path_element($elename, $elepath);
// Now we have the list of comments and annotations per grade.
$elename = $this->get_namefor('comment');
$elepath = $this->get_pathfor('/feedback_editpdfplus_comments/comment');
$paths[] = new restore_path_element($elename, $elepath);
$elename = $this->get_namefor('annotation');
$elepath = $this->get_pathfor('/feedback_editpdfplus_annotations/annotation');
$elename = $this->get_namefor('feedback_editpdfplus_annotation');
$elepath = $this->get_pathfor('/feedback_editpdfplus_annotations/feedback_editpdfplus_annotation');
$paths[] = new restore_path_element($elename, $elepath);
return $paths;
......@@ -79,7 +76,7 @@ class restore_assignfeedback_editpdfplus_subplugin extends restore_subplugin {
* Processes one feedback_editpdfplus_annotations/annotation element
* @param mixed $data
*/
public function process_assignfeedback_editpdfplus_annotation($data) {
public function process_assignfeedback_editpdfplus_feedback_editpdfplus_annotation($data) {
global $DB;
$data = (object)$data;
......@@ -92,21 +89,4 @@ class restore_assignfeedback_editpdfplus_subplugin extends restore_subplugin {
}
/**
* Processes one feedback_editpdfplus_comments/comment element
* @param mixed $data
*/
public function process_assignfeedback_editpdfplus_comment($data) {
global $DB;
$data = (object)$data;
$oldgradeid = $data->gradeid;
// The mapping is set in the restore for the core assign activity
// when a grade node is processed.
$data->gradeid = $this->get_mappingid('grade', $data->gradeid);
$DB->insert_record('assignfeedback_editpp_cmnt', $data);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment