edit.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * Edit settings for river widget
  4. */
  5. // dashboard widget has type parameter
  6. if (elgg_in_context('dashboard')) {
  7. if (!isset($vars['entity']->content_type)) {
  8. $vars['entity']->content_type = 'friends';
  9. }
  10. $params = array(
  11. 'name' => 'params[content_type]',
  12. 'value' => $vars['entity']->content_type,
  13. 'options_values' => array(
  14. 'friends' => elgg_echo('river:widgets:friends'),
  15. 'all' => elgg_echo('river:widgets:all'),
  16. ),
  17. );
  18. $type_dropdown = elgg_view('input/select', $params);
  19. ?>
  20. <div>
  21. <?php echo elgg_echo('river:widget:type'); ?>:
  22. <?php echo $type_dropdown; ?>
  23. </div>
  24. <?php
  25. }
  26. $num_display = sanitize_int($vars['entity']->num_display, false);
  27. // set default value for display number
  28. if (!$num_display) {
  29. $num_display = 8;
  30. }
  31. $params = array(
  32. 'name' => 'params[num_display]',
  33. 'value' => $num_display,
  34. 'options' => array(5, 8, 10, 12, 15, 20),
  35. );
  36. $num_dropdown = elgg_view('input/select', $params);
  37. ?>
  38. <div>
  39. <?php echo elgg_echo('widget:numbertodisplay'); ?>:
  40. <?php echo $num_dropdown; ?>
  41. </div>
  42. <?php
  43. // pass the context so we have the correct output upon save.
  44. if (elgg_in_context('dashboard')) {
  45. $context = 'dashboard';
  46. } else {
  47. $context = 'profile';
  48. }
  49. echo elgg_view('input/hidden', array(
  50. 'name' => 'context',
  51. 'value' => $context
  52. ));