function hflts_page_handler($page) { if (elgg_extract(0, $page) === 'collective') { $content = elgg_view('hflts/collective', array('nAlternativas' => $page[1], 'nCriterios' => $page[2], 'nExpertos' => $page[3], 'G' => $page[4], 'import_file' => $page[5], 'weight_file' => $page[6])); $params = array('title' => 'DM con datos de samples/set_' . $page[5] . '.csv (' . $page[6] . ')', 'content' => $content, 'filter' => ''); $body = elgg_view_layout('content', $params); echo elgg_view_page('hflts', $body); return true; } set_input('username', $page[0]); //necesario $user = elgg_get_page_owner_entity(); // ej strem $guid = elgg_get_page_owner_guid(); // id de strem //aqui es donde tengo que filtrar por guid como en https://elgg.org/discussion/view/2268999/doubt-in-elgg-get-entities-from-metadata $valorations = elgg_get_entities_from_metadata(['type' => 'object', 'subtype' => 'evaluation_content', 'metadata_name_value_pairs' => array('name' => 'user_guid', 'value' => $guid), 'limit' => $vars['entity']->num_display, 'pagination' => false, 'order_by_metadata' => ['name' => 'state', 'direction' => 'ASC', 'as' => 'text']]); if (!$valorations) { $valorations = '<p class="mtm">' . elgg_echo('evaluationcontent:none') . '</p>'; } $content = elgg_view('hflts/driver', array('valorations' => $valorations)); $params = array('title' => 'Valoraciones de ' . $user->name, 'content' => $content, 'filter' => ''); $body = elgg_view_layout('content', $params); echo elgg_view_page('hflts', $body); }
/** * Redirect the requestor to the new URL * Checks the plugin setting to determine the course of action: * a) Displays an error page with the new URL * b) Forwards to the new URL and displays an error message * c) Silently forwards to the new URL * * @param string $url Relative or absolute URL * @return mixed */ function legacy_urls_redirect($url) { $method = elgg_get_plugin_setting('redirect_method', 'legacy_urls'); // we only show landing page or queue warning if html generating page $viewtype = elgg_get_viewtype(); if ($viewtype != 'default' && !elgg_does_viewtype_fallback($viewtype)) { $method = 'immediate'; } switch ($method) { case 'landing': $content = elgg_view('legacy_urls/message', array('url' => $url)); $body = elgg_view_layout('error', array('content' => $content)); echo elgg_view_page('', $body, 'error'); return true; break; case 'immediate_error': // drop through after setting error message register_error(elgg_echo('changebookmark')); case 'immediate': default: $url = elgg_normalize_url($url); header("HTTP/1.1 301 Moved Permanently"); header("Location: {$url}"); exit; break; } }
/** * External pages page handler * * @param array $page URL segements * @param string $handler Handler identifier * @return bool */ function expages_page_handler($page, $handler) { if ($handler == 'expages') { expages_url_forwarder($page[1]); } $type = strtolower($handler); $title = elgg_echo("expages:{$type}"); $header = elgg_view_title($title); $object = elgg_get_entities(array('type' => 'object', 'subtype' => $type, 'limit' => 1)); if ($object) { $content .= elgg_view('output/longtext', array('value' => $object[0]->description)); } else { $content .= elgg_echo("expages:notset"); } $content = elgg_view('expages/wrapper', array('content' => $content)); if (elgg_is_logged_in() || !elgg_get_config('walled_garden')) { $body = elgg_view_layout('one_column', array('title' => $title, 'content' => $content)); echo elgg_view_page($title, $body); } else { elgg_load_css('elgg.walled_garden'); $body = elgg_view_layout('walled_garden', array('content' => $header . $content)); echo elgg_view_page($title, $body, 'walled_garden'); } return true; }
/** * Stripe related pages * * @param array $page * @param string $handler * @return boolean */ function stripe_page_handler($page, $handler) { gatekeeper(); $username = elgg_extract(0, $page, false); if ($username) { $user = get_user_by_username($username); } if (!elgg_instanceof($user) || !$user->canEdit()) { $user = elgg_get_logged_in_user_entity(); forward("{$handler}/{$user->username}"); } elgg_set_context('settings'); elgg_set_page_owner_guid($user->guid); elgg_push_breadcrumb(elgg_echo('stripe:billing'), 'billing'); $context = elgg_extract(1, $page, 'cards'); $action = elgg_extract(2, $page, 'all'); $view = "stripe/pages/{$context}/{$action}"; if (elgg_view_exists($view)) { $params = array('entity' => $user, 'id' => elgg_extract(3, $page, false), 'context' => $page); $title = elgg_echo("stripe:{$context}:{$action}"); $content = elgg_view($view, $params); $sidebar = elgg_view('stripe/sidebar', $params); $filter = elgg_view("stripe/filters/{$context}/{$action}", $params); } if ($content) { if (elgg_is_xhr()) { echo $content; } else { $layout = elgg_view_layout('content', array('title' => $title, 'content' => $content, 'sidebar' => $sidebar, 'filter' => $filter)); echo elgg_view_page($title, $layout); } return true; } return false; }
/** * Returns the html for a user profile. * * @param string $username The username of the profile to display * @param string $section Which section is currently selected. * * return mixed FALSE or html for the profile. */ function profile_get_user_profile_html($user, $section = 'activity') { $body = elgg_view('profile/profile_navigation', array('section' => $section, 'entity' => $user)); $view_options = array('entity' => $user); switch ($section) { case 'widgets': $body .= elgg_view_layout('widgets', $view_options); break; case 'friends': $body .= elgg_view('profile/profile_contents/friends', $view_options); break; case 'twitter': $body .= elgg_view('profile/profile_contents/twitter', $view_options); break; case 'details': $body .= elgg_view('profile/profile_contents/details', $view_options); break; default: case 'activity': $body .= elgg_view('profile/profile_contents/activity', $view_options); break; } $body .= elgg_view('profile/profile_contents/sidebar', array('section' => $section)); return $body; }
/** * External pages page handler * * @param array $page URL segements * @param string $handler Handler identifier * @return bool */ function expages_page_handler($page, $handler) { if ($handler == 'expages') { expages_url_forwarder($page[1]); } $type = strtolower($handler); $title = elgg_echo("expages:{$type}"); $header = elgg_view_title($title); $object = elgg_get_entities(array('type' => 'object', 'subtype' => $type, 'limit' => 1)); if ($object) { $content .= elgg_view('output/longtext', array('value' => $object[0]->description)); } else { $content .= elgg_echo("expages:notset"); } $content = elgg_view('expages/wrapper', array('content' => $content)); if (elgg_is_admin_logged_in()) { elgg_register_menu_item('title', array('name' => 'edit', 'text' => elgg_echo('edit'), 'href' => "admin/appearance/expages?type={$type}", 'link_class' => 'elgg-button elgg-button-action')); } if (elgg_is_logged_in() || !elgg_get_config('walled_garden')) { $body = elgg_view_layout('one_column', array('title' => $title, 'content' => $content)); echo elgg_view_page($title, $body); } else { elgg_load_css('elgg.walled_garden'); $body = elgg_view_layout('walled_garden', array('content' => $header . $content)); echo elgg_view_page($title, $body, 'walled_garden'); } return true; }
function customstyle_page_handler($page) { gatekeeper(); elgg_set_context('customstyle'); elgg_set_page_owner_guid(elgg_get_logged_in_user_guid()); $title = elgg_echo('customstyle'); $base_dir = elgg_get_plugins_path() . 'customstyle/pages/customstyle'; switch ($page[0]) { case 'colors': $body = elgg_view('customstyle/colors'); break; case 'background': $body = elgg_view('customstyle/background'); break; case 'personalize': $body = elgg_view('customstyle/default'); break; default: $body = elgg_view('customstyle/default'); break; } $params = array('content' => $body, 'title' => $title); $body = elgg_view_layout('one_sidebar', $params); echo elgg_view_page($title, $body); return true; }
/** * 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; } }
function au_group_tag_menu_page_handler($page, $identifier) { //show the page of search results // assumes url of group/guid/tag // if the tag is 'all' then will display a tagcloud switch ($page[0]) { case 'group': $entity = get_entity($page[1]); if (!elgg_instanceof($entity, 'group') || $entity->au_group_tag_menu_enable == 'no') { return false; } elgg_push_breadcrumb($entity->name, $entity->getURL()); //should be OK if this is empty $tag = $page[2]; elgg_push_breadcrumb($tag); if ($tag == "all") { //show a tag cloud for all group tags //arbitrarily set to a max of 640 tags - should be enough for anyone :-) $title = elgg_echo("au_group_tag_menu:tagcloud"); $options = array('container_guid' => $entity->getGUID(), 'type' => 'object', 'threshold' => 0, 'limit' => 640, 'tag_names' => array('tags')); $thetags = elgg_get_tags($options); //make it an alphabetical tag cloud, not with most popular first sort($thetags); //find the highest tag count for scaling the font $max = 0; foreach ($thetags as $key) { if ($key->total > $max) { $max = $key->total; } } $content = " "; //loop through and generate tags so they display nicely //in the group, not as a dumb search page foreach ($thetags as $key) { $url = elgg_get_site_url() . "group_tag_menu/group/" . $entity->getGUID() . "/" . urlencode($key->tag); $taglink = elgg_view('output/url', array('text' => ' ' . $key->tag, 'href' => $url, 'title' => "{$key->tag} ({$key->total})", 'rel' => 'tag')); // get the font size for the tag (taken from elgg's own tagcloud code - not sure I love this) $size = round(log($key->total) / log($max + 0.0001) * 100) + 30; if ($size < 100) { $size = 100; } // generate the link $content .= " <a href='{$url}' style='font-size:{$size}%'>" . $key->tag . "</a> "; } } else { //show the results for the selected tag $title = elgg_echo("au_group_tag_menu:title") . "{$tag}"; $options = array('type' => 'object', 'metadata_name' => 'tags', 'metadata_value' => $tag, 'container_guid' => $entity->guid, 'full_view' => false); $content = elgg_list_entities_from_metadata($options); } //display the page if (!$content) { $content = elgg_echo('au_group_tag_menu:noresults'); } $layout = elgg_view_layout('content', array('title' => elgg_view_title($title), 'content' => $content, 'filter' => false)); echo elgg_view_page($title, $layout); break; } return true; }
/** * 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); }
/** * Profile page handler * * @param array $page Array of page elements, forwarded by the page handling mechanism */ function profile_page_handler($page) { if (isset($page[0])) { $username = $page[0]; $user = get_user_by_username($username); elgg_set_page_owner_guid($user->guid); } // short circuit if invalid or banned username if (!$user || $user->isBanned() && !elgg_is_admin_logged_in()) { register_error(elgg_echo('profile:notfound')); forward(); } $action = NULL; if (isset($page[1])) { $action = $page[1]; } if ($action == 'edit') { // use the core profile edit page $base_dir = elgg_get_root_path(); require "{$base_dir}pages/profile/edit.php"; return; } // main profile page $params = array('content' => elgg_view('profile/wrapper'), 'num_columns' => 3); $content = elgg_view_layout('widgets', $params); $body = elgg_view_layout('one_column', array('content' => $content)); echo elgg_view_page($title, $body); }
/** * Profile page handler * * @param array $page Array of URL segments passed by the page handling mechanism * @return bool */ function profile_page_handler($page) { if (isset($page[0])) { $username = $page[0]; $user = get_user_by_username($username); elgg_set_page_owner_guid($user->guid); } elseif (elgg_is_logged_in()) { forward(elgg_get_logged_in_user_entity()->getURL()); } // short circuit if invalid or banned username if (!$user || $user->isBanned() && !elgg_is_admin_logged_in()) { register_error(elgg_echo('profile:notfound')); forward(); } $action = NULL; if (isset($page[1])) { $action = $page[1]; } if ($action == 'edit') { // use the core profile edit page $base_dir = elgg_get_root_path(); require "{$base_dir}pages/profile/edit.php"; return true; } $content = elgg_view('profile/layout', array('entity' => $user)); $body = elgg_view_layout('one_column', array('content' => $content)); echo elgg_view_page($user->name, $body); return true; }
/** * Page hander for sitewide tag cloud * * @param array $page Page array * * @return bool */ function tagcloud_tags_page_handler($page) { $title = elgg_echo('tagcloud:site_cloud'); $options = array('threshold' => 0, 'limit' => 100, 'tag_name' => 'tags'); $content = elgg_view_tagcloud($options); $body = elgg_view_layout('one_sidebar', array('title' => $title, 'content' => $content)); echo elgg_view_page($title, $body); return true; }
/** * Page handlers for hypeFramework * * * @param type $page * @return type */ function hj_framework_page_handlers($page) { if (!isset($page[0])) { forward(); } $path_pages = elgg_get_root_path() . 'mod/hypeFramework/pages/'; switch ($page[0]) { case 'edit': set_input('guid', $page[1]); include $path_pages . 'edit/object.php'; break; case 'icon': set_input('guid', $page[1]); set_input('size', $page[2]); include $path_pages . "icon/icon.php"; break; case 'download': set_input('guid', $page[1]); include $path_pages . "file/download.php"; break; case 'file': switch ($page[1]) { case 'create': gatekeeper(); $container_guid = elgg_extract(2, $page, false); if (!$container_guid) { $container_guid = elgg_get_logged_in_user_guid(); } elgg_set_page_owner_guid($container_guid); set_input('container_guid', $container_guid); include "{$path_pages}create/file.php"; break; case 'edit': gatekeeper(); set_input('guid', $page[2]); include "{$path_pages}edit/object.php"; break; case 'view': if (!isset($page[2])) { return false; } $entity = get_entity($page[2]); if (!$entity) { return false; } $sidebar = elgg_view('framework/file/dashboard/sidebar', array('entity' => $entity)); echo elgg_view_page($entity->title, elgg_view_layout('framework/entity', array('entity' => $entity, 'sidebar' => $sidebar))); break; } break; default: return false; break; } return true; }
/** * Page handler function * * @param array $page Page URL segments */ function invitefriends_page_handler($page) { gatekeeper(); elgg_set_context('friends'); set_page_owner(elgg_get_logged_in_user_guid()); $title = elgg_echo('friends:invite'); $body = elgg_view('invitefriends/form'); $params = array('content' => $body, 'title' => $title); $body = elgg_view_layout('one_sidebar', $params); echo elgg_view_page($title, $body); }
/** * 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); }
/** * Page handler for embeds * * @param array $page */ function embed_page_handler($page) { $params = array('output' => '', 'status' => 0, 'system_messages' => array('error' => array(), 'success' => array())); $container_guid = get_input('container_guid'); if ($container_guid && get_entity($container_guid)) { elgg_set_page_owner_guid($container_guid); } switch ($page[0]) { default: case 'tab': $default_tab = elgg_is_active_plugin('file') ? 'file' : 'content_items'; $embed_tab = elgg_extract(1, $page, $default_tab); $title = elgg_echo("embed:embed"); $filter = elgg_view('embed/filter', array('filter_context' => $embed_tab)); $view = "embed/tab/{$embed_tab}"; if (elgg_view_exists($view)) { $content = elgg_view($view); } else { $embed_tab = elgg_get_config('embed_tab'); if ($embed_tab instanceof \ElggMenuItem) { $view = $embed_tab->getData('view'); $options = $embed_tab->getData('options'); if ($view) { $content = elgg_view($view); } else { if ($options) { $content = elgg_view('embed/get_list', array('options' => $options)); } } } } if (empty($content)) { $content = elgg_autop(elgg_echo('embed:section:invalid')); } $params['output'] = elgg_view_layout('one_column', array('title' => $title, 'content' => $filter . $content, 'class' => 'embed-wrapper')); break; } $system_messages = system_messages(NULL, ""); if (isset($system_messages['success'])) { $params['system_messages']['success'] = $system_messages['success']; } if (isset($system_messages['error'])) { $params['system_messages']['error'] = $system_messages['error']; $params['status'] = -1; } // We do not want to serve this page via non-xhr requests if (!elgg_is_xhr()) { register_error(elgg_echo('embed:error:non_xhr_request')); return false; } echo json_encode($params); exit; }
function donation_page_handler($page) { gatekeeper(); $title = elgg_echo('donation:title:everyone', array(elgg_get_config('sitename'))); $content = elgg_view('donation/everyone'); if (elgg_get_plugin_setting('sidebar_donation', 'donation') != 'yes') { $sidebar = elgg_view("donation/sidebar"); } $params = array('content' => $content, 'title' => $title, 'sidebar' => $sidebar); $body = elgg_view_layout('one_sidebar', $params); echo elgg_view_page($title, $body); }
function importer_page_handler($page) { gatekeeper(); elgg_set_context('friends'); elgg_set_page_owner_guid(elgg_get_logged_in_user_guid()); $title = elgg_echo('import:contacts'); $body = elgg_view('importer/form'); $params = array('content' => $body, 'title' => $title); $body = elgg_view_layout('one_sidebar', $params); echo elgg_view_page($title, $body); return true; }
/** * Main activity stream list page */ function activity_view_page() { $options = array(); $page_type = preg_replace('[\\W]', '', get_input('page_type', 'all')); $type = preg_replace('[\\W]', '', get_input('type', 'all')); $subtype = preg_replace('[\\W]', '', get_input('subtype', '')); if ($subtype) { $selector = "type={$type}&subtype={$subtype}"; } else { $selector = "type={$type}"; } if ($type != 'all') { $options['type'] = $type; if ($subtype) { $options['subtype'] = $subtype; } } switch ($page_type) { case 'mine': $title = elgg_echo('river:mine'); $page_filter = 'mine'; $options['subject_guid'] = elgg_get_logged_in_user_guid(); break; case 'friends': $title = elgg_echo('river:friends'); $page_filter = 'friends'; $options['relationship_guid'] = elgg_get_logged_in_user_guid(); $options['relationship'] = 'friend'; break; default: $title = elgg_echo('river:all'); $page_filter = 'all'; break; } $create_content = ''; if (elgg_is_logged_in()) { $create_content = elgg_view('activity/create'); } $activity = elgg_list_river($options); if (!$activity) { $activity = elgg_echo('river:none'); } $content = elgg_view('core/river/filter', array('selector' => $selector)); $sidebar = elgg_view('core/river/sidebar'); $sidebar .= elgg_view('activity/module/mentions'); $sidebar .= elgg_view('activity/module/comments'); $sidebar_alt = elgg_view('activity/module/weekly_likes'); $sidebar_alt .= elgg_view('page/elements/tagcloud_block', array('limit' => 30)); $params = array('content' => $create_content . $content . $activity, 'sidebar' => $sidebar, 'sidebar_alt' => $sidebar_alt, 'filter_context' => $page_filter, 'class' => 'elgg-river-layout'); $body = elgg_view_layout('two_sidebar', $params); 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); }
/** * GV isegoria page handler. */ function isegoria_page_handler() { // Ensure that only logged-in users can see this page gatekeeper(); // Set context and title elgg_set_context('dashboard'); elgg_set_page_owner_guid(elgg_get_logged_in_user_guid()); $title = elgg_echo('dashboard'); $params = array('num_columns' => 3, 'show_access' => false); $widgets = elgg_view_layout('widgets', $params); $body = elgg_view_layout('one_column', array('content' => $widgets)); echo elgg_view_page($title, $body); return true; }
/** * Page handler function * * @param array $page Page URL segments * @return bool */ function invitefriends_page_handler($page) { elgg_gatekeeper(); if (!elgg_get_config('allow_registration')) { return false; } elgg_set_context('friends'); elgg_set_page_owner_guid(elgg_get_logged_in_user_guid()); $title = elgg_echo('friends:invite'); $body = elgg_view('invitefriends/form'); $params = array('content' => $body, 'title' => $title); $body = elgg_view_layout('one_sidebar', $params); echo elgg_view_page($title, $body); return true; }
/** * Dispatche chat pages. * * @param array $page * @return bool */ function chat_page_handler($page) { elgg_load_library('chat'); if (!isset($page[0])) { elgg_push_breadcrumb(elgg_echo('chat')); $page[0] = 'all'; } else { elgg_push_breadcrumb(elgg_echo('chat'), 'chat/all'); } switch ($page[0]) { case 'messages': include __DIR__ . '/messages.php'; return true; case 'notifier': include __DIR__ . '/notifier.php'; return true; case 'owner': $user = get_user_by_username($page[1]); $params = chat_all($user->guid); break; case 'friends': $user = get_user_by_username($page[1]); $params = chat_friends($user->guid); break; case 'add': gatekeeper(); $params = chat_edit(); break; case 'edit': gatekeeper(); $params = chat_edit($page[1]); break; case 'view': $params = chat_view($page[1]); break; case 'members': gatekeeper(); $params = chat_add_members($page[1]); break; case 'all': default: $params = chat_all(); break; } $body = elgg_view_layout('content', $params); echo elgg_view_page('test', $body); return true; }
function importUsersPageHandler($page) { admin_gatekeeper(); elgg_admin_add_plugin_settings_menu(); elgg_set_context('admin'); elgg_unregister_css('elgg'); elgg_load_js('elgg.admin'); elgg_load_js('jquery.jeditable'); $vars = array('page' => $page); $view = 'import/' . implode('/', $page); $title = "Import Users"; $content = elgg_view($view); $body = elgg_view_layout('admin', array('content' => $content, 'title' => $title)); echo elgg_view_page($title, $body, 'admin'); return true; }
/** * 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; }
/** * External pages page handler * * @param array $page URL segements * @param string $handler Handler identifier */ function expages_page_handler($page, $handler) { if ($handler == 'expages') { expages_url_forwarder($page[1]); } $type = strtolower($handler); $title = elgg_echo("expages:{$type}"); $content = elgg_view_title($title); $object = elgg_get_entities(array('type' => 'object', 'subtype' => $type, 'limit' => 1)); if ($object) { $content .= elgg_view('output/longtext', array('value' => $object[0]->description)); } else { $content .= elgg_echo("expages:notset"); } $body = elgg_view_layout("one_sidebar", array('content' => $content)); echo elgg_view_page($title, $body); }
/** * The profile page handler * * @param array $page page elements * * @return bool */ function theme_haarlem_intranet_profile_page_handler($page) { $user = false; if (isset($page[0])) { $username = $page[0]; $user = get_user_by_username($username); if (!empty($user)) { elgg_set_page_owner_guid($user->getGUID()); } } if (empty($user) && elgg_is_logged_in()) { forward(elgg_get_logged_in_user_entity()->getURL()); } // short circuit if invalid or banned username if (empty($user) || $user->isBanned() && !elgg_is_admin_logged_in()) { register_error(elgg_echo("profile:notfound")); forward(); } $action = false; if (isset($page[1])) { $action = $page[1]; } if ($action == "edit") { // use the core profile edit page $base_dir = elgg_get_root_path(); require $base_dir . "pages/profile/edit.php"; return true; } $menu = elgg_trigger_plugin_hook('register', "menu:user_hover", array('entity' => $user), array()); $builder = new ElggMenuBuilder($menu); $menu = $builder->getMenu(); $content = '<table id="theme-haarlem-intranet-profile"><tr><td>' . elgg_view("profile/owner_block", array("entity" => $user, 'menu' => $menu)); $content .= '</td><td>'; if (!theme_haarlem_is_extranet()) { $content .= elgg_view("profile/details", array("entity" => $user, 'menu' => $menu)); } else { $content .= elgg_view("profile/extranet", array("entity" => $user, 'menu' => $menu)); } $content .= '</td></tr></table>'; $sidebar = elgg_view('theme_haarlem_intranet/profile/group_membership', array('entity' => $user)); // view profile $body = elgg_view_layout("one_sidebar", array("content" => $content, 'menu' => $menu, 'layout' => 'content', 'sidebar' => $sidebar)); echo elgg_view_page($user->name, $body); return true; }
function video_page_handler($page) { elgg_load_library('elgg:video'); elgg_push_breadcrumb(elgg_echo('video'), 'video/all'); switch ($page[0]) { case 'view': $params = video_get_page_contents_view($page[1]); break; case 'owner': video_register_toggle(); $params = video_get_page_contents_owner(); break; case 'add': $params = video_get_page_contents_upload(); break; case 'edit': video_edit_menu_setup($page[1]); $params = video_get_page_contents_edit($page[1]); break; case 'group': $group = get_entity($page[1]); if (!elgg_instanceof($group, 'group')) { forward('', '404'); } set_input('guid', $group->guid); $params = video_get_page_contents_owner(); break; case 'thumbnail': video_edit_menu_setup($page[1]); $params = video_get_page_contents_edit_thumbnail($page[1]); break; case 'all': default: video_register_toggle(); $params = video_get_page_contents_list(); break; } $body = elgg_view_layout('content', $params); echo elgg_view_page($params['title'], $body); return true; }
/** * Handle requests to activity/owner/<username> * * @param string $hook Hook name * @param string $type Hook type * @param array $return Array of url segments * @param array $params * @return boolean False if the request was handled */ function personal_activity_page_handler($hook, $type, $return, $params) { $segments = $return['segments']; if (isset($segments[0]) && $segments[0] == 'owner') { $user = get_user_by_username($segments[1]); // Use default page handler if no user or user is looking at own activity if (!$user || $user->guid == elgg_get_logged_in_user_guid()) { return $return; } $params['title'] = elgg_echo('personal_activity:owner', array($user->name)); $params['filter_context'] = ''; $params['content'] = elgg_list_river(array('subject_guids' => $user->guid)); if (!$params['content']) { $params['content'] = elgg_echo('river:none'); } $body = elgg_view_layout('content', $params); echo elgg_view_page($params['title'], $body); return false; } return $return; }