[ Index ]

PHP Cross Reference of Project Glazy import

title

Body

[close]

/ -> convert.php (source)

   1  <?php
   2  
   3  /*
   4  
   5  Convert.php:
   6  
   7  input fname = filename of djson data source on server
   8  input recettes[] = array of recept ID's 
   9  
  10  output convert text in glazchem format for glazy
  11  
  12  */
  13  
  14  if(isset($_GET['fname'])) {
  15      $fichier='fichiers/'.$_GET['fname'];
  16  
  17  #echo $fichier.' ----- ' .$_SESSION['filename'].'<br>';
  18  
  19  #$fichier="fichiers/defaut.json";
  20  $people_json = file_get_contents($fichier);
  21  
  22  $rec = json_decode($people_json, true);
  23  
  24  if (isset($_GET['recettes'])) {
  25  
  26      echo '<button onclick="copy2clipboard()">Copier le texte</button><br>';
  27  
  28      echo "<textarea id='glazchem' rows='80' cols='80'>";
  29      foreach ($_GET['recettes'] as $ID) {
  30  
  31          $recette = $rec[$ID];
  32          echo "name = ".$recette['name']."\n";
  33          echo "index =\n";
  34          
  35          # echo "date = ".str_replace('-','/',substr($recette['createdAt'],0,10))."\n";
  36          echo "date = ".substr($recette['createdAt'],8,2)."/".substr($recette['createdAt'],5,2)."/".substr($recette['createdAt'],0,4)."\n";
  37          echo "source = https://glazy.org\n";
  38          echo "range =\n";
  39          echo "firetype =\n";
  40          echo "color =\n";
  41          echo "vistexture =\n";
  42          echo "quality =\n";
  43          echo "transparency =\n";
  44          echo "xtals = \n";
  45          echo "bubbles = \n";
  46          echo "flow =\n";
  47          echo "durability =\n";
  48          echo "flaws =\n";
  49          echo "tested =\n";
  50          echo "imagefile =\n";
  51          echo "notefile =\n";
  52          echo "limform = \n";
  53          echo "by_vol =\n";
  54          echo "batchsize = ".$recette['materialComponentTotalAmount']."\n";
  55          
  56              foreach ($recette['materialComponents'] as $composant) {
  57                  if ($composant['isAdditional']) {
  58                      echo "addition = ".$composant['material']['name']."\n";
  59                      echo "addamount = ".$composant['percentageAmount']."\n";           
  60                  } else {
  61                      echo "component = ".$composant['material']['name']."\n";
  62                      echo "amount = ".$composant['percentageAmount']."\n";
  63              
  64                  }
  65              }
  66          }
  67          echo '</textarea>';
  68      }   
  69  } else {
  70  
  71  echo 'fname not set in convert.php call<br>';
  72  
  73  }


Generated: Thu Sep 14 11:31:49 2023 Cross-referenced by PHPXref 0.7.1