/** * Replace angular parenthesis with html equivalents (html entities). * @param $p (string) String containing point data. * @param $w (int) Graph width. * @param $h (int) Graph height. * @return converted string */ function F_getSVGGraph($p, $w = '', $h = '') { // send headers header('Content-Description: SVG Data'); header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1 header('Pragma: public'); header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); header('Content-Type: image/svg+xml'); header('Content-Disposition: inline; filename="tce_svg_graph_' . md5($p . $w . $h) . '.svg";'); // Turn on output buffering with the gzhandler //ob_start('ob_gzhandler'); // output SVG code echo F_getSVGGraphCode($p, $w, $h); }
/** * Print SVG graph * @param $svgdata (string) String containing SVG data to print. * @public */ public function printSVGStatsGraph($svgdata) { require_once '../config/tce_config.php'; require_once '../../shared/code/tce_functions_svg_graph.php'; global $l; // display svg graph if (preg_match_all('/[x]/', $svgdata, $match) > 1) { $this->SetFont(PDF_FONT_NAME_DATA, 'B', PDF_FONT_SIZE_DATA); // legend $legend = '<span style="background-color:#ff0000;color:#ffffff;"> ' . $l['w_score'] . ' </span> <span style="background-color:#0000ff;color:#ffffff;"> ' . $l['w_answers_right'] . ' </span> / <span style="background-color:#dddddd;color:#000000;"> ' . $l['w_tests'] . ' </span></div>'; $this->writeHTML($legend, true, false, true, false, 'C'); $this->SetFont(PDF_FONT_NAME_DATA, '', 6); $w = $this->tce_page_width * $this->imgscale * $this->k; $h = round($this->tce_page_width * 9 / 16); $svg = F_getSVGGraphCode(substr($svgdata, 1), $w, $h); if (isset($svg[0]) and $svg[0] == '<') { $this->ImageSVG('@' . $svg, '', '', $this->tce_page_width, 0, '', 'N', 'C', 0, false); } } }