Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- *
- */
- class enrollmentgrid extends dbo {
- public $__editLink = 'courses_edit.php';
- public $__delLink = 'courses_del.php';
- public function __construct($db='') {
- global $urls;
- $this->urls = $urls;
- }
- function renderAction($row) {
- $html = "<a href='".$this->urls['main_site']."/view_section_enrollments.php?instance_id=".@$row['ins_id']."'>";
- $html .= "<img border='0' src='".$this->urls['main_site']."/library/images/view.gif'/></a>\n";
- return $html;
- }
- /**
- * render a table of students registered for an instance at a particular site
- * (the 'left side' of the 2 columns)
- * @param string name of HTML checkbox
- * @param array Array of registration objects
- * @param array Array of waitlisted students
- * @return string HTML
- */
- function renderRegisteredAndWaitlistedStudentsForSite($checkboxName, $registrations, $waitlistedStudents) {
- $html = "<script>$checkboxName=0;</script><table id='left_side'>\n";
- $html .= "<tr><th width='10%'> </th><th width='40%'>Name</th><th width='10%'>Section</th><th width='40%'>Status</th></tr>\n";
- if(is_array($registrations)) {
- foreach($registrations as $reg) {
- $student = $reg->student;
- $rowOnClick = "onClick='studentRowClick(\"$checkboxName\",\"".$student->bbUserID."\",\"_s\");'";
- $html .= "<tr id='row_".$student->bbUserID."_s' class='studentRow'>\n";
- $html .= "<td><input $rowOnClick type='checkbox' id='".$checkboxName.$student->bbUserID."_s' name='$checkboxName"."[".$student->bbUserID."]'></td>\n";
- $html .= "<td><label for='".$checkboxName.$student->bbUserID."_s'>".$student->lastName.", ".$student->firstName."</label></td>\n";
- $html .= "<td>".section::loadByAny("section","id",$reg->section_id)->number."</td>\n";
- $html .= "<td>".$reg->status."</td>\n";
- $html .= "</tr>\n";
- }
- }
- if(is_array($waitlistedStudents)) {
- foreach($waitlistedStudents as $student) {
- $rowOnClick = "onClick='studentRowClick(\"$checkboxName\",\"".$student->bbUserID."\",\"_w\");'";
- $html .= "<tr class='studentRow tableRowAlreadyWaitlisted' id='row_".$student->bbUserID."_w'>\n";
- $html .= "<td><input $rowOnClick type='checkbox' id='".$checkboxName.$student->bbUserID."_w' name='$checkboxName"."[".$student->bbUserID."]'></td>\n";
- $html .= "<td><label for='".$checkboxName.$student->bbUserID."_s'>".$student->lastName.", ".$student->firstName."</label></td>\n";
- $html .= "<td>".section::loadByAny("section","id",$reg->section_id)->number."</td>\n";
- $html .= "<td>Waitlisted</td>\n";
- $html .= "</tr>\n";
- }
- }
- $html .= "</table>\n";
- return $html;
- }
- /**
- * render a table of students available at a particular site
- * (the 'right side' of the 2 columns)
- * @param string name for checkbox array
- * @param array Array of student objects
- * @param Instance Instance object
- * @param array Array of students registered for given instance
- * @return string HTML
- */
- function renderAvailableStudentsForSite($checkboxName,$students, $instance, $registrations) {
- $html = "<script>var $checkboxName=0;</script><table id='right_side'>\n";
- $html .= "<tr><th width='10%'> </th><th width='50%'>Name</th><th width='40%'>Status</th></tr>\n";
- foreach($students as $student) {
- $rowOnClick = "onClick='studentRowClick(\"$checkboxName\",\"".$student->bbUserID."\",\"_a\");'";
- if ($instance->isStudentRegistered($student)) {
- $html .= "<tr class='studentRow tableRowAlreadyRegistered' id='row_".$student->bbUserID."_a'>\n";
- $html .= "<td><input type='checkbox' disabled name='$checkboxName"."[".$student->bbUserID."]'></td>\n";
- $html .= "<td>".$student->lastName.", ".$student->firstName."</td>\n";
- $html .= "<td>Registered in this instance</td>\n";
- $html .= "</tr>\n";
- } elseif ($instance->isStudentWaitlisted($student)) {
- $html .= "<tr class='studentRow tableRowAlreadyWaitlisted' id='row_".$student->bbUserID."_a'>\n";
- $html .= "<td><input type='checkbox' disabled name='$checkboxName"."[".$student->bbUserID."]'></td>\n";
- $html .= "<td>".$student->lastName.", ".$student->firstName."</td>\n";
- $html .= "<td>Waitlisted in this instance</td>\n";
- $html .= "</tr>\n";
- } else {
- $html .= "<tr class='studentRow' id='row_".$student->bbUserID."_a'>\n";
- $html .= "<td><input $rowOnClick type='checkbox' id='".$checkboxName.$student->bbUserID."_a' name='$checkboxName"."[".$student->bbUserID."]'></td>\n";
- $html .= "<td><label for='".$checkboxName.$student->bbUserID."_a'>".$student->lastName.", ".$student->firstName."</label></td>\n";
- $html .= "<td> </td>";
- $html .= "</tr>\n";
- }
- }
- $html .= "</table>\n";
- return $html;
- }
- /**
- * we'll also put code here to render the grid of students enrolled in a particular instance
- *
- * @param array Array of student objects
- * @return string HTML
- */
- function renderStudentsForNonSite($checkboxName,$registrations) {
- $html = "<script>$checkboxName=0;</script><table>\n";
- $html .= "<tr><th> </th><th>Name</th><th>Site</th><th>Status</th></tr>\n";
- foreach($registrations as $reg) {
- $student = $reg->student;
- $rowOnClick = "onClick='studentRowClick(\"$checkboxName\",\"".$student->bbUserID."\",\"_x\");'";
- $html .= "<tr id='row_".$student->bbUserID."_x' class='studentRow'>\n";
- $html .= "<td><input $rowOnClick type='checkbox' id='".$checkboxName.$student->bbUserID."_x' name='$checkboxName"."[".$student->bbUserID."]'></td>\n";
- $html .= "<td><label for='".$checkboxName.$student->bbUserID."_x'>".$student->lastName.", ".$student->firstName."</label></td>\n";
- $html .= "<td>".site::getSite($student->siteID)->name."</td>\n";
- $html .= "<td>".$student->status."</td>\n";
- $html .= "</tr>\n";
- }
- $html .= "</table>\n";
- return $html;
- }
- }
- ?>
Add Comment
Please, Sign In to add comment