XBRL-Report-Base.php
public function saveGeneratedHierarchy( $filename, $zip = false )
	{
		$result = true;

		if ( ! property_exists( $this, 'hierarchies' ) ) return "The hierarchies have not been generated";
		$json = json_encode( $this->hierarchies );
		if ( json_last_error() !== JSON_ERROR_NONE )
		{
			$result = "An error occurred generating the JSON for the hierarchies: " . XBRL::json_last_error_msg();
		}
		elseif ( $zip )
		{
			$zip = new ZipArchive();
			$zip->open( $filename, ZipArchive::CREATE );
			if ( ! $zip->addFromString( 'hierarchies.json', $json ) )
			{
				$result = "Failed to add JSON to zip file";
			}

			if ( $zip->close() === false )
			{
				$result = "Error closing zip file: " . $zip->getStatusString();
			}
		}
		else
		{
			if ( file_put_contents( $filename, $json ) === false )
			{
				$result = "Writing to the file failed";
			}
		}

		return $result;
	}
public function saveGeneratedHierarchy( $filename, $zip = false )
	{
		$result = true;

		if ( ! property_exists( $this, 'hierarchies' ) ) return "The hierarchies have not been generated";
		$json = json_encode( $this->hierarchies );
		if ( json_last_error() !== JSON_ERROR_NONE )
		{
			$result = "An error occurred generating the JSON for the hierarchies: " . XBRL::json_last_error_msg();
		}
		elseif ( $zip )
		{
			$zip = new ZipArchive();
			$zip->open( $filename, ZipArchive::CREATE );
			if ( ! $zip->addFromString( 'hierarchies.json', $json ) )
			{
				$result = "Failed to add JSON to zip file";
			}

			if ( $zip->close() === false )
			{
				$result = "Error closing zip file: " . $zip->getStatusString();
			}
		}
		else
		{
			if ( file_put_contents( $filename, $json ) === false )
			{
				$result = "Writing to the file failed";
			}
		}

		return $result;
	}
public function saveGeneratedHierarchy ( $ filename , $ zip = false ) { $ result = true ; if ( ! property_exists ( $ this , 'hierarchies' ) ) return "The hierarchies have not been generated" ; $ json = json_encode ( $ this -> hierarchies ) ; if ( json_last_error ( ) !== JSON_ERROR_NONE ) { $ result = "An error occurred generating the JSON for the hierarchies: " . XBRL :: json_last_error_msg ( ) ; } elseif ( $ zip ) { $ zip = new ZipArchive ( ) ; $ zip -> open ( $ filename , ZipArchive :: CREATE ) ; if ( ! $ zip -> addFromString ( 'hierarchies.json' , $ json ) ) { $ result = "Failed to add JSON to zip file" ; } if ( $ zip -> close ( ) === false ) { $ result = "Error closing zip file: " . $ zip -> getStatusString ( ) ; } } else { if ( file_put_contents ( $ filename , $ json ) === false ) { $ result = "Writing to the file failed" ; } } return $ result ; }
Export the hierarchy to a file in JSON format
@param string $filename
@param bool $zip (Optional) Indicates whether the file should be zipped (Default: false)
@return bool|string True if successful or a string reporting the issue
Export the hierarchy to a file in JSON format