page.propertie.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. ?>
  3. <h4>Widget</h4>
  4. <label for="widgetLabel">Titre</label>
  5. <input type="text" onblur="stats_save_widget()" id="widgetLabel" class="form-control" value="<?php echo html_decode_utf8($widget->label); ?>" placeholder="Titre du widget">
  6. <div class="btn btn-dark mt-2" data-type="right"
  7. data-scope = 'statistic_widget'
  8. data-uid = '<?php echo $widget->id; ?>'
  9. data-configure = "false"
  10. data-recursive = "false"
  11. ><i class="fas fa-user-lock"></i> Permissions sur le widget</div>
  12. <br/>
  13. <hr/>
  14. <?php if(!is_null($widget->view)){ ?>
  15. <h4>Graphique</h4>
  16. <div id="properties-form">
  17. <?php
  18. require_once(__DIR__.SLASH.'View.class.php');
  19. View::require_all();
  20. $widget->meta = json_decode($widget->meta,true);
  21. if(!is_array($widget->meta)) $widget->meta = array();
  22. if(!isset($widget->meta['properties'])) $widget->meta['properties'] = array();
  23. $fields = $widget->view::option();
  24. foreach($fields as $key=>$field):
  25. if(isset($widget->meta['properties'][$key])){
  26. $fields[$key]['value'] = $widget->meta['properties'][$key];
  27. }
  28. endforeach;
  29. $form = FieldType::toForm($fields);
  30. foreach($form as $element): ?>
  31. <div>
  32. <label><?php echo $element['label']; ?></label>
  33. <?php echo $element['input']; ?>
  34. </div>
  35. <?php endforeach;
  36. } ?>
  37. <br/>
  38. <div class="btn btn-dark" onclick="stats_properties_save()">Enregistrer</div>
  39. </div>