本文整理汇总了PHP中elgg_view_entity_icon函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_view_entity_icon函数的具体用法?PHP elgg_view_entity_icon怎么用?PHP elgg_view_entity_icon使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_view_entity_icon函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareMenu
public static function prepareMenu($h, $t, $v, $p)
{
$default = new MenuList(elgg_extract('default', $v, []));
$alt = new MenuList(elgg_extract('alt', $v, []));
// dump alt items into default
$default->appendList($alt);
$avatar = $default->get('profile');
$account = $default->get('account');
if ($avatar && $account) {
$user = elgg_get_logged_in_user_entity();
// copy account children under avatar
$children = new MenuList($account->getChildren());
// copy admin out
$admin = $children->remove('administration');
$url = $avatar->getHref();
$profile = new \ElggMenuItem('view-profile', elgg_echo('profile'), $url);
$children->move($profile, 0);
$avatar->setHref(null);
elgg_push_context('mrclay_aalborg_topbar');
$avatar->setText(elgg_view_entity_icon($user, 'tiny'));
elgg_pop_context();
$default->remove($account);
$default->push($avatar);
if ($admin) {
$admin->setTooltip(elgg_echo('admin'));
$admin->setText(elgg_view_icon('settings-alt'));
$default->move($admin, 0);
}
}
return ['default' => $default->getItems()];
}
示例2: getRowCells
/**
* Map column headers to a proper representation in the row cell
* @param ElggEntity $entity
* @param boolean $csv
* @return array
*/
public function getRowCells($entity)
{
$row = array();
$headers = $this->getColumnHeaders();
foreach ($headers as $header => $label) {
$value = '';
switch ($header) {
default:
$value = $entity->{$header};
if (is_array($value)) {
$value = implode('; ', $value);
}
break;
case 'guid':
$value = $entity->guid;
break;
case 'icon':
$value = $entity->getIconURL();
if (!elgg_in_context('plaintext')) {
$value = elgg_view_entity_icon($entity, 'small');
}
break;
case 'title':
$value = elgg_instanceof($entity, 'object') ? $entity->title : $entity->name;
if (!elgg_in_context('plaintext')) {
$value = elgg_view('output/url', array('text' => $value, 'href' => $entity->getURL()));
}
break;
case 'time_created':
$value = date('M d, Y H:i', $entity->time_created);
break;
case 'owner_guid':
$value = '';
$owner = $entity->getOwnerEntity();
if (elgg_instanceof($owner)) {
$value = $owner->guid;
if (!elgg_in_context('plaintext')) {
$value = elgg_view('output/url', array('text' => elgg_instanceof($owner, 'object') ? $owner->title : $owner->name, 'href' => $owner->getURL()));
}
}
break;
case 'container_guid':
$value = '';
$container = $entity->getContainerEntity();
if (elgg_instanceof($container)) {
$value = $container->guid;
if (!elgg_in_context('plaintext')) {
$value = elgg_view('output/url', array('text' => elgg_instanceof($container, 'object') ? $container->title : $container->name, 'href' => $container->getURL()));
}
}
break;
}
$row[$header] = $value;
}
return elgg_trigger_plugin_hook('export:entity', 'table', array('headers' => $this->getColumnHeaders(), 'entity' => $entity), $row);
}
示例3: user_picker_add_user
function user_picker_add_user($user_id)
{
$user = get_entity($user_id);
if (!$user || !$user instanceof ElggUser) {
return false;
}
$icon = elgg_view_entity_icon($user, 'tiny', array('use_hover' => false));
// this html must be synced with the userpicker.js library
$code = '<li><div class="elgg-image-block">';
$code .= "<div class='elgg-image'>{$icon}</div>";
$code .= "<div class='elgg-image-alt'><a href='#' class='elgg-userpicker-remove'>X</a></div>";
$code .= "<div class='elgg-body'>" . $user->name . "</div>";
$code .= "</div>";
$code .= "<input type=\"hidden\" name=\"members[]\" value=\"{$user_id}\">";
$code .= '</li>';
return $code;
}
示例4: wire_get_posts
function wire_get_posts($context, $limit = 10, $offset = 0, $username)
{
if (!$username) {
$user = elgg_get_loggedin_user_entity();
} else {
$user = get_user_by_username($username);
if (!$user) {
throw new InvalidParameterException('registration:usernamenotvalid');
}
}
if ($context == "all") {
$params = array('types' => 'object', 'subtypes' => 'thewire', 'limit' => $limit, 'full_view' => FALSE, 'no_results' => elgg_echo('thewire:noposts'));
}
if ($context == "mine" || $context == "user") {
$params = array('types' => 'object', 'subtypes' => 'thewire', 'owner_guid' => $user->guid, 'limit' => $limit, 'full_view' => FALSE, 'no_results' => elgg_echo('thewire:noposts'));
}
$latest_wire = elgg_get_entities($params);
if ($context == "friends") {
$options = array('type' => 'object', 'subtype' => 'thewire', 'full_view' => false, 'no_results' => elgg_echo('thewire:noposts'));
$latest_wire = $user->getFriendsObjects($options, $limit, $offset);
}
if ($latest_wire) {
foreach ($latest_wire as $single) {
$wire['guid'] = $single->guid;
$owner = get_entity($single->owner_guid);
$wire['owner']['guid'] = $owner->guid;
$wire['owner']['name'] = $owner->name;
$wire['owner']['avatar_url'] = elgg_view_entity_icon($owner, 'small');
$wire['time_created'] = (int) $single->time_created;
$wire['description'] = $single->description;
$return[] = $wire;
}
} else {
$msg = elgg_echo('thewire:noposts');
$return[] = $msg;
}
echo json_encode($return, true) . '<br/>';
}
示例5: elgg_tokeninput_export_entity
/**
* Get exportable entity values
*
* @param ElggEntity $entity
* @return array
*/
function elgg_tokeninput_export_entity($entity)
{
if (!elgg_instanceof($entity)) {
if ($entity_from_guid = get_entity($entity)) {
$entity = $entity_from_guid;
} else {
return elgg_tokeninput_export_metadata($entity);
}
}
$type = $entity->getType();
$subtype = $entity->getSubtype();
$icon = elgg_view_entity_icon($entity, 'small', array('use_hover' => false));
if (elgg_instanceof($entity, 'user')) {
$title = "{$entity->name} ({$entity->username})";
} else {
if (elgg_instanceof($entity, 'group')) {
$title = $entity->name;
} else {
$title = $entity->getDisplayName();
if (!$title) {
$title = elgg_echo('untitled');
}
$metadata[] = elgg_echo('byline', array($entity->getOwnerEntity()->name));
}
}
if ($entity->description) {
$metadata[] = elgg_get_excerpt(elgg_strip_tags($entity->description), 100);
}
if ($entity->location) {
$metadata[] = $entity->location;
}
$export = array('label' => $title, 'value' => $entity->guid, 'metadata' => $metadata ? implode('<br />', $metadata) : '', 'icon' => $icon, 'type' => $type, 'subtype' => $subtype, 'html_result' => elgg_view_exists("tokeninput/{$type}/{$subtype}") ? elgg_view("tokeninput/{$type}/{$subtype}", array('entity' => $entity, 'for' => 'result')) : null, 'html_token' => elgg_view_exists("tokeninput/{$type}/{$subtype}") ? elgg_view("tokeninput/{$type}/{$subtype}", array('entity' => $entity, 'for' => 'token')) : null);
$export = elgg_trigger_plugin_hook('tokeninput:entity:export', $type, array('entity' => $entity), $export);
array_walk_recursive($export, function (&$value) {
$value = is_string($value) ? html_entity_decode($value, ENT_QUOTES, 'UTF-8') : $value;
});
return $export;
}
示例6: show_friends_json
function show_friends_json($username, $limit = 10, $offset = 0)
{
if ($username) {
$user = get_user_by_username($username);
} else {
$user = elgg_get_logged_in_user_entity();
}
if (!$user) {
throw new InvalidParameterException(elgg_echo('registration:usernamenotvalid'));
}
$options = array('relationship' => 'friend', 'relationship_guid' => $user->guid, 'inverse_relationship' => false, 'type' => 'user', 'full_view' => false, 'no_results' => elgg_echo('friends:none'));
$friends = $user->getFriends($options, 10, 0);
if ($friends) {
foreach ($friends as $single) {
$friend['guid'] = $single->guid;
$friend['username'] = $single->username;
$friend['name'] = $single->name;
$friend['avatar_url'] = elgg_view_entity_icon($single, 'small');
$return[] = $friend;
}
}
echo json_encode($return, true) . '<br/>';
}
示例7: input_livesearch_page_handler
/**
* Page handler for autocomplete endpoint.
*
* @todo split this into functions/objects, this is way too big
*
* /livesearch?q=<query>
*
* Other options include:
* match_on string all or array(groups|users|friends)
* match_owner int 0/1
* limit int default is 10
*
* @param array $page
* @return string JSON string is returned and then exit
* @access private
*/
function input_livesearch_page_handler($page)
{
global $CONFIG;
// only return results to logged in users.
if (!($user = elgg_get_logged_in_user_entity())) {
exit;
}
if (!($q = get_input('term', get_input('q')))) {
exit;
}
$q = sanitise_string($q);
// replace mysql vars with escaped strings
$q = str_replace(array('_', '%'), array('\\_', '\\%'), $q);
$match_on = get_input('match_on', 'all');
if (!is_array($match_on)) {
$match_on = array($match_on);
}
// all = users and groups
if (in_array('all', $match_on)) {
$match_on = array('users', 'groups');
}
if (get_input('match_owner', false)) {
$owner_where = 'AND e.owner_guid = ' . $user->getGUID();
} else {
$owner_where = '';
}
$limit = sanitise_int(get_input('limit', 10));
// grab a list of entities and send them in json.
$results = array();
foreach ($match_on as $match_type) {
switch ($match_type) {
case 'users':
$query = "SELECT * FROM {$CONFIG->dbprefix}users_entity as ue, {$CONFIG->dbprefix}entities as e\n\t\t\t\t\tWHERE e.guid = ue.guid\n\t\t\t\t\t\tAND e.enabled = 'yes'\n\t\t\t\t\t\tAND ue.banned = 'no'\n\t\t\t\t\t\tAND (ue.name LIKE '{$q}%' OR ue.name LIKE '% {$q}%' OR ue.username LIKE '{$q}%')\n\t\t\t\t\tLIMIT {$limit}\n\t\t\t\t";
if ($entities = get_data($query)) {
foreach ($entities as $entity) {
// @todo use elgg_get_entities (don't query in a loop!)
$entity = get_entity($entity->guid);
/* @var ElggUser $entity */
if (!$entity) {
continue;
}
if (in_array('groups', $match_on)) {
$value = $entity->guid;
} else {
$value = $entity->username;
}
$output = elgg_view_list_item($entity, array('use_hover' => false, 'class' => 'elgg-autocomplete-item'));
$icon = elgg_view_entity_icon($entity, 'tiny', array('use_hover' => false));
$result = array('type' => 'user', 'name' => $entity->name, 'desc' => $entity->username, 'guid' => $entity->guid, 'label' => $output, 'value' => $value, 'icon' => $icon, 'url' => $entity->getURL());
$results[$entity->name . rand(1, 100)] = $result;
}
}
break;
case 'groups':
// don't return results if groups aren't enabled.
if (!elgg_is_active_plugin('groups')) {
continue;
}
$query = "SELECT * FROM {$CONFIG->dbprefix}groups_entity as ge, {$CONFIG->dbprefix}entities as e\n\t\t\t\t\tWHERE e.guid = ge.guid\n\t\t\t\t\t\tAND e.enabled = 'yes'\n\t\t\t\t\t\t{$owner_where}\n\t\t\t\t\t\tAND (ge.name LIKE '{$q}%' OR ge.name LIKE '% {$q}%' OR ge.description LIKE '% {$q}%')\n\t\t\t\t\tLIMIT {$limit}\n\t\t\t\t";
if ($entities = get_data($query)) {
foreach ($entities as $entity) {
// @todo use elgg_get_entities (don't query in a loop!)
$entity = get_entity($entity->guid);
/* @var ElggGroup $entity */
if (!$entity) {
continue;
}
$output = elgg_view_list_item($entity, array('use_hover' => false, 'class' => 'elgg-autocomplete-item'));
$icon = elgg_view_entity_icon($entity, 'tiny', array('use_hover' => false));
$result = array('type' => 'group', 'name' => $entity->name, 'desc' => strip_tags($entity->description), 'guid' => $entity->guid, 'label' => $output, 'value' => $entity->guid, 'icon' => $icon, 'url' => $entity->getURL());
$results[$entity->name . rand(1, 100)] = $result;
}
}
break;
case 'friends':
$query = "SELECT * FROM\n\t\t\t\t\t\t{$CONFIG->dbprefix}users_entity as ue,\n\t\t\t\t\t\t{$CONFIG->dbprefix}entity_relationships as er,\n\t\t\t\t\t\t{$CONFIG->dbprefix}entities as e\n\t\t\t\t\tWHERE er.relationship = 'friend'\n\t\t\t\t\t\tAND er.guid_one = {$user->getGUID()}\n\t\t\t\t\t\tAND er.guid_two = ue.guid\n\t\t\t\t\t\tAND e.guid = ue.guid\n\t\t\t\t\t\tAND e.enabled = 'yes'\n\t\t\t\t\t\tAND ue.banned = 'no'\n\t\t\t\t\t\tAND (ue.name LIKE '{$q}%' OR ue.name LIKE '% {$q}%' OR ue.username LIKE '{$q}%')\n\t\t\t\t\tLIMIT {$limit}\n\t\t\t\t";
if ($entities = get_data($query)) {
foreach ($entities as $entity) {
// @todo use elgg_get_entities (don't query in a loop!)
$entity = get_entity($entity->guid);
/* @var ElggUser $entity */
if (!$entity) {
continue;
}
//.........这里部分代码省略.........
示例8: elgg_extract
<?php
$entity = elgg_extract('entity', $vars);
if (elgg_is_admin_logged_in()) {
elgg_require_js('pool/reorder');
}
$turns = $entity->getTurnsNowAndAfter();
$items = '';
foreach ($turns as $turn) {
$date = date('j.n.Y', $turn->value);
$time = date('H:i', $turn->value);
$name = $turn->getOwnerEntity()->name;
$user = $turn->getOwnerEntity();
$image = elgg_view_entity_icon($user, 'small');
$metadata = null;
if (elgg_is_admin_logged_in()) {
$metadata = elgg_view('output/confirmlink', array('text' => elgg_echo('pool:remove'), 'href' => "action/pool/remove?guid={$entity->guid}&user_guid={$user->guid}", 'is_action' => true, 'class' => 'elgg-menu-entity'));
}
$body = elgg_view('object/elements/summary', array('entity' => $user, 'subtitle' => $user->name, 'metadata' => $metadata, 'title' => elgg_echo('pool:list:title', array($date, $time))));
$block = elgg_view_image_block($image, $body, array('id' => $user->guid));
$items .= "<li>{$block}</li>";
}
echo "<ul id=\"elgg-pool-users\">{$items}</ul>";
示例9: elgg_require_js
<?php
/**
* Post comment on album river view
*/
elgg_require_js('tidypics/tidypics');
elgg_load_js('lightbox');
elgg_load_css('lightbox');
$item = $vars['item'];
$comment = $item->getObjectEntity();
$subject = $item->getSubjectEntity();
$target = $item->getTargetEntity();
$subject_link = elgg_view('output/url', array('href' => $subject->getURL(), 'text' => $subject->name, 'class' => 'elgg-river-subject', 'is_trusted' => true));
$target_link = elgg_view('output/url', array('href' => $target->getURL(), 'text' => $target->getDisplayName(), 'class' => 'elgg-river-target', 'is_trusted' => true));
$attachments = '';
$river_comments_thumbnails = elgg_get_plugin_setting('river_comments_thumbnails', 'tidypics');
if ($river_comments_thumbnails == "show") {
$album = $target;
$image = $album->getCoverImage();
if ($image) {
$preview_size = elgg_get_plugin_setting('river_thumbnails_size', 'tidypics');
if (!$preview_size) {
$preview_size = 'tiny';
}
$attachments = elgg_view_entity_icon($image, $preview_size, array('href' => $image->getIconURL('master'), 'img_class' => 'tidypics-photo', 'link_class' => 'tidypics-lightbox'));
}
}
$summary = elgg_echo('river:comment:object:album', array($subject_link, $target_link));
echo elgg_view('river/elements/layout', array('item' => $vars['item'], 'attachments' => $attachments, 'message' => elgg_get_excerpt($comment->description), 'summary' => $summary));
示例10: elgg_view_entity_icon
<?php
/**
* Elgg show the users who liked the object
*
* @uses $vars['annotation']
*/
if (!isset($vars['annotation'])) {
return true;
}
$like = $vars['annotation'];
$user = $like->getOwnerEntity();
if (!$user) {
return true;
}
$user_icon = elgg_view_entity_icon($user, 'tiny');
$user_link = elgg_view('output/url', array('href' => $user->getURL(), 'text' => $user->name, 'is_trusted' => true));
$likes_string = elgg_echo('likes:this');
$friendlytime = elgg_view_friendly_time($like->time_created);
if ($like->canEdit()) {
$delete_button = elgg_view("output/confirmlink", array('href' => "action/likes/delete?id={$like->id}", 'text' => elgg_view_icon('delete', 'float-alt'), 'confirm' => elgg_echo('likes:delete:confirm'), 'encode_text' => false));
}
$body = <<<HTML
<p class="mbn">
\t{$delete_button}
\t{$user_link} {$likes_string}
\t<span class="elgg-subtext">
\t\t{$friendlytime}
\t</span>
</p>
HTML;
示例11: elgg_extract
<?php
$entity = elgg_extract('entity', $vars);
$full_view = elgg_extract('full_view', $vars);
if ($full_view) {
echo elgg_view('object/static/full', $vars);
return;
}
$icon = '';
$editor = $entity->getLastEditor();
if ($editor) {
$icon = elgg_view_entity_icon($editor, 'tiny');
}
$metadata = elgg_view_menu('entity', ['entity' => $entity, 'handler' => 'static', 'sort_by' => 'priority', 'class' => 'elgg-menu-hz']);
$excerpt = elgg_get_excerpt($entity->description);
$params = ['entity' => $entity, 'metadata' => $metadata, 'subtitle' => elgg_view('static/by_line', $vars), 'content' => $excerpt];
$params = $params + $vars;
$list_body = elgg_view('object/elements/summary', $params);
echo elgg_view_image_block($icon, $list_body);
示例12: sanitise_string
if (!elgg_is_logged_in()) {
exit;
}
$q = sanitise_string(get_input('term'));
// replace mysql vars with escaped strings
$q = str_replace(array('_', '%'), array('\\_', '\\%'), $q);
$user_guid = elgg_get_logged_in_user_guid();
$entities = elgg_get_entities(array('type' => 'group', 'owner_guid' => $user_guid, 'limit' => 0));
$entities = array_merge($entities, elgg_get_entities_from_relationship(array('type' => 'group', 'relationship' => 'operator', 'relationship_guid' => $user_guid, 'limit' => 0)));
$all_entities = array();
while (!empty($entities)) {
$entity = array_pop($entities);
$childs = elgg_get_entities(array('type' => 'group', 'container_guid' => $entity->guid));
foreach ($childs as $child) {
array_push($entities, $child);
}
$all_entities[] = $entity;
}
$results = array();
foreach ($all_entities as $entity) {
if (!preg_match("/^{$q}/i", $entity->name)) {
continue;
}
$output = elgg_view_list_item($entity, array('use_hover' => false, 'class' => 'elgg-autocomplete-item'));
$icon = elgg_view_entity_icon($entity, 'tiny', array('use_hover' => false));
$results[$entity->name . $entity->guid] = array('type' => 'group', 'name' => $entity->name, 'desc' => strip_tags($entity->description), 'guid' => $entity->guid, 'label' => $output, 'value' => $entity->guid, 'icon' => $icon, 'url' => $entity->getURL());
}
ksort($results);
header("Content-Type: application/json");
echo json_encode(array_values($results));
exit;
示例13: elgg_view_entity_icon
}
# simplified condition :
*/
if (!in_array($vars['annotation']->id, $review_array) || $can_see_unapproved) {
$mc_class = "generic_comment";
$reviewed = true;
?>
<div
class="<?php
echo $mc_class;
?>
">
<!-- start of generic_comment div -->
<div class="generic_comment_icon">
<?php
echo elgg_view_entity_icon($owner, 'small');
?>
</div>
<div class="generic_comment_details">
<!-- output the actual comment -->
<?php
echo elgg_view("output/longtext", array("value" => $vars['annotation']->value));
?>
<p class="generic_comment_owner">
<a href="<?php
echo $owner->getURL();
?>
"><?php
echo $owner->name;
示例14: elgg_extract
*
* @package Questions
*/
$full = elgg_extract("full_view", $vars, false);
$question = elgg_extract("entity", $vars, false);
$workflow = elgg_extract("workflow", $vars, false);
if (!$question) {
return true;
}
if ($workflow) {
$url = $question->getWorkflowURL();
} else {
$url = $question->getURL();
}
$poster = $question->getOwnerEntity();
$poster_icon = elgg_view_entity_icon($poster, "small");
$poster_link = elgg_view("output/url", array("text" => $poster->name, "href" => $poster->getURL(), "is_trusted" => true));
$poster_text = elgg_echo("questions:asked", array($poster_link));
$container = $question->getContainerEntity();
if (elgg_instanceof($container, "group") && elgg_get_page_owner_guid() != $container->getGUID()) {
$group_link = elgg_view("output/url", array("text" => $container->name, "href" => "questions/group/" . $container->getGUID() . "/all", "is_trusted" => true));
$poster_text .= " " . elgg_echo("river:ingroup", array($group_link));
}
$tags = elgg_view("output/tags", array("tags" => $question->tags));
$categories = elgg_view("output/categories", $vars);
$date = elgg_view_friendly_time($question->time_created);
$answers_link = "";
if ($workflow) {
$answer_subtype = "intanswer";
} else {
$answer_subtype = "answer";
示例15: elgg_view_entity_icon
<?php
/**
* Group entity view
*
* @package ElggGroups
*/
$group = $vars['entity'];
$icon = elgg_view_entity_icon($group, 'tiny', $vars);
$metadata = '';
if (!elgg_in_context('owner_block') && !elgg_in_context('widgets')) {
// only show entity menu outside of widgets and owner block
$metadata = elgg_view_menu('entity', array('entity' => $group, 'handler' => 'groups', 'sort_by' => 'priority', 'class' => 'elgg-menu-hz'));
}
if ($vars['full_view']) {
echo elgg_view('groups/profile/summary', $vars);
} else {
// brief view
$params = array('entity' => $group, 'metadata' => $metadata, 'subtitle' => $group->briefdescription);
$params = $params + $vars;
$list_body = elgg_view('group/elements/summary', $params);
echo elgg_view_image_block($icon, $list_body, $vars);
}