Improvements in problem lists for MU2.
[openemr.git] / library / openflashchart / php-ofc-library / open-flash-chart-object.php
blob6e1129f46b6e985244de63616781f0ac4a968312
1 <?php
3 function open_flash_chart_object_str( $width, $height, $url, $use_swfobject=true, $base='' )
5 //
6 // return the HTML as a string
7 //
8 return _ofc( $width, $height, $url, $use_swfobject, $base );
11 function open_flash_chart_object( $width, $height, $url, $use_swfobject=true, $base='' )
14 // stream the HTML into the page
16 echo _ofc( $width, $height, $url, $use_swfobject, $base );
19 function _ofc( $width, $height, $url, $use_swfobject, $base )
22 // I think we may use swfobject for all browsers,
23 // not JUST for IE...
25 //$ie = strstr(getenv('HTTP_USER_AGENT'), 'MSIE');
28 // escape the & and stuff:
30 $url = urlencode($url);
33 // output buffer
35 $out = array();
38 // check for http or https:
40 if (isset ($_SERVER['HTTPS']))
42 if (strtoupper ($_SERVER['HTTPS']) == 'ON')
44 $protocol = 'https';
46 else
48 $protocol = 'http';
51 else
53 $protocol = 'http';
57 // if there are more than one charts on the
58 // page, give each a different ID
60 global $open_flash_chart_seqno;
61 $obj_id = 'chart';
62 $div_name = 'flashcontent';
64 //$out[] = '<script type="text/javascript" src="'. $base .'js/ofc.js"></script>';
66 if( !isset( $open_flash_chart_seqno ) )
68 $open_flash_chart_seqno = 1;
69 $out[] = '<script type="text/javascript" src="'. $base .'js/swfobject.js"></script>';
71 else
73 $open_flash_chart_seqno++;
74 $obj_id .= '_'. $open_flash_chart_seqno;
75 $div_name .= '_'. $open_flash_chart_seqno;
78 if( $use_swfobject )
80 // Using library for auto-enabling Flash object on IE, disabled-Javascript proof
81 $out[] = '<div id="'. $div_name .'"></div>';
82 $out[] = '<script type="text/javascript">';
83 $out[] = 'var so = new SWFObject("'. $base .'open-flash-chart.swf", "'. $obj_id .'", "'. $width . '", "' . $height . '", "9", "#FFFFFF");';
85 $out[] = 'so.addVariable("data-file", "'. $url . '");';
87 $out[] = 'so.addParam("allowScriptAccess", "always" );//"sameDomain");';
88 $out[] = 'so.write("'. $div_name .'");';
89 $out[] = '</script>';
90 $out[] = '<noscript>';
93 $out[] = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="' . $protocol . '://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ';
94 $out[] = 'width="' . $width . '" height="' . $height . '" id="ie_'. $obj_id .'" align="middle">';
95 $out[] = '<param name="allowScriptAccess" value="sameDomain" />';
96 $out[] = '<param name="movie" value="'. $base .'open-flash-chart.swf?data='. $url .'" />';
97 $out[] = '<param name="quality" value="high" />';
98 $out[] = '<param name="bgcolor" value="#FFFFFF" />';
99 $out[] = '<embed src="'. $base .'open-flash-chart.swf?data=' . $url .'" quality="high" bgcolor="#FFFFFF" width="'. $width .'" height="'. $height .'" name="'. $obj_id .'" align="middle" allowScriptAccess="sameDomain" ';
100 $out[] = 'type="application/x-shockwave-flash" pluginspage="' . $protocol . '://www.macromedia.com/go/getflashplayer" id="'. $obj_id .'"/>';
101 $out[] = '</object>';
103 if ( $use_swfobject ) {
104 $out[] = '</noscript>';
107 return implode("\n",$out);