edit.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. $widget = elgg_extract("entity", $vars);
  3. $folders = file_tools_get_folders($widget->owner_guid);
  4. if (empty($folders)) {
  5. return;
  6. }
  7. $selected_folders = $widget->folder_guids;
  8. if (!empty($selected_folders) && !is_array($selected_folders)) {
  9. $selected_folders = array($selected_folders);
  10. } elseif (empty($selected_folders)) {
  11. $selected_folders = array();
  12. }
  13. // select folder(s) to display
  14. echo elgg_echo("widgets:file_tree:edit:select");
  15. echo "<div>";
  16. echo elgg_view("input/hidden", array("name" => "params[folder_guids][]", "value" => "")); // needed to be able to empty the list
  17. echo file_tools_build_widget_options($folders, "params[folder_guids][]", $selected_folders);
  18. echo "</div>";
  19. // display folder or folder content
  20. $checkbox_options = array(
  21. "name" => "params[show_content]",
  22. "value" => "1"
  23. );
  24. if (!empty($widget->show_content)) {
  25. $checkbox_options["checked"] = "checked";
  26. }
  27. echo "<div>";
  28. echo elgg_view("input/checkbox", $checkbox_options);
  29. echo elgg_echo("widgets:file_tree:edit:show_content");
  30. echo "</div>";