Guest User

Untitled

a guest
Apr 23rd, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.79 KB | None | 0 0
  1. <?php
  2. *
  3. */
  4.  
  5. class enrollmentgrid extends dbo {
  6.  
  7. public $__editLink = 'courses_edit.php';
  8. public $__delLink = 'courses_del.php';
  9.  
  10. public function __construct($db='') {
  11. global $urls;
  12. $this->urls = $urls;
  13. }
  14.  
  15.  
  16. function renderAction($row) {
  17. $html = "<a href='".$this->urls['main_site']."/view_section_enrollments.php?instance_id=".@$row['ins_id']."'>";
  18. $html .= "<img border='0' src='".$this->urls['main_site']."/library/images/view.gif'/></a>\n";
  19. return $html;
  20. }
  21.  
  22.  
  23. /**
  24. * render a table of students registered for an instance at a particular site
  25. * (the 'left side' of the 2 columns)
  26. * @param string name of HTML checkbox
  27. * @param array Array of registration objects
  28. * @param array Array of waitlisted students
  29. * @return string HTML
  30. */
  31. function renderRegisteredAndWaitlistedStudentsForSite($checkboxName, $registrations, $waitlistedStudents) {
  32. $html = "<script>$checkboxName=0;</script><table id='left_side'>\n";
  33. $html .= "<tr><th width='10%'>&nbsp;</th><th width='40%'>Name</th><th width='10%'>Section</th><th width='40%'>Status</th></tr>\n";
  34. if(is_array($registrations)) {
  35. foreach($registrations as $reg) {
  36. $student = $reg->student;
  37. $rowOnClick = "onClick='studentRowClick(\"$checkboxName\",\"".$student->bbUserID."\",\"_s\");'";
  38. $html .= "<tr id='row_".$student->bbUserID."_s' class='studentRow'>\n";
  39. $html .= "<td><input $rowOnClick type='checkbox' id='".$checkboxName.$student->bbUserID."_s' name='$checkboxName"."[".$student->bbUserID."]'></td>\n";
  40. $html .= "<td><label for='".$checkboxName.$student->bbUserID."_s'>".$student->lastName.", ".$student->firstName."</label></td>\n";
  41. $html .= "<td>".section::loadByAny("section","id",$reg->section_id)->number."</td>\n";
  42. $html .= "<td>".$reg->status."</td>\n";
  43. $html .= "</tr>\n";
  44. }
  45. }
  46. if(is_array($waitlistedStudents)) {
  47. foreach($waitlistedStudents as $student) {
  48. $rowOnClick = "onClick='studentRowClick(\"$checkboxName\",\"".$student->bbUserID."\",\"_w\");'";
  49. $html .= "<tr class='studentRow tableRowAlreadyWaitlisted' id='row_".$student->bbUserID."_w'>\n";
  50. $html .= "<td><input $rowOnClick type='checkbox' id='".$checkboxName.$student->bbUserID."_w' name='$checkboxName"."[".$student->bbUserID."]'></td>\n";
  51. $html .= "<td><label for='".$checkboxName.$student->bbUserID."_s'>".$student->lastName.", ".$student->firstName."</label></td>\n";
  52. $html .= "<td>".section::loadByAny("section","id",$reg->section_id)->number."</td>\n";
  53. $html .= "<td>Waitlisted</td>\n";
  54. $html .= "</tr>\n";
  55. }
  56. }
  57. $html .= "</table>\n";
  58. return $html;
  59. }
  60.  
  61. /**
  62. * render a table of students available at a particular site
  63. * (the 'right side' of the 2 columns)
  64. * @param string name for checkbox array
  65. * @param array Array of student objects
  66. * @param Instance Instance object
  67. * @param array Array of students registered for given instance
  68. * @return string HTML
  69. */
  70. function renderAvailableStudentsForSite($checkboxName,$students, $instance, $registrations) {
  71. $html = "<script>var $checkboxName=0;</script><table id='right_side'>\n";
  72. $html .= "<tr><th width='10%'>&nbsp;</th><th width='50%'>Name</th><th width='40%'>Status</th></tr>\n";
  73. foreach($students as $student) {
  74. $rowOnClick = "onClick='studentRowClick(\"$checkboxName\",\"".$student->bbUserID."\",\"_a\");'";
  75. if ($instance->isStudentRegistered($student)) {
  76. $html .= "<tr class='studentRow tableRowAlreadyRegistered' id='row_".$student->bbUserID."_a'>\n";
  77. $html .= "<td><input type='checkbox' disabled name='$checkboxName"."[".$student->bbUserID."]'></td>\n";
  78. $html .= "<td>".$student->lastName.", ".$student->firstName."</td>\n";
  79. $html .= "<td>Registered in this instance</td>\n";
  80. $html .= "</tr>\n";
  81. } elseif ($instance->isStudentWaitlisted($student)) {
  82. $html .= "<tr class='studentRow tableRowAlreadyWaitlisted' id='row_".$student->bbUserID."_a'>\n";
  83. $html .= "<td><input type='checkbox' disabled name='$checkboxName"."[".$student->bbUserID."]'></td>\n";
  84. $html .= "<td>".$student->lastName.", ".$student->firstName."</td>\n";
  85. $html .= "<td>Waitlisted in this instance</td>\n";
  86. $html .= "</tr>\n";
  87. } else {
  88. $html .= "<tr class='studentRow' id='row_".$student->bbUserID."_a'>\n";
  89. $html .= "<td><input $rowOnClick type='checkbox' id='".$checkboxName.$student->bbUserID."_a' name='$checkboxName"."[".$student->bbUserID."]'></td>\n";
  90. $html .= "<td><label for='".$checkboxName.$student->bbUserID."_a'>".$student->lastName.", ".$student->firstName."</label></td>\n";
  91. $html .= "<td>&nbsp;</td>";
  92. $html .= "</tr>\n";
  93. }
  94. }
  95. $html .= "</table>\n";
  96. return $html;
  97. }
  98.  
  99.  
  100.  
  101. /**
  102. * we'll also put code here to render the grid of students enrolled in a particular instance
  103. *
  104. * @param array Array of student objects
  105. * @return string HTML
  106. */
  107. function renderStudentsForNonSite($checkboxName,$registrations) {
  108. $html = "<script>$checkboxName=0;</script><table>\n";
  109. $html .= "<tr><th>&nbsp;</th><th>Name</th><th>Site</th><th>Status</th></tr>\n";
  110. foreach($registrations as $reg) {
  111. $student = $reg->student;
  112. $rowOnClick = "onClick='studentRowClick(\"$checkboxName\",\"".$student->bbUserID."\",\"_x\");'";
  113. $html .= "<tr id='row_".$student->bbUserID."_x' class='studentRow'>\n";
  114. $html .= "<td><input $rowOnClick type='checkbox' id='".$checkboxName.$student->bbUserID."_x' name='$checkboxName"."[".$student->bbUserID."]'></td>\n";
  115. $html .= "<td><label for='".$checkboxName.$student->bbUserID."_x'>".$student->lastName.", ".$student->firstName."</label></td>\n";
  116. $html .= "<td>".site::getSite($student->siteID)->name."</td>\n";
  117. $html .= "<td>".$student->status."</td>\n";
  118. $html .= "</tr>\n";
  119. }
  120. $html .= "</table>\n";
  121. return $html;
  122. }
  123.  
  124.  
  125. }
  126. ?>
Add Comment
Please, Sign In to add comment