original_string: protected function define_structure() {
  
          // To know if we are including userinfo
          $userinfo = $this->get_setting_value('userinfo');
  
          // Define the elements
  
          $areas = new backup_nested_element('areas');
  
          $area = new backup_nested_element('area', array('id'), array(
              'areaname', 'activemethod'));
  
          $definitions = new backup_nested_element('definitions');
  
          $definition = new backup_nested_element('definition', array('id'), array(
              'method', 'name', 'description', 'descriptionformat', 'status',
              'timecreated', 'timemodified', 'options'));
  
          $instances = new backup_nested_element('instances');
  
          $instance = new backup_nested_element('instance', array('id'), array(
              'raterid', 'itemid', 'rawgrade', 'status', 'feedback',
              'feedbackformat', 'timemodified'));
  
          // Build the tree including the method specific structures
          // (beware - the order of how gradingform plugins structures are attached is important)
          $areas->add_child($area);
          // attach local plugin stucture to $area element, multiple allowed
          $this->add_plugin_structure('local', $area, true);
          $area->add_child($definitions);
          $definitions->add_child($definition);
          $this->add_plugin_structure('gradingform', $definition, true);
          // attach local plugin stucture to $definition element, multiple allowed
          $this->add_plugin_structure('local', $definition, true);
          $definition->add_child($instances);
          $instances->add_child($instance);
          $this->add_plugin_structure('gradingform', $instance, false);
          // attach local plugin stucture to $instance element, multiple allowed
          $this->add_plugin_structure('local', $instance, true);
  
          // Define data sources
  
          $area->set_source_table('grading_areas', array('contextid' => backup::VAR_CONTEXTID,
              'component' => array('sqlparam' => 'mod_'.$this->get_task()->get_modulename())));
  
          $definition->set_source_table('grading_definitions', array('areaid' => backup::VAR_PARENTID));
  
          if ($userinfo) {
              $instance->set_source_table('grading_instances', array('definitionid' => backup::VAR_PARENTID));
          }
  
          // Annotate references
          $definition->annotate_files('grading', 'description', 'id');
          $instance->annotate_ids('user', 'raterid');
  
          // Return the root element
          return $areas;
      }
code: protected function define_structure() {
  
          // To know if we are including userinfo
          $userinfo = $this->get_setting_value('userinfo');
  
          // Define the elements
  
          $areas = new backup_nested_element('areas');
  
          $area = new backup_nested_element('area', array('id'), array(
              'areaname', 'activemethod'));
  
          $definitions = new backup_nested_element('definitions');
  
          $definition = new backup_nested_element('definition', array('id'), array(
              'method', 'name', 'description', 'descriptionformat', 'status',
              'timecreated', 'timemodified', 'options'));
  
          $instances = new backup_nested_element('instances');
  
          $instance = new backup_nested_element('instance', array('id'), array(
              'raterid', 'itemid', 'rawgrade', 'status', 'feedback',
              'feedbackformat', 'timemodified'));
  
          // Build the tree including the method specific structures
          // (beware - the order of how gradingform plugins structures are attached is important)
          $areas->add_child($area);
          // attach local plugin stucture to $area element, multiple allowed
          $this->add_plugin_structure('local', $area, true);
          $area->add_child($definitions);
          $definitions->add_child($definition);
          $this->add_plugin_structure('gradingform', $definition, true);
          // attach local plugin stucture to $definition element, multiple allowed
          $this->add_plugin_structure('local', $definition, true);
          $definition->add_child($instances);
          $instances->add_child($instance);
          $this->add_plugin_structure('gradingform', $instance, false);
          // attach local plugin stucture to $instance element, multiple allowed
          $this->add_plugin_structure('local', $instance, true);
  
          // Define data sources
  
          $area->set_source_table('grading_areas', array('contextid' => backup::VAR_CONTEXTID,
              'component' => array('sqlparam' => 'mod_'.$this->get_task()->get_modulename())));
  
          $definition->set_source_table('grading_definitions', array('areaid' => backup::VAR_PARENTID));
  
          if ($userinfo) {
              $instance->set_source_table('grading_instances', array('definitionid' => backup::VAR_PARENTID));
          }
  
          // Annotate references
          $definition->annotate_files('grading', 'description', 'id');
          $instance->annotate_ids('user', 'raterid');
  
          // Return the root element
          return $areas;
      }
code_tokens: protected function define_structure ( ) { // To know if we are including userinfo $ userinfo = $ this -> get_setting_value ( 'userinfo' ) ; // Define the elements $ areas = new backup_nested_element ( 'areas' ) ; $ area = new backup_nested_element ( 'area' , array ( 'id' ) , array ( 'areaname' , 'activemethod' ) ) ; $ definitions = new backup_nested_element ( 'definitions' ) ; $ definition = new backup_nested_element ( 'definition' , array ( 'id' ) , array ( 'method' , 'name' , 'description' , 'descriptionformat' , 'status' , 'timecreated' , 'timemodified' , 'options' ) ) ; $ instances = new backup_nested_element ( 'instances' ) ; $ instance = new backup_nested_element ( 'instance' , array ( 'id' ) , array ( 'raterid' , 'itemid' , 'rawgrade' , 'status' , 'feedback' , 'feedbackformat' , 'timemodified' ) ) ; // Build the tree including the method specific structures // (beware - the order of how gradingform plugins structures are attached is important) $ areas -> add_child ( $ area ) ; // attach local plugin stucture to $area element, multiple allowed $ this -> add_plugin_structure ( 'local' , $ area , true ) ; $ area -> add_child ( $ definitions ) ; $ definitions -> add_child ( $ definition ) ; $ this -> add_plugin_structure ( 'gradingform' , $ definition , true ) ; // attach local plugin stucture to $definition element, multiple allowed $ this -> add_plugin_structure ( 'local' , $ definition , true ) ; $ definition -> add_child ( $ instances ) ; $ instances -> add_child ( $ instance ) ; $ this -> add_plugin_structure ( 'gradingform' , $ instance , false ) ; // attach local plugin stucture to $instance element, multiple allowed $ this -> add_plugin_structure ( 'local' , $ instance , true ) ; // Define data sources $ area -> set_source_table ( 'grading_areas' , array ( 'contextid' => backup :: VAR_CONTEXTID , 'component' => array ( 'sqlparam' => 'mod_' . $ this -> get_task ( ) -> get_modulename ( ) ) ) ) ; $ definition -> set_source_table ( 'grading_definitions' , array ( 'areaid' => backup :: VAR_PARENTID ) ) ; if ( $ userinfo ) { $ instance -> set_source_table ( 'grading_instances' , array ( 'definitionid' => backup :: VAR_PARENTID ) ) ; } // Annotate references $ definition -> annotate_files ( 'grading' , 'description' , 'id' ) ; $ instance -> annotate_ids ( 'user' , 'raterid' ) ; // Return the root element return $ areas ; }
docstring: Declares the gradable areas structures and data sources
docstring_tokens: Declares the gradable areas structures and data sources