Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Le Louvre</title>
- </head>
- <body>
- <form
- method="post"
- action="le_louvre_dl.php"
- >
- <label for="idNumberPage">Typology page number:</label>
- <input type="number"
- id="idNumberPage"
- name="nameNumberPage"
- value="1"
- step="1"
- size="5"
- >
- <!--
- e.g. https://collections.louvre.fr/en/recherche?typology[0]=1";
- -->
- <label for="idSelectArtworkTypology">Artwork typology:</label>
- <select id="idSelectArtworkTypology"
- name="nameSelectArtworkTypology"
- >
- <option value="1">Paintings</option>
- <!--<option value="2">Dessins and Gravures</option>-->
- <option value="3">Sculptures</option>
- <option value="4">Textiles</option>
- <option value="5">Jewellery and Finery</option>
- <option value="6">Furniture</option>
- <option value="7">Writing and Inscriptions</option>
- <option value="8">Objects</option>
- </select>
- <label for="idSelectAction">Action:</label>
- <select id="idSelectAction"
- name="nameSelectAction"
- >
- <option value="list">list urls</option>
- <option value="dl">download</option>
- </select>
- <input type="submit" value="go!">
- </form>
- </body>
- </html>
- ***
- <?php
- require "./vendor/autoload.php";
- use am\museum\LeLouvre;
- //////////////// TESTING ZONE ////////////////
- define ("CLOUD", false);
- define ("PROJECT_NAME", "le-louvre-210421");
- define ("BASE_BUCKET_NAME", "am-ll-210421");
- if (CLOUD){
- /*
- * this bucket could have been previously created; e.g.:
- * gsutil mb -p myll-210413 -c STANDARD -l europe-west1 -b on gs://am-210413
- */
- //$o = new LeLouvre("gs://am-210413/");
- $o = new LeLouvre(
- PROJECT_NAME, //"myll-210413",
- BASE_BUCKET_NAME //"am-210415"
- );
- }
- else{
- //running and downloading locally only
- $o=new LeLouvre();
- }
- //receber o pedido do front-end em HTML
- /*
- * 1
- * basta atender à super-global $_REQUEST
- * ou à super-global $_POST
- * porque ambas codificam as escolhas do utilizador, na form
- */
- $iPageNumber = intval($_POST['nameNumberPage']); //name usado no HTML
- $iArtworkTypology = intval($_POST['nameSelectArtworkTypology']); //name usado no HTML
- $strDesiredAction = $_POST['nameSelectAction']; //name usado no HTML
- //responder ao pedido, chamando os métodos certos do objeto do tipo LeLouvre
- /*
- * olhar, acima de tudo, para os métodos public da class LeLouvre
- * pois o objeto $o obtidos nas linhas acima, poderá e deverá
- * invocar, consoante as escolhas, um desses métodos
- */
- switch($strDesiredAction){
- case "list":
- $aPermalinksListForTheTypologyAtPage =
- $o->getWorksPermalinksHrefsForTypologyPage(
- $iArtworkTypology,
- $iPageNumber//,
- //true
- );
- var_dump ($aPermalinksListForTheTypologyAtPage);
- break;
- case "dl":
- $o->dlAllArtworksForTypologyPage(
- $iArtworkTypology,
- $iPageNumber
- );
- break;
- }//switch
Add Comment
Please, Sign In to add comment