2 require_once("{$GLOBALS['srcdir']}/sql.inc");
5 // table type plural singular abbrev style
6 'medical_problem' => array('Medical Problems', 'Problem' , 'P', 0),
7 'allergy' => array('Allergies' , 'Allergy' , 'A', 0),
8 'medication' => array('Medications' , 'Medication', 'M', 0),
9 'surgery' => array('Surgeries' , 'Surgery' , 'S', 0),
10 'dental' => array('Dental Issues' , 'Dental' , 'D', 0)
13 // 0 - Normal, as in 2.8.1.
14 // 1 - Simplified: only title, start date, comments and an Active checkbox;
15 // no diagnosis, occurrence, end date, referred-by or sports fields.
16 // Internally we'll still use a null end date to indicate active.
20 function getListById ($id, $cols = "*")
22 return sqlQuery("select $cols from lists where id='$id' order by date DESC limit 0,1");
25 function getListByType ($pid, $type, $cols = "*", $active = "all", $limit = "all", $offset="0")
28 $sql = "select $cols from lists where pid='$pid' and type='$type' order by date DESC";
30 $sql = "select $cols from lists where pid='$pid' and type='$type' and activity='$active' order by date DESC";
32 $sql .= " limit $offset,$limit";
35 $res = sqlStatement($sql);
36 for($iter =0;$row = sqlFetchArray($res);$iter++)
42 function addList ($pid, $type, $title, $comments, $activity = "1")
44 return sqlInsert("insert into lists (date, pid, type, title, activity, comments, user, groupname) values (NOW(), '$pid', '$type', '$title', '$activity', '$comments', '".$_SESSION['authUser']."', '".$_SESSION['authProvider']."')");
47 function disappearList ($id)
49 sqlStatement("update lists set activity = '0' where id='$id'");
53 function reappearList ($id)
55 sqlStatement("update lists set activity = '1' where id='$id'");