PageRenderTime 74ms CodeModel.GetById 44ms RepoModel.GetById 1ms app.codeStats 0ms

/cso/cso_summary_of_enrollment_ways.php

https://github.com/eedsonpaul/iris
PHP | 222 lines | 176 code | 38 blank | 8 comment | 13 complexity | d0a2f6b75a7ee79fb53e669472aca13d MD5 | raw file
  1. <?php
  2. //File: CSO Degree Programs
  3. //Version 2: Revision Date: October 6, 2010
  4. //Version 1: Date: September 19, 2010
  5. //By: Stefany Marie Serino
  6. //CSO TEAM
  7. ?>
  8. <html>
  9. <head>
  10. <title>CSO</title>
  11. <style type="text/css">
  12. @import url("documents.css");
  13. .row0 { background-color: #EAEAEA; }
  14. .row1 { background-color:#FFFFFF; }
  15. </style>
  16. </head>
  17. <p><a href="javascript:history.go(-1)"><b>BACK</b></a></p>
  18. <body>
  19. <!-- HEADER -->
  20. <p align=center><img src="up_logo.jpg" width=80 height=80></p>
  21. <p class=headfont>
  22. UNIVERSITY OF THE PHILIPPINES VISAYAS CEBU COLLEGE
  23. <br/><br/>
  24. </p>
  25. <p class=notice>
  26. <b>REPORT<br/>
  27. <u><?php session_start(); echo $_SESSION['semester'];?>, <?php echo $_SESSION['academic_year'];?></u></b><br/>
  28. AS OF <?php echo date("D M d H:i:s T Y"); ?>
  29. </p>
  30. <br/><br/><br/><br/>
  31. <!-- BODY -->
  32. <?php
  33. include ('connect_to_database.php');
  34. include ('cso_enrollment_functions.php');
  35. $action = $_GET['by'];
  36. if ($action == 'class') echo byClass();
  37. else if ($action == 'course') echo byCourse();
  38. else if ($action == 'courseAndYearLevel') echo byCourseAndYearLevel ();
  39. ?>
  40. </body>
  41. </html>
  42. <?php
  43. function byClass() {
  44. $prog_array = mysql_query("SELECT * FROM degree_program");
  45. while ($programs = mysql_fetch_array($prog_array)) {
  46. extract($programs);
  47. echo "<p class=headfont><u>".strtoupper($degree_name)."</u></p>";
  48. echo "<p class=notice><u>ENROLLMENT BY CLASS</u><br/></p>";
  49. print "<center><table width=800>
  50. <tr bgcolor = #A2A2A2>
  51. <td>#</td>
  52. <td>COURSE CODE</td>
  53. <td>SECTION</td>
  54. <td>MALE</td>
  55. <td>FEMALE</td>
  56. <td>TOTAL</td>
  57. </tr>";
  58. $offered_subjects = mysql_query("SELECT * FROM offered_subjects a, section b WHERE a.degree_program_id=$degree_program_id AND a.course_code = b.course_code ");
  59. $count=1;
  60. $rowclass=0;
  61. while ($offered_classes=mysql_fetch_array($offered_subjects)) {
  62. extract($offered_classes);
  63. echo "<tr class=row" .$rowclass ."><td>".$count ."</td>" ;
  64. $rowclass = 1 - $rowclass;
  65. $count++;
  66. echo "<td>" .strtoupper($course_code)."</td>"."<td>" .strtoupper($section_label)."</td>";
  67. //get male students from the said class
  68. $males = sprintf("SELECT a.student_number, b.gender FROM student_status a, student b WHERE section_label='%s' AND course_code='%s' AND a.student_number=b.student_number AND b.gender='%s' ",
  69. mysql_real_escape_string($section_label),
  70. mysql_real_escape_string($course_code),
  71. mysql_real_escape_string('male'));
  72. //check if students are enrolled.
  73. $male_count = countStudents($males);
  74. //get female students from the said class
  75. $females = sprintf("SELECT a.student_number, b.gender FROM student_status a, student b WHERE section_label='%s' AND course_code='%s' AND a.student_number=b.student_number AND b.gender='%s' ",
  76. mysql_real_escape_string($section_label),
  77. mysql_real_escape_string($course_code),
  78. mysql_real_escape_string('female'));
  79. $female_count = countStudents($females);
  80. $total = $female_count + $male_count;
  81. echo "<td>" .$male_count ."</td>";
  82. echo "<td>" .$female_count."</td>";
  83. echo "<td>" .$total ."</td></tr>";
  84. }
  85. print "</table></center><br/><br/>";
  86. }
  87. }
  88. function byCourse () {
  89. echo "<p class=headfont><u>ENROLLMENT by COURSE</u><br/><br/></p>";
  90. $prog_array = mysql_query("SELECT * FROM degree_program");
  91. echo "<center><table width=800><tr bgcolor=#A2A2A2>
  92. <td width=50>#</td>
  93. <td width=300>DEGREE PROGRAM</td>
  94. <td width=100>MALE</td>
  95. <td width=100>FEMALE</td>
  96. <td width=100>TOTAL</td>
  97. </tr>";
  98. $count=1;
  99. $rowclass=0;
  100. while ($progs = mysql_fetch_array($prog_array)) {
  101. extract($progs);
  102. $males = sprintf("SELECT * FROM student WHERE gender='%s' AND degree_program_id='%s' ",
  103. mysql_real_escape_string('male'),
  104. mysql_real_escape_string($degree_program_id));
  105. $females = sprintf("SELECT * FROM student WHERE gender='%s' AND degree_program_id='%s' ",
  106. mysql_real_escape_string('female'),
  107. mysql_real_escape_string($degree_program_id));
  108. $male_count = countStudents($males);
  109. $female_count=countStudents($females);
  110. $total = $female_count + $male_count;
  111. echo "<tr class=row" .$rowclass .">".
  112. "<td>" .$count ."</td>".
  113. "<td>" .$degree_name ."</td>".
  114. "<td>" .$male_count . "</td>".
  115. "<td>" .$female_count. "</td>".
  116. "<td>" .$total ."</td></tr>";
  117. $rowclass = 1 - $rowclass;
  118. $count++;
  119. }
  120. echo "</table></center>";
  121. }
  122. function byCourseAndYearLevel () {
  123. echo "<p class=headfont><u>ENROLLMENT by COURSE and YEAR LEVEL</u><br/><br/></p>";
  124. echo "<center><table width=100%>
  125. <tr rowspan=2 bgcolor=#A2A2A2>
  126. <th>course</th>
  127. <th colspan=3>FIRST YEAR</th>
  128. <th colspan=3>SECOND YEAR</th>
  129. <th colspan=3>THIRD YEAR</th>
  130. <th colspan=3>FOURTH YEAR</th>
  131. <th colspan=3>TOTAL</th>
  132. </tr>
  133. <tr bgcolor=#A2A2A2 align=center valign=center>
  134. <td></td>
  135. <td>Male</td>
  136. <td>Female</td>
  137. <td>Total</td>
  138. <td>Male</td>
  139. <td>Female</td>
  140. <td>Total</td>
  141. <td>Male</td>
  142. <td>Female</td>
  143. <td>Total</td>
  144. <td>Male</td>
  145. <td>Female</td>
  146. <td>Total</td>
  147. <td>Male</td>
  148. <td>Female</td>
  149. <td>Total</td>
  150. </tr>";
  151. $rowclass=0;
  152. $prog_array = mysql_query("SELECT degree_name, degree_program_id FROM degree_program");
  153. while ($courses = mysql_fetch_array($prog_array)) {
  154. extract($courses);
  155. echo "<tr class=row" .$rowclass ."><td>".$degree_name ."</td>" ;
  156. $rowclass = 1 - $rowclass;
  157. $year_level = 1;
  158. $all_male_count=0;
  159. $all_female_count=0;
  160. while ($year_level <= 4) {
  161. $males = sprintf("SELECT * FROM student WHERE year_level='%s' AND gender='%s' AND degree_program_id='%s' ",
  162. mysql_real_escape_string($year_level),
  163. mysql_real_escape_string('male'),
  164. mysql_real_escape_string($degree_program_id));
  165. $male_count = countStudents($males);
  166. $all_male_count+=$male_count;
  167. $females = sprintf("SELECT * FROM student WHERE year_level='%s' AND gender='%s' AND degree_program_id='%s' ",
  168. mysql_real_escape_string($year_level),
  169. mysql_real_escape_string('female'),
  170. mysql_real_escape_string($degree_program_id));
  171. $female_count = countStudents($females);
  172. $all_female_count+=$female_count;
  173. $total = $male_count + $female_count;
  174. echo "<td align=center valign=center>" .$male_count ."</td>";
  175. echo "<td align=center valign=center>" .$female_count ."</td>";
  176. echo "<td align=center valign=center>". $total ."</td>";
  177. $year_level++;
  178. }
  179. $all_count = $all_male_count + $all_female_count;
  180. echo "<td align=center valign=center>" .$all_male_count ."</td><td align=center valign=center>" .$all_female_count ."</td><td align=center valign=center>" .$all_count ."</td></tr>";
  181. }
  182. echo "</table></center>";
  183. }
  184. ?>