Skip to content

Commit

Permalink
Fix registrationListSample form.
Browse files Browse the repository at this point in the history
The RegistrationListSample has a form for creating registrations, which
doesn't do anything-creating a registration requires a courseId and
neither this nor any other page supplies it. I've added a select list
of courses so the createRegistration call can succeed.
  • Loading branch information
Nathan Skirvin committed Feb 21, 2014
1 parent cc9229a commit 48ebf6c
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions samples/RegistrationListSample.php
Expand Up @@ -62,20 +62,33 @@
$regService = $ScormService->getRegistrationService();

if(isset($courseid)){
$allResults = $regService->GetRegistrationList(null,$courseid);
$allResults = $regService->GetRegistrationList(null,$courseid,null);
}else{
$allResults = $regService->GetRegistrationList(null,null);
$allResults = $regService->GetRegistrationList(null,null,null);
}



echo '<form action="CreateRegistrationSample.php" method="GET">';
echo '<input type="hidden" name="courseid" value="'.$courseid.'"/>';
?>
<h3>Create New Registration</h3>
Email: <input type="text" name="learnerid" /><br/>
First Name:<input type="text" name="learnerfirstname" /><br/>
Last Name:<input type="text" name="learnerlastname" /><br/>
<?php
if (isset($courseid)){
echo '<input type="hidden" name="courseid" value="'.$courseid.'"/>';
}else{
echo '<select name="courseid">';
$courseService = $ScormService->getCourseService();
$allCourses = $courseService->GetCourseList();
foreach($allCourses as $course)
{
echo '<option value="'.$course->getCourseId().'">'.$course->getTitle().'</option>';
}
echo '</select><br/>';
}
?>
<input type="submit" name="submit" value="Submit" />
</form>
<br/><br/>
Expand Down

0 comments on commit 48ebf6c

Please sign in to comment.