diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2007-08-01 10:23:32 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2007-08-01 10:23:32 +0000 |
commit | b5c65273088eb4fe7214b880d544d4c43c16d947 (patch) | |
tree | 3260d74d628e3facd390183531498031b339d84f /src/tools.php | |
parent | 85872e40892ae2f92f2f7eef20fb37c85f7cfbc3 (diff) | |
download | zetacomponents-graph-b5c65273088eb4fe7214b880d544d4c43c16d947.zip zetacomponents-graph-b5c65273088eb4fe7214b880d544d4c43c16d947.tar.gz |
- Fixed bug #11207: Missing URL property for legend, or missing legend, may
cause PHP notice
Diffstat (limited to 'src/tools.php')
-rw-r--r-- | src/tools.php | 60 |
1 files changed, 33 insertions, 27 deletions
diff --git a/src/tools.php b/src/tools.php index 8050a01..3df16bb 100644 --- a/src/tools.php +++ b/src/tools.php @@ -46,28 +46,31 @@ class ezcGraphTools $imageMap = sprintf( "<map name=\"%s\">\n", $name ); // Iterate over legends elements - foreach ( $elements['legend'] as $objectName => $polygones ) + if ( isset( $elements['legend'] ) ) { - $url = $elements['legend_url'][$objectName]; - - if ( empty( $url ) ) + foreach ( $elements['legend'] as $objectName => $polygones ) { - continue; - } + $url = $elements['legend_url'][$objectName]; - foreach ( $polygones as $shape => $polygone ) - { - $coordinateString = ''; - foreach ( $polygone as $coordinate ) + if ( empty( $url ) ) { - $coordinateString .= sprintf( '%d,%d,', $coordinate->x, $coordinate->y ); + continue; } - $imageMap .= sprintf( "\t<area shape=\"poly\" coords=\"%s\" href=\"%s\" alt=\"%s\" />\n", - substr( $coordinateString, 0, -1 ), - $url, - $objectName - ); + foreach ( $polygones as $shape => $polygone ) + { + $coordinateString = ''; + foreach ( $polygone as $coordinate ) + { + $coordinateString .= sprintf( '%d,%d,', $coordinate->x, $coordinate->y ); + } + + $imageMap .= sprintf( "\t<area shape=\"poly\" coords=\"%s\" href=\"%s\" alt=\"%s\" />\n", + substr( $coordinateString, 0, -1 ), + $url, + $objectName + ); + } } } @@ -152,21 +155,24 @@ class ezcGraphTools } // Link legend elements - foreach ( $elements['legend'] as $objectName => $ids ) + if ( isset( $elements['legend'] ) ) { - $url = $elements['legend_url'][$objectName]; - - if ( empty( $url ) ) + foreach ( $elements['legend'] as $objectName => $ids ) { - continue; - } + $url = $elements['legend_url'][$objectName]; - foreach ( $ids as $id ) - { - $element = $xpath->query( '//*[@id = \'' . $id . '\']' )->item( 0 ); + if ( empty( $url ) ) + { + continue; + } - $element->setAttribute( 'style', $element->getAttribute( 'style' ) . ' cursor: ' . $chart->driver->options->linkCursor . ';' ); - $element->setAttribute( 'onclick', "top.location = '{$url}'" ); + foreach ( $ids as $id ) + { + $element = $xpath->query( '//*[@id = \'' . $id . '\']' )->item( 0 ); + + $element->setAttribute( 'style', $element->getAttribute( 'style' ) . ' cursor: ' . $chart->driver->options->linkCursor . ';' ); + $element->setAttribute( 'onclick', "top.location = '{$url}'" ); + } } } |