Space to separate "&&" so that all "&$var" can be made into "$var" later
[openemr.git] / library / onotes.inc
blob4bd86c9540a9cf2dc5948807527d9e2e6ae49cbd
1 <?php
2 require_once("{$GLOBALS['srcdir']}/sql.inc");
4 function getOnoteById ($id, $cols = "*")
6         return sqlQuery("select $cols from onotes where id='$id' order by date DESC limit 0,1");
9 function getOnoteByDate ($date, $activity = "1", $cols = "*", $limit="all", $offset="0")
12         if($limit == "all")
13         {
15                 $sql = "select $cols from onotes where date like '%$date%' ";
16                 if ($activity != "all")
17                         $sql .= "and activity='$activity' ";
18                 $sql .= "order by date DESC";
19         }
20         else
21         {
22                 $sql = "select $cols from onotes where date like '%$date%' ";
23                 if ($activity != "all")
24                         $sql .= "and activity ='$activity' ";
25                 $sql .= "order by date DESC LIMIT $offset,$limit";
26         }
27         
28         $res = sqlStatement($sql);
29 //      if ($res == FALSE) { return FALSE; }
30         for ($iter = 0;$row = sqlFetchArray($res);$iter++)
31                 $all[$iter] = $row;
32         return $all;
35 function addOnote($body, $activity = "1")
37         $body = mysql_escape_string($body);
38         return sqlInsert("insert into onotes (date, body, user, groupname, activity) values (NOW(), '$body', '". $_SESSION['authUser'] ."', '". $_SESSION['authProvider'] ."', '$activity')");
41 function disappearOnote($id)
43         sqlStatement("update onotes set activity = '0' where id='$id'");
44         return true;
47 function reappearOnote ($id)
49         sqlStatement("update onotes set activity = '1' where id='$id'");
50         return true;