Fix for web site change courtesy of info from whimmel.
[openemr.git] / library / lists.inc
blobb9a5cae44c1992244cf3a8f606df7dbc148599cd
1 <?php
2 require_once("{$GLOBALS['srcdir']}/sql.inc");
4 if (!empty($GLOBALS['ippf_specific'])) {
5   $ISSUE_TYPES = array(
6     // table type               plural                 singular          abbrev style
7     'medical_problem' => array(xl('Medical Problems'),xl('Problem')      ,xl('P'),0),
8     'allergy'         => array(xl('Allergies')       ,xl('Allergy')      ,xl('Y'),0),
9     'medication'      => array(xl('Medications')     ,xl('Medication')   ,xl('M'),0),
10     'surgery'         => array(xl('Surgeries')       ,xl('Surgery')      ,xl('S'),0),
11     'ippf_gcac'       => array(xl('Abortions')       ,xl('Abortion')     ,xl('A'),3),
12     'contraceptive'   => array(xl('Contraception')   ,xl('Contraception'),xl('C'),4),
13 //  'ippf_srh'        => array(xl('SRH')             ,xl('SRH')          ,xl('R'),5),
14   );
16 else if (!empty($GLOBALS['athletic_team'])) {
17   $ISSUE_TYPES = array(
18     'football_injury' => array(xl('Football Injuries'),xl('Injury') ,xl('I'),2),
19     'medical_problem' => array(xl('Medical Problems') ,xl('Problem'),xl('P'),0),
20     'allergy'         => array(xl('Allergies')        ,xl('Allergy'),xl('A'),1),
21     'general'         => array(xl('General')          ,xl('General'),xl('G'),1),
22   );
24 else { // default version
25   $ISSUE_TYPES = array(
26     // table type                plural                 singular    abbrev style
27     'medical_problem' => array(xl('Medical Problems'),xl('Problem')   ,xl('P'),0),
28     'allergy'         => array(xl('Allergies')       ,xl('Allergy')   ,xl('A'),0),
29     'medication'      => array(xl('Medications')     ,xl('Medication'),xl('M'),0),
30     'surgery'         => array(xl('Surgeries')       ,xl('Surgery')   ,xl('S'),0),
31     'dental'          => array(xl('Dental Issues')   ,xl('Dental')    ,xl('D'),0),
32     //
33     // Styles are:
34     // 0 - Normal, as in 2.8.1.
35     // 1 - Simplified: only title, start date, comments and an Active checkbox;
36     //     no diagnosis, occurrence, end date, referred-by or sports fields.
37     //     Internally we'll still use a null end date to indicate active.
38     // 2 - Football Injury.
39     //
40   );
44 // 06/2009 - BM Migrated the ISSUE_OCCURRENCES to list_options
47 $ISSUE_CLASSIFICATIONS = array(
48   0   => xl('Unknown or N/A'),
49   1   => xl('Trauma'),
50   2   => xl('Overuse')
53 function getListById ($id, $cols = "*")
55         return sqlQuery("select $cols from lists where id='$id' order by date DESC limit 0,1");
58 function getListByType ($pid, $type, $cols = "*", $active = "all", $limit = "all", $offset="0")
60         if($active == "all")
61                 $sql = "select $cols from lists where pid='$pid' and type='$type' order by date DESC";
62         else
63                 $sql = "select $cols from lists where pid='$pid' and type='$type' and activity='$active' order by date DESC";
64         if ($limit != "all")
65                 $sql .= " limit $offset,$limit";
66         
68         $res = sqlStatement($sql);
69         for($iter =0;$row = sqlFetchArray($res);$iter++)
70                 $all[$iter] = $row;
71         return $all;
75 function addList ($pid, $type, $title, $comments, $activity = "1")
77         return sqlInsert("insert into lists (date, pid, type, title, activity, comments, user, groupname) values (NOW(), '$pid', '$type', '$title', '$activity', '$comments', '".$_SESSION['authUser']."', '".$_SESSION['authProvider']."')");
80 function disappearList ($id)
82         sqlStatement("update lists set activity = '0' where id='$id'");
83         return true;
86 function reappearList ($id)
88         sqlStatement("update lists set activity = '1' where id='$id'");
89         return true;