forked from openemr/openemr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
onotes.inc
52 lines (44 loc) · 1.29 KB
/
onotes.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
require_once("{$GLOBALS['srcdir']}/sql.inc");
function getOnoteById ($id, $cols = "*")
{
return sqlQuery("select $cols from onotes where id='$id' order by date DESC limit 0,1");
}
function getOnoteByDate ($date, $activity = "1", $cols = "*", $limit="all", $offset="0")
{
if($limit == "all")
{
$sql = "select $cols from onotes where date like '%$date%' ";
if ($activity != "all")
$sql .= "and activity='$activity' ";
$sql .= "order by date DESC";
}
else
{
$sql = "select $cols from onotes where date like '%$date%' ";
if ($activity != "all")
$sql .= "and activity ='$activity' ";
$sql .= "order by date DESC LIMIT $offset,$limit";
}
$res = sqlStatement($sql);
// if ($res == FALSE) { return FALSE; }
for ($iter = 0;$row = sqlFetchArray($res);$iter++)
$all[$iter] = $row;
return $all;
}
function addOnote($body, $activity = "1")
{
$body = mysql_escape_string($body);
return sqlInsert("insert into onotes (date, body, user, groupname, activity) values (NOW(), '$body', '". $_SESSION['authUser'] ."', '". $_SESSION['authProvider'] ."', '$activity')");
}
function disappearOnote($id)
{
sqlStatement("update onotes set activity = '0' where id='$id'");
return true;
}
function reappearOnote ($id)
{
sqlStatement("update onotes set activity = '1' where id='$id'");
return true;
}
?>