Returns the subplugin structure to attach to the XML element.

@return restore_path_element[] array of elements to be processed on restore.
976438
protected function define_lti_subplugin_structure() {

        $paths = array();
        $elename = $this->get_namefor('lineitem');
        $elepath = $this->get_pathfor('/lineitems/lineitem');
        $paths[] = new restore_path_element($elename, $elepath);
        return $paths;
    }
1180640
public function getParentOrRoot() {
		if(DEBUG_LOG_BITEMS){
			BLog::addToLog('[Items.ItemTree.'.$this->tableName.']: Try to get parent / root element.');
			}
		$parent = $this->getParent();
		if(!empty($parent)){
			return $parent;
			}
		//return $fparent;
		if(DEBUG_LOG_BITEMS){
			BLog::addToLog('[Items.ItemTree.'.$this->tableName.']: Parent is empty. Trying to get root from collection.');
			}
		$collection = $this->getCollection();
		if(empty($collection)){
			return NULL;
			}
		if(DEBUG_LOG_BITEMS){
			BLog::addToLog('[Items.ItemTree.'.$this->tableName.']: Parent is empty. Collection is not empty. Calling getGroupRoot.');
			}
		$groupRoot = $collection->getGroupRoot($this->getGroupId());
		if(DEBUG_LOG_BITEMS){
			BLog::addToLog('[Items.ItemTree.'.$this->tableName.']: Got getGroupRoot!');
			}
		return $groupRoot;
		}
1333452
protected function define_assessment_subplugin_structure() {

        $paths = array();

        $elename = $this->get_namefor('grade');
        $elepath = $this->get_pathfor('/workshopform_accumulative_grade'); // we used get_recommended_name() so this works
        $paths[] = new restore_path_element($elename, $elepath);

        return $paths; // And we return the interesting paths
    }
395776
public function getContainmentTreeWithRequestPaths() {
    $tree_by_path = [];

    $tree = $this->getContainmentTree();

    foreach ($tree as $parent => $children) {
      foreach ($children as $child) {
        $tree_by_path[$this->requestPaths[$parent]][] = $this->requestPaths[$child];
      }
    }

    return $tree_by_path;
  }
156563
protected function define_question_plugin_structure() {

        $paths = array();

        // This qtype uses question_answers, add them.
        $this->add_question_question_answers($paths);

        // Add own qtype stuff.
        $elename = 'multichoice';
        // We used get_recommended_name() so this works.
        $elepath = $this->get_pathfor('/multichoice');
        $paths[] = new restore_path_element($elename, $elepath);

        return $paths; // And we return the interesting paths.
    }
903412
public function getXPath()
    {
      if(!isset($this->xpath))
      {
        $this->xpath = new DOMXPath($this);

        if($this->documentElement->namespaceURI <> '')
          $this->xpath->registerNamespace('default', $this->documentElement->namespaceURI);

        /*foreach ($this->getNamespaces() as $prefix => $namespaceUri)
          $this->xpath->registerNamespace($prefix, $namespaceUri);*/
      }

      return $this->xpath;
    }
989427
public function getDomXml()
    {
        if ($this->_oDom === null) {
            $this->_oDom = clone $this->_getInitialDom();

            // removes items denied by user group
            $this->_checkGroups($this->_oDom);

            // removes items denied by user rights
            $this->_checkRights($this->_oDom);

            // removes items marked as not visible
            $this->removeInvisibleMenuNodes($this->_oDom);

            // check config params
            $this->_checkDemoShopDenials($this->_oDom);
            $this->onGettingDomXml();
            $this->_cleanEmptyParents($this->_oDom, '//SUBMENU[@id][@list]', 'TAB');
            $this->_cleanEmptyParents($this->_oDom, '//MAINMENU[@id]', 'SUBMENU');
        }

        return $this->_oDom;
    }
987602
private function dimension_grades_structure($elementname) {

        // create XML elements
        $subplugin = $this->get_subplugin_element(); // virtual optigroup element
        $subpluginwrapper = new backup_nested_element($this->get_recommended_name());
        $subplugingrade = new backup_nested_element($elementname, array('id'), array(
            'dimensionid', 'grade', 'peercomment', 'peercommentformat'));

        // connect XML elements into the tree
        $subplugin->add_child($subpluginwrapper);
        $subpluginwrapper->add_child($subplugingrade);

        // set source to populate the data
        $subplugingrade->set_source_sql(
            "SELECT id, dimensionid, grade, peercomment, peercommentformat
               FROM {workshop_grades}
              WHERE strategy = 'accumulative' AND assessmentid = ?",
              array(backup::VAR_PARENTID));

        return $subplugin;
    }
594395
protected function define_workshop_subplugin_structure() {

        // create XML elements
        $subplugin = $this->get_subplugin_element(); // virtual optigroup element
        $subplugin_wrapper = new backup_nested_element($this->get_recommended_name());
        $subplugin_table_settings = new backup_nested_element('workshopeval_best_settings', null, array('comparison'));

        // connect XML elements into the tree
        $subplugin->add_child($subplugin_wrapper);
        $subplugin_wrapper->add_child($subplugin_table_settings);

        // set source to populate the data
        $subplugin_table_settings->set_source_table('workshopeval_best_settings', array('workshopid' => backup::VAR_ACTIVITYID));

        return $subplugin;
    }
648090
protected function define_question_plugin_structure() {

        $paths = array();

        // Add own qtype stuff.
        $elename = 'matchoptions';
        // We used get_recommended_name() so this works.
        $elepath = $this->get_pathfor('/matchoptions');
        $paths[] = new restore_path_element($elename, $elepath);

        $elename = 'match';
        // We used get_recommended_name() so this works.
        $elepath = $this->get_pathfor('/matches/match');
        $paths[] = new restore_path_element($elename, $elepath);

        return $paths;
    }
927920
protected function define_submission_subplugin_structure() {

        return false; // This subplugin backup is only one example. Skip it.

        // remember this has not XML representation
        $subplugin = $this->get_subplugin_element(null, '/assignment/assignmenttype', 'offline');

        // type of the subplugin, name of the subplugin and name of the connection point (recommended)
        $asssuboff = new backup_nested_element($this->get_recommended_name());
        // Why 'submission_config' name? Because it must be unique in the hierarchy and we
        // already are using 'config' above withing the same file
        $config = new backup_nested_element('submission_config', null, array('name', 'value'));

        $subplugin->add_child($asssuboff);
        $asssuboff->add_child($config);

        $config->set_source_table('config', array('id' => backup::VAR_PARENTID));

        return $subplugin; // And we return the root subplugin element
    }
398393
public function getInheritedElement()
    {
        /** @var ClassDescriptor|InterfaceDescriptor|null $associatedClass */
        $associatedClass = $this->getParent();

        if (($associatedClass instanceof ClassDescriptor || $associatedClass instanceof InterfaceDescriptor)
            && ($associatedClass->getParent() instanceof ClassDescriptor
                || $associatedClass->getParent() instanceof InterfaceDescriptor
            )
        ) {
            /** @var ClassDescriptor|InterfaceDescriptor $parentClass */
            $parentClass = $associatedClass->getParent();

            return $parentClass->getProperties()->get($this->getName());
        }

        return null;
    }
731781
public function getSegmentsExplode()
	{
		if ($this->_path === null)
			return [];

		$segments = explode('/', $this->_path);

		if (empty(end($segments)))
			array_pop($segments); // this normally indicates that the last character was a '/', which created an empty string in the last array member

		return $segments;
	}
1307313
public function getInnerXml()
	{
		if ( is_null( $this->domNode ) ) return null;
		$owner = $this->domNode instanceof \DOMDocument ? $this->domNode : $this->domNode->ownerDocument;
		$xml = $owner->saveXml( $this->domNode, LIBXML_NOEMPTYTAG );
		$xml = ltrim( preg_replace( "/^<\?xml.*\?>/", "", $xml ) );
		$xml = ltrim( preg_replace( "/^<!DOCTYPE[^>[]*(\[[^]]*\])?>/s", "", $xml ) );
		return $xml;
	}
1244843
protected function define_workshop_subplugin_structure() {

        $paths = array();

        $elename = $this->get_namefor('setting');
        $elepath = $this->get_pathfor('/workshopeval_best_settings'); // we used get_recommended_name() so this works
        $paths[] = new restore_path_element($elename, $elepath);

        return $paths; // And we return the interesting paths
    }
1094502
protected function define_workshop_subplugin_structure() {

        $paths = array();

        $elename = $this->get_namefor('map');
        $elepath = $this->get_pathfor('/workshopform_numerrors_map'); // we used get_recommended_name() so this works
        $paths[] = new restore_path_element($elename, $elepath);

        $elename = $this->get_namefor('dimension');
        $elepath = $this->get_pathfor('/workshopform_numerrors_dimension'); // we used get_recommended_name() so this works
        $paths[] = new restore_path_element($elename, $elepath);

        return $paths; // And we return the interesting paths
    }
554814
protected function define_grade_subplugin_structure() {

        // Create XML elements.
        $subplugin = $this->get_subplugin_element();
        $subpluginwrapper = new backup_nested_element($this->get_recommended_name());
        $subpluginelementfiles = new backup_nested_element('feedback_editpdf_files', null, array('gradeid'));
        $subpluginelementannotations = new backup_nested_element('feedback_editpdf_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_editpdf_comments');
        $subpluginelementcomment = new backup_nested_element('comment', null, array('gradeid', 'pageno', 'x', 'y', 'width', 'rawtext', 'colour', 'draft'));
        $subpluginelementrotation = new backup_nested_element('feedback_editpdf_rotation');
        $subpluginelementpagerotation = new backup_nested_element('pagerotation', null,
            array('gradeid', 'pageno', 'pathnamehash', 'isrotated', 'degree'));

        // Connect XML elements into the tree.
        $subplugin->add_child($subpluginwrapper);
        $subpluginelementannotations->add_child($subpluginelementannotation);
        $subpluginelementcomments->add_child($subpluginelementcomment);
        $subpluginelementrotation->add_child($subpluginelementpagerotation);
        $subpluginwrapper->add_child($subpluginelementfiles);
        $subpluginwrapper->add_child($subpluginelementannotations);
        $subpluginwrapper->add_child($subpluginelementcomments);
        $subpluginwrapper->add_child($subpluginelementrotation);

        // 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_editpdf_annot', array('gradeid' => backup::VAR_PARENTID));
        $subpluginelementcomment->set_source_table('assignfeedback_editpdf_cmnt', array('gradeid' => backup::VAR_PARENTID));
        $subpluginelementpagerotation->set_source_table('assignfeedback_editpdf_rot', 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_editpdf',
            \assignfeedback_editpdf\document_services::FINAL_PDF_FILEAREA, 'gradeid');
        $subpluginelementfiles->annotate_files('assignfeedback_editpdf',
            \assignfeedback_editpdf\document_services::PAGE_IMAGE_READONLY_FILEAREA, 'gradeid');
        $subpluginelementfiles->annotate_files('assignfeedback_editpdf', 'stamps', 'gradeid');
        return $subplugin;
    }