Source for file confirm.php

Documentation is available at confirm.php

  1. <?php
  2. // ----------------------------------------
  3. // to check db config and choose table to migrate
  4. // ----------------------------------------
  5.  
  6. include "inc/config_inc.php";
  7. include "inc/header.html";
  8.  
  9. $source_database = $_SESSION['source_database'];
  10. $source_version = $_SESSION['source_version'];
  11.  
  12. $target_database = $_SESSION['target_database'];
  13. $target_version = $_SESSION['target_version'];
  14.  
  15. if (isset($config_encodage)) {$config_encodage_disp = $config_encodage;}
  16. else {$config_encodage_disp = 'UTF 8';}
  17.  
  18.  
  19. // --------------------------------------------------
  20. // DISPLAY
  21. // --------------------------------------------------
  22.  
  23. print "<h2>Récapitulatif des paramètres</h2>";
  24. print "<p><b>Transfert</b> : $source_database &rarr; $target_database <br />";
  25. print "<b>Encodage des caractères</b> : $config_encodage_disp</p>";
  26. print "<p><b>Tables concernées</b> <br />";
  27.  
  28. // --------------------------------------------------
  29. // form to select
  30. // --------------------------------------------------
  31.  
  32. print "<form name=\"form1\" method=\"post\" action=\"migrate.php\">";
  33.  
  34. print "<table border=\"1\" cellspacing=\"0\" cellpadding=\"3\">";
  35. print " <tr valign=\"top\">";
  36. print " <th align=\"center\">Source => Cible</th>";
  37. print " <th align=\"center\">Nb fiches</th>";
  38. print " <th align=\"center\">Temps</th>";
  39. print " </tr>";
  40.  
  41. db_connection('source');
  42. $total_record = 0;
  43.  
  44. for ($i = 1; $i <= count($table_to_migrate); $i++) {
  45. $from_table_name = $table_to_migrate[$i]['from'];
  46. $to_table_name = $table_to_migrate[$i]['to'];
  47.  
  48. $nb_record = nb_record($from_table_name);
  49. $nb_record_f = fr_format_number($nb_record);
  50. $total_record += $nb_record;
  51.  
  52. $estimated_time_each = ceil($nb_record / $transfer_rate);
  53. $estimated_time_each_f = convert_hms($estimated_time_each);
  54. $total_estimated_time += $estimated_time_each;
  55.  
  56. print "<tr>";
  57. print "<td align=\"left\">";
  58. print "<input type=\"checkbox\" name=\"selected_source_table_name[]\"
  59. value=\"$from_table_name\" id=\"$from_table_name\">";
  60. print "<label for=\"$from_table_name\">$from_table_name => $to_table_name</label>";
  61. print "</td>";
  62. print "<td align=\"right\">$nb_record_f</td>";
  63. print "<td align=\"right\">$estimated_time_each_f</td>";
  64. print "</tr>";
  65. }
  66.  
  67. $total_record_f = fr_format_number($total_record);
  68. $total_estimated_time_f = convert_hms($total_estimated_time);
  69. $total_estimated_time_fl = convert_hms($total_estimated_time, 'long');
  70.  
  71. // total
  72. print "<tr>";
  73. print " <th>Total</th>";
  74. print " <th>$total_record_f</th>";
  75. print " <th>$total_estimated_time_f</th>";
  76. print " </tr>";
  77.  
  78.  
  79.  
  80. // submit
  81. print "<tr>";
  82. print " <td valign=\"top\" align=\"center\">";
  83. print " <input colspan=\"3\" type=\"submit\" name=\"Submit\" value=\"Submit\" />";
  84. print "</td>";
  85. print " </tr>";
  86. print "</table>";
  87.  
  88. print "</form>";
  89.  
  90. // --------------------------------------------------
  91. // calc
  92. // --------------------------------------------------
  93.  
  94. print "<p>Estimation du temps de traitement <br />";
  95. print "$total_record_f fiches à transférer <br />";
  96. print "soit $total_estimated_time_fl au rythme de $transfer_rate fiches/seconde<br />";
  97.  
  98.  
  99. include "inc/footer.html";
  100. ?>

Documentation generated on Mon, 31 Mar 2008 18:08:42 +0200 by phpDocumentor 1.3.0RC3