From 4c594ebf3c752351e430a2326793995f19bbf1ab Mon Sep 17 00:00:00 2001 From: markleeds Date: Sun, 30 Sep 2007 00:05:13 +0000 Subject: [PATCH] If you put reports in the directory /openemr/interface/reports/myreports, they will show on the reports screen at the top. If you add subdirectories to myreports and put reports in the subdirectories, they will show up as popup menus with the reports listed. This saves having to edit general_default.html to add reports. --- templates/report/general_default.html | 61 +++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/templates/report/general_default.html b/templates/report/general_default.html index fbea11dc9..e7764d2d7 100644 --- a/templates/report/general_default.html +++ b/templates/report/general_default.html @@ -33,6 +33,67 @@ function dopopup(aurl) { +{php} +//get directories that might contain reports +$reportsdir = './myreports/'; +if (is_dir($reportsdir)) { + $folder_array = array(); + if ($handle = opendir($reportsdir)) { + while (false !== ($file = readdir($handle))) { + if ($file != '.' && $file != '..' && is_dir($reportsdir.$file)) { + $folder_array[$file] = array(); + } + } + closedir($handle); + } + + //fill elements of $folder_array with the php files in each directory + foreach ($folder_array as $key => $val) { + $reportsubdir = $reportsdir.$key.'/'; + if ($handle = opendir($reportsubdir)) { + while (false !== ($file = readdir($handle))) { + if ($file != '.' && $file != '..' && substr($file,-4,4) == '.php') { + //if ($file != '.' && $file != '..') { + $filename = substr($file,0,strlen($file)-4); + $folder_array[$key][$filename] = $GLOBALS['webroot'].'/interface/reports/myreports/'.$key.'/'.$file; + } + } + closedir($handle); + } + } + //generate drop down menus + echo "
\n"; + foreach ($folder_array as $title => $link) { + if (count($link) > 0) { //only create menus for those subdirectories with php reports in them + echo "
\n"; + } + } + echo "
\n"; + + //now deal with the reports that are just under myreports, not organized into subdirectories + $reportsdir = './myreports/'; + $dir_array = array(); + if ($handle = opendir($reportsdir)) { + while (false !== ($file = readdir($handle))) { + if ($file != '.' && $file != '..' && substr($file,-4,4) == '.php') { + $filename = substr($file,0,strlen($file)-4); + array_push($dir_array,"".xl($filename)."
\n"); + } + } + closedir($handle); + } + //print the links for reports under myreports + foreach($dir_array as $var) { + echo $var; + } +} +{/php} + {xl t='Superbill Report'}
-- 2.11.4.GIT