v_tickets.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. /* $Id$ */
  3. /*
  4. FusionPBX
  5. Version: MPL 1.1
  6. The contents of this file are subject to the Mozilla Public License Version
  7. 1.1 (the "License"); you may not use this file except in compliance with
  8. the License. You may obtain a copy of the License at
  9. http://www.mozilla.org/MPL/
  10. Software distributed under the License is distributed on an "AS IS" basis,
  11. WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12. for the specific language governing rights and limitations under the
  13. License.
  14. The Original Code is FusionPBX
  15. The Initial Developer of the Original Code is
  16. Mark J Crane <[email protected]>
  17. Portions created by the Initial Developer are Copyright (C) 2008-2012
  18. the Initial Developer. All Rights Reserved.
  19. Contributor(s):
  20. Ken Rice <[email protected]>
  21. Mark J Crane <[email protected]>
  22. */
  23. include "root.php";
  24. require_once "resources/require.php";
  25. require_once "resources/check_auth.php";
  26. if (permission_exists('ticket_view')) {
  27. //access granted
  28. }
  29. else {
  30. echo "access denied";
  31. exit;
  32. }
  33. require_once "resources/header.php";
  34. require_once "resources/paging.php";
  35. if (isset($_REQUEST['show_closed'])) {
  36. $show_closed = true;
  37. }
  38. //get a list of assigned extensions for this user
  39. $sql = "";
  40. $sql .= "select * from v_tickets ";
  41. $sql .= "where domain_uuid = '$domain_uuid' ";
  42. if (!$show_closed) {
  43. $sql .= "and ticket_status < 6 ";
  44. }
  45. if (!if_group("superadmin") && !if_group("admin")){
  46. $sql .= "and user_uuid = " . $_SESSION['user_uuid'] . " ";
  47. }
  48. $sql .= "order by ticket_status, queue_id ";
  49. $prep_statement = $db->prepare(check_sql($sql));
  50. $prep_statement->execute();
  51. $x = 0;
  52. $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
  53. foreach ($result as &$row) {
  54. $tickets[$x] = $row;
  55. $x++;
  56. }
  57. unset ($prep_statement);
  58. $sql = "";
  59. $sql .= "select * from v_ticket_statuses ";
  60. $prep_statement = $db->prepare(check_sql($sql));
  61. $prep_statement->execute();
  62. $x = 0;
  63. $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
  64. foreach ($result as &$row) {
  65. $statuses[$row['status_id']] = $row['status_name'];
  66. }
  67. unset ($prep_statement);
  68. $sql = "";
  69. $sql .= "select * from v_ticket_queues ";
  70. $sql .= "where domain_uuid = $domain_uuid ";
  71. $prep_statement = $db->prepare(check_sql($sql));
  72. $prep_statement->execute();
  73. $x = 0;
  74. $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
  75. foreach ($result as &$row) {
  76. $queues[$row['queue_id']] = $row['queue_name'];
  77. }
  78. unset ($prep_statement);
  79. //include the view
  80. include "ticket_list.php";
  81. //include the footer
  82. require_once "resources/footer.php";
  83. ?>