phpgacl implementation updates
[openemr.git] / interface / patient_file / summary / pnotes_full.php
blob83d28d9f05e809100c740349e03c52f2120b207c
1 <?
2 include_once("../../globals.php");
3 include_once("$srcdir/pnotes.inc");
4 include_once("$srcdir/acl.inc");
6 // Check authorization.
7 $thisauth = acl_check('patients', 'notes');
8 if ($thisauth != 'write' && $thisauth != 'addonly')
9 die("Not authorized.");
11 //the number of records to display per screen
12 $N = 5;
14 if (!isset($offset)) {
15 $offset=0;
18 if (!isset($active)) {
19 $active="all";
22 //this code handles changing the state of activity tags when the user updates them through the interface
23 if (isset($mode)) {
24 if ($mode == "update") {
25 foreach ($_POST as $var => $val) {
26 if ($val == "true" || $val == "false") {
27 $id = str_replace("act","",$var);
28 if ($val == "true") {reappearPnote ($id);}elseif($val=="false"){disappearPnote($id);};
29 //print "$id: $val > $act_state<br>\n";
33 } elseif ($mode == "new") {
34 addPnote($pid,$_POST["note"],$userauthorized);
38 <html>
39 <head>
41 <link rel=stylesheet href="<?echo $css_header;?>" type="text/css">
43 </head>
44 <body <?echo $top_bg_line;?> topmargin=0 rightmargin=0 leftmargin=2 bottommargin=0 marginwidth=2 marginheight=0>
46 <form border=0 method=post name=new_note action="pnotes_full.php">
47 <a href="../summary/patient_summary.php" target="Main"><font class="title">Patient Notes</font><font class=back>(Back)</font></a>
48 <br>
50 <input type=hidden name=mode value="new">
51 <input type=hidden name=offset value="<?echo $offset;?>">
52 <input type=hidden name=active value="<?echo $active;?>">
54 <textarea name=note rows=6 cols=40 wrap=virtual></textarea>
55 <br>
56 <a href="javascript:document.new_note.submit();" class=link_submit>[Add New Note]</a>
57 </form>
59 <form border=0 method=post name=update_activity action="pnotes_full.php">
61 <?//change the view on the current mode, whether all, active, or inactive
62 $all_class="link";$active_class="link";$inactive_class="link";
63 if ($active=="all") {
64 $all_class="link_selected";
65 } elseif ($active==1) {
66 $active_class="link_selected";
67 } elseif ($active==0) {
68 $inactive_class="link_selected";
74 <font class=text>View: </font>
75 <a href="pnotes_full.php?offset=0&active=all" class=<?echo $all_class;?>>[All]</a>
76 <a href="pnotes_full.php?offset=0&active=1" class=<?echo $active_class;?>>[Only Active]</a>
77 <a href="pnotes_full.php?offset=0&active=0" class=<?echo $inactive_class;?>>[Only Inactive]</a>
79 <input type=hidden name=mode value="update">
80 <input type=hidden name=offset value="<?echo $offset;?>">
81 <input type=hidden name=active value="<?echo $active;?>">
82 <table border=0>
83 <tr><td colspan=3 align=left><a href="javascript:document.update_activity.submit();" class=link_submit>[Change Activity]</a></td></tr>
85 //display all of the notes for the day, as well as others that are active from previous dates, up to a certain number, $N
87 //retrieve all notes
89 if ($result = getPnotesByDate("", $active, "id,date,body,user,activity",$pid,$N,$offset)) {
91 $result_count = 0;
92 foreach ($result as $iter) {
93 $result_count++;
95 if (getdate() == strtotime($iter{"date"})) {
96 $date_string = "Today, " . date( "D F jS" ,strtotime($iter{"date"}));
97 } else {
98 $date_string = date( "D F jS" ,strtotime($iter{"date"}));
101 if ($iter{"activity"}) {
102 $checked = "checked";
103 } else {
104 $checked = "";
106 print "<tr><td><input type=hidden value='' name=act".$iter{"id"}.">";
107 print "<input onClick='javascript:document.update_activity.act".$iter{"id"}.".value=this.checked' type=checkbox $checked></td>";
108 print "<td><font class=bold>".$date_string . "</font>";
109 print " <font class=bold>(". $iter{"user"}.")</font></td>";
110 print "<td>" . "<font class=text>" . stripslashes($iter{"body"}) . "</font></td></tr>\n";
111 $notes_count++;
113 }else{
114 //no results
115 print "<tr><td></td><td></td><td></td></tr>\n";
119 <tr><td colspan=3 align=left><a href="javascript:document.update_activity.submit();" class=link_submit>[Change Activity]</a></td></tr>
120 </table>
121 </form>
122 <hr>
123 <table width=400 border=0 cellpadding=0 cellspacing=0>
124 <tr><td>
126 if ($offset>($N-1)) {
127 echo "<a class=link href=pnotes_full.php?active=".$active."&offset=".($offset-$N).">[Previous]</a>";
130 </td><td align=right>
132 if ($result_count == $N) {
133 echo "<a class=link href=pnotes_full.php?active=".$active."&offset=".($offset+$N).">[Next]</a>";
136 </td></tr>
137 </table>
139 </body>
140 </html>