Skip to content

Instantly share code, notes, and snippets.

Avatar

Brian Rogers brianrogers

View GitHub Profile
@brianrogers
brianrogers / gist:3174200
Created Jul 25, 2012
RollupRegistrationOnExit with database inserts and interactions
View gist:3174200
public override void RollupRegistrationOnExit(ExternalRegistrationId externalReg, ExternalConfiguration externalConfig)
{
PettitExternalRegistrationId myExternalRegistrationId = externalReg as PettitExternalRegistrationId;
if (myExternalRegistrationId == null)
{
throw new ScormContentPlayerApplicationException("The external registration id argument was not a valid PettitExternalRegistrationId object.");
}
RegistrationSummary regSummary = ScormEngineManager.GetRegistrationSummary(externalReg, externalConfig);
// Completion is an enumeration: Unknown, Completed, Incomplete
Completion completionStatus = regSummary.CompletionStatus;
@brianrogers
brianrogers / gist:1444150
Created Dec 7, 2011
Changing the text in the left TOC menu
View gist:1444150
//add this code to the 'head' section of your left.jsp/aspx page
<script src="../scripts/thirdparty/jquery-1.3.2.min.js" type="text/javascript"></script>
<script>
$(document).ready(function(){
console.log('jquery loaded');
setTimeout("ChangeMenuItems()",1000);
});
@brianrogers
brianrogers / gist:1435319
Created Dec 5, 2011
SCORM Engine DataHelper Sample Code
View gist:1435319
DataHelper dh = Retrieve.Implementation.GetHelper(this.GetConnectionString(externalConfig));
ArrayList spParams = new ArrayList();
spParams.Add(new SPParam("@U_ID", myExternalRegistrationId.UserId));
// This sql query must be adjusted to suit your database
string sql =
@"select first_name, last_name
from Users
WHERE U_id = @U_ID
@brianrogers
brianrogers / gist:988166
Created May 24, 2011
ScormEngineManager basics
View gist:988166
//setup the externalConfig and externalPackageId
string serializedExternalConfiguration = "";
VanillaExternalConfiguration config = new VanillaExternalConfiguration();
config.ParseFromString(serializedExternalConfiguration);
string serializedExternalPackageId = "CourseId|123";
VanillaExternalPackageId pkgId = new VanillaExternalPackageId();
pkgId.ParseFromString(serializedExternalPackageId);
pkgId.VersionId = 0;
@brianrogers
brianrogers / gist:952734
Created May 3, 2011
GetExternalPackageIdFromExternalRegId Override
View gist:952734
//Change CLIENTNAME to your company code to match the rest of your integration overrides
//Replace ClientRegistrationKey with your ExternalRegistrationId keys
//Replace ClientPackageKey with your ExternalPackageId keys
public override ExternalPackageId GetExternalPackageIdFromExternalRegId(ExternalRegistrationId externalReg, ExternalConfiguration externalConfig)
{
if (externalReg.ExternalPackageId != null)
{ // we have it cached
Integration.Implementation.LogDetail("Default GetExternalPackageIdFromExternalRegId() called - cached id found, database bypassed", externalConfig);
return externalReg.ExternalPackageId;
@brianrogers
brianrogers / gist:914330
Created Apr 11, 2011
IntegrationInterface.IsAllowed
View gist:914330
/// <summary>
/// See <see cref="IntegrationInterface.IsAllowed"/> for a full description.
/// </summary>
/// <param name="request">Http Request on whose behalf the method is invoked</param>
/// <param name="method">The method that's being invoked</param>
/// <returns>True if the credentials in the HttpRequest are satisfactory to execute the given method</returns>
public override bool IsAllowed(HttpRequest request, SecureMethod method)
{
bool isAllowed = false;
@brianrogers
brianrogers / gist:902234
Created Apr 4, 2011
Package Property Overrides
View gist:902234
#region Default Package Properties
/// <summary>
/// See <see cref="IntegrationInterface.DefaultShowFinishButton"/> for a full description..
/// </summary>
/// <param name="learningStandard">The learning standard that governs delivery of the package</param>
/// <param name="singleSco">Will be true if there is only one SCO in the package (because this structure usually results in a different default setup)</param>
/// <param name="externalConfig">External configuration information.</param>
/// <returns>This implementation returns <see cref="YesNoValue.NO"/> for a single SCO, otherwise it returns <see cref="YesNoValue.YES"/>.</returns>
public override YesNo DefaultShowFinishButton(LearningStandard learningStandard, bool singleSco, ExternalConfiguration externalConfig)