edit.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * Edit form body for external pages
  4. *
  5. * @uses $vars['type']
  6. *
  7. */
  8. $type = $vars['type'];
  9. //grab the required entity
  10. $page_contents = elgg_get_entities(array(
  11. 'type' => 'object',
  12. 'subtype' => $type,
  13. 'limit' => 1,
  14. ));
  15. if ($page_contents) {
  16. $description = $page_contents[0]->description;
  17. $guid = $page_contents[0]->guid;
  18. } else {
  19. $description = "";
  20. $guid = 0;
  21. }
  22. // set the required form variables
  23. $input_area = elgg_view('input/longtext', array(
  24. 'name' => 'expagescontent',
  25. 'value' => $description,
  26. ));
  27. $submit_input = elgg_view('input/submit', array(
  28. 'name' => 'submit',
  29. 'value' => elgg_echo('save'),
  30. ));
  31. $view_page = elgg_view('output/url', array(
  32. 'text' => elgg_echo('expages:edit:viewpage'),
  33. 'href' => $type,
  34. 'target' => '_blank',
  35. 'class' => 'elgg-button elgg-button-action float-alt',
  36. ));
  37. $hidden_type = elgg_view('input/hidden', array(
  38. 'name' => 'content_type',
  39. 'value' => $type,
  40. ));
  41. $hidden_guid = elgg_view('input/hidden', array(
  42. 'name' => 'guid',
  43. 'value' => $guid,
  44. ));
  45. $external_page_title = elgg_echo("expages:$type");
  46. //construct the form
  47. echo <<<EOT
  48. <div class="mtm">
  49. <label>$external_page_title</label>
  50. $input_area
  51. </div>
  52. <div class="elgg-foot">
  53. $hidden_guid
  54. $hidden_type
  55. $view_page
  56. $submit_input
  57. </div>
  58. EOT;