Example #1
0
 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) {
     $added_members = array();
     $user_provision = array();
     $membershipFromConsumer = array();
     // 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()) {
         // Get array of membership from consumer
         $members = $context->doMembershipsService();
         // Failure and single context --- abandon with error message
         if (!$members && sizeof(contexts) == 1) {
             register_error(sprintf(elgg_echo('LTI:members:error:noservice'), $context->consumer_instance->guid));
             forward($group->getURL());
         }
         if (!$members && sizeof($contexts) > 1) {
             register_error(sprintf(elgg_echo('LTI:members:error:noservice'), $context->consumer_instance->guid));
             break;
         }
         // If there are members
         if (!empty($members)) {
             foreach ($members as $member) {
                 $user = null;
Example #2
0
$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');
$delete = $deletions == 'yes' ? true : false;
$added_members = unserialize($_SESSION['added_members']);
if ($delete) {
    $deleted_members = unserialize($_SESSION['deleted_members']);
}
$changed_members = unserialize($_SESSION['changed_members']);
$role_changed_del = unserialize($_SESSION['role_changed_del']);
$role_changed_add = unserialize($_SESSION['role_changed_add']);
$user_provision = unserialize($_SESSION['user_provision']);
/*------------------------------------------------------------------
Example #3
0
function LTI_Group_Delete($event, $object_type, $group)
{
    // Check we have LTI group (i.e. it has a context and consumer_key) and the delete
    // event is occurring
    if (!empty($group->context_id) && !empty($group->consumer_key) && $event == 'delete') {
        $consumer_instance = new LTI_Tool_Consumer_Instance($group->consumer_key, elgg_get_config('dbprefix'));
        $context = new LTI_Context($consumer_instance, $group->context_id);
        if (elgg_is_active_plugin('notifications')) {
            if ($context->hasMembershipsService()) {
                // Inform all instructors that group is being deleted using
                // membership list from consumer
                InformInstructorsViaLTIMembership($group, $context, $consumer_instance->guid);
            } else {
                // No Membership service, so use group members
                InformInstructorsViaGroupMembership($group);
            }
        }
        $context->delete();
    }
    return true;
}