page.factory.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. global $myUser;
  3. User::check_access('factory','read');
  4. require_once(__DIR__.SLASH.'Template.class.php');
  5. ?>
  6. <div id="factoryForm" data-action="factory_render">
  7. <div class="row">
  8. <div class="col-xl-12 form-inline">
  9. <label>Template</label>
  10. <select class="form-control ml-2" id="template" onchange="factory_change_template(event);">
  11. <option value="">-</option>
  12. <?php foreach(glob(Template::dir().'*') as $tpl): ?>
  13. <option value="<?php echo basename($tpl); ?>"><?php echo basename($tpl); ?></option>
  14. <?php endforeach; ?>
  15. </select>
  16. </div>
  17. </div>
  18. <div class="row">
  19. <div class="col-xl-5">
  20. <h4>Plugin</h4>
  21. <input type="text" class="form-control" placeholder="Nom du plugin" id="plugin">
  22. <input type="text" class="form-control mt-2" placeholder="Description courte (optionnel)" id="description">
  23. <h4 class="mt-4">Entité</h4>
  24. <div class="list-group">
  25. <span class="list-group-item">
  26. <input type="text" class="form-control" placeholder="Nom de l'entité" id="entity">
  27. </span>
  28. <!-- champ d'entité -->
  29. <div class="list-group-item field">
  30. <div class="row">
  31. <div class="col-xl-4">
  32. <input type="text" class="form-control input-small fieldSlug" placeholder="slug">
  33. </div>
  34. <div class="col-xl-4">
  35. <input type="text" class="form-control input-small fieldLabel" placeholder="Libellé">
  36. </div>
  37. <div class="col-xl-4">
  38. <select class="form-control input-small fieldType" >
  39. <?php foreach(Template::types() as $key=>$value): ?>
  40. <option value="<?php echo $key; ?>"><?php echo $value['label']; ?></option>
  41. <?php endforeach; ?>
  42. </select>
  43. </div>
  44. </div>
  45. </div>
  46. </div>
  47. <br>
  48. <div id="factoryFilters">
  49. <h4 class="hidden">Options</h4>
  50. <ul class="list-group">
  51. <li class="hidden list-group-item">
  52. <input onchange="factory_render()" data-section="{{section}}" data-checked="{{checked}}" type="checkbox" name="{{section}}" id="{{section}}" data-type="checkbox">
  53. <label for="{{section}}">{{section}}</label>
  54. </li>
  55. </ul>
  56. </div>
  57. <hr/>
  58. <a href="#" class="pointer" onclick="$(this).next().slideToggle(200);">Voir les conventions de nommage</a>
  59. <div class="hidden">
  60. <h5>Conventions de nommage</h5>
  61. <ul>
  62. <li><strong>Méthode et fonctions</strong> <code>function get_users(){}</code> - Séparation par "_" et tout en minuscule</li>
  63. <li><strong>Classes</strong> <code>class MaClasse {}</code> - Séparation par camelCase et premiere lettre en majuscule</li>
  64. <li><strong>Variables</strong> <code>$maVariable</code> - Séparation par camelCase tout en minuscule</li>
  65. <li><strong>Constantes</strong> <code>const MA_CONSTANTE</code> - Séparation par "_"tout en majuscule</li>
  66. <li><strong>Classes css et id css</strong> <code>.ma-classe {} #mon-id{}</code> - Séparation par tiret tout en minuscule</li>
  67. <li><strong>Actions</strong> <code>case 'plugin_entite_action'</code> - Séparation par "_" en minuscule</li>
  68. </ul>
  69. </div>
  70. </div>
  71. <div class="col-xl-7">
  72. <ul class="nav nav-tabs" id="factoryParts">
  73. <li class="nav-item hidden">
  74. <a class="nav-link {{#active}}active{{/active}}" data-part="{{label}}" data-langage="{{syntax}}" href="#">{{label}}</a>
  75. </li>
  76. </ul>
  77. <div id="factory-generate-button" class="btn btn-primary mb-2 mt-2 float-left" onclick="factory_render(event,1)"><i class="fas fa-cogs"></i> Générer</div>
  78. <div class="btn btn-info ml-2 mb-2 mt-2 float-left" onclick="copy_to_clipboard($('#factoryCode'));"><i class="fas fa-copy"></i> Copier</div>
  79. <span id="factory-generate-message"></span>
  80. <div class="clear"></div>
  81. <pre><code id="factoryCode" onclick="select_text($('#factoryCode'))" class="php"></code></pre>
  82. </div>
  83. </div>
  84. </div>
  85. <br/>
  86. <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/monokai-sublime.min.css">
  87. <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
  88. <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/languages/php.min.js"></script>