/** * Page handler for generic comments manipulation. * * @param array $page * @return bool * @access private */ function _elgg_comments_page_handler($page) { switch ($page[0]) { case 'edit': elgg_gatekeeper(); if (empty($page[1])) { register_error(elgg_echo('generic_comment:notfound')); forward(REFERER); } $comment = get_entity($page[1]); if (!$comment instanceof \ElggComment || !$comment->canEdit()) { register_error(elgg_echo('generic_comment:notfound')); forward(REFERER); } $target = $comment->getContainerEntity(); if (!$target instanceof \ElggEntity) { register_error(elgg_echo('generic_comment:notfound')); forward(REFERER); } $title = elgg_echo('generic_comments:edit'); elgg_push_breadcrumb($target->getDisplayName(), $target->getURL()); elgg_push_breadcrumb($title); $params = array('entity' => $target, 'comment' => $comment, 'is_edit_page' => true); $content = elgg_view_form('comment/save', null, $params); $params = array('content' => $content, 'title' => $title, 'filter' => ''); $body = elgg_view_layout('content', $params); echo elgg_view_page($title, $body); return true; break; default: return false; break; } }
/** * gvcontact page handler * * @param array $page URL segements * @param string $handler Handler identifier * @return bool */ function gvcontact_page_handler($page, $handler) { $title = elgg_echo('gvcontact:contacttitle'); $content = elgg_view_form('gvcontact/contact'); $body = elgg_view_layout('one_column', array('content' => $content)); echo elgg_view_page($title, $body); }
public function testCanRenderForm() { $expected = elgg_view('forms/foo/bar.html'); $actual = elgg_view_form('foo/bar', ['class' => 'foo-bar'], ['baz2' => 'bar2']); $this->assertNotEmpty($expected); $this->assertNotEmpty($actual); $normalize = function ($html) { return preg_replace('~>\\s+~', ">", $html); }; $this->assertEquals($normalize($expected), $normalize($actual)); }
/** * Reported content page handler * * Serves the add report page * * @param array $page Array of page routing elements */ function reportedcontent_page_handler($page) { // only logged in users can report things gatekeeper(); $content .= elgg_view_title(elgg_echo('reportedcontent:this')); $content .= elgg_view_form('reportedcontent/add'); $sidebar = elgg_echo('reportedcontent:instructions'); $params = array('content' => $content, 'sidebar' => $sidebar); $body = elgg_view_layout('one_sidebar', $params); echo elgg_view_page(elgg_echo('reportedcontent:this'), $body); }
function poll_get_page_edit($page_type, $guid = 0) { gatekeeper(); // Get the current page's owner $page_owner = elgg_get_page_owner_entity(); if ($page_owner === false || is_null($page_owner)) { $page_owner = elgg_get_logged_in_user_entity(); elgg_set_page_owner_guid($page_owner->guid); } $form_vars = array('id' => 'poll-edit-form'); // Get the post, if it exists if ($page_type == 'edit') { $poll = get_entity($guid); if ($poll instanceof Poll) { $container_guid = $poll->container_guid; elgg_set_page_owner_guid($container_guid); $title = elgg_echo('poll:editpost', array($poll->title)); $body_vars = array('fd' => poll_prepare_edit_body_vars($poll), 'entity' => $poll); if ($poll->canEdit()) { $content = elgg_view_form("poll/edit", $form_vars, $body_vars); } else { $content = elgg_echo('poll:permission_error'); } $container = get_entity($container_guid); if (elgg_instanceof($container, 'group')) { elgg_push_breadcrumb($container->name, 'poll/group/' . $container->getGUID()); } else { elgg_push_breadcrumb($container->name, 'poll/owner/' . $container->username); } elgg_push_breadcrumb(elgg_echo("poll:edit")); } else { $title = elgg_echo('poll:error_title'); $content = elgg_echo('poll:no_such_poll'); } } else { if ($guid) { elgg_set_page_owner_guid($guid); $container = get_entity($guid); elgg_push_breadcrumb($container->name, 'poll/group/' . $container->getGUID()); } else { $user = elgg_get_logged_in_user_entity(); elgg_set_page_owner_guid($user->getGUID()); elgg_push_breadcrumb($user->name, 'poll/owner/' . $user->username); } elgg_push_breadcrumb(elgg_echo('poll:add')); $title = elgg_echo('poll:addpost'); $body_vars = array('fd' => poll_prepare_edit_body_vars(), 'container_guid' => $guid); $content = elgg_view_form("poll/edit", $form_vars, $body_vars); } $params = array('title' => $title, 'content' => $content, 'filter' => ''); $body = elgg_view_layout('content', $params); // Display page return elgg_view_page($title, $body); }
function sched_conf_get_page_content_edit($page_type, $guid) { $vars = array(); $vars['id'] = 'sched-conf-edit'; $vars['name'] = 'sched_conf_edit'; // just in case a feature adds an image upload $vars['enctype'] = 'multipart/form-data'; $body_vars = array(); if ($page_type == 'edit') { $title = elgg_echo('sched_conf:edit_conf_title'); $conf = get_entity((int) $guid); if (elgg_instanceof($conf, 'object', 'conference') && $conf->canEdit()) { $body_vars['conference'] = $conf; $body_vars['form_data'] = sched_conf_prepare_edit_form_vars($conf); $conf_container = get_entity($conf->container_guid); if (elgg_instanceof($conf_container, 'group')) { elgg_push_breadcrumb(elgg_echo('event_calendar:group_breadcrumb'), 'event_calendar/group/' . $conf->container_guid); } else { elgg_push_breadcrumb(elgg_echo('event_calendar:show_events_title'), 'event_calendar/list'); } elgg_push_breadcrumb(elgg_echo('sched_conf:edit_conf_title')); $content = elgg_view_form('sched_conf/edit', $vars, $body_vars); } else { $content = elgg_echo('sched_conf:error_edit'); } } else { $title = elgg_echo('sched_conf:add_conf_title'); if ($guid) { // add to group $group = get_entity($guid); if (elgg_instanceof($group, 'group')) { $body_vars['group_guid'] = $guid; elgg_push_breadcrumb(elgg_echo('event_calendar:group_breadcrumb'), 'event_calendar/group/' . $guid); elgg_push_breadcrumb(elgg_echo('sched_conf:add_conf_title')); $body_vars['form_data'] = event_calendar_prepare_edit_form_vars(); $content = elgg_view_form('sched_conf/edit', $vars, $body_vars); } else { $content = elgg_echo('sched_conf:no_group'); } } else { elgg_push_breadcrumb(elgg_echo('event_calendar:show_events_title'), 'event_calendar/list'); elgg_push_breadcrumb(elgg_echo('sched_conf:add_conf_title')); $body_vars['form_data'] = sched_conf_prepare_edit_form_vars(); $content = elgg_view_form('sched_conf/edit', $vars, $body_vars); } } $params = array('title' => $title, 'content' => $content, 'filter' => ''); $body = elgg_view_layout("content", $params); return elgg_view_page($title, $body); }
/** * Reported content page handler * * Serves the add report page * * @param array $page Array of page routing elements * @return bool */ function reportedcontent_page_handler($page) { // only logged in users can report things elgg_gatekeeper(); if (elgg_extract(0, $page) === 'add' && elgg_is_xhr()) { echo elgg_view('resources/reportedcontent/add_form'); return true; } $title = elgg_echo('reportedcontent:this'); $content = elgg_view_form('reportedcontent/add'); $sidebar = elgg_echo('reportedcontent:instructions'); $params = array('title' => $title, 'content' => $content, 'sidebar' => $sidebar); $body = elgg_view_layout('one_sidebar', $params); echo elgg_view_page($title, $body); return true; }
function poll_get_page_edit($page_type, $guid = 0) { gatekeeper(); $form_vars = array('id' => 'poll-edit-form'); // Get the post, if it exists if ($page_type == 'edit') { $poll = get_entity($guid); if (!$poll instanceof Poll) { register_error(elgg_echo('poll:not_found')); forward(REFERER); } if (!$poll->canEdit()) { register_error(elgg_echo('poll:permission_error')); forward(REFERER); } $container = $poll->getContainerEntity(); elgg_set_page_owner_guid($container->guid); $title = elgg_echo('poll:editpost', array($poll->title)); $body_vars = array('fd' => poll_prepare_edit_body_vars($poll), 'entity' => $poll); if ($container instanceof ElggGroup) { elgg_push_breadcrumb($container->name, 'poll/group/' . $container->guid); } else { elgg_push_breadcrumb($container->name, 'poll/owner/' . $container->username); } elgg_push_breadcrumb(elgg_echo("poll:edit")); } else { if ($guid) { $container = get_entity($guid); elgg_push_breadcrumb($container->name, 'poll/group/' . $container->guid); } else { $container = elgg_get_logged_in_user_entity(); elgg_push_breadcrumb($container->name, 'poll/owner/' . $container->username); } elgg_set_page_owner_guid($container->guid); elgg_push_breadcrumb(elgg_echo('poll:add')); $title = elgg_echo('poll:addpost'); $body_vars = array('fd' => poll_prepare_edit_body_vars(), 'container_guid' => $guid); } $content = elgg_view_form("poll/edit", $form_vars, $body_vars); $params = array('title' => $title, 'content' => $content, 'filter' => ''); $body = elgg_view_layout('content', $params); // Display page return elgg_view_page($title, $body); }
/** * Edit or add a discussion topic * * @param string $type 'add' or 'edit' * @param int $guid GUID of group or topic */ function discussion_handle_edit_page($type, $guid) { elgg_gatekeeper(); if ($type == 'add') { $group = get_entity($guid); if (!elgg_instanceof($group, 'group')) { register_error(elgg_echo('group:notfound')); forward(); } // make sure user has permissions to add a topic to container if (!$group->canWriteToContainer(0, 'object', 'groupforumtopic')) { register_error(elgg_echo('groups:permissions:error')); forward($group->getURL()); } $title = elgg_echo('groups:addtopic'); elgg_push_breadcrumb($group->name, "discussion/owner/{$group->guid}"); elgg_push_breadcrumb($title); $body_vars = discussion_prepare_form_vars(); $content = elgg_view_form('discussion/save', array(), $body_vars); } else { $topic = get_entity($guid); if (!elgg_instanceof($topic, 'object', 'groupforumtopic') || !$topic->canEdit()) { register_error(elgg_echo('discussion:topic:notfound')); forward(); } $group = $topic->getContainerEntity(); if (!elgg_instanceof($group, 'group')) { register_error(elgg_echo('group:notfound')); forward(); } $title = elgg_echo('groups:edittopic'); elgg_push_breadcrumb($group->name, "discussion/owner/{$group->guid}"); elgg_push_breadcrumb($topic->title, $topic->getURL()); elgg_push_breadcrumb($title); $body_vars = discussion_prepare_form_vars($topic); $content = elgg_view_form('discussion/save', array(), $body_vars); } $params = array('content' => $content, 'title' => $title, 'sidebar' => elgg_view('discussion/sidebar/edit'), 'filter' => ''); $body = elgg_view_layout('content', $params); echo elgg_view_page($title, $body); }
/** * Add starrating menu items to rateable entities * * @param string $hook Equals 'register' * @param string $type Equals 'menu:entity' or 'menu:title' * @param array $return Current menu items * @param array $params Additional params * @return array Update menu items */ function elgg_stars_menu_setup($hook, $type, $return, $params) { if (!(bool) elgg_get_plugin_setting('extend_menu', 'elgg_stars')) { return $return; } $entity = elgg_extract('entity', $params, false); if (!elgg_instanceof($entity)) { return $return; } $type_subtype_pairs = elgg_stars_get_rateable_type_subtype_pairs(); $type = $entity->getType(); $subtype = $entity->getSubtype(); if (!array_key_exists($type, $type_subtype_pairs)) { return $return; } if ($subtype && array_search($subtype, $type_subtype_pairs[$type]) === false) { return $return; } $starrating = array('name' => 'stars', 'priority' => 10, 'text' => elgg_view_form('stars/rate', array(), $params), 'href' => false, 'encode_text' => false, 'section' => 'rating'); $return[] = ElggMenuItem::factory($starrating); return $return; }
/** * add in our own page in the friends/collections URI * * @param type $hook * @param type $type * @param type $return * @param type $params * @return boolean */ function friend_collection_message_router($hook, $type, $return, $params) { if (!($return['segments'][0] == 'collections' && $return['segments'][1] == 'message')) { return $return; } $id = $return['segments'][2]; $collection = get_access_collection($id); $owner = get_user($collection->owner_guid); $can_message = elgg_trigger_plugin_hook('can_message', 'collection', array('collection_id' => $id), true); if (!$collection || !$owner || !$owner->canEdit() || !$can_message) { return $return; } $step = get_input('step', 1); // if we don't havea subject/message we will force step 1 $subject = get_input('subject'); $message = get_input('message'); if (!$subject || !$message) { $step = 1; } $title = elgg_echo('friend_collection_message:title', array($collection->name)); $collections_link = elgg_normalize_url('collections/' . $owner->username); elgg_push_breadcrumb(elgg_echo('friends:collections'), $collections_link); elgg_push_breadcrumb($title); switch ($step) { case 2: $action = 'action/friend_collection_message/send'; $content = elgg_view_form('friend_collection_message/send', array('action' => $action), array('collection' => $collection)); break; default: $action = elgg_http_remove_url_query_element(current_page_url(), 'step'); $action = elgg_http_add_url_query_elements($action, array('step' => 2)); $content = elgg_view_form('friend_collection_message/compose', array('action' => $action), array('collection' => $collection)); break; } $layout = elgg_view_layout('content', array('title' => $title, 'content' => $content, 'filter' => false)); echo elgg_view_page($title, $layout); return false; }
/** * Serve pages related to group requests * * @param array $page The URL segments */ function group_requests_page_handler($page) { if (!isset($page[0])) { $page[0] = 'add'; } $params = array('filter' => false); switch ($page[0]) { case 'all': admin_gatekeeper(); $requests = elgg_list_entities(array('type' => 'object', 'subtype' => \Groups\Requests\Request::SUBTYPE, 'no_results' => elgg_echo('group_requests:none'))); $params['title'] = elgg_echo('group_requests:requests'); $params['content'] = $requests; break; case 'add': default: gatekeeper(); $params['title'] = elgg_echo('group_requests:request'); $params['content'] = elgg_view_form('groups/request', array(), array('user_guid' => elgg_get_logged_in_user_guid())); break; } $body = elgg_view_layout('content', $params); echo elgg_view_page($title, $body); }
<?php /** * This view prepends the content layout to check if we need to add a wire add form to the group acivity listing */ if (!elgg_is_logged_in() || !elgg_in_context("groups")) { return; } $group = elgg_get_page_owner_entity(); if (!$group instanceof ElggGroup) { return; } if ($group->thewire_enable == "no") { return; } if (!$group->canEdit() && !$group->isMember()) { return; } $page = current_page_url(); $page = str_ireplace(elgg_get_site_url(), "", $page); // check if we're on the activity page if (strpos($page, "groups/activity/" . $group->getGUID()) === 0) { // check the plugin setting if (elgg_get_plugin_setting("extend_activity", "thewire_tools") == "yes") { echo elgg_view_form("thewire/add"); } }
<?php $guid = (int) get_input('guid'); $entity = get_entity($guid); if (empty($entity) || !elgg_instanceof($entity, 'object', Wizard::SUBTYPE)) { register_error(elgg_echo('wizard:action:error:entity')); forward(REFERER); } $title = elgg_echo('wizard:edit:title', array($entity->title)); $form = elgg_view_form('wizard/edit', array('action' => 'action/wizard/edit'), array('entity' => $entity)); echo elgg_view_module('inline', $title, $form);
<?php $form_helper = new \Tour\Page\Form(); $form_vars = $form_helper->prepare(); echo elgg_view_form('tour_page/save', array(), $form_vars);
$search_with_loader = true; } $title = elgg_extract('title', $vars); $content = elgg_extract('body', $vars); $class = elgg_extract('class', $vars); $search_params = (array) elgg_extract('params', $vars, []); // register menu items search_advanced_register_menu_items($vars); if (is_array($content)) { $content = implode('', $content); } if (empty($content)) { $content = elgg_view('search/no_results'); } else { $menu = elgg_view_menu('search_list', ['sort_by' => 'priority', 'class' => 'float-alt elgg-menu-hz', 'search_params' => $search_params]); if (!empty($menu)) { $menu = '<div class="clearfix">' . $menu . '</div>'; $content = $menu . $content; } } // add search form if (!elgg_is_xhr() || $search_with_loader && $loader) { $form = elgg_view_form('search_advanced/search', ['action' => 'search', 'method' => 'GET', 'disable_security' => true], $search_params); $content = $form . $content; } if (!elgg_is_xhr() || $loader) { $sidebar = elgg_view('search/sidebar', $vars); echo elgg_view_layout('one_sidebar', ['title' => $title, 'content' => $content, 'sidebar' => $sidebar, 'class' => $class]); } else { echo $content; }
<?php $guid = get_input('guid'); if ($guid) { $entity = get_entity($guid); $form_vars = scheduling_prepare_form_vars($entity); } else { $form_vars = scheduling_prepare_form_vars(); } $content = elgg_view_form('scheduling/save', array(), $form_vars); $params = array('title' => elgg_echo('scheduling'), 'content' => $content, 'filter' => ''); $body = elgg_view_layout('content', $params); echo elgg_view_page('title here', $body);
return true; } $comment_count = $object->countComments(); $options = array('guid' => $object->getGUID(), 'annotation_name' => 'generic_comment', 'limit' => 3, 'order_by' => 'n_table.time_created desc'); $comments = elgg_get_annotations($options); if ($comments) { // why is this reversing it? because we're asking for the 3 latest // comments by sorting desc and limiting by 3, but we want to display // these comments with the latest at the bottom. $comments = array_reverse($comments); ?> <span class="elgg-river-comments-tab"><?php echo elgg_echo('comments'); ?> </span> <?php echo elgg_view_annotation_list($comments, array('list_class' => 'elgg-river-comments')); if ($comment_count > count($comments)) { $num_more_comments = $comment_count - count($comments); $url = $object->getURL(); $params = array('href' => $url, 'text' => elgg_echo('river:comments:more', array($num_more_comments))); $link = elgg_view('output/url', $params); echo "<div class=\"elgg-river-more\">{$link}</div>"; } } // inline comment form $form_vars = array('id' => "comments-add-{$object->getGUID()}", 'class' => 'hidden'); $body_vars = array('entity' => $object, 'inline' => true); echo elgg_view_form('comments/add', $form_vars, $body_vars);
/** * Get page components to edit/create a blog post. * * @param string $page 'edit' or 'new' * @param int $guid GUID of blog post or container * @param int $revision Annotation id for revision to edit (optional) * @return array */ function blog_get_page_content_edit($page, $guid = 0, $revision = NULL) { elgg_load_js('elgg.blog'); $return = array('filter' => ''); $vars = array(); $vars['id'] = 'blog-post-edit'; $vars['name'] = 'blog_post'; $vars['class'] = 'elgg-form-alt'; if ($page == 'edit') { $blog = get_entity((int) $guid); $title = elgg_echo('blog:edit'); if (elgg_instanceof($blog, 'object', 'blog') && $blog->canEdit()) { $vars['entity'] = $blog; $title .= ": \"{$blog->title}\""; if ($revision) { $revision = elgg_get_annotation_from_id((int) $revision); $vars['revision'] = $revision; $title .= ' ' . elgg_echo('blog:edit_revision_notice'); if (!$revision || !($revision->entity_guid == $guid)) { $content = elgg_echo('blog:error:revision_not_found'); $return['content'] = $content; $return['title'] = $title; return $return; } } $body_vars = blog_prepare_form_vars($blog, $revision); elgg_push_breadcrumb($blog->title, $blog->getURL()); elgg_push_breadcrumb(elgg_echo('edit')); elgg_load_js('elgg.blog'); $content = elgg_view_form('blog/save', $vars, $body_vars); $sidebar = elgg_view('blog/sidebar/revisions', $vars); } else { $content = elgg_echo('blog:error:cannot_edit_post'); } } else { if (!$guid) { $container = elgg_get_logged_in_user_entity(); } else { $container = get_entity($guid); } elgg_push_breadcrumb(elgg_echo('blog:add')); $body_vars = blog_prepare_form_vars($blog); $title = elgg_echo('blog:add'); $content = elgg_view_form('blog/save', $vars, $body_vars); } $return['title'] = $title; $return['content'] = $content; $return['sidebar'] = $sidebar; return $return; }
<?php /** * Search for content in this group * * @uses vars['entity'] ElggGroup */ $entity = elgg_extract('entity', $vars, elgg_get_page_owner_entity()); if (!elgg_group_gatekeeper(false, $entity->guid)) { return; } $identifier = is_callable('group_subtypes_get_identifier') ? group_subtypes_get_identifier($entity) : 'groups'; $url = elgg_get_site_url() . 'search'; $body = elgg_view_form('groups/search', array('action' => $url, 'method' => 'get', 'disable_security' => true), $vars); echo elgg_view_module('aside', elgg_echo("{$identifier}:search_in_group"), $body);
<?php /** * Displays a process bar for enabling notifications for all users * * TODO Add checkboxes for selecting the desired notification methods */ $setting = elgg_extract('setting', $vars); $count = elgg_extract('count', $vars); $enable_desc = elgg_echo("notification_tools:process:{$setting}", array($count)); $link = elgg_view('output/url', array('text' => elgg_echo('notification_tools:admin:activate'), 'href' => false, 'id' => "enable-{$setting}", 'data-operation' => $setting, 'class' => 'elgg-button elgg-button-action')); $form = elgg_view_form('notification_tools/methods', array('data-operation' => $setting, 'action' => "notification_tools/enable_{$setting}")); echo <<<HTML \t<div class="elgg-border-plain pvm phm mvl"> \t\t<p>{$enable_desc}</p> \t\t<div class="elgg-progressbar mbm" data-total="{$count}" id="progressbar-{$setting}"></div> \t\t{$form} \t</div> HTML ;
<?php elgg_gatekeeper(); $guid = get_input('guid'); elgg_set_page_owner_guid($guid); $title = elgg_echo('groups:invite:title'); $group = get_entity($guid); if (!elgg_instanceof($group, 'group') || !$group->canEdit()) { register_error(elgg_echo('groups:noaccess')); forward(REFERER); } $content = elgg_view_form('groups/invite', array('id' => 'invite_to_group', 'class' => 'elgg-form-alt mtm'), array('entity' => $group)); elgg_push_breadcrumb($group->name, $group->getURL()); elgg_push_breadcrumb(elgg_echo('groups:invite')); $params = array('content' => $content, 'title' => $title, 'filter' => ''); $body = elgg_view_layout('content', $params); echo elgg_view_page($title, $body);
<?php /** * Manage subgroups page * * @package ElggSubroups */ elgg_load_library('elgg:subgroups'); $page_owner = elgg_get_page_owner_entity(); elgg_set_context('groups'); if (!$page_owner instanceof ElggGroup || !$page_owner->canEdit()) { forward($page_owner->getURL()); } elgg_push_breadcrumb(elgg_echo('group'), 'groups/all'); elgg_push_breadcrumb($page_owner->name, $page_owner->getURL()); $title = elgg_echo('subgroups:add'); elgg_push_breadcrumb($title); elgg_register_title_button('subgroups', 'new'); elgg_register_menu_item('title', array('name' => 'add_existing', 'href' => "#subgroups-add", 'text' => elgg_echo("subgroups:add_existing"), 'rel' => 'toggle', 'link_class' => 'elgg-button elgg-button-action', 'priority' => 200)); $form_vars = array('class' => 'hidden', 'id' => 'subgroups-add'); $body_vars = array('group' => $page_owner); $content = elgg_view_form('subgroups/add', $form_vars, $body_vars); $content .= list_subgroups($page_owner); $body = elgg_view_layout('content', array('content' => $content, 'title' => $title, 'filter' => '')); echo elgg_view_page($title, $body);
/** * Serve individual views for Ajax. * * /ajax/view/<view_name>?<key/value params> * /ajax/form/<action_name>?<key/value params> * * @param string[] $segments URL segments (not including "ajax") * @return bool * * @see elgg_register_ajax_view() * @elgg_pagehandler ajax * @access private */ function _elgg_ajax_page_handler($segments) { elgg_ajax_gatekeeper(); if (count($segments) < 2) { return false; } if ($segments[0] === 'view' || $segments[0] === 'form') { if ($segments[0] === 'view') { // ignore 'view/' $view = implode('/', array_slice($segments, 1)); } else { // form views start with "forms", not "form" $view = 'forms/' . implode('/', array_slice($segments, 1)); } $allowed_views = elgg_get_config('allowed_ajax_views'); if (!array_key_exists($view, $allowed_views)) { header('HTTP/1.1 403 Forbidden'); exit; } // pull out GET parameters through filter $vars = array(); foreach (_elgg_services()->request->query->keys() as $name) { $vars[$name] = get_input($name); } if (isset($vars['guid'])) { $vars['entity'] = get_entity($vars['guid']); } if ($segments[0] === 'view') { // Try to guess the mime-type switch ($segments[1]) { case "js": header("Content-Type: text/javascript"); break; case "css": header("Content-Type: text/css"); break; } echo elgg_view($view, $vars); } else { $action = implode('/', array_slice($segments, 1)); echo elgg_view_form($action, array(), $vars); } return true; } return false; }
<?php elgg_gatekeeper(); $title = elgg_echo('reportedcontent:this'); $content = elgg_view_form('reportedcontent/add'); $sidebar = elgg_echo('reportedcontent:instructions'); $params = array('title' => $title, 'content' => $content, 'sidebar' => $sidebar); $body = elgg_view_layout('one_sidebar', $params); echo elgg_view_page($title, $body);
<?php /** * List of unvalidated users */ echo elgg_view_form('uservalidationbyadmin/bulk_action', array('id' => 'uservalidationbyadmin-form', 'action' => 'action/uservalidationbyadmin/bulk_action'));
<?php /** * Assembles and outputs the forgotten password page. */ if (elgg_is_logged_in()) { forward(); } $title = elgg_echo('user:password:lost'); $hash_missing_username = elgg_get_session()->get('forgotpassword:hash_missing'); if ($hash_missing_username) { elgg_get_session()->remove('forgotpassword:hash_missing'); register_error(elgg_echo('user:password:hash_missing')); } $form_vars = ['class' => 'elgg-form-account']; $body_vars = ['username' => $hash_missing_username]; $content = elgg_view_form('user/requestnewpassword', $form_vars, $body_vars); $shell = elgg_get_config('walled_garden') ? 'walled_garden' : 'default'; $body = elgg_view_layout('default', ['content' => $content, 'title' => $title, 'sidebar' => false]); echo elgg_view_page($title, $body, $shell);
<?php /** * Elgg personal notifications */ echo elgg_view('subscriptions/form/additions', $vars); // Display a description echo elgg_view_form('notificationsettings/save', array('class' => 'elgg-form-alt'));
*/ elgg_gatekeeper(); elgg_group_gatekeeper(); // get the album entity $album_guid = elgg_extract('guid', $vars); $album = get_entity($album_guid); // panic if we can't get it if (!$album) { forward(); } // container should always be set, but just in case $owner = $album->getContainerEntity(); elgg_set_page_owner_guid($owner->getGUID()); $title = elgg_echo('tidypics:sort', array($album->getTitle())); // set up breadcrumbs elgg_push_breadcrumb(elgg_echo('photos'), 'photos/siteimagesall'); elgg_push_breadcrumb(elgg_echo('tidypics:albums'), 'photos/all'); if (elgg_instanceof($owner, 'group')) { elgg_push_breadcrumb($owner->name, "photos/group/{$owner->guid}/all"); } else { elgg_push_breadcrumb($owner->name, "photos/owner/{$owner->username}"); } elgg_push_breadcrumb($album->getTitle(), $album->getURL()); elgg_push_breadcrumb(elgg_echo('album:sort')); if ($album->getSize()) { $content = elgg_view_form('photos/album/sort', array(), array('album' => $album)); } else { $content = elgg_echo('tidypics:sort:no_images'); } $body = elgg_view_layout('content', array('filter' => false, 'content' => $content, 'title' => $title, 'sidebar' => elgg_view('photos/sidebar_al', array('page' => 'upload')))); echo elgg_view_page($title, $body);
<?php namespace hypeJunction\Prototyper\UI; $hooks = _elgg_services()->hooks->getAllHandlers(); $prepare_hooks = elgg_extract('prepare', $hooks, array()); foreach ($prepare_hooks as $type => $handlers) { list($prefix, $action) = explode(':', $type); if ($prefix == 'form') { $options[] = $action; } } $action_name = get_input('action', $options[0]); $form .= '<div>'; $form .= '<label>' . elgg_echo('prototyper:ui:action') . '</label>'; $form .= elgg_view('input/dropdown', array('name' => 'action', 'value' => $action_name, 'options' => $options, 'id' => '#prototyper-filter')); $form .= '</div>'; $form .= elgg_view('input/submit', array('value' => elgg_echo('submit'), 'class' => 'hidden')); echo elgg_view('input/form', array('action' => current_page_url(), 'body' => $form)); echo elgg_view_form('prototyper/edit', array(), array('action_name' => $action_name)); elgg_pop_context();