Check if form is installed in "left-nav.php"

produnis wrote on Tuesday, April 08, 2014:

Hi folks,
I would like to check if form track_anything is installed/enabled, and if so, I would like to put a link named “configure tracks” which points to interface/forms/track_anything/create.php into Left-Nav. Thus I added the two lines 1464 and 1465 to left_nav.php (see commit openemr/left_nav.php at track_anything2 · produnis/openemr · GitHub )

 <?php $myrow = sqlQuery("SELECT state FROM registry WHERE directory = 'track_anything'");
 if($myrow=='1') { genMiscLink('RTop','tan','0',xl('Configure Tracks'),'forms/track_anything/create.php'); }?>

… but a) it does not seem to work and b) my code looks alien there…

Would be happy for any advice…
:wink:
Greetings,
Joe

visolveemr wrote on Tuesday, April 08, 2014:

Joe

You should add ‘tan’ description similar to this in the $primary_docs array before using it.

Thanks
OpenEMR Customization/Support provider,
ViSolve Inc
services@visolve.com

produnis wrote on Tuesday, April 08, 2014:

Thx, I added it as suggested!
I had another syntax error, the second line has to be:

 if($myrow['state']=='1') { genMiscLink('RTop','tan','0',xl('Configure Tracks'),'forms/track_anything/create.php'); }?>

If the user installs/enables the form, frame “left-nav.php” needs to be reloaded in order to show the new link “Configure Tracks”. Any ideas on how to reload the frame after a form was enabled?

visolveemr wrote on Tuesday, April 08, 2014:

Joe
Use this script

parent.left_nav.location.reload();

to reload the left navigation bar.

Thanks
OpenEMR Customization/Support provider,
ViSolve Inc
services@visolve.com

produnis wrote on Tuesday, April 08, 2014:

thx, but how can I run this function after a form is installed/enabled?