v_fifo_agent_profiles.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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-2012
  17. the Initial Developer. All Rights Reserved.
  18. Contributor(s):
  19. Mark J Crane <[email protected]>
  20. */
  21. require_once "root.php";
  22. require_once "resources/require.php";
  23. require_once "resources/check_auth.php";
  24. if (if_group("admin") || if_group("superadmin")) {
  25. //access granted
  26. }
  27. else {
  28. echo "access denied";
  29. exit;
  30. }
  31. require_once "resources/header.php";
  32. require_once "resources/paging.php";
  33. $order_by = $_GET["order_by"];
  34. $order = $_GET["order"];
  35. echo "<div align='center'>";
  36. echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
  37. echo "<tr class='border'>\n";
  38. echo " <td align=\"center\">\n";
  39. echo " <br>";
  40. echo "<table width='100%' border='0'>\n";
  41. echo "<tr>\n";
  42. echo "<td width='50%' nowrap='nowrap' align='left'><b>Agent Profile List</b></td>\n";
  43. echo "<td width='50%' align='right'>&nbsp;</td>\n";
  44. echo "</tr>\n";
  45. echo "</tr></table>\n";
  46. $sql = "";
  47. $sql .= "select * from v_fifo_agent_profiles ";
  48. $sql .= "where domain_uuid = '$domain_uuid' ";
  49. if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
  50. $prep_statement = $db->prepare(check_sql($sql));
  51. $prep_statement->execute();
  52. $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
  53. $num_rows = count($result);
  54. unset ($prep_statement, $result, $sql);
  55. $rows_per_page = 10;
  56. $param = "";
  57. $page = $_GET['page'];
  58. if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
  59. list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
  60. $offset = $rows_per_page * $page;
  61. $sql = "";
  62. $sql .= "select * from v_fifo_agent_profiles ";
  63. $sql .= "where domain_uuid = '$domain_uuid' ";
  64. if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
  65. $sql .= " limit $rows_per_page offset $offset ";
  66. $prep_statement = $db->prepare(check_sql($sql));
  67. $prep_statement->execute();
  68. $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
  69. $result_count = count($result);
  70. unset ($prep_statement, $sql);
  71. $c = 0;
  72. $row_style["0"] = "row_style0";
  73. $row_style["1"] = "row_style1";
  74. echo "<div align='center'>\n";
  75. echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
  76. echo "<tr>\n";
  77. echo th_order_by('profile_name', 'Profile Name', $order_by, $order);
  78. echo th_order_by('profile_desc', 'Description', $order_by, $order);
  79. echo "<td align='right' width='42'>\n";
  80. echo " <a href='v_fifo_agent_profiles_edit.php' alt='add'>$v_link_label_add</a>\n";
  81. //echo " <input type='button' class='btn' name='' alt='add' onclick=\"window.location='v_fifo_agent_profiles_edit.php'\" value='+'>\n";
  82. echo "</td>\n";
  83. echo "<tr>\n";
  84. if ($result_count == 0) { //no results
  85. }
  86. else { //received results
  87. foreach($result as $row) {
  88. //print_r( $row );
  89. echo "<tr >\n";
  90. echo " <td valign='top' class='".$row_style[$c]."'>".$row[profile_name]."</td>\n";
  91. echo " <td valign='top' class='".$row_style[$c]."'>".$row[profile_desc]."</td>\n";
  92. echo " <td valign='top' align='right'>\n";
  93. echo " <a href='v_fifo_agent_profiles_edit.php?id=".$row[fifo_agent_profile_id]."' alt='edit'>$v_link_label_edit</a>\n";
  94. echo " <a href='v_fifo_agent_profiles_delete.php?id=".$row[fifo_agent_profile_id]."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
  95. //echo " <input type='button' class='btn' name='' alt='edit' onclick=\"window.location='v_fifo_agent_profiles_edit.php?id=".$row[fifo_agent_profile_id]."'\" value='e'>\n";
  96. //echo " <input type='button' class='btn' name='' alt='delete' onclick=\"if (confirm('Are you sure you want to delete this?')) { window.location='v_fifo_agent_profiles_delete.php?id=".$row[fifo_agent_profile_id]."' }\" value='x'>\n";
  97. echo " </td>\n";
  98. echo "</tr>\n";
  99. if ($c==0) { $c=1; } else { $c=0; }
  100. } //end foreach
  101. unset($sql, $result, $row_count);
  102. } //end if results
  103. echo "<tr>\n";
  104. echo "<td colspan='3' align='left'>\n";
  105. echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
  106. echo " <tr>\n";
  107. echo " <td width='33.3%' nowrap>&nbsp;</td>\n";
  108. echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
  109. echo " <td width='33.3%' align='right'>\n";
  110. echo " <a href='v_fifo_agent_profiles_edit.php' alt='add'>$v_link_label_add</a>\n";
  111. //echo " <input type='button' class='btn' name='' alt='add' onclick=\"window.location='v_fifo_agent_profiles_edit.php'\" value='+'>\n";
  112. echo " </td>\n";
  113. echo " </tr>\n";
  114. echo " </table>\n";
  115. echo "</td>\n";
  116. echo "</tr>\n";
  117. echo "</table>";
  118. echo "</div>";
  119. echo "<br><br>";
  120. echo "<br><br>";
  121. echo "</td>";
  122. echo "</tr>";
  123. echo "</table>";
  124. echo "</div>";
  125. echo "<br><br>";
  126. require_once "resources/footer.php";
  127. unset ($result_count);
  128. unset ($result);
  129. unset ($key);
  130. unset ($val);
  131. unset ($c);
  132. ?>