fix in recurrence widget (#426)
[openemr.git] / interface / forms_admin / forms_admin.php
blobd5c97e3e25e3c9aedf4a09c98eba76aec6fc5fb1
1 <?php
2 // This program is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU General Public License
4 // as published by the Free Software Foundation; either version 2
5 // of the License, or (at your option) any later version.
7 //INCLUDES, DO ANY ACTIONS, THEN GET OUR DATA
8 include_once("../globals.php");
9 include_once("$srcdir/registry.inc");
10 if ($_GET['method'] == "enable"){
11 updateRegistered ( $_GET['id'], "state=1" );
13 elseif ($_GET['method'] == "disable"){
14 updateRegistered ( $_GET['id'], "state=0" );
16 elseif ($_GET['method'] == "install_db"){
17 $dir = getRegistryEntry ( $_GET['id'], "directory" );
18 if (installSQL ("$srcdir/../interface/forms/{$dir['directory']}"))
19 updateRegistered ( $_GET['id'], "sql_run=1" );
20 else
21 $err = xl('ERROR: could not open table.sql, broken form?');
23 elseif ($_GET['method'] == "register"){
24 registerForm ( $_GET['name'] ) or $err=xl('error while registering form!');
26 $bigdata = getRegistered("%") or $bigdata = false;
29 //START OUT OUR PAGE....
31 <html>
32 <head>
33 <?php html_header_show();?>
34 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
35 </head>
36 <body class="body_top">
37 <span class="title"><?php xl('Forms Administration','e');?></span>
38 <br><br>
39 <?php
40 foreach($_POST as $key=>$val) {
41 if (preg_match('/nickname_(\d+)/', $key, $matches)) {
42 $nickname_id = $matches[1];
43 sqlQuery("update registry set nickname='".$val."' where id=".$nickname_id);
45 if (preg_match('/category_(\d+)/', $key, $matches)) {
46 $category_id = $matches[1];
47 sqlQuery("update registry set category='".$val."' where id=".$category_id);
49 if (preg_match('/priority_(\d+)/', $key, $matches)) {
50 $priority_id = $matches[1];
51 sqlQuery("update registry set priority='".$val."' where id=".$priority_id);
57 <?php //ERROR REPORTING
58 if ($err)
59 echo "<span class=bold>$err</span><br><br>\n";
63 <?php //REGISTERED SECTION ?>
64 <span class=bold><?php xl('Registered','e');?></span><br>
65 <form method=POST action ='./forms_admin.php'>
66 <i><?php xl('click here to update priority, category and nickname settings','e'); ?></i>
67 <input type=submit name=update value='<?php xl('update','e'); ?>'><br>
68 <table border=0 cellpadding=1 cellspacing=2 width="500">
69 <tr>
70 <td> </td>
71 <td> </td>
72 <td> </td>
73 <td> </td>
74 <td> </td>
75 <td><?php xl('Priority ','e'); ?></td>
76 <td><?php xl('Category ','e'); ?></td>
77 <td><?php xl('Nickname','e'); ?></td>
78 </tr>
79 <?php
80 $color="#CCCCCC";
81 if ($bigdata != false)
82 foreach($bigdata as $registry)
84 $priority_category = sqlQuery("select priority, category, nickname from registry where id=".$registry['id']);
86 <tr>
87 <td bgcolor="<?php echo $color?>" width="2%">
88 <span class=text><?php echo $registry['id'];?></span>
89 </td>
90 <td bgcolor="<?php echo $color?>" width="30%">
91 <span class=bold><?php echo xl_form_title($registry['name']); ?></span>
92 </td>
93 <?php
94 if ($registry['sql_run'] == 0)
95 echo "<td bgcolor='$color' width='10%'><span class='text'>".xl('registered')."</span>";
96 elseif ($registry['state'] == "0")
97 echo "<td bgcolor='#FFCCCC' width='10%'><a class=link_submit href='./forms_admin.php?id={$registry['id']}&method=enable'>".xl('disabled')."</a>";
98 else
99 echo "<td bgcolor='#CCFFCC' width='10%'><a class=link_submit href='./forms_admin.php?id={$registry['id']}&method=disable'>".xl('enabled')."</a>";
100 ?></td>
101 <td bgcolor="<?php $color?>" width="10%">
102 <span class=text><?php
104 if ($registry['unpackaged'])
105 echo xl('PHP extracted','e');
106 else
107 echo xl('PHP compressed','e');
109 ?></span>
110 </td>
111 <td bgcolor="<?php echo $color?>" width="10%">
112 <?php
113 if ($registry['sql_run'])
114 echo "<span class=text>".xl('DB installed')."</span>";
115 else
116 echo "<a class=link_submit href='./forms_admin.php?id={$registry['id']}&method=install_db'>".xl('install DB')."</a>";
118 </td>
119 <?php
120 echo "<td><input type=text size=4 name=priority_".$registry['id']." value='".$priority_category['priority']."'></td>";
121 echo "<td><input type=text size=8 name=category_".$registry['id']." value='".$priority_category['category']."'></td>";
122 echo "<td><input type=text size=8 name=nickname_".$registry['id']." value='".$priority_category['nickname']."'></td>";
124 </tr>
125 <?php
126 if ($color=="#CCCCCC")
127 $color="#999999";
128 else
129 $color="#CCCCCC";
130 } //end of foreach
132 </table>
133 <hr>
135 <?php //UNREGISTERED SECTION ?>
136 <span class=bold><?php xl('Unregistered','e');?></span><br>
137 <table border=0 cellpadding=1 cellspacing=2 width="500">
138 <?php
139 $dpath = "$srcdir/../interface/forms/";
140 $dp = opendir($dpath);
141 $color="#CCCCCC";
142 for ($i=0; false != ($fname = readdir($dp)); $i++)
143 if ($fname != "." && $fname != ".." && $fname != "CVS" && $fname != "LBF" &&
144 (is_dir($dpath.$fname) || stristr($fname, ".tar.gz") ||
145 stristr($fname, ".tar") || stristr($fname, ".zip") ||
146 stristr($fname, ".gz")))
147 $inDir[$i] = $fname;
149 // ballards 11/05/2005 fixed bug in removing registered form from the list
150 if ($bigdata != false)
152 foreach ( $bigdata as $registry )
154 $key = array_search($registry['directory'], $inDir) ; /* returns integer or FALSE */
155 unset($inDir[$key]);
159 foreach ( $inDir as $fname )
161 // added 8-2009 by BM - do not show the metric vitals form as option since deprecated
162 // also added a toggle in globals.php in case user wants the option to add this deprecated form
163 if (($fname == "vitalsM") && ($GLOBALS['disable_deprecated_metrics_form'])) continue;
165 if (stristr($fname, ".tar.gz") || stristr($fname, ".tar") || stristr($fname, ".zip") || stristr($fname, ".gz"))
166 $phpState = "PHP compressed";
167 else
168 $phpState = "PHP extracted";
170 <tr>
171 <td bgcolor="<?php echo $color?>" width="1%">
172 <span class=text> </span>
173 </td>
174 <td bgcolor="<?php echo $color?>" width="20%">
175 <?php
176 $form_title_file = @file($GLOBALS['srcdir']."/../interface/forms/$fname/info.txt");
177 if ($form_title_file)
178 $form_title = $form_title_file[0];
179 else
180 $form_title = $fname;
182 <span class=bold><?php echo xl_form_title($form_title); ?></span>
183 </td>
184 <td bgcolor="<?php echo $color?>" width="10%"><?php
185 if ($phpState == "PHP extracted")
186 echo '<a class=link_submit href="./forms_admin.php?name=' . urlencode($fname) . '&method=register">' . xl('register') . '</a>';
187 else
188 echo '<span class=text>' . xl('n/a') . '</span>';
189 ?></td>
190 <td bgcolor="<?php echo $color?>" width="20%">
191 <span class=text><?php echo xl($phpState); ?></span>
192 </td>
193 <td bgcolor="<?php echo $color?>" width="10%">
194 <span class=text><?php xl('n/a','e'); ?></span>
195 </td>
196 </tr>
197 <?php
198 if ($color=="#CCCCCC")
199 $color="#999999";
200 else
201 $color="#CCCCCC";
202 flush();
203 }//end of foreach
205 </table>
207 </body>
208 </html>