page.list.{{entity.readable}}.php 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. {"label":"Liste entité","syntax":"php"}
  2. <?php
  3. global $myUser;
  4. User::check_access('{{plugin}}','read');
  5. require_once(__DIR__.SLASH.'{{Entity}}.class.php');
  6. {{#fields}}{{#isList}}${{key}}s = array();
  7. foreach ({{Entity}}::{{key}}s() as $key => ${{key}}) {
  8. ${{key}}s[$key] = ${{key}}['label'];
  9. }{{/isList}}{{/fields}}
  10. ?>
  11. <div class="plugin-{{plugin}}">
  12. <div class="row">
  13. <div class="col-md-12">
  14. <div class="d-flex my-2 w-100">
  15. <h4 class="d-inline-block my-auto mx-0 text-uppercase">Liste des {{entityLabel}}s</h4>
  16. <div class="text-left ml-3 d-inline-block noPrint">
  17. <div onclick="window.print();" class="btn btn-info rounded-0 btn-squarred" title="Imprimer la page"><i class="fas fa-print"></i></div>
  18. <div onclick="{{plugin_entity_deduplicate}}_search(null,true);" id="export-{{plugin}}s-btn" class="btn btn-info rounded-0 btn-squarred ml-1 btn-export" title="Exporter les résultats"><i class="fas fa-file-export"></i></div>
  19. </div>
  20. {{^edit-form}}
  21. <div class="my-auto ml-auto mr-0 noPrint">
  22. <?php if($myUser->can('{{plugin}}', 'edit')) : ?>
  23. <a href="index.php?module={{plugin}}&page=sheet.{{entity.readable}}" class="btn btn-success right"><i class="fas fa-plus"></i> Ajouter</a>
  24. <?php endif; ?>
  25. </div>
  26. {{/edit-form}}
  27. </div>
  28. <div class="clear noPrint"></div>
  29. </div>
  30. {{#advanced-search}}
  31. <div class="col-md-12">
  32. <select id="{{plugin_entity_deduplicate}}-filters" data-type="filter" data-label="Recherche" data-function="{{plugin_entity_deduplicate}}_search">
  33. <option value="main.label" data-filter-type="text">Libellé</option><!--{{#fields}}
  34. <option value="main.{{key}}" data-filter-type="{{type.search-slug}}"{{#isList}} data-values='<?php echo json_encode(${{key}}s); ?>' {{/isList}}>{{label}}</option>{{/fields}}-->
  35. </select>
  36. </div>
  37. {{/advanced-search}}
  38. </div>
  39. <h5 class="results-count my-2"><span></span> Résultat(s)
  40. <!-- bloc de preference de pagination -->
  41. <small class="text-muted right text-muted text-small"><div class="d-inline-block mr-1" data-type="pagination-preference" data-table="#{{entity-readable}}s" data-value="20" data-max-item="100"></div></small><div class="clear"></div>
  42. </h5>
  43. <div class="row">
  44. <!-- search results -->
  45. <div class="col-xl-12">
  46. {{#list-search}}
  47. <!-- présentation liste -->
  48. <ul id="{{entity-readable}}s" class="list-group" data-entity-search="{{plugin_entity_deduplicate}}_search">
  49. <li data-id="[-[-id-]-]" class="hidden item-line list-group-item">
  50. {{#fields}}
  51. <div class="align-middle">{{#isFile}}
  52. <ul class="list-group list-group-flush shadow-sm">
  53. [-[-#{{key}}-]-]
  54. <li class="list-group-item p-1"><a href="[-[-url-]-]">[-[-label-]-]</a></li>
  55. [-[-/{{key}}-]-]
  56. </ul>{{/isFile}}{{#isImage}}<img class="shadow-sm rounded-sm" style="max-width: 100px;height: auto;" src="[-[-{{key}}-]-]">{{/isImage}}{{#isUrl}}<a href="[-[-{{key}}-]-]">[-[-{{key}}-]-]</a>{{/isUrl}}{{#isUser}}<img src="[-[-{{key}}.avatar-]-]" class="avatar-mini avatar-rounded avatar-login" title="[-[-{{key}}.fullName-]-]"> [-[-{{key}}.fullName-]-]{{/isUser}}{{#isColor}}<i class="fas fa-dot-circle" style="color:[-[-{{key}}-]-]"></i> {{/isColor}}{{#isBoolean}}[-[-#{{key}}-]-] <i class="fas fa-check text-success"></i> OUI[-[-/{{key}}-]-][-[-^{{key}}-]-]<i class="fas fa-times text-danger"></i> Non[-[-/{{key}}-]-]{{/isBoolean}}{{#isIcon}}<i class="[-[-{{key}}-]-]"></i> {{/isIcon}}{{#isWysiwyg}}{[-[-{{key}}-]-]}{{/isWysiwyg}}{{#isDate}}[-[-{{key}}-readable-]-]{{/isDate}}{{#isList}}[-[-{{key}}.label-]-]{{/isList}}{{#isDictionary}}[-[-{{key}}.label-]-]{{/isDictionary}}{{#isChoice}}[-[-{{key}}.label-]-]{{/isChoice}}{{^isUrl}}{{^isFile}}{{^isImage}}{{^isUser}}{{^isBoolean}}{{^isWysiwyg}}{{^isDate}}{{^isDictionary}}{{^isList}}{{^isChoice}}[-[-{{key}}-]-]{{/isChoice}}{{/isList}}{{/isDictionary}}{{/isDate}}{{/isWysiwyg}}{{/isBoolean}}{{/isUser}}{{/isImage}}{{/isFile}}{{/isUrl}}</div>{{/fields}}
  57. <div class="align-middle text-right">
  58. <div class="btn-group btn-group-sm" role="group">
  59. {{^edit-form}}<a class="btn text-info" title="Éditer {{entity_readable}}" href="index.php?module={{plugin}}&page=sheet.{{entity.readable}}&id=[-[-id-]-]"><i class="fas fa-pencil-alt"></i></a>{{/edit-form}}
  60. {{#edit-form}}<div class="btn text-info" title="Éditer {{entity_readable}}" onclick="{{plugin_entity_deduplicate}}_edit(this);"><i class="fas fa-pencil-alt"></i></div>
  61. {{/edit-form}}<div class="btn text-danger" title="Supprimer {{entity_readable}}" onclick="{{plugin_entity_deduplicate}}_delete(this);"><i class="far fa-trash-alt"></i></div>
  62. </div>
  63. </div>
  64. </li>
  65. </ul>
  66. {{/list-search}}
  67. {{^list-search}}
  68. <!-- présentation tableau -->
  69. <table id="{{entity-readable}}s" class="table table-striped " data-entity-search="{{plugin_entity_deduplicate}}_search">
  70. <thead>
  71. <tr>
  72. <!--<th>#</th>-->{{#fields}}
  73. <th data-sortable="{{key}}">{{label}}</th>{{/fields}}
  74. <th></th>
  75. </tr>
  76. </thead>
  77. {{#edit-form}}
  78. <thead>
  79. <tr id="{{entity-readable}}-form" data-action="{{plugin_entity_deduplicate}}_save" data-id="">
  80. <th>#</th>{{#fields}}
  81. <th>{{input_novalue}}</th>{{/fields}}
  82. <th class="text-right"><div onclick="{{plugin_entity_deduplicate}}_save();" class="btn btn-success"><i class="fas fa-check"></i> Enregistrer</div></th>
  83. </tr>
  84. </thead>
  85. {{/edit-form}}
  86. <tbody>
  87. <tr data-id="[-[-id-]-]" class="hidden item-line">
  88. <!--<td class="align-middle">[-[-id-]-]</td>-->{{#fields}}
  89. <td class="align-middle">{{#isFile}}
  90. <ul class="list-group list-group-flush shadow-sm">
  91. [-[-#{{key}}-]-]
  92. <li class="list-group-item p-1"><a href="[-[-url-]-]">[-[-label-]-]</a></li>
  93. [-[-/{{key}}-]-]
  94. </ul>{{/isFile}}{{#isImage}}<img class="shadow-sm rounded-sm" style="max-width: 100px;height: auto;" src="[-[-{{key}}-]-]">{{/isImage}}{{#isUrl}}<a href="[-[-{{key}}-]-]">[-[-{{key}}-]-]</a>{{/isUrl}}{{#isUser}}<img src="[-[-{{key}}.avatar-]-]" class="avatar-mini avatar-rounded avatar-login" title="[-[-{{key}}.fullName-]-]"> [-[-{{key}}.fullName-]-]{{/isUser}}{{#isColor}}<i class="fas fa-dot-circle" style="color:[-[-{{key}}-]-]"></i> {{/isColor}}{{#isBoolean}}[-[-#{{key}}-]-] <i class="fas fa-check text-success"></i> OUI[-[-/{{key}}-]-][-[-^{{key}}-]-]<i class="fas fa-times text-danger"></i> Non[-[-/{{key}}-]-]{{/isBoolean}}{{#isIcon}}<i class="[-[-{{key}}-]-]"></i> {{/isIcon}}{{#isWysiwyg}}{[-[-{{key}}-]-]}{{/isWysiwyg}}{{#isDate}}[-[-{{key}}-readable-]-]{{/isDate}}{{#isList}}[-[-{{key}}.label-]-]{{/isList}}{{#isDictionary}}[-[-{{key}}.label-]-]{{/isDictionary}}{{#isChoice}}[-[-{{key}}.label-]-]{{/isChoice}}{{^isUrl}}{{^isFile}}{{^isImage}}{{^isUser}}{{^isBoolean}}{{^isWysiwyg}}{{^isDate}}{{^isDictionary}}{{^isList}}{{^isChoice}}[-[-{{key}}-]-]{{/isChoice}}{{/isList}}{{/isDictionary}}{{/isDate}}{{/isWysiwyg}}{{/isBoolean}}{{/isUser}}{{/isImage}}{{/isFile}}{{/isUrl}}</td>{{/fields}}
  95. <td class="align-middle text-right">
  96. <div class="btn-group btn-group-sm" role="group">
  97. {{^edit-form}}<a class="btn text-info" title="Éditer {{entity_readable}}" href="index.php?module={{plugin}}&page=sheet.{{entity.readable}}&id=[-[-id-]-]"><i class="fas fa-pencil-alt"></i></a>{{/edit-form}}
  98. {{#edit-form}}<div class="btn text-info" title="Éditer {{entity_readable}}" onclick="{{plugin_entity_deduplicate}}_edit(this);"><i class="fas fa-pencil-alt"></i></div>
  99. {{/edit-form}}<div class="btn text-danger" title="Supprimer {{entity_readable}}" onclick="{{plugin_entity_deduplicate}}_delete(this);"><i class="far fa-trash-alt"></i></div>
  100. </div>
  101. </td>
  102. </tr>
  103. </tbody>
  104. </table>
  105. {{/list-search}}
  106. <br>
  107. {{#advanced-search}}<!-- Pagination (data-range définit le nombre de pages max affichées avant et après la page courante) -->
  108. <ul class="pagination justify-content-center" data-range="5">
  109. <li class="page-item hidden" data-value="[-[-value-]-]" title="Voir la page [-[-label-]-]" onclick="$(this).parent().find('li').removeClass('active');$(this).addClass('active');{{plugin_entity_deduplicate}}_search();">
  110. <span class="page-link">[-[-label-]-]</span>
  111. </li>
  112. </ul>{{/advanced-search}}
  113. </div>
  114. </div>
  115. </div>