예제 #1
0
$testmode = $values['testmode'];
// Get group details
$group_guid = (int) get_input('group_guid');
$group = get_entity($group_guid);
set_page_owner($group_guid);
// Update synchronisation time
$contexts = array();
// Get logged in user
$cur_user = elgg_get_logged_in_user_entity();
$consumer_instance = new LTI_Tool_Consumer_Instance($cur_user->consumer_key, elgg_get_config('dbprefix'));
$context = new LTI_Context($consumer_instance, $cur_user->context_id);
// Add this context as must be used
$contexts[] = $context;
if ($cur_user->consumer_key == $group->consumer_key) {
    // add the shared contexts --- get all the contexts
    $shares = $context->getShares();
    foreach ($shares as $share) {
        $consumer_instance = new LTI_Tool_Consumer_Instance($share->consumer_instance_guid, elgg_get_config('dbprefix'));
        $context = new LTI_Context($consumer_instance, $share->context_id);
        $contexts[] = $context;
    }
}
foreach ($contexts as $context) {
    // First check that we have a membership service. Strictly speaking we shouldn't end up here unless
    // there is a service as the Sync option shouldn't appear
    if ($context->hasMembershipsService() && $context->hasSettingService()) {
        // Lets try and write back the current time
        $context->doSettingService(LTI_Context::EXT_WRITE, date('d-M-Y H:i'));
    }
}
$deletions = get_input('delete');
예제 #2
0
<?php

/*-------------------------------------------------------------------
 * Elgg LTI
 *
 * List the sharing contexts
 ------------------------------------------------------------------*/
elgg_set_context('groups');
// Must be logged in to use this page
gatekeeper();
// Get group details
$group_guid = (int) get_input('group_guid');
$group = get_entity($group_guid);
elgg_set_page_owner_guid($group_guid);
// Sort out which consumer to get membership from
$consumer_instance = new LTI_Tool_Consumer_Instance($group->consumer_key, elgg_get_config('dbprefix'));
$context = new LTI_Context($consumer_instance, $group->context_id);
$list_of_shares = $context->getShares();
$area2 = elgg_view_title(elgg_echo('LTI:share:manage'));
if (!empty($list_of_shares)) {
    $text = '';
    foreach ($list_of_shares as $share) {
        $text .= elgg_view('object/shares', array('shares' => $share, 'group' => $group_guid));
    }
    $area2 .= $text;
} else {
    $area2 .= elgg_view('page/elements/body', array('body' => elgg_echo('LTI:share:noshared')));
}
$body = elgg_view_layout('two_column_left_sidebar', array('title' => '', 'content' => $area2));
// Finally draw the page
echo elgg_view_page($title, $body);