index.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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 galer&iacute; - 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/galeria.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/galeria.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>Albums</h3>
  29. <div class='entry'>
  30. <?php
  31. $q = mysqli_query($con, "SELECT * FROM album;");
  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/galeria/translate/translate.php?id=$r[id]'>$r[title_es]</a></td>";
  35. $total = 1; //Title is 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 (strlen($r['description_es']) > 0){
  46. if ($r['description_en'] != $r['description_es']){
  47. $translated_en ++;
  48. }
  49. if ($r['description_eu'] != $r['description_es']){
  50. $translated_eu ++;
  51. }
  52. }
  53. $q_i = mysqli_query($con, "SELECT title_es, title_en, title_eu, description_es, description_en, description_eu FROM photo, photo_album where photo = id AND album = $r[id]");
  54. while ($r_i = mysqli_fetch_array($q_i)){
  55. $total ++;
  56. if ($r_i['title_en'] != $r_i['title_es']){
  57. $translated_en ++;
  58. }
  59. if ($r_i['title_eu'] != $r_i['title_es']){
  60. $translated_eu ++;
  61. }
  62. if (strlen($r_i['description_es']) > 0){
  63. $total ++;
  64. if ($r_i['description_en'] != $r_i['description_es']){
  65. $translated_en ++;
  66. }
  67. if ($r_i['description_eu'] != $r_i['description_es']){
  68. $translated_eu ++;
  69. }
  70. }
  71. }
  72. //Calculate percents
  73. echo "<td>" . intval($translated_en * 100 / $total) . "%</td><td>" . intval($translated_eu * 100 / $total) . "%</td></tr>\n";
  74. }
  75. echo "</table>\n";
  76. ?>
  77. </div>
  78. </div>
  79. </div>
  80. </body>
  81. </html>
  82. <?php } ?>