v_fifo_agent_languages.php 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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>Fifo Agent Language List</b></td>\n";
  43. echo "<td width='50%' align='right'>&nbsp;</td>\n";
  44. echo "</tr>\n";
  45. echo "<tr>\n";
  46. echo "<td colspan='2' align='left'>\n";
  47. echo "Matches the Agent with languages they can speak with their proficiency level.<br /><br />\n";
  48. echo "</td>\n";
  49. echo "</tr>\n";
  50. echo "</tr></table>\n";
  51. $sql = "";
  52. $sql .= " select * from v_fifo_agent_languages ";
  53. if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
  54. $prep_statement = $db->prepare(check_sql($sql));
  55. $prep_statement->execute();
  56. $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
  57. $num_rows = count($result);
  58. unset ($prep_statement, $result, $sql);
  59. $rows_per_page = 10;
  60. $param = "";
  61. $page = $_GET['page'];
  62. if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
  63. list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
  64. $offset = $rows_per_page * $page;
  65. $sql = "";
  66. $sql .= " select * from v_fifo_agent_languages ";
  67. if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
  68. $sql .= " limit $rows_per_page offset $offset ";
  69. $prep_statement = $db->prepare(check_sql($sql));
  70. $prep_statement->execute();
  71. $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
  72. $result_count = count($result);
  73. unset ($prep_statement, $sql);
  74. $c = 0;
  75. $row_style["0"] = "row_style0";
  76. $row_style["1"] = "row_style1";
  77. echo "<div align='center'>\n";
  78. echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
  79. echo "<tr>\n";
  80. echo th_order_by('username', 'Username', $order_by, $order);
  81. echo th_order_by('language', 'Language', $order_by, $order);
  82. echo th_order_by('proficiency', 'Proficiency', $order_by, $order);
  83. echo "<td align='right' width='42'>\n";
  84. echo " <a href='v_fifo_agent_languages_edit.php' alt='add'>$v_link_label_add</a>\n";
  85. //echo " <input type='button' class='btn' name='' alt='add' onclick=\"window.location='v_fifo_agent_languages_edit.php'\" value='+'>\n";
  86. echo "</td>\n";
  87. echo "<tr>\n";
  88. if ($result_count == 0) { //no results
  89. }
  90. else { //received results
  91. foreach($result as $row) {
  92. //print_r( $row );
  93. echo "<tr >\n";
  94. echo " <td valign='top' class='".$row_style[$c]."'>".$row[username]."</td>\n";
  95. echo " <td valign='top' class='".$row_style[$c]."'>".$row[language]."</td>\n";
  96. echo " <td valign='top' class='".$row_style[$c]."'>".$row[proficiency]."</td>\n";
  97. echo " <td valign='top' align='right'>\n";
  98. echo " <a href='v_fifo_agent_languages_edit.php?id=".$row[fifo_agent_language_id]."' alt='edit'>$v_link_label_edit</a>\n";
  99. echo " <a href='v_fifo_agent_languages_delete.php?id=".$row[fifo_agent_language_id]."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
  100. //echo " <input type='button' class='btn' name='' alt='edit' onclick=\"window.location='v_fifo_agent_languages_edit.php?id=".$row[fifo_agent_language_id]."'\" value='e'>\n";
  101. //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_languages_delete.php?id=".$row[fifo_agent_language_id]."' }\" value='x'>\n";
  102. echo " </td>\n";
  103. echo "</tr>\n";
  104. if ($c==0) { $c=1; } else { $c=0; }
  105. } //end foreach
  106. unset($sql, $result, $row_count);
  107. } //end if results
  108. echo "<tr>\n";
  109. echo "<td colspan='4' align='left'>\n";
  110. echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
  111. echo " <tr>\n";
  112. echo " <td width='33.3%' nowrap>&nbsp;</td>\n";
  113. echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
  114. echo " <td width='33.3%' align='right'>\n";
  115. echo " <a href='v_fifo_agent_languages_edit.php' alt='add'>$v_link_label_add</a>\n";
  116. //echo " <input type='button' class='btn' name='' alt='add' onclick=\"window.location='v_fifo_agent_languages_edit.php'\" value='+'>\n";
  117. echo " </td>\n";
  118. echo " </tr>\n";
  119. echo " </table>\n";
  120. echo "</td>\n";
  121. echo "</tr>\n";
  122. echo "</table>";
  123. echo "</div>";
  124. echo "<br><br>";
  125. echo "<br><br>";
  126. echo "</td>";
  127. echo "</tr>";
  128. echo "</table>";
  129. echo "</div>";
  130. echo "<br><br>";
  131. require_once "resources/footer.php";
  132. unset ($result_count);
  133. unset ($result);
  134. unset ($key);
  135. unset ($val);
  136. unset ($c);
  137. ?>