/**
  * Override to remove the course module step if restoring a preset.
  */
 public function build()
 {
     parent::build();
     // If restoring into a given activity replace the restore module structure step
     // with the our specialized one, as we only need to update the current module instance.
     if ($this->get_activityid()) {
         $steps = array();
         foreach ($this->steps as $key => $step) {
             if ($step instanceof restore_module_structure_step) {
                 $step = new restore_dataform_to_module_structure_step('module_info', 'module.xml');
                 $step->set_task($this);
                 $steps[] = $step;
             } else {
                 $steps[] = $step;
             }
         }
         $this->steps = $steps;
     }
 }
 /**
  * Given a commment area, return the itemname that contains the itemid mappings.
  *
  * @param string $commentarea Comment area name e.g. database_entry.
  * @return string name of the mapping used to determine the itemid.
  */
 public function get_comment_mapping_itemname($commentarea)
 {
     if ($commentarea == 'database_entry') {
         $itemname = 'data_record';
     } else {
         $itemname = parent::get_comment_mapping_itemname($commentarea);
     }
     return $itemname;
 }
 /**
  * Given a comment area, return the itemname that contains the itemid mappings.
  *
  * @param string $commentarea
  * @return string
  */
 public function get_comment_mapping_itemname($commentarea)
 {
     switch ($commentarea) {
         case 'submission_comments':
             $itemname = 'submission';
             break;
         default:
             $itemname = parent::get_comment_mapping_itemname($commentarea);
             break;
     }
     return $itemname;
 }