index.php 4.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. $http_host = $_SERVER['HTTP_HOST'];
  3. include("../../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 id, title_es, title_eu, title_en, text_es, text_en, text_eu, DATE_FORMAT(date, '%b %d, %Y') AS dat FROM activity ORDER BY date;");
  32. echo "<table class='translation_table'><tr><th>Nombre</th><th>Fecha</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. echo("<td>$r[dat]</td>");
  36. $total = 2; //Title and text are mandatory
  37. $translated_en = 0;
  38. $translated_eu = 0;
  39. //Calculate field number
  40. if ($r['title_en'] != $r['title_es']){
  41. $translated_en ++;
  42. }
  43. if ($r['title_eu'] != $r['title_es']){
  44. $translated_eu ++;
  45. }
  46. if ($r['text_en'] != $r['text_es']){
  47. $translated_en ++;
  48. }
  49. if ($r['text_eu'] != $r['text_es']){
  50. $translated_eu ++;
  51. }
  52. if (strlen($r['after_es']) > 0){
  53. $total ++;
  54. if ($r['after_en'] != $r['after_es']){
  55. $translated_en ++;
  56. }
  57. if ($r['after_eu'] != $r['after_es']){
  58. $translated_eu ++;
  59. }
  60. }
  61. $q_i = mysqli_query($con, "SELECT * FROM activity_itinerary WHERE activity = $r[id]");
  62. while ($r_i = mysqli_fetch_array($q_i)){
  63. $total ++;
  64. if ($r_i['title_en'] != $r_i['title_es']){
  65. $translated_en ++;
  66. }
  67. if ($r_i['title_eu'] != $r_i['title_es']){
  68. $translated_eu ++;
  69. }
  70. if (strlen($r_i['description_es']) > 0){
  71. $total ++;
  72. if ($r_i['description_en'] != $r_i['description_es']){
  73. $translated_en ++;
  74. }
  75. if ($r_i['description_eu'] != $r_i['description_es']){
  76. $translated_eu ++;
  77. }
  78. }
  79. }
  80. //Calculate percents
  81. echo "<td>" . intval($translated_en * 100 / $total) . "%</td><td>" . intval($translated_eu * 100 / $total) . "%</td></tr>\n";
  82. }
  83. echo "</table>\n";
  84. ?>
  85. </div>
  86. </div>
  87. </div>
  88. </body>
  89. </html>
  90. <?php } ?>