/** * 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; }
<?php /** * Tag cloud widget */ $num_items = $vars['entity']->num_items; elgg_push_context('tags'); $options = array('owner_guid' => elgg_get_page_owner_guid(), 'threshold' => 1, 'limit' => $num_items, 'tag_name' => 'tags', 'modified_time_lower' => time() - 86400); echo elgg_view_tagcloud($options); elgg_pop_context();
* <http://www.gnu.org/licenses/>. * * Generally used in a sidebar. Does not work with groups currently. * * @uses $vars['subtypes'] Object subtype string or array of subtypes * @uses $vars['owner_guid'] The owner of the content being tagged * @uses $vars['limit'] The maxinum number of tags to display */ $owner_guid = elgg_extract('owner_guid', $vars, ELGG_ENTITIES_ANY_VALUE); if (!$owner_guid) { $owner_guid = ELGG_ENTITIES_ANY_VALUE; } $owner_entity = get_entity($owner_guid); $options = array('type' => 'object', 'subtype' => elgg_extract('subtypes', $vars, ELGG_ENTITIES_ANY_VALUE), 'container_guid' => $owner_guid, 'threshold' => 0, 'limit' => elgg_extract('limit', $vars, 50), 'tag_name' => 'tags'); $title = elgg_echo('tagcloud'); if (is_array($options['subtype']) && count($options['subtype']) > 1) { // we cannot provide links to tagged objects with multiple types $tag_data = elgg_get_tags($options); $cloud = elgg_view("output/tagcloud", array('value' => $tag_data, 'type' => $type)); } else { $cloud = elgg_view_tagcloud($options); } if (!$cloud) { return true; } // add a link to all site tags $cloud .= '<p class="small">'; $cloud .= elgg_view_icon('tag'); $cloud .= elgg_view('output/url', array('href' => 'tags', 'text' => elgg_echo('tagcloud:allsitetags'), 'is_trusted' => true)); $cloud .= '</p>'; echo elgg_view_module('aside', $title, $cloud);
function aga_handle_stats_page($group) { //only show if enabled or is admin if (!(($group->canEdit() || $group->aga_stats_enable == 'yes') && (elgg_get_plugin_setting('aga_stats', 'au_group_activity') != 'no' || elgg_is_admin_logged_in()))) { forward(REFERER); } $title = elgg_echo('aga:groupstats', array($group->name)); elgg_push_breadcrumb($group->name, $group->getURL()); elgg_push_breadcrumb(elgg_echo('aga:groupstats')); $content = ""; // Get entity statistics //first get array of possible objects $guid = $group->guid; $types = get_registered_entity_types('object'); $content .= elgg_view_module('info', elgg_echo('aga:note'), elgg_echo('aga:statscaution')); // generate a table of stats $even_odd = ""; $statscontent = "<table class=\"elgg-table-alt\">"; //member count $statscontent .= "<tr class=\"odd\"><td>" . elgg_echo('aga:nummembers') . "</td><td>" . aga_get_member_count($group) . "</td></tr>"; //post count $statscontent .= "<tr class=\"even\"><td>" . elgg_echo('aga:numposts') . "</td><td>" . aga_get_post_count($group) . "</td></tr>"; //count comments and discussion replies $statscontent .= "<tr><td>" . elgg_echo('aga:generic_comment') . "</td><td>" . aga_get_annotation_count($group, 'generic_comment') . "</td></tr>"; $statscontent .= "<tr><td>" . elgg_echo('aga:group_topic_post') . "</td><td>" . aga_get_annotation_count($group, 'group_topic_post') . "</td></tr>"; //get first and most recent posts $statscontent .= "<tr class=\"odd\"><td>" . elgg_echo('aga:first_post') . "</td><td>" . aga_get_firstlast_post($group, 'first') . "</td></tr>"; $statscontent .= "<tr class=\"even\"><td>" . elgg_echo('aga:last_post') . "</td><td>" . aga_get_firstlast_post($group, 'last') . "</td></tr>"; // show per-object stats $statscontent .= "<tr><td><h4>" . elgg_echo('aga:perobjecttype') . "</h4></td><td>" . elgg_echo('aga:perobjecttypehelp') . "</td></tr>"; foreach ($types as $k => $object) { //This function controls the alternating class $even_odd = 'odd' != $even_odd ? 'odd' : 'even'; $count = aga_get_post_count($group, $object); $objectNice = elgg_echo("item:object:{$object}"); $statscontent .= "<tr class=\"{$even_odd}\">\n\t\t\t\t\t<td>{$objectNice}</td>\n\t\t\t\t\t<td><a href=\"{$handler}ingroup?type=object&subtype={$object}\">{$count}</a></td>\n\t\t\t\t</tr> "; } /* trying to get things set with group acl but can't make it work yet $inacl=aga_get_acl_count($group,'in'); $outacl=aga_get_acl_count($group,'out'); $content.="<tr><td>".elgg_echo('aga:accesscount:in')."</td><td>".$inacl."</td></tr>"; $content.="<tr><td>".elgg_echo('aga:accesscount:out')."</td><td>".$outacl."</td></tr>"; */ //end table $statscontent .= "</table>"; $content .= elgg_view_module('aside', elgg_echo('aga:generalstats'), $statscontent); //show tags $content .= elgg_view_module('aside', elgg_echo('aga:populartags'), elgg_view_tagcloud(array('container_guid' => $guid, 'limit' => 500))); $params = array('filter_context' => 'aga', 'content' => $content, 'title' => $title); $body = elgg_view_layout('content', $params); echo elgg_view_page($title, $body); }
/** * Page hander for tags * * @param array $page Page array * * @return void */ function elgg_tagcloud_page_handler($page) { switch ($page[0]) { default: $title = elgg_view_title(elgg_echo('tags:site_cloud')); $options = array('threshold' => 0, 'limit' => 100, 'tag_name' => 'tags'); $tags = elgg_view_tagcloud($options); $content = $title . $tags; $body = elgg_view_layout('one_sidebar', array('content' => $content)); echo elgg_view_page(elgg_echo('tags:site_cloud'), $body); break; } }
$tags = elgg_get_tags($options); // make alphabetical sort($tags); } else { //use owner-set tags. Do not sort - need to show in correct order $tags = $group->menu_tags; } //start setting up the owner block - note this //is emulating the menu - needs to be separate from the actual menu $body = '<ul class="elgg-menu elgg-menu-owner-block elgg-menu-owner-block-default">'; //add the title link that points to the group tagcloud ('all' is a special tag) $url = elgg_get_site_url() . "group_tag_menu/group/" . $group->guid . "/all"; $body .= "<li><a href='{$url}'><strong>" . elgg_echo('au_group_tag_menu:menu') . "</strong></a></li>"; //as yet unused option to display as a tag cloud if ($group->menu_showastagcloud && !$group->menu_tags) { $body .= elgg_view_tagcloud(array('$container_guids' => $group->getGUID(), 'types' => 'object', 'threshold' => 0, 'limit' => $maxtags, 'tag_names' => array('tags'))); } // different arrays depending on whether tag cloud or saved menu tags if (!$group->menu_tags) { //using standard group tags so we have a tag cloud - multi-dimensional array foreach ($tags as $key) { $url = "group_tag_menu/group/" . $group->guid . "/" . urlencode($key->tag); $taglink = elgg_view('output/url', array('text' => ' - ' . $key->tag, 'href' => $url, 'title' => "{$key->tag} ({$key->total})", 'rel' => 'tag')); $body .= '<li>' . $taglink . '</li>'; } } else { //using menu tags so we just have a simple array of tags to read in foreach ($tags as $key) { $url = "group_tag_menu/group/" . $group->guid . "/" . urlencode($key); $taglink = elgg_view('output/url', array('text' => ' - ' . $key, 'href' => $url, 'title' => "{$key}", 'rel' => 'tag')); $body .= '<li>' . $taglink . '</li>';
<?php $title = elgg_echo('tagcloud:site_cloud'); $options = array('threshold' => 0, 'limit' => 100, 'tag_name' => 'tags', 'modified_time_lower' => time() - 86400); $content = elgg_view_tagcloud($options); $body = elgg_view_layout('one_sidebar', array('title' => $title, 'content' => $content)); echo elgg_view_page($title, $body);
<?php /** * Tag cloud widget */ $widget = elgg_extract('entity', $vars); elgg_push_context('tags'); echo elgg_view_tagcloud(['owner_guid' => $widget->owner_guid, 'threshold' => 1, 'limit' => $widget->num_items, 'tag_name' => 'tags']); elgg_pop_context();