PageRenderTime 39ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 1ms

/interface/main/onotes/office_comments_full.php

https://github.com/md-tech/openemr
PHP | 144 lines | 108 code | 29 blank | 7 comment | 26 complexity | 0a114f72b44c09fd52897362042f3b1d MD5 | raw file
  1. <?php
  2. include_once("../../globals.php");
  3. include_once("$srcdir/onotes.inc");
  4. //the number of records to display per screen
  5. $N = 10;
  6. if (!isset($offset)) { $offset=0; }
  7. if (!isset($active)) { $active="all"; }
  8. //this code handles changing the state of activity tags when the user updates them through the interface
  9. if (isset($mode)) {
  10. if ($mode == "update") {
  11. foreach ($_POST as $var => $val) {
  12. if ($val == "true" || $val == "false") {
  13. $id = str_replace("act","",$var);
  14. if ($val == "true") {reappearOnote ($id);}elseif($val=="false"){disappearOnote($id);};
  15. //print "$id: $val > $act_state<br>\n";
  16. }
  17. }
  18. } elseif ($mode == "new") {
  19. addOnote($_POST["note"]);
  20. }
  21. }
  22. ?>
  23. <html>
  24. <head>
  25. <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
  26. </head>
  27. <body class="body_top">
  28. <div id="officenotes_edit">
  29. <form method="post" name="new_note" action="office_comments_full.php">
  30. <?php
  31. /* BACK should go to the main Office Notes screen */
  32. if ($userauthorized) { $backurl="office_comments.php"; }
  33. else { $backurl="../main_info.php"; }
  34. ?>
  35. <?php if ($GLOBALS['concurrent_layout']) { ?>
  36. <a href="office_comments.php">
  37. <?php } else { ?>
  38. <a href="<?php echo $backurl; ?>" target="Main">
  39. <?php } ?>
  40. <span class="title"><?php xl('Office Notes','e'); ?></span>
  41. <span class="back"><?php echo $tback; ?></span></a>
  42. <br>
  43. <input type="hidden" name="mode" value="new">
  44. <input type="hidden" name="offset" value="<?php echo $offset; ?>">
  45. <input type="hidden" name="active" value="<?php echo $active; ?>">
  46. <textarea name="note" rows="6" cols="40" wrap="virtual"></textarea>
  47. <br>
  48. <a href="javascript:document.new_note.submit();" class="link_submit">[<?php xl ('Add New Note','e'); ?>]</a>
  49. </form>
  50. <br/>
  51. <form method="post" name="update_activity" action="office_comments_full.php">
  52. <?php //change the view on the current mode, whether all, active, or inactive
  53. $all_class="link"; $active_class="link"; $inactive_class="link";
  54. if ($active=="all") { $all_class="link_selected"; }
  55. elseif ($active==1) { $active_class="link_selected"; }
  56. elseif ($active==0) { $inactive_class="link_selected"; }
  57. ?>
  58. <span class="text"><?php xl('View:','e'); ?> </span>
  59. <a href="office_comments_full.php?offset=0&active=all" class="<?php echo $all_class;?>">[<?php xl('All','e'); ?>]</a>
  60. <a href="office_comments_full.php?offset=0&active=1" class="<?php echo $active_class;?>">[<?php xl ('Only Active','e'); ?>]</a>
  61. <a href="office_comments_full.php?offset=0&active=0" class="<?php echo $inactive_class;?>">[<?php xl('Only Inactive','e'); ?>]</a>
  62. <input type="hidden" name="mode" value="update">
  63. <input type="hidden" name="offset" value="<?php echo $offset;?>">
  64. <input type="hidden" name="active" value="<?php echo $active;?>">
  65. <br/>
  66. <a href="javascript:document.update_activity.submit();" class="link_submit">[<?php xl('Change Activity','e'); ?>]</a>
  67. <table border="0" class="existingnotes">
  68. <?php
  69. //display all of the notes for the day, as well as others that are active from previous dates, up to a certain number, $N
  70. //retrieve all notes
  71. if ($result = getOnoteByDate("", $active, "id,date,body,user,activity",$N,$offset)) {
  72. $result_count = 0;
  73. foreach ($result as $iter) {
  74. $result_count++;
  75. if (getdate() == strtotime($iter{"date"})) {
  76. $date_string = "Today, " . date( "D F dS" ,strtotime($iter{"date"}));
  77. } else {
  78. $date_string = date( "D F dS" ,strtotime($iter{"date"}));
  79. }
  80. if ($iter{"activity"}) { $checked = "checked"; }
  81. else { $checked = ""; }
  82. print "<tr><td><input type=hidden value='' name='act".$iter{"id"}."' id='act".$iter{"id"}."'>";
  83. 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>";
  84. print "<td><label for='box".$iter{"id"}."' class='bold'>".$date_string . "</label>";
  85. print " <label for='box".$iter{"id"}."' class='bold'>(". $iter{"user"}.")</label></td>";
  86. print "<td><label for='box".$iter{"id"}."' class='text'>" . stripslashes($iter{"body"}) . "&nbsp;</label></td></tr>\n";
  87. $notes_count++;
  88. }
  89. }else{
  90. //no results
  91. print "<tr><td></td><td></td><td></td></tr>\n";
  92. }
  93. ?>
  94. </table>
  95. <a href="javascript:document.update_activity.submit();" class="link_submit">[<?php xl ('Change Activity','e'); ?>]</a>
  96. </form>
  97. <hr>
  98. <table width="400" border="0" cellpadding="0" cellspacing="0">
  99. <tr><td>
  100. <?php
  101. if ($offset>($N-1)) {
  102. echo "<a class='link' href=office_comments_full.php?active=".$active."&offset=".($offset-$N).">[".xl('Previous','e')."]</a>";
  103. }
  104. ?>
  105. </td><td align=right>
  106. <?php
  107. if ($result_count == $N) {
  108. echo "<a class='link' href=office_comments_full.php?active=".$active."&offset=".($offset+$N).">[".xl('Next')."]</a>";
  109. }
  110. ?>
  111. </td></tr>
  112. </table>
  113. </div>
  114. </body>
  115. </html>