$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']); /*------------------------------------------------------------------
$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; } } // Title $area2 = elgg_view_title(elgg_echo('LTI:members:label')); // Main text $formbody = elgg_echo('LTI:members:explain'); // Read back the last sync time if (sizeof($contexts) == 1 && $context->hasSettingService()) { $last_sync = $context->doSettingService(LTI_Context::EXT_READ, NULL); if (!empty($last_sync)) { $formbody .= sprintf(elgg_echo('LTI:members:explain:lastsync'), $last_sync); } } else { $formbody .= sprintf(elgg_echo('LTI:members:explain:lastsync:share')); foreach ($contexts as $context) { if ($context->hasSettingService()) { $last_sync = $context->doSettingService(LTI_Context::EXT_READ, NULL); if (!empty($last_sync)) { $formbody .= $context->title . ': ' . $last_sync . '<br />'; } } } }