index.php 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. $http_host = $_SERVER['HTTP_HOST'];
  3. include("../../../php_functions.php");
  4. $con = startdb();
  5. if (!checkSession($con)){
  6. header("Location: /index.php");
  7. exit (-1);
  8. }
  9. else{?>
  10. <html>
  11. <head>
  12. <meta content="text/html; charset=windows-1252" http-equiv="content-type"/>
  13. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
  14. <title>Taducir actividades - Administraci&oacute;n</title>
  15. <!-- CSS files -->
  16. <link rel="stylesheet" type="text/css" href="/css/ui.css"/>
  17. <link rel="stylesheet" type="text/css" href="/css/actividades.css"/>
  18. <!-- CSS for mobile version -->
  19. <link rel="stylesheet" type="text/css" media="(max-width : 990px)" href="/css/m/ui.css"/>
  20. <link rel="stylesheet" type="text/css" media="(max-width : 990px)" href="/css/m/actividades.css"/>
  21. <!-- Script files -->
  22. <script type="text/javascript" src="/script/ui.js"></script>
  23. </head>
  24. <body>
  25. <?php include('../../toolbar.php'); ?>
  26. <div id='content'>
  27. <div class='section'>
  28. <h3>Lista de actividades</h3>
  29. <div class='entry'>
  30. <?php
  31. $q = mysqli_query($con, "SELECT * FROM activity;");
  32. echo "<table class='translation_table'><tr><th>Nombre</th><th>Ingles</th><th>Euskera</th></tr>\n";
  33. while ($r = mysqli_fetch_array($q)){
  34. echo "<tr><td><a href='http://$http_host/actividades/translate/translate.php?id=$r[id]'>$r[title_es]</a></td>";
  35. $total = 2; //Title and text are mandatory
  36. $translated_en = 0;
  37. $translated_eu = 0;
  38. //Calculate field number
  39. if ($r['title_en'] != $r['title_es']){
  40. $translated_en ++;
  41. }
  42. if ($r['title_eu'] != $r['title_es']){
  43. $translated_eu ++;
  44. }
  45. if ($r['text_en'] != $r['text_es']){
  46. $translated_en ++;
  47. }
  48. if ($r['text_eu'] != $r['text_es']){
  49. $translated_eu ++;
  50. }
  51. if (strlen($r['after_es']) > 0){
  52. $total ++;
  53. if ($r['after_en'] != $r['after_es']){
  54. $translated_en ++;
  55. }
  56. if ($r['after_eu'] != $r['after_es']){
  57. $translated_eu ++;
  58. }
  59. }
  60. $q_i = mysqli_query($con, "SELECT * FROM activity_itinerary WHERE activity = $r[id]");
  61. while ($r_i = mysqli_fetch_array($q_i)){
  62. $total ++;
  63. if ($r_i['title_en'] != $r_i['title_es']){
  64. $translated_en ++;
  65. }
  66. if ($r_i['title_eu'] != $r_i['title_es']){
  67. $translated_eu ++;
  68. }
  69. if (strlen($r_i['description_es']) > 0){
  70. $total ++;
  71. if ($r_i['description_en'] != $r_i['description_es']){
  72. $translated_en ++;
  73. }
  74. if ($r_i['description_eu'] != $r_i['description_es']){
  75. $translated_eu ++;
  76. }
  77. }
  78. }
  79. //Calculate percents
  80. echo "<td>" . intval($translated_en * 100 / $total) . "%</td><td>" . intval($translated_eu * 100 / $total) . "%</td></tr>\n";
  81. }
  82. echo "</table>\n";
  83. ?>
  84. </div>
  85. </div>
  86. </div>
  87. </body>
  88. </html>
  89. <?php } ?>