XBRL.php
public function summarizeNodes( $nodes, $locators, $options = array() )
	{
		$result = array();

		if ( ! $options || ! is_array( $options ) ) $options = array();
		if ( ! isset( $options['collectionName'] ) ) $options['collectionName'] = 'children';
		if ( ! isset( $options['labelName'] ) ) $options['labelName'] = 'label';
		if ( ! isset( $options['description'] ) ) $options['description'] = 'true';
		$options['indent'] = isset( $options['indent'] ) ? $options['indent'] + 1 : 0;

		$taxonomy_base_name = $this->getTaxonomyXSD();

		foreach ( $nodes as $nodeKey => $node )
		{
			$index = $node[ $options['labelName'] ];
			if ( isset( $node['arcrole'] ) )	$index .= " ({$node['arcrole']})";
			if ( isset( $node['order'] ) )		$index .= " ({$node['order']})";
			if ( isset( $node['targetRole'] ) ) $index .= " ->({$node['targetRole']})";

			//	$this->log()->info(  isset( $locators[ $node[ $labelName ] ] )
			//		? "Locator found {$locators[ $node[ $labelName ] ]}\n"
			//		: "Locator not found" );

			// $taxonomy = strpos( $locators[ $node[ $options['labelName'] ] ], $taxonomy_base_name ) === 0
			//	? $this
			//	: $this->getTaxonomyForXSD( $locators[ $node[ $options['labelName'] ] ] );

			if ( $options['description'] )
			{
				$description = $this->getTaxonomyDescriptionForIdWithDefaults( $node[ $options['labelName'] ], null, getDefaultLanguage() );
				if ( $description !== false )
				{
					$index .= " '$description'";
				}
			}

			if ( isset( $node['nodeclass'] ) )
				$index .= " ({$node['nodeclass']})";

			if ( isset( $options['callback'] ) )
			{
				if ( $callback_string = call_user_func( array( $this, $options['callback'] ), $node, $taxonomy ) )
				{
					$index .= " [$callback_string]";
				}
			}

			$leaf = "Leaf";

			$result[ $index ] = $leaf;
			if ( ! isset( $node[ $options['collectionName'] ] ) ) continue;
			$result[ $index ] = $this->summarizeNodes( $node[ $options['collectionName'] ], $locators, $options );
		}

		return $result;
	}
public function summarizeNodes( $nodes, $locators, $options = array() )
	{
		$result = array();

		if ( ! $options || ! is_array( $options ) ) $options = array();
		if ( ! isset( $options['collectionName'] ) ) $options['collectionName'] = 'children';
		if ( ! isset( $options['labelName'] ) ) $options['labelName'] = 'label';
		if ( ! isset( $options['description'] ) ) $options['description'] = 'true';
		$options['indent'] = isset( $options['indent'] ) ? $options['indent'] + 1 : 0;

		$taxonomy_base_name = $this->getTaxonomyXSD();

		foreach ( $nodes as $nodeKey => $node )
		{
			$index = $node[ $options['labelName'] ];
			if ( isset( $node['arcrole'] ) )	$index .= " ({$node['arcrole']})";
			if ( isset( $node['order'] ) )		$index .= " ({$node['order']})";
			if ( isset( $node['targetRole'] ) ) $index .= " ->({$node['targetRole']})";

			//	$this->log()->info(  isset( $locators[ $node[ $labelName ] ] )
			//		? "Locator found {$locators[ $node[ $labelName ] ]}\n"
			//		: "Locator not found" );

			// $taxonomy = strpos( $locators[ $node[ $options['labelName'] ] ], $taxonomy_base_name ) === 0
			//	? $this
			//	: $this->getTaxonomyForXSD( $locators[ $node[ $options['labelName'] ] ] );

			if ( $options['description'] )
			{
				$description = $this->getTaxonomyDescriptionForIdWithDefaults( $node[ $options['labelName'] ], null, getDefaultLanguage() );
				if ( $description !== false )
				{
					$index .= " '$description'";
				}
			}

			if ( isset( $node['nodeclass'] ) )
				$index .= " ({$node['nodeclass']})";

			if ( isset( $options['callback'] ) )
			{
				if ( $callback_string = call_user_func( array( $this, $options['callback'] ), $node, $taxonomy ) )
				{
					$index .= " [$callback_string]";
				}
			}

			$leaf = "Leaf";

			$result[ $index ] = $leaf;
			if ( ! isset( $node[ $options['collectionName'] ] ) ) continue;
			$result[ $index ] = $this->summarizeNodes( $node[ $options['collectionName'] ], $locators, $options );
		}

		return $result;
	}
public function summarizeNodes ( $ nodes , $ locators , $ options = array ( ) ) { $ result = array ( ) ; if ( ! $ options || ! is_array ( $ options ) ) $ options = array ( ) ; if ( ! isset ( $ options [ 'collectionName' ] ) ) $ options [ 'collectionName' ] = 'children' ; if ( ! isset ( $ options [ 'labelName' ] ) ) $ options [ 'labelName' ] = 'label' ; if ( ! isset ( $ options [ 'description' ] ) ) $ options [ 'description' ] = 'true' ; $ options [ 'indent' ] = isset ( $ options [ 'indent' ] ) ? $ options [ 'indent' ] + 1 : 0 ; $ taxonomy_base_name = $ this -> getTaxonomyXSD ( ) ; foreach ( $ nodes as $ nodeKey => $ node ) { $ index = $ node [ $ options [ 'labelName' ] ] ; if ( isset ( $ node [ 'arcrole' ] ) ) $ index .= " ({$node['arcrole']})" ; if ( isset ( $ node [ 'order' ] ) ) $ index .= " ({$node['order']})" ; if ( isset ( $ node [ 'targetRole' ] ) ) $ index .= " ->({$node['targetRole']})" ; //	$this->log()->info(  isset( $locators[ $node[ $labelName ] ] )
 //		? "Locator found {$locators[ $node[ $labelName ] ]}\n"
 //		: "Locator not found" );
 // $taxonomy = strpos( $locators[ $node[ $options['labelName'] ] ], $taxonomy_base_name ) === 0
 //	? $this
 //	: $this->getTaxonomyForXSD( $locators[ $node[ $options['labelName'] ] ] );
 if ( $ options [ 'description' ] ) { $ description = $ this -> getTaxonomyDescriptionForIdWithDefaults ( $ node [ $ options [ 'labelName' ] ] , null , getDefaultLanguage ( ) ) ; if ( $ description !== false ) { $ index .= " '$description'" ; } } if ( isset ( $ node [ 'nodeclass' ] ) ) $ index .= " ({$node['nodeclass']})" ; if ( isset ( $ options [ 'callback' ] ) ) { if ( $ callback_string = call_user_func ( array ( $ this , $ options [ 'callback' ] ) , $ node , $ taxonomy ) ) { $ index .= " [$callback_string]" ; } } $ leaf = "Leaf" ; $ result [ $ index ] = $ leaf ; if ( ! isset ( $ node [ $ options [ 'collectionName' ] ] ) ) continue ; $ result [ $ index ] = $ this -> summarizeNodes ( $ node [ $ options [ 'collectionName' ] ] , $ locators , $ options ) ; } return $ result ; }
Creates a summary of a collection of nodes that are arganized in to a hierarchy such as presentation and definition link bases.
The requirements of the collection is that it is an associative array, that there is an element which is the label and one which
is a nested collection of nodes.  This function is called recursively in a depth first manner to traverse the hierarchy.
@param array $nodes The array of nodes to summarize.
@param array $locators An array of locators for the role
@param array options An array of options with the following optional elements:
int 'indent' The indentation level for this iteration.
string		'labelName'			The name of the element of each node that represents the label to include in the summary
string		'collectionName'	The name of the element which references a nested collection of nodes if the node is not a leaf.
bool		'description'		If not present or true, include a node decription in the output
function	'callback'			A function to call for each node.  The function will be passed the node and the taxonomy of the node
It will return a string that will be added to the description generated.
@return array A hierarchy summarizing the node hierarchy passed in
Creates a summary of a collection of nodes that are arganized in to a hierarchy such as presentation and definition link bases . The requirements of the collection is that it is an associative array that there is an element which is the label and one which is a nested collection of nodes . This function is called recursively in a depth first manner to traverse the hierarchy .