5 * LICENSE: This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 3
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
17 * @author Brady Miller <brady@sparmy.com>
18 * @link http://www.open-emr.org
21 function getOnoteById ($id, $cols = "*")
23 return sqlQuery("select $cols from onotes where id=? order by date DESC limit 0,1", array($id));
26 function getOnoteByDate ($date, $activity = "1", $cols = "*", $limit="all", $offset="0")
29 $sqlBindArray = array();
32 $sql = "select $cols from onotes where date like ? ";
33 array_push($sqlBindArray,"%".$date."%");
34 if ($activity != "all") {
35 $sql .= "and activity=? ";
36 array_push($sqlBindArray,$activity);
39 $sql .= "order by date DESC";
43 $sql = "select $cols from onotes where date like ? ";
44 array_push($sqlBindArray,"%".$date."%");
45 if ($activity != "all") {
46 $sql .= "and activity =? ";
47 array_push($sqlBindArray,$activity);
50 $sql .= "order by date DESC LIMIT ".escape_limit($offset).",".escape_limit($limit);
53 $res = sqlStatement($sql,$sqlBindArray);
55 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
60 function addOnote($body, $activity = "1")
62 return sqlInsert("insert into onotes (date, body, user, groupname, activity) values (NOW(),?,?,?,?)", array($body,$_SESSION['authUser'],$_SESSION['authProvider'],$activity));
65 function disappearOnote($id)
67 sqlStatement("update onotes set activity = '0' where id=?", array($id));
71 function reappearOnote ($id)
73 sqlStatement("update onotes set activity = '1' where id=?", array($id));