Skip to content

Instantly share code, notes, and snippets.

@stimms
Created June 29, 2010 19:56
Show Gist options
  • Save stimms/457724 to your computer and use it in GitHub Desktop.
Save stimms/457724 to your computer and use it in GitHub Desktop.
//enform specific code
require_once("../../lib/EnformSOAPClient.php");
$enf = new EnformSOAP();
$modulesComplete = array();
//just for PST and CSTS - because CSTS isn't a 'real' course we actually send completion for PST, odd I know
if($course->id == 104 || $course->id== 87)
{
$ers = $db->Execute("SELECT gi.itemname FROM mdl_grade_grades g, mdl_grade_items gi WHERE g.itemid = gi.id and g.userid={$USER->id} AND g.itemid IN (157,159,160,161)");
if ( ! $ers->EOF )
{
while ($user_obj = rs_fetch_next_record($ers))
{
$modulesComplete[] = str_replace(" Test", "", $user_obj->itemname);
}
}
rs_close($ers); // release the handle
$CSTSCompletions = $db->Execute("SELECT count(*) as total FROM mdl_grade_grades g, mdl_grade_items gi WHERE g.itemid = gi.id and g.userid={$USER->id} AND g.itemid IN (97,104)");
if(! $CSTSCompletions->EOF)
{
while ($count = rs_fetch_next_record($CSTSCompletions))
{
if($count->total == 2)
{
$modulesComplete[] = 'CSTS';
}
}
}
rs_close($CSTSCompletions);
$result = $enf->RegisterCourseCompletion($USER->idnumber, 104, 100, $modulesComplete);
}
else
{
$result = $enf->RegisterCourseCompletion($USER->idnumber, $course->id, 100, $modulesComplete);
}
}
//end enform specific
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment