<?php /** * Edit a page * * @package ElggPages */ gatekeeper(); $guid = (int) get_input('guid'); $publication = get_entity($guid); if (!$publication) { register_error(elgg_echo('noaccess')); forward(''); } elgg_push_breadcrumb($publication->title, $publication->getURL()); elgg_push_breadcrumb(elgg_echo('edit')); $title = elgg_echo("publications:edit"); if ($publication->canEdit()) { $vars = publications_prepare_form_vars($publication); $content = elgg_view_form('publications/edit', $vars); } else { $content = elgg_echo("publications:noaccess"); } $body = elgg_view_layout('content', array('filter' => '', 'content' => $content, 'title' => $title)); echo elgg_view_page($title, $body);
<?php /** * Create a new publication * * @package ElggPages */ gatekeeper(); $container_guid = (int) get_input('guid'); $container = get_entity($container_guid); if (!$container) { } $parent_guid = 0; $page_owner = $container; if (elgg_instanceof($container, 'object')) { $parent_guid = $container->getGUID(); $page_owner = $container->getContainerEntity(); } elgg_set_page_owner_guid($page_owner->getGUID()); $title = elgg_echo('publications:add'); elgg_push_breadcrumb($title); $vars = publications_prepare_form_vars(null, $parent_guid); $vars['enctype'] = 'multipart/form-data'; $content = elgg_view_form('publications/edit', $vars, $vars); $body = elgg_view_layout('content', array('filter' => '', 'content' => $content, 'title' => $title)); echo elgg_view_page($title, $body);