page.sheet.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <?php
  2. User::check_access('export','configure');
  3. require_once(__DIR__.SLASH.'ExportModel.class.php');
  4. $exportmodel = ExportModel::provide();
  5. $datasets = array();
  6. Plugin::callHook('export_model_data', array(&$datasets, array() ));
  7. $dataSetPicker = array();
  8. foreach ($datasets as $slug=>$dataset) {
  9. if(!isset($dataSetPicker[$dataset['plugin']])) $dataSetPicker[$dataset['plugin']] = array();
  10. $dataSetPicker[$dataset['plugin']][] = $dataset;
  11. }
  12. ?>
  13. <br>
  14. <div class="export">
  15. <div id="exportmodel-form" class="row exportmodel-form" data-action="export_model_save" data-id="<?php echo $exportmodel->id; ?>">
  16. <div class="col-md-12">
  17. <h3 class="d-inline-block">Fiche export modèle</h3>
  18. <div onclick="export_model_save();" class="btn btn-success float-right"><i class="fas fa-check"></i> Enregistrer</div>
  19. <a href="setting.php?section=export" class="btn btn-info float-right mr-2"><i class="fas fa-arrow-left"></i> Retour</a>
  20. <hr>
  21. </div>
  22. <div class="col-md-8">
  23. <div class="row mb-2">
  24. <div class="col-md-8">
  25. <label for="label">Libellé : </label>
  26. <input required id="label" name="label" class="form-control" placeholder="Nom export modèle" value="<?php echo html_decode_utf8($exportmodel->label); ?>" type="text">
  27. </div>
  28. <div class="col-md-4 position-relative">
  29. <div class="export-privacy-button text-center">
  30. <label for="privacy" class="pointer"><i class="fas fa-user-secret"></i>&nbsp;Export modèle privé :</label>
  31. <input type="checkbox" data-type="checkbox" id="privacy" name="privacy" <?php echo $exportmodel->privacy==ExportModel::PRIVACY_PRIVATE?'checked':''; ?>>
  32. </div>
  33. </div>
  34. </div>
  35. <div class="row">
  36. <div class="<?php echo $myUser->superadmin ? 'col-md-8' : 'col-md-12'; ?>">
  37. <label for="dataset">Jeu de données associé au modèle d'export : </label>
  38. <select required name="dataset" id="dataset" class="form-control" onchange="export_model_get_dataset(this);">
  39. <option value="" class="template"> - </option>
  40. <?php foreach ($dataSetPicker as $plugin=>$datasets): ?>
  41. <optgroup label="<?php echo $plugin; ?>">
  42. <?php foreach ($datasets as $dataset): ?>
  43. <option <?php echo $exportmodel->dataset==$dataset['dataset'] ? 'selected="selected"':'' ?> data-plugin="<?php echo $plugin; ?>" value="<?php echo $dataset['dataset']; ?>"><?php echo $dataset['label']; ?></option>
  44. <?php endforeach; ?>
  45. </optgroup>
  46. <?php endforeach; ?>
  47. </select>
  48. </div>
  49. <?php if($myUser->superadmin): ?>
  50. <div class="col-md-4">
  51. <label for="label">Slug : </label>
  52. <input required id="slug" name="slug" class="form-control" placeholder="Slug export modèle" value="<?php echo html_decode_utf8($exportmodel->slug); ?>" type="text">
  53. </div>
  54. <?php endif; ?>
  55. <div class="col-md-12 mt-2">
  56. <label for="description">Description : </label>
  57. <input id="description" name="description" class="form-control" placeholder="Description export modèle" value="<?php echo html_decode_utf8($exportmodel->description); ?>" type="text">
  58. </div>
  59. </div>
  60. </div>
  61. <div class="col-md-4">
  62. <div>
  63. <label for="document">Fichier modèle :</label>
  64. <div data-type="dropzone" data-max-files="1" data-allowed="<?php echo implode(',',array_keys(ExportModel::templates())); ?>" data-label="Faites glisser le modèle d'export ici..." data-delete="export_model_delete_document" data-save="export_model_add_document" class="form-control" id="document" name="document"><?php echo json_encode($exportmodel->documents()); ?></div>
  65. </div>
  66. <div class="options-box">
  67. <!-- format box -->
  68. <label for="export_format" class="pointer">&nbsp;Export au format :</label>
  69. <select name="export_format" data-value="<?php echo $exportmodel->export_format; ?>" id="export_format" class="form-control"></select>
  70. </div>
  71. </div>
  72. <div class="clear"></div>
  73. <hr class="col-md-12">
  74. <div id="dataset-container" class="col-md-12 dataset-container p-0 hidden">
  75. <div class="row">
  76. <div class="col-md-8 dataset-showcase">
  77. <h5 class="mb-2 d-inline-block">Liste des macros disponibles pour ce jeu de données :</h5>
  78. <a class="d-inline-block float-right" href="index.php?module=export&page=documentation"><i class="far fa-question-circle"></i> Voir la documentation générale</a>
  79. <div class="clear"></div>
  80. <ul>
  81. <li onclick="export_copy_macro(this,event)" class="hidden template li-{{type}}" data-type="{{type}}" data-macro="{{macro}}">
  82. <span class="badge badge-pill macro-{{type}}">{{badge}}</span>
  83. <code data-code="{{absolutemacro}}">{{macro}}</code> : {{label}}
  84. </li>
  85. </ul>
  86. </div>
  87. <div class="col-md-4 dataset-example-files">
  88. <span class="mb-2 block"><i class="fas fa-cloud-download-alt"></i> Fichiers d'exemple à télécharger :</span>
  89. <ul>
  90. <li class="hidden template" title="Cliquer pour copier dans le presse-papier"><a href="{{path}}" class="font-weight-bold"><i class="fas {{icon}}"></i> {{label}}</a></li>
  91. </ul>
  92. </div>
  93. </div>
  94. </div>
  95. </div>
  96. </div><br>