edit.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * Edit an image
  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($entity->getContainerEntity()->getURL());
  16. }
  17. $album = $entity->getContainerEntity();
  18. if (!$album) {
  19. }
  20. elgg_set_page_owner_guid($album->getContainerGUID());
  21. $owner = elgg_get_page_owner_entity();
  22. gatekeeper();
  23. group_gatekeeper();
  24. $title = elgg_echo('image:edit');
  25. // set up breadcrumbs
  26. elgg_push_breadcrumb(elgg_echo('photos'), 'photos/siteimagesall');
  27. if (elgg_instanceof($owner, 'user')) {
  28. elgg_push_breadcrumb($owner->name, "photos/owner/$owner->username");
  29. } else {
  30. elgg_push_breadcrumb($owner->name, "photos/group/$owner->guid/all");
  31. }
  32. elgg_push_breadcrumb($album->getTitle(), $album->getURL());
  33. elgg_push_breadcrumb($entity->getTitle(), $entity->getURL());
  34. elgg_push_breadcrumb($title);
  35. $vars = tidypics_prepare_form_vars($entity);
  36. $content = elgg_view_form('photos/image/save', array('method' => 'post'), $vars);
  37. $body = elgg_view_layout('content', array(
  38. 'content' => $content,
  39. 'title' => $title,
  40. 'filter' => '',
  41. 'sidebar' => elgg_view('photos/sidebar', array('page' => 'image')),
  42. ));
  43. echo elgg_view_page($title, $body);