Example #1
0
<?php

/**
 * ARLearn Message Board index page
 *
 * @package MessageBoard
 */
elgg_load_library('elgg:wespot_arlearnservices');
$group = elgg_get_page_owner_entity();
$threadId = get_input('threadId');
// sync with ARLearn
wespot_msg_sync_messages($group, $threadId);
elgg_push_breadcrumb($group->name, $group->getURL());
$title = elgg_echo('wespot_msg:owner', array($group->name));
$mb_url = '';
elgg_push_breadcrumb(elgg_echo('wespot_msg:board'), $mb_url);
$options = array('type' => 'object', 'subtype' => 'arlearn_msg', 'container_guids' => $group->getGUID(), 'metadata_names' => array('threadId'), 'metadata_values' => array($threadId), 'order_by_metadata' => array('name' => 'post_date', 'direction' => DESC, 'as' => integer), 'limit' => 10, 'full_view' => true, 'view_type_toggle' => false, 'pagination' => true);
$messages = elgg_list_entities_from_metadata($options);
if (empty($messages)) {
    $messages = elgg_echo('wespot_msg:none');
}
$vars = array('filter' => false, 'content' => $messages, 'title' => $title, 'reverse_order_by' => false);
$body = elgg_view_layout('content', $vars);
echo elgg_view_page($title, $body);
Example #2
0
/**
 * Elgg wespot_msg widget view
 *
 */
set_context('wespot_msg');
elgg_load_js('google_channel');
elgg_load_js('elgg.wespot_msg.channel');
elgg_load_js('elgg.wespot_msg');
elgg_load_js('elgg.wespot_msg.infinite_scroll');
elgg_load_js('jquery-waypoints');
elgg_load_js('elgg.wespot_msg.infinite_scroll.automatic_pagination');
elgg_load_js('jquery-viewport');
elgg_load_library('elgg:wespot_arlearn');
elgg_load_library('elgg:wespot_msg');
$group = elgg_get_page_owner_entity();
wespot_msg_sync_messages($group, $vars['entity']->threadId);
$offset = $vars['offset'];
$metadata_name_value_pair = array();
$metadata_name_value_pair[] = array('name' => 'threadId', 'value' => $vars['entity']->threadId, 'operand' => '=');
if (!empty($offset)) {
    $metadata_name_value_pair[] = array('name' => 'post_date', 'value' => $offset, 'operand' => '>');
}
$num_display = $vars['entity']->num_display;
$options = array('type' => 'object', 'subtype' => 'arlearn_msg', 'container_guid' => $group->getGUID(), 'metadata_name_value_pair' => $metadata_name_value_pair, 'order_by_metadata' => array('name' => 'post_date', 'direction' => DESC, 'as' => integer), 'limit' => $num_display, 'offset' => 0, 'full_view' => true, 'view_type_toggle' => false, 'reverse_order_by' => false, 'pagination' => true);
$messages = elgg_get_entities_from_metadata($options);
$defaults = array('items' => array_reverse($messages), 'list_class' => 'elgg-list elgg-list-entity', 'full_view' => true);
echo '<div class="elgg-widget-content-wespot_msg">';
echo '<div class="elgg-infinite-scroll-bottom">';
echo '<a href="" class="elgg-button">' . elgg_echo('infinite_scroll:load_more') . '</a>';
echo '</div>';
//echo elgg_view('page/components/list', $defaults);