contact_notes.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <?php
  2. /*
  3. FusionPBX
  4. Version: MPL 1.1
  5. The contents of this file are subject to the Mozilla Public License Version
  6. 1.1 (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.mozilla.org/MPL/
  9. Software distributed under the License is distributed on an "AS IS" basis,
  10. WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  11. for the specific language governing rights and limitations under the
  12. License.
  13. The Original Code is FusionPBX
  14. The Initial Developer of the Original Code is
  15. Mark J Crane <[email protected]>
  16. Portions created by the Initial Developer are Copyright (C) 2008-2024
  17. the Initial Developer. All Rights Reserved.
  18. Contributor(s):
  19. Mark J Crane <[email protected]>
  20. */
  21. //includes files
  22. require_once dirname(__DIR__, 2) . "/resources/require.php";
  23. require_once "resources/check_auth.php";
  24. //check permissions
  25. if (permission_exists('contact_note_view')) {
  26. //access granted
  27. }
  28. else {
  29. echo "access denied";
  30. exit;
  31. }
  32. //set the uuid
  33. if (!empty($_GET['id']) && is_uuid($_GET['id'])) {
  34. $contact_uuid = $_GET['id'];
  35. }
  36. //get the contact list
  37. $sql = "select * from v_contact_notes ";
  38. $sql .= "where domain_uuid = :domain_uuid ";
  39. $sql .= "and contact_uuid = :contact_uuid ";
  40. $sql .= "order by last_mod_date desc ";
  41. $parameters['domain_uuid'] = $_SESSION['domain_uuid'];
  42. $parameters['contact_uuid'] = $contact_uuid ?? '';
  43. $database = new database;
  44. $contact_notes = $database->select($sql, $parameters, 'all');
  45. unset($sql, $parameters);
  46. //show if exists
  47. if (!empty($contact_notes)) {
  48. //show the content
  49. echo "<div class='action_bar sub shrink'>\n";
  50. echo " <div class='heading'><b>".$text['label-contact_notes']."</b></div>\n";
  51. echo " <div style='clear: both;'></div>\n";
  52. echo "</div>\n";
  53. echo "<div class='card'>\n";
  54. echo "<table class='list'>\n";
  55. echo "<tr class='list-header'>\n";
  56. if (permission_exists('contact_note_delete')) {
  57. echo " <th class='checkbox'>\n";
  58. echo " <input type='checkbox' id='checkbox_all_notes' name='checkbox_all' onclick=\"edit_all_toggle('notes');\" ".(!empty($contact_notes) ?: "style='visibility: hidden;'").">\n";
  59. echo " </th>\n";
  60. }
  61. echo "<th>".$text['label-note_content']."</th>\n";
  62. echo "<th class='shrink'>".$text['label-note_user']."</th>\n";
  63. if (permission_exists('contact_note_edit') && $list_row_edit_button == 'true') {
  64. echo " <td class='action-button'>&nbsp;</td>\n";
  65. }
  66. echo "</tr>\n";
  67. if (!empty($contact_notes)) {
  68. foreach ($contact_notes as $row) {
  69. $contact_note = $row['contact_note'];
  70. $contact_note = escape($contact_note);
  71. $contact_note = str_replace("\n","<br />",$contact_note);
  72. if (permission_exists('contact_note_add')) {
  73. $list_row_url = "contact_note_edit.php?contact_uuid=".escape($row['contact_uuid'])."&id=".escape($row['contact_note_uuid']);
  74. }
  75. echo "<tr class='list-row' href='".$list_row_url."'>\n";
  76. if (permission_exists('contact_note_delete')) {
  77. echo " <td class='checkbox'>\n";
  78. echo " <input type='checkbox' name='contact_notes[$x][checked]' id='checkbox_".$x."' class='chk_delete checkbox_notes' value='true' onclick=\"edit_delete_action('notes');\">\n";
  79. echo " <input type='hidden' name='contact_notes[$x][uuid]' value='".escape($row['contact_note_uuid'])."' />\n";
  80. echo " </td>\n";
  81. }
  82. echo " <td class='overflow'>".$contact_note."</td>\n";
  83. echo " <td class='description no-wrap'><strong>".escape($row['last_mod_user'])."</strong>: ".date("j M Y @ H:i:s", strtotime($row['last_mod_date']))."</td>\n";
  84. if (permission_exists('contact_note_edit') && $list_row_edit_button == 'true') {
  85. echo " <td class='action-button'>\n";
  86. echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
  87. echo " </td>\n";
  88. }
  89. echo "</tr>\n";
  90. $x++;
  91. }
  92. }
  93. unset($contact_notes);
  94. echo "</table>";
  95. echo "</div>\n";
  96. echo "<br />\n";
  97. }
  98. ?>