index.php 5.0 KB

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