index.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 galer&iacute; - 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/galeria.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/galeria.css'/>
  22. <!-- Script files -->
  23. <script type='text/javascript' src='/script/ui.js'></script>
  24. </head>
  25. <body>
  26. <?php
  27. include("../../toolbar.php");
  28. ?>
  29. <div id='content'>
  30. <div class='section'>
  31. <h3>Albums</h3>
  32. <div class='entry'>
  33. <table class='translation_table'>
  34. <tr>
  35. <th>Nombre</th>
  36. <th>Ingles</th>
  37. <th>Euskera</th>
  38. </tr>
  39. <?php
  40. $q = mysqli_query($con, "SELECT * FROM album;");
  41. while ($r = mysqli_fetch_array($q)){
  42. ?>
  43. <tr>
  44. <td>
  45. <a href='/galeria/translate/translate.php?id=<?=$r["id"]?>'><?=$r["title_es"]?></a>
  46. </td>
  47. <?php
  48. $total = 1; //Title is mandatory
  49. $translated_en = 0;
  50. $translated_eu = 0;
  51. //Calculate field number
  52. if ($r["title_en"] != $r["title_es"]){
  53. $translated_en ++;
  54. }
  55. if ($r["title_eu"] != $r["title_es"]){
  56. $translated_eu ++;
  57. }
  58. if (strlen($r["description_es"]) > 0){
  59. if ($r["description_en"] != $r["description_es"]){
  60. $translated_en ++;
  61. }
  62. if ($r["description_eu"] != $r["description_es"]){
  63. $translated_eu ++;
  64. }
  65. }
  66. $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]");
  67. while ($r_i = mysqli_fetch_array($q_i)){
  68. $total ++;
  69. if ($r_i["title_en"] != $r_i["title_es"]){
  70. $translated_en ++;
  71. }
  72. if ($r_i["title_eu"] != $r_i["title_es"]){
  73. $translated_eu ++;
  74. }
  75. if (strlen($r_i["description_es"]) > 0){
  76. $total ++;
  77. if ($r_i["description_en"] != $r_i["description_es"]){
  78. $translated_en ++;
  79. }
  80. if ($r_i["description_eu"] != $r_i["description_es"]){
  81. $translated_eu ++;
  82. }
  83. }
  84. }
  85. ?>
  86. <td><?=intval($translated_en * 100 / $total)?>%</td>
  87. <td><?=intval($translated_eu * 100 / $total)?>%</td>
  88. </tr>\n";
  89. }
  90. </table>
  91. ?>
  92. </div>
  93. </div>
  94. </div>
  95. </body>
  96. </html>
  97. <?php
  98. }
  99. ?>