edit.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * Edit an album
  4. *
  5. * @author Cash Costello
  6. * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
  7. */
  8. $guid = (int) get_input('guid');
  9. if (!$entity = get_entity($guid)) {
  10. // @todo either deleted or do not have access
  11. forward('photos/all');
  12. }
  13. if (!$entity->canEdit()) {
  14. // @todo cannot change it
  15. forward('photos/all');
  16. }
  17. elgg_set_page_owner_guid($entity->getContainerGUID());
  18. $owner = elgg_get_page_owner_entity();
  19. gatekeeper();
  20. group_gatekeeper();
  21. $title = elgg_echo('album:edit');
  22. // set up breadcrumbs
  23. elgg_push_breadcrumb(elgg_echo('photos'), 'photos/siteimagesall');
  24. elgg_push_breadcrumb(elgg_echo('tidypics:albums'), 'photos/all');
  25. if (elgg_instanceof($owner, 'user')) {
  26. elgg_push_breadcrumb($owner->name, "photos/owner/$owner->username");
  27. } else {
  28. elgg_push_breadcrumb($owner->name, "photos/group/$owner->guid/all");
  29. }
  30. elgg_push_breadcrumb($entity->getTitle(), $entity->getURL());
  31. elgg_push_breadcrumb($title);
  32. $vars = tidypics_prepare_form_vars($entity);
  33. $content = elgg_view_form('photos/album/save', array('method' => 'post'), $vars);
  34. $body = elgg_view_layout('content', array(
  35. 'content' => $content,
  36. 'title' => $title,
  37. 'filter' => '',
  38. 'sidebar' => elgg_view('photos/sidebar', array('page' => 'album')),
  39. ));
  40. echo elgg_view_page($title, $body);