switch to explode since split deprecated
[openemr.git] / interface / main / onotes / office_comments_full.php
blobaa7f4eb866227a43f2e8da21fd054d1dd91afa57
1 <?php
2 include_once("../../globals.php");
3 include_once("$srcdir/onotes.inc");
5 //the number of records to display per screen
6 $N = 10;
8 if (!isset($offset)) { $offset=0; }
10 if (!isset($active)) { $active="all"; }
12 //this code handles changing the state of activity tags when the user updates them through the interface
13 if (isset($mode)) {
14 if ($mode == "update") {
15 foreach ($_POST as $var => $val) {
16 if ($val == "true" || $val == "false") {
17 $id = str_replace("act","",$var);
18 if ($val == "true") {reappearOnote ($id);}elseif($val=="false"){disappearOnote($id);};
19 //print "$id: $val > $act_state<br>\n";
22 } elseif ($mode == "new") {
23 addOnote($_POST["note"]);
27 <html>
28 <head>
30 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
32 </head>
33 <body class="body_top">
35 <div id="officenotes_edit">
37 <form method="post" name="new_note" action="office_comments_full.php">
39 <?php
40 /* BACK should go to the main Office Notes screen */
41 if ($userauthorized) { $backurl="office_comments.php"; }
42 else { $backurl="../main_info.php"; }
45 <?php if ($GLOBALS['concurrent_layout']) { ?>
46 <a href="office_comments.php">
47 <?php } else { ?>
48 <a href="<?php echo $backurl; ?>" target="Main">
49 <?php } ?>
51 <span class="title"><?php xl('Office Notes','e'); ?></span>
52 <span class="back"><?php echo $tback; ?></span></a>
54 <br>
55 <input type="hidden" name="mode" value="new">
56 <input type="hidden" name="offset" value="<?php echo $offset; ?>">
57 <input type="hidden" name="active" value="<?php echo $active; ?>">
59 <textarea name="note" rows="6" cols="40" wrap="virtual"></textarea>
60 <br>
61 <a href="javascript:document.new_note.submit();" class="link_submit">[<?php xl ('Add New Note','e'); ?>]</a>
62 </form>
64 <br/>
66 <form method="post" name="update_activity" action="office_comments_full.php">
68 <?php //change the view on the current mode, whether all, active, or inactive
69 $all_class="link"; $active_class="link"; $inactive_class="link";
70 if ($active=="all") { $all_class="link_selected"; }
71 elseif ($active==1) { $active_class="link_selected"; }
72 elseif ($active==0) { $inactive_class="link_selected"; }
75 <span class="text"><?php xl('View:','e'); ?> </span>
76 <a href="office_comments_full.php?offset=0&active=all" class="<?php echo $all_class;?>">[<?php xl('All','e'); ?>]</a>
77 <a href="office_comments_full.php?offset=0&active=1" class="<?php echo $active_class;?>">[<?php xl ('Only Active','e'); ?>]</a>
78 <a href="office_comments_full.php?offset=0&active=0" class="<?php echo $inactive_class;?>">[<?php xl('Only Inactive','e'); ?>]</a>
80 <input type="hidden" name="mode" value="update">
81 <input type="hidden" name="offset" value="<?php echo $offset;?>">
82 <input type="hidden" name="active" value="<?php echo $active;?>">
83 <br/>
84 <a href="javascript:document.update_activity.submit();" class="link_submit">[<?php xl('Change Activity','e'); ?>]</a>
86 <table border="0" class="existingnotes">
87 <?php
88 //display all of the notes for the day, as well as others that are active from previous dates, up to a certain number, $N
90 //retrieve all notes
91 if ($result = getOnoteByDate("", $active, "id,date,body,user,activity",$N,$offset)) {
92 $result_count = 0;
93 foreach ($result as $iter) {
94 $result_count++;
96 if (getdate() == strtotime($iter{"date"})) {
97 $date_string = "Today, " . date( "D F dS" ,strtotime($iter{"date"}));
98 } else {
99 $date_string = date( "D F dS" ,strtotime($iter{"date"}));
102 if ($iter{"activity"}) { $checked = "checked"; }
103 else { $checked = ""; }
105 print "<tr><td><input type=hidden value='' name='act".$iter{"id"}."' id='act".$iter{"id"}."'>";
106 print "<input name='box".$iter{"id"}."' id='box".$iter{"id"}."' onClick='javascript:document.update_activity.act".$iter{"id"}.".value=this.checked' type=checkbox $checked></td>";
107 print "<td><label for='box".$iter{"id"}."' class='bold'>".$date_string . "</label>";
108 print " <label for='box".$iter{"id"}."' class='bold'>(". $iter{"user"}.")</label></td>";
109 print "<td><label for='box".$iter{"id"}."' class='text'>" . stripslashes($iter{"body"}) . "&nbsp;</label></td></tr>\n";
112 $notes_count++;
114 }else{
115 //no results
116 print "<tr><td></td><td></td><td></td></tr>\n";
120 </table>
122 <a href="javascript:document.update_activity.submit();" class="link_submit">[<?php xl ('Change Activity','e'); ?>]</a>
123 </form>
125 <hr>
126 <table width="400" border="0" cellpadding="0" cellspacing="0">
127 <tr><td>
128 <?php
129 if ($offset>($N-1)) {
130 echo "<a class='link' href=office_comments_full.php?active=".$active."&offset=".($offset-$N).">[".xl('Previous','e')."]</a>";
133 </td><td align=right>
134 <?php
135 if ($result_count == $N) {
136 echo "<a class='link' href=office_comments_full.php?active=".$active."&offset=".($offset+$N).">[".xl('Next')."]</a>";
139 </td></tr>
140 </table>
141 </div>
143 </body>
144 </html>