am_dot_com

CN20210423

Apr 23rd, 2021 (edited)
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.08 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Le Louvre</title>
  6. </head>
  7. <body>
  8. <form
  9. method="post"
  10. action="le_louvre_dl.php"
  11. >
  12. <label for="idNumberPage">Typology page number:</label>
  13. <input type="number"
  14. id="idNumberPage"
  15. name="nameNumberPage"
  16. value="1"
  17. step="1"
  18. size="5"
  19. >
  20.  
  21. <!--
  22. e.g. https://collections.louvre.fr/en/recherche?typology[0]=1";
  23. -->
  24.  
  25. <label for="idSelectArtworkTypology">Artwork typology:</label>
  26. <select id="idSelectArtworkTypology"
  27. name="nameSelectArtworkTypology"
  28. >
  29. <option value="1">Paintings</option>
  30. <!--<option value="2">Dessins and Gravures</option>-->
  31. <option value="3">Sculptures</option>
  32. <option value="4">Textiles</option>
  33. <option value="5">Jewellery and Finery</option>
  34. <option value="6">Furniture</option>
  35. <option value="7">Writing and Inscriptions</option>
  36. <option value="8">Objects</option>
  37. </select>
  38.  
  39. <label for="idSelectAction">Action:</label>
  40. <select id="idSelectAction"
  41. name="nameSelectAction"
  42. >
  43. <option value="list">list urls</option>
  44. <option value="dl">download</option>
  45. </select>
  46.  
  47. <input type="submit" value="go!">
  48. </form>
  49. </body>
  50. </html>
  51.  
  52. ***
  53. <?php
  54.  
  55. require "./vendor/autoload.php";
  56.  
  57. use am\museum\LeLouvre;
  58.  
  59. //////////////// TESTING ZONE ////////////////
  60. define ("CLOUD", false);
  61. define ("PROJECT_NAME", "le-louvre-210421");
  62. define ("BASE_BUCKET_NAME", "am-ll-210421");
  63.  
  64. if (CLOUD){
  65. /*
  66. * this bucket could have been previously created; e.g.:
  67. * gsutil mb -p myll-210413 -c STANDARD -l europe-west1 -b on gs://am-210413
  68. */
  69. //$o = new LeLouvre("gs://am-210413/");
  70. $o = new LeLouvre(
  71. PROJECT_NAME, //"myll-210413",
  72. BASE_BUCKET_NAME //"am-210415"
  73. );
  74. }
  75. else{
  76. //running and downloading locally only
  77. $o=new LeLouvre();
  78. }
  79.  
  80. //receber o pedido do front-end em HTML
  81. /*
  82. * 1
  83. * basta atender à super-global $_REQUEST
  84. * ou à super-global $_POST
  85. * porque ambas codificam as escolhas do utilizador, na form
  86. */
  87.  
  88. $iPageNumber = intval($_POST['nameNumberPage']); //name usado no HTML
  89. $iArtworkTypology = intval($_POST['nameSelectArtworkTypology']); //name usado no HTML
  90. $strDesiredAction = $_POST['nameSelectAction']; //name usado no HTML
  91.  
  92. //responder ao pedido, chamando os métodos certos do objeto do tipo LeLouvre
  93. /*
  94. * olhar, acima de tudo, para os métodos public da class LeLouvre
  95. * pois o objeto $o obtidos nas linhas acima, poderá e deverá
  96. * invocar, consoante as escolhas, um desses métodos
  97. */
  98.  
  99. switch($strDesiredAction){
  100. case "list":
  101. $aPermalinksListForTheTypologyAtPage =
  102. $o->getWorksPermalinksHrefsForTypologyPage(
  103. $iArtworkTypology,
  104. $iPageNumber//,
  105. //true
  106. );
  107. var_dump ($aPermalinksListForTheTypologyAtPage);
  108. break;
  109. case "dl":
  110. $o->dlAllArtworksForTypologyPage(
  111. $iArtworkTypology,
  112. $iPageNumber
  113. );
  114. break;
  115. }//switch
Add Comment
Please, Sign In to add comment