Example #1
0
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> &nbsp; ";
                }
            } 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;
}
Example #2
0
/**
 * Returns HTML for a blog post.
 *
 * @param int $guid of a blog entity.
 * @return string html
 */
function blog_get_page_content_read($owner_guid = NULL, $guid = NULL)
{
    $content = elgg_view('page_elements/content_header', array('context' => $context, 'type' => 'blog'));
    if ($guid) {
        $blog = get_entity($guid);
        if (!elgg_instanceof($blog, 'object', 'blog') && $blog->status == 'final') {
            $content .= elgg_echo('blog:error:post_not_found');
        } else {
            elgg_push_breadcrumb($blog->title, $blog->getURL());
            $content .= elgg_view_entity($blog, TRUE);
        }
    } else {
        $options = array('type' => 'object', 'subtype' => 'blog', 'full_view' => FALSE, 'order_by_metadata' => array('name' => 'publish_date', 'direction' => 'DESC', 'as' => 'int'));
        if ($owner_guid) {
            $options['owner_guid'] = $owner_guid;
        }
        // show all posts for admin or users looking at their own blogs
        // show only published posts for other users.
        if (!(isadminloggedin() || isloggedin() && $owner_guid == get_loggedin_userid())) {
            $options['metadata_name_value_pairs'] = array(array('name' => 'status', 'value' => 'published'), array('name' => 'publish_date', 'operand' => '<', 'value' => time()));
        }
        $content .= elgg_list_entities_from_metadata($options);
    }
    return array('content' => $content);
}
 /**
  * displays the list of accepted challenges
  */
 public function actionAccepted()
 {
     $page_owner = elgg_get_page_owner_entity();
     $this->page_elements['title'] = $page_owner->name . '\'s ' . elgg_echo('izap-contest:challenge:accepted');
     $list = elgg_list_entities_from_metadata(array('type' => 'object', 'subtype' => GLOBAL_IZAP_CONTEST_CHALLENGE_SUBTYPE, 'metadata_name' => 'accepted_by', 'metadata_value' => $page_owner->guid));
     if (empty($list) || $list == '') {
         $this->page_elements['content'] = '<div class="contentWrapper">' . elgg_echo('izap-contest:notfound') . '</div>';
     } else {
         $this->page_elements['content'] = $list;
     }
     $this->drawpage();
 }
Example #4
0
/**
 * Prepare the add/edit form variables
 *
 * @param ElggObject $video A video object.
 * @return array
 */
function videos_get_page_content_featured($guid = NULL)
{
    $return = array();
    $options = array('type' => 'object', 'subtype' => 'videos', 'full_view' => FALSE, 'limit' => 10, 'metadata_name_value_pairs' => array(array("name" => "featured", "value" => true)));
    $list = elgg_list_entities_from_metadata($options);
    $return['filter_context'] = 'Featured';
    $return['content'] = $list;
    $return['title'] = elgg_echo('videos:title:featured');
    elgg_push_breadcrumb($crumbs_title, "Featured");
    elgg_register_title_button();
    return $return;
}
function blog_get_page_content_list($offset, $base_url, $container_guid = NULL)
{
    $return = array();
    $return['filter_context'] = $container_guid ? 'mine' : 'all';
    $options = array('base_url' => $base_url, 'type' => 'object', 'subtype' => 'blog', 'full_view' => false, 'offset' => $offset);
    $current_user = elgg_get_logged_in_user_entity();
    if ($container_guid) {
        // access check for closed groups
        group_gatekeeper();
        $options['container_guid'] = $container_guid;
        $container = get_entity($container_guid);
        if (!$container) {
        }
        $return['title'] = elgg_echo('blog:title:user_blogs', array($container->name));
        $crumbs_title = $container->name;
        elgg_push_breadcrumb($crumbs_title);
        if ($current_user && $container_guid == $current_user->guid) {
            $return['filter_context'] = 'mine';
        } else {
            if (elgg_instanceof($container, 'group')) {
                $return['filter'] = false;
            } else {
                // do not show button or select a tab when viewing someone else's posts
                $return['filter_context'] = 'none';
            }
        }
    } else {
        $return['filter_context'] = 'all';
        $return['title'] = elgg_echo('blog:title:all_blogs');
        elgg_pop_breadcrumb();
        elgg_push_breadcrumb(elgg_echo('blog:blogs'));
    }
    elgg_register_title_button();
    // show all posts for admin or users looking at their own blogs
    // show only published posts for other users.
    $show_only_published = true;
    if ($current_user) {
        if ($current_user->guid == $container_guid || $current_user->isAdmin()) {
            $show_only_published = false;
        }
    }
    if ($show_only_published) {
        $options['metadata_name_value_pairs'] = array(array('name' => 'status', 'value' => 'published'));
    }
    $list = elgg_list_entities_from_metadata($options);
    if (!$list) {
        $return['content'] = elgg_echo('blog:none');
    } else {
        $return['content'] = $list;
    }
    return $return;
}
Example #6
0
function groups_search_page()
{
    elgg_push_breadcrumb(elgg_echo('search'));
    $tag = get_input("tag");
    $title = elgg_echo('groups:search:title', array($tag));
    // groups plugin saves tags as "interests" - see groups_fields_setup() in start.php
    $params = array('metadata_name' => 'interests', 'metadata_value' => $tag, 'type' => 'group', 'full_view' => false, 'no_results' => elgg_echo('groups:search:none'));
    $content = elgg_list_entities_from_metadata($params);
    $sidebar = elgg_view('groups/sidebar/find');
    $sidebar .= elgg_view('groups/sidebar/featured');
    $params = array('content' => $content, 'sidebar' => $sidebar, 'filter' => false, 'title' => $title);
    $body = elgg_view_layout('content', $params);
    echo elgg_view_page($title, $body);
}
Example #7
0
/** 
 * Custom function to grab entities belonging to a container OR a tag
 */
function am_list_entities_by_container_or_tag($options)
{
    if ($options['container_guid']) {
        $container_sql = "e.container_guid IN ({$options['container_guid']})";
    }
    if ($options['tag']) {
        $access_sql = get_access_sql_suffix('tag_meta_table');
        $tag_sql = "\n\t\t\t(\n\t\t\t\t(tag_msn.string IN ('tags')) AND ( BINARY tag_msv.string IN ('{$options['tag']}')) \n\t\t\t\tAND\n\t\t\t\t{$access_sql}\n\t\t\t)\n\t\t";
    }
    $subtypes = is_array($options['subtypes']) ? $options['subtypes'] : array();
    $limit = $options['limit'] === NULL ? 10 : $options['limit'];
    $offset = $options['offset'] === NULL ? 0 : $options['offset'];
    $title = $options['title'] === NULL ? 'Custom Module' : $options['title'];
    global $CONFIG;
    // As long as we have either a container_guid or a tag, use the $wheres
    if ($container_sql || $tag_sql) {
        $joins[] = "JOIN {$CONFIG->dbprefix}metadata tag_meta_table on e.guid = tag_meta_table.entity_guid";
        $joins[] = "JOIN {$CONFIG->dbprefix}metastrings tag_msn on tag_meta_table.name_id = tag_msn.id";
        $joins[] = "JOIN {$CONFIG->dbprefix}metastrings tag_msv on tag_meta_table.value_id = tag_msv.id";
        // Need to watch the brackets here..
        $wheres[] = "\n\t\t\t(\n\t\t\t\t{$container_sql}\n\t\t\t\tOR\n\t\t\t\t{$tag_sql}\n\t\t\t)\n\t\t";
    }
    // Not sure if I still need this one..
    elgg_push_context('search');
    // Don't display metadata menu
    elgg_push_context('widgets');
    $params = array('type' => 'object', 'subtypes' => $subtypes, 'joins' => $joins, 'wheres' => $wheres, 'full_view' => FALSE, 'limit' => $limit, 'offset' => $offset, 'owner_guids' => $options['owner_guids'], 'created_time_upper' => $options['created_time_upper'], 'created_time_lower' => $options['created_time_lower'], 'count' => $options['count']);
    if ($options['count']) {
        $entities = elgg_get_entities_from_metadata($params);
        echo $entities;
    } else {
        $entities = elgg_list_entities_from_metadata($params);
        if ($entities) {
            return $entities;
        } else {
            return "<div style='width: 100%; text-align: center; margin: 10px;'><strong>No results</strong></div>";
        }
    }
}
Example #8
0
elgg_push_breadcrumb(elgg_echo('groups'));
if (elgg_get_plugin_setting('limited_groups', 'groups') != 'yes' || elgg_is_admin_logged_in()) {
    elgg_register_title_button();
}
$selected_tab = get_input('filter', 'newest');
switch ($selected_tab) {
    case 'popular':
        $content = elgg_list_entities_from_relationship_count(array('type' => 'group', 'relationship' => 'member', 'inverse_relationship' => false, 'full_view' => false, 'no_results' => elgg_echo('groups:none')));
        break;
    case 'discussion':
        // Get only the discussions that have been created inside a group
        $dbprefix = elgg_get_config('dbprefix');
        $content = elgg_list_entities(array('type' => 'object', 'subtype' => 'discussion', 'order_by' => 'e.last_action desc', 'limit' => 40, 'full_view' => false, 'no_results' => elgg_echo('discussion:none'), 'joins' => array("JOIN {$dbprefix}entities ce ON ce.guid = e.container_guid"), 'wheres' => array('ce.type = "group"'), 'distinct' => false, 'preload_containers' => true));
        break;
    case 'featured':
        $content = elgg_list_entities_from_metadata(array('type' => 'group', 'metadata_name' => 'featured_group', 'metadata_value' => 'yes', 'full_view' => false));
        if (!$content) {
            $content = elgg_echo('groups:nofeatured');
        }
        break;
    case 'alpha':
        $dbprefix = elgg_get_config('dbprefix');
        $content = elgg_list_entities(array('type' => 'group', 'joins' => ["JOIN {$dbprefix}groups_entity ge ON e.guid = ge.guid"], 'order_by' => 'ge.name', 'full_view' => false, 'no_results' => elgg_echo('groups:none'), 'distinct' => false));
        break;
    case 'newest':
    default:
        $content = elgg_list_entities(array('type' => 'group', 'full_view' => false, 'no_results' => elgg_echo('groups:none'), 'distinct' => false));
        break;
}
$filter = elgg_view('groups/group_sort_menu', array('selected' => $selected_tab));
$sidebar = elgg_view('groups/sidebar/find');
Example #9
0
<?php

/**
* Elgg sent messages page
*
* @package ElggMessages
*/
gatekeeper();
$page_owner = elgg_get_page_owner_entity();
if (!$page_owner || !$page_owner->canEdit()) {
    $guid = 0;
    if ($page_owner) {
        $guid = $page_owner->getGUID();
    }
    register_error(elgg_echo("pageownerunavailable", array($guid)));
    forward();
}
elgg_push_breadcrumb(elgg_echo('messages:sent'));
elgg_register_title_button();
$title = elgg_echo('messages:sentmessages', array($page_owner->name));
$list = elgg_list_entities_from_metadata(array('type' => 'object', 'subtype' => 'messages', 'metadata_name' => 'fromId', 'metadata_value' => elgg_get_page_owner_guid(), 'owner_guid' => elgg_get_page_owner_guid(), 'full_view' => false));
$body_vars = array('folder' => 'sent', 'list' => $list);
$content = elgg_view_form('messages/process', array(), $body_vars);
$body = elgg_view_layout('content', array('content' => $content, 'title' => $title, 'filter' => ''));
echo elgg_view_page($title, $body);
Example #10
0
/**
* Ajaxmodule page handler
* 
* @param array $page From the page_handler function
* @return true|false Depending on success
*
*/
function ajaxmodule_page_handler($page)
{
    switch ($page[0]) {
        case 'load_activity_ping':
            // check for last checked time
            if (!($seconds_passed = get_input('seconds_passed', 0))) {
                echo '';
                exit;
            }
            $last_reload = time() - $seconds_passed;
            // Get current count of entries
            $current_count = elgg_get_river(array('count' => TRUE));
            // Get the count at the last reload
            $last_count = elgg_get_river(array('count' => TRUE, 'posted_time_upper' => $last_reload));
            if ($current_count > $last_count) {
                $count = $current_count - $last_count;
                $s = $count == 1 ? '' : 's';
                $link = "<a id='refresh-river-module' href='#' class='update_link'>{$count} update{$s}!</a>";
                $page_title = "[{$count} update{$s}] ";
                echo json_encode(array('count' => $count, 'link' => $link));
                exit;
            }
            break;
        case 'loadriver':
            // River options
            $options['ids'] = get_input('ids');
            $options['subject_guids'] = json_decode(get_input('subject_guids'));
            $options['object_guids'] = json_decode(get_input('object_guids'));
            $options['annotation_ids'] = json_decode(get_input('annotation_ids'));
            $options['action_types'] = json_decode(get_input('action_types'));
            $options['posted_time_lower'] = get_input('posted_time_lower');
            $options['posted_time_upper'] = get_input('posted_time_upper');
            $options['types'] = get_input('types');
            $options['subtypes'] = get_input('subtypes');
            $options['type_subtype_pairs'] = json_decode(get_input('type_subtype_pairs'));
            $options['relationship'] = get_input('relationship');
            $options['relationship_guid'] = get_input('relationship_guid');
            $options['inverse_relationship'] = get_input('inverse_relationship');
            $options['limit'] = get_input('limit', 15);
            $options['offset'] = get_input('offset', 0);
            $options['count'] = get_input('count');
            $options['order_by'] = get_input('order_by');
            $options['group_by'] = get_input('group_by');
            // Remove empty options
            foreach ($options as $key => $option) {
                if ($option === NULL || empty($options)) {
                    unset($options[$key]);
                }
            }
            $options = elgg_trigger_plugin_hook('get_options', 'river', '', $options);
            // Display river
            $river = elgg_list_river($options);
            if (!$river) {
                echo "<div style='font-weight: bold; margin-top: 10px; margin-bottom: 10px; border-top: 1px solid #aaa; width: 100%; text-align: center;'>" . elgg_echo('river:none') . "</div>";
            } else {
                //echo $river;
                echo elgg_trigger_plugin_hook('output', 'page', array(), $river);
            }
            break;
        case 'loadentities':
            // Entity options
            $options['container_guid'] = get_input('container_guid');
            $options['tag'] = get_input('tag', false);
            $options['tags'] = json_decode(get_input('tags', false));
            $options['types'] = json_decode(get_input('types'));
            $options['subtypes'] = json_decode(get_input('subtypes'));
            $options['limit'] = get_input('limit', 10);
            $options['offset'] = get_input('offset', 0);
            $options['owner_guids'] = json_decode(get_input('owner_guids'));
            $options['created_time_upper'] = get_input('created_time_upper');
            $options['created_time_lower'] = get_input('created_time_lower');
            $options['count'] = get_input('count', FALSE);
            // Store access status
            $access_status = access_get_show_hidden_status();
            // Check if bypassing hidden entities
            if (get_input('access_show_hidden_entities')) {
                // Override
                access_show_hidden_entities(true);
            }
            // Set 'listing type' for new simple listing if supplied
            if ($listing_type = get_input('listing_type', FALSE)) {
                set_input('ajaxmodule_listing_type', $listing_type);
            }
            // Make sure container guid isn't empty
            $options['container_guid'] = !empty($options['container_guid']) ? $options['container_guid'] : ELGG_ENTITIES_ANY_VALUE;
            if (get_input('restrict_tag')) {
                // Grab content with supplied tags ONLY
                elgg_set_context('search');
                $options['type'] = 'object';
                $options['full_view'] = FALSE;
                // Multiple tags
                if ($options['tags']) {
                    foreach ($options['tags'] as $tag) {
                        $options['metadata_name_value_pairs'][] = array('name' => 'tags', 'value' => $tag, 'operand' => '=', 'case_sensitive' => FALSE);
                    }
                } else {
                    // Just one
                    $options['metadata_name_value_pairs'] = array(array('name' => 'tags', 'value' => $options['tag'], 'operand' => '=', 'case_sensitive' => FALSE));
                    unset($options['tag']);
                }
                unset($options['tags']);
                // Let plugins decide if we want to check the container of the container as well (ie photos)
                if ($options['container_guid'] && elgg_trigger_plugin_hook('check_parent_container', 'modules', $options['subtypes'], FALSE)) {
                    $dbprefix = elgg_get_config('dbprefix');
                    $cont = sanitise_int($options['container_guid']);
                    $options['joins'][] = "JOIN {$dbprefix}entities container_e on e.container_guid = container_e.guid";
                    $options['wheres'][] = "(e.container_guid in ({$cont}) OR container_e.container_guid in ({$cont}))";
                    unset($options['container_guid']);
                }
                if ($options['count']) {
                    $entities = elgg_get_entities_from_metadata($options);
                    echo $entities;
                    break;
                } else {
                    $content = elgg_list_entities_from_metadata($options);
                }
            } else {
                if (get_input('albums_images')) {
                    // Grab photos with tag, including photos in albums with tag
                    $options['full_view'] = FALSE;
                    $options['list_type'] = 'gallery';
                    $content = elgg_list_entities($options, 'am_get_entities_from_tag_and_container_tag');
                } else {
                    if (!get_input('restrict_tag') && $options['container_guid'] != ELGG_ENTITIES_ANY_VALUE) {
                        // Container supplied, and not restricting tags
                        $options['full_view'] = FALSE;
                        $content = elgg_list_entities($options);
                    } else {
                        // Default to container or tag
                        $content = am_list_entities_by_container_or_tag($options);
                    }
                }
            }
            // Display friendly message if there is no content
            if (!$content) {
                echo "<div style='width: 100%; text-align: center; margin: 10px;'><strong>No results</strong></div>";
            } else {
                echo $content;
            }
            break;
        default:
            access_show_hidden_entities($access_status);
            return FALSE;
    }
    access_show_hidden_entities($access_status);
    return TRUE;
}
Example #11
0
$widget = elgg_extract("entity", $vars);
$num_display = (int) $widget->num_display;
if ($num_display < 1) {
    $num_display = 5;
}
$show_random = $widget->show_random;
$featured_options = array("type" => "group", "limit" => $num_display, "full_view" => false, "pagination" => false, "metadata_name_value_pairs" => array("featured_group" => "yes"), "order_by" => "RAND()");
if ($widget->show_members == "yes") {
    $show_members = true;
} else {
    $show_members = false;
}
if ($show_members) {
    elgg_push_context("widgets_groups_show_members");
}
$featured = elgg_list_entities_from_metadata($featured_options);
if ($show_members) {
    elgg_pop_context();
}
$random = "";
if ($show_random == "yes") {
    $dbprefix = elgg_get_config("dbprefix");
    $featured_id = add_metastring("featured_group");
    $yes_id = add_metastring("yes");
    $random_options = array("type" => "group", "limit" => 1, "order_by" => "RAND()", "wheres" => array("NOT EXISTS (\n\t\t\t\tSELECT 1 FROM {$dbprefix}metadata md\n\t\t\t\tWHERE md.entity_guid = e.guid\n\t\t\t\t\tAND md.name_id = {$featured_id}\n\t\t\t\t\tAND md.value_id = {$yes_id})"));
    if ($random_groups = elgg_get_entities($random_options)) {
        $group = $random_groups[0];
        $title = elgg_view("output/url", array("text" => $group->name, "href" => $group->getURL()));
        $icon = elgg_view_entity_icon($group, "large");
        $random = elgg_view_module("main", $title, $icon, array("class" => "center"));
    }
Example #12
0
<?php

$options = array('type' => 'object', 'subtype' => 'showcase', 'metadata_name_value_pairs' => array('name' => 'featured', 'value' => 1), 'count' => true);
$count = elgg_get_entities_from_metadata($options);
if ($count) {
    unset($options['count']);
    echo elgg_list_entities_from_metadata($options);
} else {
    echo elgg_echo('showcase:noresults');
}
<?php

elgg_push_context('widgets');
echo elgg_list_entities_from_metadata(array('type' => 'object', 'subtype' => 'notification', 'owner_guid' => (int) elgg_get_logged_in_user_guid(), 'order_by_metadata' => array('name' => 'status', 'direction' => 'DESC'), 'list_class' => 'elgg-list-notifier', 'full_view' => false, 'pagination' => !elgg_is_xhr()));
elgg_pop_context();
Example #14
0
        $group_options['inverse_relationship'] = false;
        break;
    case 'featured':
        $group_options['metadata_names'] = ['name' => 'featured'];
        break;
    case 'open':
        $group_options['metadata_name_value_pairs'] = ['name' => 'membership', 'value' => ACCESS_PUBLIC];
        break;
    case 'closed':
        $group_options['metadata_name_value_pairs'] = ['name' => 'membership', 'value' => ACCESS_PUBLIC, 'operand' => '<>'];
        break;
    case 'alpha':
        $group_options['joins'] = ["JOIN {$dbprefix}groups_entity ge ON e.guid = ge.guid"];
        $group_options['order_by'] = 'ge.name ASC';
        break;
}
if (isset($group_options['relationship'])) {
    $content = elgg_list_entities_from_relationship($group_options);
} else {
    $content = elgg_list_entities_from_metadata($group_options);
}
if (empty($content)) {
    $content = elgg_echo('groups:none');
}
$filter = elgg_view('groups/group_sort_menu', ['selected' => $selected_tab]);
$sidebar = elgg_view('groups/sidebar/find');
$sidebar .= elgg_view('groups/sidebar/featured');
// build page
$body = elgg_view_layout('content', ['content' => $content, 'sidebar' => $sidebar, 'filter' => $filter]);
// draw page
echo elgg_view_page(elgg_echo('groups:all'), $body);
Example #15
0
    }
    if (elgg_is_active_plugin('messages')) {
        $forms .= elgg_view_form('faker/gen_messages');
    }
    if (elgg_is_active_plugin('discussions')) {
        $forms .= elgg_view_form('faker/gen_discussions');
    }
    $forms .= elgg_view_form('faker/gen_comments');
    if (elgg_is_active_plugin('likes')) {
        $forms .= elgg_view_form('faker/gen_likes');
    }
    if (elgg_is_active_plugin('countries')) {
        $forms .= elgg_view_form('faker/gen_location');
    }
}
$fakes = elgg_list_entities_from_metadata(array('metadata_names' => '__faker'));
$content = '<div id="faker-log">' . $fakes . '</div>';
$delete = elgg_view('output/url', array('text' => elgg_echo('faker:delete'), 'href' => 'action/faker/delete', 'confirm' => true, 'class' => 'elgg-button elgg-button-action'));
echo '<div class="clearfix">';
echo '<div class="elgg-col elgg-col-1of2">';
echo '<div class="pam">';
echo $forms;
echo '</div>';
echo '</div>';
echo '<div class="elgg-col elgg-col-1of2">';
echo '<div class="pam">';
echo elgg_view_module('aside', elgg_echo('faker:data'), $content, array('footer' => $delete));
echo '</div>';
echo '</div>';
echo '</div>';
?>
Example #16
0
<?php

elgg_load_js('lightbox');
elgg_load_css('lightbox');
elgg_require_js('wizard/admin_edit');
$guid = (int) get_input('guid');
elgg_entity_gatekeeper($guid, 'object', Wizard::SUBTYPE);
elgg_register_menu_item('title', ['name' => 'wizards', 'text' => elgg_echo('admin:administer_utilities:wizard'), 'href' => 'admin/administer_utilities/wizard', 'link_class' => 'elgg-button elgg-button-action']);
/* @var $entity Wizard */
$entity = get_entity($guid);
// wizard info
$title = elgg_echo('wizard:manage_steps:info:title');
$wizard_info = elgg_view_entity($entity, ['full_view' => false]);
echo elgg_view_module('inline', $title, $wizard_info);
// stepts
echo elgg_format_element('div', ['class' => 'clearfix'], elgg_view('output/url', ['text' => elgg_echo('add'), 'href' => "wizard_step/add/{$entity->getGUID()}", 'class' => ['elgg-lightbox', 'elgg-button', 'elgg-button-action', 'float-alt', 'mbn'], 'data-colorbox-opts' => json_encode(['width' => '650px;'])]));
$title = elgg_echo('wizard:manage_steps:steps:title');
$steps = elgg_list_entities_from_metadata(['type' => 'object', 'subtype' => WizardStep::SUBTYPE, 'limit' => false, 'container_guid' => $entity->getGUID(), 'order_by_metadata' => ['name' => 'order', 'as' => 'integer', 'direction' => 'ASC'], 'list_class' => 'wizard-manage-steps', 'no_results' => elgg_echo('wizard:no_steps')]);
echo elgg_view_module('inline', $title, $steps, ['class' => 'mts']);
Example #17
0
<?php

/** Setup **/
$options = array();
$title = 'Home';
//title is the title of page
$page_filter = 'all';
$action = 'create';
$pagination = '10';
/** Configuring the options to filter the content **/
$vetorFunctions = get_input('functions_list');
$vetorSpaces = get_input('spaces_list');
$pairFunctions = array('name' => 'functions', 'value' => $vetorFunctions);
$pairSpaces = array('name' => 'spaces', 'value' => $vetorSpaces);
$options = array('type' => 'object', 'subtype' => 'advisors', 'limit' => $pagination, 'owner_guid' => get_input("owner_guid", ELGG_ENTITIES_ANY_VALUE), 'full_view' => FALSE, 'metadata_case_sensitive' => FALSE, 'metadata_name_value_pairs_operator' => 'AND', 'metadata_name_value_pairs' => array($pairFunctions, $pairSpaces));
/** Setup page **/
$list_post = elgg_list_entities_from_metadata($options);
$params = array('content' => $list_post, 'filter_context' => $page_filter, 'class' => 'elgg-river-layout', 'spaces' => $vetorSpaces, 'functions' => $vetorFunctions, 'functSelected' => 'functionSelected');
$body = elgg_view_layout('two_sidebar_advisor', $params);
echo elgg_view_page($title, $body);
Example #18
0
/**
 * Get the subfolders of a folder
 *
 * @param ElggObject $folder the folder to get the subfolders for
 * @param bool       $list   output a list (default: false)
 *
 * @return bool|array|string
 */
function file_tools_get_sub_folders($folder = false, $list = false)
{
    $result = false;
    if (!empty($folder) && elgg_instanceof($folder, "object", FILE_TOOLS_SUBTYPE)) {
        $container_guid = $folder->getContainerGUID();
        $parent_guid = $folder->getGUID();
    } else {
        $container_guid = elgg_get_page_owner_guid();
        $parent_guid = 0;
    }
    $options = array("type" => "object", "subtype" => FILE_TOOLS_SUBTYPE, "container_guid" => $container_guid, "limit" => false, "metadata_name" => "parent_guid", "metadata_value" => $parent_guid, "order_by_metadata" => array('name' => 'order', 'direction' => 'ASC', 'as' => 'integer'), "full_view" => false, "pagination" => false);
    if ($list) {
        $folders = elgg_list_entities_from_metadata($options);
    } else {
        $folders = elgg_get_entities_from_metadata($options);
    }
    if ($folders) {
        $result = $folders;
    }
    return $result;
}
Example #19
0
<?php

/**
 * Simple Kaltura Most Played Sidebar
 * 
 * @package Simplekaltura
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
 * @author Jeff Tilson
 * @copyright THINK Global School 2010 - 2013
 * @link http://www.thinkglobalschool.com/
 * 
 */
if (!elgg_get_page_owner_guid()) {
    $options = array('type' => 'object', 'subtype' => 'simplekaltura_video', 'order_by_metadata' => array('name' => 'plays', 'as' => 'integer', 'direction' => 'DESC'), 'full_view' => FALSE, 'limit' => 5, 'offset' => 0, 'pagination' => FALSE);
    elgg_push_context('gallery');
    $videos = elgg_list_entities_from_metadata($options);
    elgg_pop_context();
    $module = elgg_view_module('aside', elgg_echo('simplekaltura:label:mostplayed'), $videos, array('class' => 'simplekaltura-sidebar-gallery-module'));
    echo $module;
}
Example #20
0
<?php

/**
 * View conversation thread
 */
$thread_id = get_input('thread_id');
$title = elgg_echo('thewire:thread');
elgg_push_breadcrumb(elgg_echo('thewire'), 'thewire/all');
elgg_push_breadcrumb($title);
$content = elgg_list_entities_from_metadata(array("metadata_name" => "wire_thread", "metadata_value" => $thread_id, "type" => "object", "subtype" => "thewire", "limit" => max(20, elgg_get_config('default_limit')), 'preload_owners' => true));
$body = elgg_view_layout('content', array('filter' => false, 'content' => $content, 'title' => $title));
echo elgg_view_page($title, $body);
Example #21
0
<?php

/**
 * List a developer's plugins
 */
$type = get_input('type', '');
//$tag = get_input('tag', '');
plugins_add_type_menu(page_owner());
//set the title
$types_string = elgg_echo("plugins:types:{$type}");
if (page_owner() == get_loggedin_userid()) {
    $title = sprintf(elgg_echo('plugins:yours'), $types_string);
} else {
    $title = sprintf(elgg_echo("plugins:user"), page_owner_entity()->name, $types_string);
}
$content = elgg_view_title($title);
//$pop = get_input('pop');
//$area2 = list_entities_from_annotation_count("object", "plugin_project", "download", 10, 0, 0, false, true, false);
// list plugins
set_context('search');
$params = array('types' => 'object', 'subtypes' => 'plugin_project', 'owner_guid' => page_owner(), 'limit' => 10, 'full_view' => FALSE);
if ($type) {
    $params['metadata_name'] = 'plugin_type';
    $params['metadata_value'] = $type;
    $content .= elgg_list_entities_from_metadata($params);
} else {
    $content .= elgg_list_entities($params);
}
$body = elgg_view_layout('two_column_left_sidebar', '', $content);
page_draw($title, $body);
Example #22
0
 /**
  *	Get the content for a list tab based on selected tab
  */
 function getListTabContent()
 {
     if ($this->list_tabs == 'date') {
         return $this->getDateTabContent();
     }
     $tab_var = $this->variables[$this->list_tabs];
     $first_option = $tab_var->options[0];
     $selected_tab = get_input('filter', $first_option);
     $container_guid = elgg_get_page_owner_guid();
     $options = array('type' => 'object', 'subtype' => $this->crud_type, 'limit' => 10, 'container_guid' => $container_guid, 'full_view' => false);
     if ($this->list_tabs && $selected_tab != 'all') {
         $metadata_search = true;
         $options['metadata_name_value_pairs'] = array(array('name' => $this->list_tabs, 'value' => $selected_tab));
     }
     if ($this->list_order) {
         $metadata_search = true;
         $options['order_by_metadata'] = array('name' => $this->list_order, 'direction' => $this->list_order_direction);
     }
     if ($metadata_search) {
         $content = elgg_list_entities_from_metadata($options);
     } else {
         $content = elgg_list_entities($options);
     }
     if (!$content) {
         $content = elgg_echo($this->module . ':' . $this->crud_type . ':none');
     }
     return $content;
 }
<?php

/**
* 	Plugin: Valoraciones linguisticas con HFLTS
*	Author: Rosana Montes Soldado
*			Universidad de Granada
*	Licence: 	CC-ByNCSA
*	Reference:	Microproyecto CEI BioTIC Ref. 11-2015
* 	Project coordinator: @rosanamontes
*	Website: http://lsi.ugr.es/rosana
*	
*	File: Array data of evaluations (an elgg list)
*/
$list = elgg_list_entities_from_metadata(['type' => 'object', 'subtype' => 'evaluation_content', 'order_by_metadata' => ['name' => 'state', 'direction' => 'ASC', 'as' => 'text']]);
if (!$list) {
    $list = '<p class="mtm">' . elgg_echo('evaluationcontent:none') . '</p>';
}
echo $list;
Example #24
0
<?php

/**
 * Renders a list of featured groups
 */
echo elgg_list_entities_from_metadata(array('type' => 'group', 'metadata_name' => 'featured_group', 'metadata_value' => 'yes', 'full_view' => false, 'no_results' => elgg_echo('groups:nofeatured')));
Example #25
0
function au_subgroups_handle_openclosed_tabs()
{
    $display_subgroups = elgg_get_plugin_setting('display_subgroups', 'au_subgroups');
    $display_alphabetically = elgg_get_plugin_setting('display_alphabetically', 'au_subgroups');
    $db_prefix = elgg_get_config('dbprefix');
    // all groups doesn't get link to self
    elgg_pop_breadcrumb();
    elgg_push_breadcrumb(elgg_echo('groups'));
    elgg_register_title_button();
    $selected_tab = get_input('filter');
    // default group options
    $group_options = array("type" => "group", "full_view" => false);
    if ($display_subgroups != 'yes') {
        $group_options['wheres'] = array("NOT EXISTS ( SELECT 1 FROM {$db_prefix}entity_relationships WHERE guid_one = e.guid AND relationship = '" . AU_SUBGROUPS_RELATIONSHIP . "' )");
    }
    if ($display_alphabetically != 'no') {
        $group_options['joins'] = array("JOIN {$db_prefix}groups_entity ge ON e.guid = ge.guid");
        $group_options['order_by'] = 'ge.name ASC';
    }
    switch ($selected_tab) {
        case "open":
            $group_options["metadata_name_value_pairs"] = array("name" => "membership", "value" => ACCESS_PUBLIC);
            break;
        case "closed":
            $group_options["metadata_name_value_pairs"] = array("name" => "membership", "value" => ACCESS_PUBLIC, "operand" => "<>");
            break;
        case "alpha":
            $dbprefix = elgg_get_config("dbprefix");
            $group_options["joins"] = array("JOIN " . $dbprefix . "groups_entity ge ON e.guid = ge.guid");
            $group_options["order_by"] = "ge.name ASC";
            break;
    }
    if (!($content = elgg_list_entities_from_metadata($group_options))) {
        $content = elgg_echo("groups:none");
    }
    $filter = elgg_view('groups/group_sort_menu', array('selected' => $selected_tab));
    $sidebar = elgg_view('groups/sidebar/find');
    $sidebar .= elgg_view('groups/sidebar/featured');
    $params = array('content' => $content, 'sidebar' => $sidebar, 'filter' => $filter);
    $body = elgg_view_layout('content', $params);
    echo elgg_view_page(elgg_echo('groups:all'), $body);
}
Example #26
0
<?php

/**
 * List banned users
 *
 * @todo figure out how to display users in a table
 *
 * @uses $vars['limit']
 * @uses $vars['pagination']
 */
// elgg makes it hard to list entities with an alternate view
elgg_register_plugin_hook_handler('view', 'user/default', 'banned_user_view');
$pagination = elgg_extract('pagination', $vars, true);
$limit = elgg_extract('limit', $vars, get_input('limit', 10));
$dbprefix = get_config('dbprefix');
$joins = array("JOIN {$dbprefix}users_entity u on e.guid = u.guid");
$params = array('type' => 'user', 'joins' => $joins, 'wheres' => array("u.banned = 'yes'"), 'limit' => $limit, 'full_view' => false, 'pagination' => $pagination);
$list = elgg_list_entities_from_metadata($params);
if ($list) {
    echo $list;
} else {
    echo elgg_echo('ban:none');
}
elgg_unregister_plugin_hook_handler('view', 'user/default', 'banned_user_view');
Example #27
0
        elgg_push_context("simple");
        break;
    default:
        elgg_push_context("listing");
        break;
}
$options = array("type" => "object", "subtype" => "blog", "limit" => $count, "full_view" => false, "pagination" => false, "view_type_toggle" => false, "metadata_name_value_pairs" => array());
// only show published blogs to non admins
if (!elgg_is_admin_logged_in()) {
    $options["metadata_name_value_pairs"][] = array("name" => "status", "value" => "published");
}
// limit to featured blogs?
if ($widget->show_featured == "yes") {
    $options["metadata_name_value_pairs"][] = array("name" => "featured", "value" => true);
}
if ($blogs = elgg_list_entities_from_metadata($options)) {
    if ($view_mode == 'slider') {
        $blog_entities = elgg_get_entities_from_metadata($options);
        echo "<div id='blog_tools_widget_items_container_" . $widget->getGUID() . "' class='blog_tools_widget_items_container'>";
        echo $blogs;
        echo "</div>";
        echo "<div id='blog_tools_widget_items_navigator_" . $widget->getGUID() . "' class='elgg-widget-more blog_tools_widget_items_navigator'>";
        foreach ($blog_entities as $key => $blog) {
            echo "<span rel='" . $blog->getGUID() . "'>" . ($key + 1) . "</span>";
        }
        echo "</div>";
        ?>
			<script type="text/javascript">
				function rotateBlogItems<?php 
        echo $widget->getGUID();
        ?>
Example #28
0
File: view.php Project: ibou77/elgg
<?php

/**
 * View a user's site notifications
 */
$page_owner = elgg_get_page_owner_entity();
if (!$page_owner || !$page_owner->canEdit()) {
    // must have access to view
    register_error(elgg_echo('site_notifications:no_access'));
    forward();
}
elgg_push_breadcrumb(elgg_echo('site_notifications'), 'site_notifications');
elgg_push_breadcrumb($page_owner->name);
$title = elgg_echo('site_notifications');
$list = elgg_list_entities_from_metadata(array('type' => 'object', 'subtype' => 'site_notification', 'owner_guid' => $page_owner->guid, 'full_view' => false, 'metadata_name' => 'read', 'metadata_value' => false));
$body_vars = array('list' => $list);
$form = elgg_view_form("site_notifications/process", array(), $body_vars);
$body = elgg_view_layout('content', array('content' => $form, 'title' => $title, 'filter' => ''));
echo elgg_view_page($title, $body);
/**
 * Get page components to show blogs with publish dates between $lower and $upper
 *
 * @param int $owner_guid The GUID of the owner of this page
 * @param int $lower      Unix timestamp
 * @param int $upper      Unix timestamp
 * @return array
 */
function blog_get_page_content_archive($owner_guid, $lower = 0, $upper = 0)
{
    $now = time();
    $owner = get_entity($owner_guid);
    elgg_set_page_owner_guid($owner_guid);
    $crumbs_title = $owner->name;
    if (elgg_instanceof($owner, 'user')) {
        $url = "blog/owner/{$owner->username}";
    } else {
        $url = "blog/group/{$owner->guid}/all";
    }
    elgg_push_breadcrumb($crumbs_title, $url);
    elgg_push_breadcrumb(elgg_echo('blog:archives'));
    if ($lower) {
        $lower = (int) $lower;
    }
    if ($upper) {
        $upper = (int) $upper;
    }
    $options = array('type' => 'object', 'subtype' => 'blog', 'full_view' => FALSE);
    if ($owner_guid) {
        $options['container_guid'] = $owner_guid;
    }
    // admin / owners can see any posts
    // everyone else can only see published posts
    if (!(elgg_is_admin_logged_in() || elgg_is_logged_in() && $owner_guid == elgg_get_logged_in_user_guid())) {
        if ($upper > $now) {
            $upper = $now;
        }
        $options['metadata_name_value_pairs'] = array(array('name' => 'status', 'value' => 'published'));
    }
    if ($lower) {
        $options['created_time_lower'] = $lower;
    }
    if ($upper) {
        $options['created_time_upper'] = $upper;
    }
    $list = elgg_list_entities_from_metadata($options);
    if (!$list) {
        $content .= elgg_echo('blog:none');
    } else {
        $content .= $list;
    }
    $title = elgg_echo('date:month:' . date('m', $lower), array(date('Y', $lower)));
    return array('content' => $content, 'title' => $title, 'filter' => '');
}
Example #30
0
<?php

/**
 * Elgg Gifts plugin
 * Send gifts to you friends
 *
 * @package Gifts
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
 * @author Christian Heckelmann
 * @copyright Christian Heckelmann
 * @link http://www.heckelmann.info
 *
 * updated by iionly (iionly@gmx.de)
 */
elgg_push_breadcrumb(elgg_echo('gifts:menu'), 'gifts/' . elgg_get_logged_in_user_entity()->username . '/index');
$title = elgg_echo('gifts:yourgifts');
elgg_push_breadcrumb($title);
$user_guid = elgg_get_logged_in_user_guid();
$access = elgg_set_ignore_access(true);
$result = elgg_list_entities_from_metadata(array('type' => 'object', 'subtype' => 'gift', 'metadata_name_value_pair' => array('name' => 'receiver', 'value' => $user_guid, 'operand' => '=')));
if (!empty($result)) {
    $area2 = $result;
} else {
    $area2 = elgg_echo('gifts:nogifts');
}
elgg_set_context('gifts');
// Format page
$body = elgg_view_layout('content', array('content' => $area2, 'filter' => '', 'title' => $title));
// Draw it
echo elgg_view_page($title, $body);
elgg_set_ignore_access($access);