本文整理汇总了PHP中elgg_list_annotations函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_list_annotations函数的具体用法?PHP elgg_list_annotations怎么用?PHP elgg_list_annotations使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_list_annotations函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elgg_extract
/**
* List comments with optional add form
*
* @uses $vars['entity'] ElggEntity
* @uses $vars['show_add_form'] Display add form or not
* @uses $vars['id'] Optional id for the div
* @uses $vars['class'] Optional additional class for the div
*/
$show_add_form = elgg_extract('show_add_form', $vars, true);
$id = '';
if (isset($vars['id'])) {
$id = "id =\"{$vars['id']}\"";
}
$class = 'elgg-comments';
if (isset($vars['class'])) {
$class = "{$class} {$vars['class']}";
}
// work around for deprecation code in elgg_view()
unset($vars['internalid']);
echo "<div {$id} class=\"{$class}\">";
$options = array('guid' => $vars['entity']->getGUID(), 'annotation_name' => 'generic_comment');
$html = elgg_list_annotations($options);
if ($html) {
echo '<h3>' . elgg_echo('comments') . '</h3>';
echo $html;
}
if ($show_add_form) {
$form_vars = array('name' => 'elgg_add_comment');
echo elgg_view_form('comments/add', $form_vars, $vars);
}
echo '</div>';
示例2: elgg_extract
<?php
$entity = elgg_extract("entity", $vars);
$full_view = elgg_extract("full_view", $vars, false);
// the api application of which this is the user settings object
$api_application = $entity->getContainerEntity();
$owner = $entity->getOwnerEntity();
if ($full_view) {
// display information about the api application
$summary = elgg_view_entity($api_application, array("full_view" => false));
// list all the push notification services
$body = "";
if ($pns = $api_application->getPushNotificationServices()) {
$pns_names = array_keys($pns);
$pns_options = array("guid" => $entity->getGUID(), "annotation_names" => $pns_names, "limit" => false, "owner_guid" => $owner->getGUID(), "pagination" => false);
$body .= elgg_view_module("pns", elgg_echo("ws_pack:usersettings:push_notification_services"), elgg_list_annotations($pns_options));
}
echo elgg_view("object/elements/full", array("summary" => $summary, "body" => $body));
} else {
// listing view
$owner_icon = elgg_view_entity_icon($owner, "small");
$owner_link = elgg_view("output/url", array("text" => $owner->name, "href" => $owner->getURL(), "is_trusted" => true));
$subtitle = elgg_echo("entity:default:strapline", array(elgg_get_friendly_time($entity->time_created), $owner_link));
$params = array("entity" => $entity, "metadata" => "", "title" => $api_application->getTitle(), "subtitle" => $subtitle, "content" => "");
$params = $params + $vars;
$summary = elgg_view("object/elements/summary", $params);
echo elgg_view_image_block($owner_icon, $summary);
}
示例3: get_input
<?php
$project_guid = get_input('plugin');
$project = get_entity($project_guid);
$title = elgg_echo('plugins:requests:ownership');
$content = elgg_list_annotations(array('guid' => $project->guid, 'annotation_name' => 'ownership_request', 'no_results' => elgg_echo('none')));
$sidebar = elgg_view('plugins/project_sidebar', array('entity' => $project));
$body = elgg_view_layout('one_sidebar', array('title' => $title, 'sidebar' => $sidebar, 'content' => $content));
echo elgg_view_page($title, $body);
示例4: elgg_view_menu
$comments_link = '';
}
$metadata = elgg_view_menu('entity', array('entity' => $answer, 'handler' => 'answers', 'sort_by' => 'priority', 'class' => 'elgg-menu-hz'));
$subtitle = "{$author_text} {$date} {$comments_link} {$categories}";
// do not show the metadata and controls in widget view
if (elgg_in_context('widgets')) {
$metadata = '';
}
if ($full) {
$rating_block = elgg_view("answers/rating_block", $vars);
$body = elgg_view('output/longtext', array('value' => $answer->description, 'class' => 'question-post'));
$params = array('entity' => $answer, 'title' => false, 'metadata' => $metadata, 'subtitle' => $subtitle);
$params = $params + $vars;
$summary = elgg_view('object/elements/summary', $params);
$answer_info = elgg_view_image_block($owner_icon, $summary, array('class' => 'mts'));
$answer_comments = elgg_list_annotations(array('guid' => $answer_guid, 'annotation_name' => 'generic_comment', 'full_view' => 'tiny'));
if (elgg_is_logged_in()) {
$answer_edit_form = elgg_view_form('answers/answer/edit', array('id' => 'edit-answer-' . $answer_guid, 'class' => 'hidden'), $vars);
$answer_add_comment = elgg_view('answers/comment_toggle', $vars);
}
echo <<<HTML
<div id="elgg-object-{$answer->guid}" class="elgg-item-answer">
\t{$rating_block}
\t<div class="answer-content mbl">
\t\t<div class="answer-output">
\t\t\t{$body}
\t\t</div>
\t\t{$answer_info}
\t\t{$answer_edit_form}
\t\t<div id="answer-comment-{$answer_guid}" class="elgg-comments">
\t\t\t{$answer_comments}
示例5: elgg_echo
<?php
/**
* Count of who has liked something
*
* @uses $vars['entity']
*/
$list = '';
$num_of_likes = \Elgg\Likes\DataService::instance()->getNumLikes($vars['entity']);
$guid = $vars['entity']->guid;
if ($num_of_likes) {
// display the number of likes
if ($num_of_likes == 1) {
$likes_string = elgg_echo('likes:userlikedthis', array($num_of_likes));
} else {
$likes_string = elgg_echo('likes:userslikedthis', array($num_of_likes));
}
$params = array('text' => $likes_string, 'title' => elgg_echo('likes:see'), 'rel' => 'popup', 'href' => "#likes-{$guid}", 'class' => 'elgg-non-link');
$list = elgg_view('output/url', $params);
$list .= "<div class='elgg-module elgg-module-popup elgg-likes hidden clearfix' id='likes-{$guid}'>";
$list .= elgg_list_annotations(array('guid' => $guid, 'annotation_name' => 'likes', 'limit' => 99, 'list_class' => 'elgg-list-likes', 'preload_owners' => true));
$list .= "</div>";
echo $list;
}
示例6: elgg_extract
<?php
$entity = elgg_extract('entity', $vars);
if (empty($entity)) {
return;
}
$annotations = elgg_list_annotations(['guid' => $entity->getGUID(), 'annotation_name' => 'static_revision', 'limit' => false]);
if (empty($annotations)) {
return;
}
echo elgg_view_module('aside', elgg_echo('static:revisions'), $annotations);
示例7: elgg_view_icon
return true;
}
$object = $vars['item']->getObjectEntity();
$num_of_likes = $object->countAnnotations('likes');
if ($num_of_likes == 0) {
return true;
}
$guid = $object->guid;
$likes_button = elgg_view_icon('thumbs-up');
// check to see if the user has already liked this
if (elgg_is_logged_in() && $object->canAnnotate(0, 'likes')) {
if (!elgg_annotation_exists($guid, 'likes')) {
$likes_button = elgg_view('output/url', array('href' => "action/likes/add?guid={$guid}", 'text' => elgg_view_icon('thumbs-up'), 'title' => elgg_echo('likes:likethis'), 'is_action' => true));
} else {
$likes = elgg_get_annotations(array('guid' => $guid, 'annotation_name' => 'likes', 'owner_guid' => elgg_get_logged_in_user_guid()));
$likes_button = elgg_view('output/url', array('href' => "action/likes/delete?annotation_id={$likes[0]->id}", 'text' => elgg_view_icon('thumbs-up-alt'), 'title' => elgg_echo('likes:remove'), 'is_action' => true));
}
}
// display the number of likes
if ($num_of_likes == 1) {
$likes_string = elgg_echo('likes:userlikedthis', array($num_of_likes));
} else {
$likes_string = elgg_echo('likes:userslikedthis', array($num_of_likes));
}
$likes_string = elgg_view('output/url', array('text' => $likes_string, 'title' => elgg_echo('likes:see'), 'rel' => 'popup', 'href' => "#likes-{$guid}"));
$likes_list = elgg_list_annotations(array('guid' => $guid, 'annotation_name' => 'likes', 'limit' => 99));
$likes_module = elgg_view_module('popup', 'Likes', $likes_list, array('class' => 'hidden elgg-likes-list', 'id' => "likes-{$guid}"));
$vars['image'] = $likes_button;
$vars['body'] = $likes_string . $likes_module;
$vars['class'] = 'elgg-river-participation';
echo elgg_view('page/components/image_block', $vars);
示例8: get_input
**/
$markdown_wiki_guid = get_input('guid');
$markdown_wiki = get_entity($markdown_wiki_guid);
$container = $markdown_wiki->getContainerEntity();
if (!$markdown_wiki || !$container) {
forward(REFERER);
}
elgg_load_js('markdown_wiki:discussion');
elgg_set_page_owner_guid($markdown_wiki->getContainerGUID());
elgg_register_menu_item('title', array('name' => 'toggle-modification', 'href' => "#", 'text' => elgg_echo('markdown_wiki:toggle-modification'), 'link_class' => 'elgg-button-toggle-modification active'));
$title = elgg_echo('markdown_wiki:discussion', array($markdown_wiki->title));
if (elgg_instanceof($container, 'group')) {
elgg_push_breadcrumb($container->name, "wiki/group/{$container->guid}/all");
} else {
elgg_push_breadcrumb($container->name, "wiki/owner/{$container->username}");
}
elgg_push_breadcrumb($markdown_wiki->title, $markdown_wiki->getURL());
elgg_push_breadcrumb(elgg_echo('markdown_wiki:page:discussion'));
elgg_register_menu_item('page', array('name' => 'compare', 'href' => "wiki/compare/{$markdown_wiki_guid}/{$markdown_wiki->title}", 'text' => elgg_echo('markdown_wiki:page:compare')));
elgg_register_menu_item('page', array('name' => 'history', 'href' => "wiki/history/{$markdown_wiki_guid}/{$markdown_wiki->title}", 'text' => elgg_echo('markdown_wiki:page:history')));
if ($markdown_wiki->canEdit($user_guid)) {
elgg_register_menu_item('page', array('name' => 'edit-page', 'href' => "wiki/edit/{$markdown_wiki_guid}/{$markdown_wiki->title}", 'text' => elgg_echo('markdown_wiki:page:edit')));
}
$content = elgg_trigger_plugin_hook('markdown_wiki_discussion', 'header', $markdown_wiki, '');
$form_vars = array('name' => 'elgg_add_comment', 'class' => 'desc');
$vars['entity'] = $markdown_wiki;
$content .= '<div class="elgg-comments">' . elgg_view_form('comments/add', $form_vars, $vars);
$content .= elgg_list_annotations(array('types' => 'object', 'subtypes' => 'markdown_wiki', 'annotation_names' => array('markdown_wiki', 'generic_comment'), 'guids' => $markdown_wiki_guid, 'order_by' => 'time_created desc', 'summary_view' => true));
$content .= '</div>';
$body = elgg_view_layout('content', array('filter' => '', 'content' => $content, 'title' => $title, 'sidebar' => elgg_view('markdown_wiki/sidebar/sidebar')));
echo elgg_view_page($title, $body);
示例9: elgg_extract
<?php
/**
* Elgg-markdown_wiki plugin
* @package elgg-markdown_wiki
* @author Emmanuel Salomon @ManUtopiK
* @license GNU Affero General Public License, version 3 or late
* @link https://github.com/ManUtopiK/elgg-markdown_wiki
*
* Elgg-markdown_wiki compare form
**/
$markdown_wiki = elgg_extract('markdown_wiki', $vars);
$annoff = elgg_extract('annoff', $vars, false);
$annotations = elgg_list_annotations(array('types' => 'object', 'subtypes' => 'markdown_wiki', 'annotation_names' => 'markdown_wiki', 'guids' => $markdown_wiki->guid, 'order_by' => 'time_created desc', 'limit' => $annoff ? 10 : 15, 'summary_view' => true, 'list_class' => 'history-module', 'compare' => true));
if ($annoff) {
$recent = elgg_list_annotations(array('types' => 'object', 'subtypes' => 'markdown_wiki', 'annotation_names' => 'markdown_wiki', 'guids' => $markdown_wiki->guid, 'order_by' => 'time_created desc', 'limit' => 5, 'summary_view' => true, 'list_class' => 'history-module', 'compare' => true, 'pagination' => false, 'offset' => 0));
// dumby hack to merge both lists
$posR = strrpos($recent, '</ul>');
$posA = strpos($annotations, '<li id="item-annotation');
echo substr($recent, 0, $posR) . '<li>...</li>' . substr($annotations, $posA);
} else {
echo $annotations;
}
echo elgg_view('input/hidden', array('name' => 'markdown_wiki', 'value' => $markdown_wiki->guid));
echo elgg_view('input/submit', array('value' => elgg_echo('markdown_wiki:compare:button'), 'class' => 'elgg-button-submit mtm'));
示例10: elgg_extract
<?php
/**
* History of revisions of a page
*
* @package ElggPages
*/
$page_guid = elgg_extract('guid', $vars);
$page = get_entity($page_guid);
if (!pages_is_page($page)) {
forward('', '404');
}
$container = $page->getContainerEntity();
if (!$container) {
forward('', '404');
}
elgg_set_page_owner_guid($container->getGUID());
if (elgg_instanceof($container, 'group')) {
elgg_push_breadcrumb($container->name, "pages/group/{$container->guid}/all");
} else {
elgg_push_breadcrumb($container->name, "pages/owner/{$container->username}");
}
pages_prepare_parent_breadcrumbs($page);
elgg_push_breadcrumb($page->title, $page->getURL());
elgg_push_breadcrumb(elgg_echo('pages:history'));
$title = $page->title . ": " . elgg_echo('pages:history');
$content = elgg_list_annotations(array('guid' => $page_guid, 'annotation_name' => 'page', 'limit' => max(20, elgg_get_config('default_limit')), 'order_by' => "n_table.time_created desc"));
$body = elgg_view_layout('content', array('filter' => '', 'content' => $content, 'title' => $title, 'sidebar' => elgg_view('pages/sidebar/navigation', array('page' => $page))));
echo elgg_view_page($title, $body);
示例11: get_input
<?php
/**
* Elgg Message board: add message action
*
* @package ElggMessageBoard
*/
$message_content = get_input('message_content');
$owner_guid = get_input("owner_guid");
$owner = get_entity($owner_guid);
if ($owner && !empty($message_content)) {
$result = messageboard_add(elgg_get_logged_in_user_entity(), $owner, $message_content, $owner->access_id);
if ($result) {
system_message(elgg_echo("messageboard:posted"));
$options = array('annotations_name' => 'messageboard', 'guid' => $owner->getGUID(), 'limit' => $num_display, 'pagination' => false, 'reverse_order_by' => true, 'limit' => 1);
$output = elgg_list_annotations($options);
echo $output;
} else {
register_error(elgg_echo("messageboard:failure"));
}
} else {
register_error(elgg_echo("messageboard:blank"));
}
forward(REFERER);
示例12: get_input
<?php
/**
* Elgg Message board: add message action
*
* @package ElggMessageBoard
*/
$message_content = get_input('message_content');
$owner_guid = (int) get_input('owner_guid');
$owner = get_user($owner_guid);
if (!$owner || empty($message_content)) {
return elgg_error_response(elgg_echo('messageboard:blank'));
}
$result = messageboard_add(elgg_get_logged_in_user_entity(), $owner, $message_content, $owner->access_id);
if (!$result) {
return elgg_error_response(elgg_echo('messageboard:failure'));
}
$output = elgg_list_annotations(['annotations_name' => 'messageboard', 'guid' => $owner->guid, 'pagination' => false, 'reverse_order_by' => true, 'limit' => 1]);
return elgg_ok_response($output, elgg_echo('messageboard:posted'));
示例13: sprintf
}
$title = "";
if ($entity instanceof ElggUser || $entity instanceof ElggGroup) {
$title = $entity->name;
} else {
if ($entity instanceof ElggObject && $entity->getSubtype() == 'thewire') {
$title = $entity->description;
} else {
$title = $entity->title;
}
}
$title = sprintf(elgg_echo('river_comments:allcommentsof'), $title);
//$comments_count = (int) count_annotations($entity_guid, "", "", 'generic_comment');
$comments_count = (int) elgg_get_annotations(array('annotation_names' => 'generic_comment', 'guid' => $entity_guid, 'count' => true));
if (!$callback) {
$content = elgg_list_annotations(array('annotation_names' => 'generic_comment', 'guid' => $entity_guid, 'count' => $comments_count));
} else {
$comments_offset = 0;
$comments_limit = $comments_count;
if ($comments_count > 2) {
$comments_limit -= 2;
}
//$comments = get_annotations($entity_guid, "", "", 'generic_comment', "", "", $comments_limit, $comments_offset);
$comments = elgg_get_annotations(array('guid' => $entity_guid, 'annotation_name' => 'generic_comment', 'limit' => $comments_limit, 'offset' => $comments_offset));
foreach ($comments as $comment) {
$owner = get_user($comment->owner_guid);
$content .= elgg_view('river_comments/river_comment', array('owner' => $owner, 'annotation' => $comment));
}
}
if (!$callback) {
$body = elgg_view_layout('content', array('filter' => false, 'content' => $content, 'title' => $title));
示例14: get_input
<?php
$guid = get_input("guid");
if (!get_entity($guid)) {
echo elgg_echo("error:missing_data");
return;
}
$list = elgg_list_annotations(array('guid' => $guid, 'annotation_name' => 'likes', 'limit' => 99, 'preload_owners' => true, 'pagination' => false));
echo elgg_format_element('div', ['class' => 'elgg-likes-popup'], $list);
示例15: get_input
<?php
/**
* History of revisions of a page
*
* @package ElggPages
*/
$page_guid = get_input('guid');
$page = get_entity($page_guid);
if (!$page) {
forward('', '404');
}
$container = $page->getContainerEntity();
if (!$container) {
forward('', '404');
}
elgg_set_page_owner_guid($container->getGUID());
if (elgg_instanceof($container, 'group')) {
elgg_push_breadcrumb($container->name, "pages/group/{$container->guid}/all");
} else {
elgg_push_breadcrumb($container->name, "pages/owner/{$container->username}");
}
pages_prepare_parent_breadcrumbs($page);
elgg_push_breadcrumb($page->title, $page->getURL());
elgg_push_breadcrumb(elgg_echo('pages:history'));
$title = $page->title . ": " . elgg_echo('pages:history');
$content = elgg_list_annotations(array('guid' => $page_guid, 'annotation_name' => 'page', 'limit' => 20, 'order_by' => "n_table.time_created desc"));
$body = elgg_view_layout('content', array('filter' => '', 'content' => $content, 'title' => $title, 'sidebar' => elgg_view('pages/sidebar/navigation', array('page' => $page))));
echo elgg_view_page($title, $body);