2 //these are the functions used to access the forms registry database
6 function registerForm ( $directory , $sql_run=0 , $unpackaged=1 , $state=0 )
8 $check = sqlQuery("select state from registry where directory='$directory'");
11 $lines = @file($GLOBALS['srcdir']."/../interface/forms/$directory/info.txt");
16 return sqlInsert("insert into registry set
19 directory='".add_escape_custom($directory)."',
21 unpackaged='$unpackaged',
28 function updateRegistered ( $id, $mod )
30 return sqlInsert("update registry set
38 function getRegistered ( $state="1", $limit="unlimited", $offset="0")
40 $sql = "select * from registry where state like \"$state\" order by priority, name";
41 if ($limit != "unlimited")
42 $sql .= " limit $limit, $offset";
43 $res = sqlStatement($sql);
45 for($iter=0; $row=sqlFetchArray($res); $iter++)
54 function getRegistryEntry ( $id, $cols = "*" )
56 $sql = "select $cols from registry where id='$id'";
57 return sqlQuery($sql);
60 function getRegistryEntryByDirectory($directory, $cols = "*") {
61 $sql = "select $cols from registry where directory = ?";
62 return sqlQuery($sql, $directory);
65 function installSQL ( $dir )
67 $sqltext = $dir."/table.sql";
68 if ($sqlarray = @file($sqltext))
70 $sql = implode("", $sqlarray);
71 //echo "<br>$sql<br><br>";
72 $sqla = explode(";",$sql);
73 foreach ($sqla as $sqlq) {
74 if (strlen($sqlq) > 5) {
75 sqlStatement(rtrim("$sqlq"));
86 * is a form registered
87 * (optional - and active)
90 * NOTE - sometimes the Name of a form has a line-break at the end, thus this function might be better
92 * INPUT = directory => form directory
93 * state => 0=inactive / 1=active
94 * OUTPUT = true or false
96 function isRegistered ( $directory, $state = 1)
98 $sql = "select id from registry where ".
99 "directory='".$directory.
100 "' and state=".$state;
101 $result = sqlQuery($sql);
102 if ($result['id'] != '') return true;
106 function getTherapyGroupCategories(){