本文整理汇总了PHP中elgg_view_layout函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_view_layout函数的具体用法?PHP elgg_view_layout怎么用?PHP elgg_view_layout使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_view_layout函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hflts_page_handler
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);
}
示例2: legacy_urls_redirect
/**
* 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;
}
}
示例3: expages_page_handler
/**
* 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;
}
示例4: stripe_page_handler
/**
* 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;
}
示例5: profile_get_user_profile_html
/**
* 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;
}
示例6: expages_page_handler
/**
* 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;
}
示例7: customstyle_page_handler
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;
}
示例8: _elgg_comments_page_handler
/**
* 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;
}
}
示例9: au_group_tag_menu_page_handler
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;
}
示例10: gvcontact_page_handler
/**
* 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);
}
示例11: profile_page_handler
/**
* 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);
}
示例12: profile_page_handler
/**
* 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;
}
示例13: tagcloud_tags_page_handler
/**
* 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;
}
示例14: hj_framework_page_handlers
/**
* 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;
}
示例15: invitefriends_page_handler
/**
* 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);
}