<?php
// Begin PHP script
//echo "crs:".$crs."sess:".$sess."yr:".$EXyear."<br />";
$year = 'yk2';
if ( $year=='2012' || $year=='2013' || $year=='2014') //temporary - fix year
{
//echo "year: $year<br />"; //for debugging
$nextyr=$year+1;
$prevyr=$year-1;
//echo "nextyear: $nextyr<br />"; //for debugging
//echo "prevyear: $prevyr<br />"; //for debugging
$prevyr = substr($prevyr, -2,2);
$lookupyr = substr($year, -2);
$nextyr = substr($nextyr, -2);
//echo "previous year: $prevyr - look up year: $lookupyr - next year: $nextyr<br />";//for debugging
// set EX Year according to session variable
if ( $sess == 'SP' ){ $EXyear=$prevyr.$lookupyr; }
else if ( $sess == 'SU' ){ $EXyear=$prevyr.$lookupyr; }
else { $EXyear=$lookupyr.$nextyr; }
//echo "EXyear:$EXyear<br />";//for debugging
}//temporary
else { $EXyear=$year; }
if (!isset($FacID))
{// if FacID is not set then check these variables
if (!isset($crs) || !isset($sess) || !isset($year))
exit("<h1 align='center'>Sorry, Improper Access</h1>");
if (!isset($ch)) { $ch="OFF"; }
if (!isset($cp)) { $cp="OFF"; }
if (!isset($sh)) { $sh="OFF"; }
if (!isset($ts)) { $ts="OFF"; }
if (!isset($tc)) { $tc="OFF"; }
if (!isset($wr)) { $wr="OFF"; }
if (!isset($all)) { $all=false; }
// ===============================
// Session module goes here
// ===============================
$campus_query = "";
$num_campus = 0;
$report = "";
// process campus selection
if(!$all == "ON")
{
$campus_query = "and ( ";
if ($ch =="ON")
{
$campus_query .= "section_master_v.loc_cde='CH' ";
$num_campus++;
$report .= "CH ";
}
if ($cp =="ON")
{
if($num_campus > 0)
$campus_query .= "or ";
$campus_query .= "section_master_v.loc_cde='CP' ";
$num_campus++;
$report .= "CP ";
}
if ($sh =="ON")
{
if($num_campus > 0)
$campus_query .= "or ";
$campus_query .= "section_master_v.loc_cde='SH' ";
$num_campus++;
$report .= "SH ";
}
if ($ts =="ON")
{
if($num_campus > 0)
$campus_query .= "or ";
$campus_query .= "section_master_v.loc_cde='TS' ";
$num_campus++;
$report .= "TS ";
}
if ($tc =="ON")
{
if($num_campus > 0)
$campus_query .= "or ";
$campus_query .= "section_master_v.loc_cde='TC' ";
$num_campus++;
$report .= "TC ";
}
if ($wr =="ON")
{
if($num_campus > 0)
$campus_query .= "or ";
$campus_query .= "section_master_v.loc_cde='WR' ";
$num_campus++;
$report .= "WR ";
}
$campus_query .= " ) ";
if($num_campus < 1)
{
exit("<table><tr><td><font color='white' size='2'><b>Please select a campus.</b></font></td></tr></table>");
}
}//if(!$all == "ON") -- process campus selection
else
{
$report = "ALL CAMPUSES";
}// else (!$all == "ON") -- process campus selection
//---------- set up calcuations for automatic year based on current date
$Cur_Date = getdate();
$Cur_Day = $Cur_Date['mday'];
$Cur_Month = $Cur_Date['mon'];
$Cur_Year = $Cur_Date['year'];
/* if ( $year=='2012' || $year=='2013' || $year=='2014') //temporary - fix year
{
//echo "year: $year<br />"; //for debugging
$nextyr=$year+1;
$prevyr=$year-1;
//echo "nextyear: $nextyr<br />"; //for debugging
//echo "prevyear: $prevyr<br />"; //for debugging
$prevyr = substr($prevyr, -2,2);
$lookupyr = substr($year, -2);
$nextyr = substr($nextyr, -2);
//echo "previous year: $prevyr - look up year: $lookupyr - next year: $nextyr<br />";//for debugging
// set EX Year according to session variable
if ( $sess == 'SP' ){ $EXyear=$prevyr.$lookupyr; }
else if ( $sess == 'SU' ){ $EXyear=$prevyr.$lookupyr; }
else { $EXyear=$lookupyr.$nextyr; }
//echo "EXyear:$EXyear<br />";//for debugging
}//temporary
else { $EXyear=$year; } */
$query = "select distinct section_master_v.crs_cde, section_master_v.crs_comp1, section_master_v.crs_comp2, section_master_v.crs_comp3, section_master_v.crs_comp4, section_master_v.loc_cde, section_master_v.crs_enrollment, section_master_v.section_sts, section_master_v.crs_capacity, section_master_v.crs_title ";
$query .="from section_master_v ";
$query .= "where section_master_v.trm_cde='". $sess . "' and section_master_v.yr_cde='". $EXyear. "' ";
$query .= $campus_query;
$query .= "and section_master_v.crs_comp1 LIKE '". $crs ."%' ";
$query .= "order by section_master_v.crs_comp1, section_master_v.crs_comp2, section_master_v.crs_comp4,
section_master_v.crs_comp3 ";
}// end if $FacID is not set
else
{// else $FacID is set
$query = "select distinct section_schedules.crs_cde, section_schedules.professor_id_num, section_schedules.comment_txt, section_schedules.crs_meet_type, name_master.last_name, name_master.first_name ";
$query .="from section_schedules left outer join name_master ";
$query .= "on section_schedules.professor_id_num=name_master.id_num ";
$query .= "where section_schedules.trm_cde='". $sess . "' and section_schedules.yr_cde='". $EXyear. "' and section_schedules.professor_id_num='". $FacID . "' ";
$query .= "order by section_schedules.crs_cde ";
$report = "ALL CAMPUSES";
}// end else $FacID is set
// print query for debug
//echo "<p><font color='white'>$query</p>";
function dbquery($sql) { // function to connect to db and fetch data into an array; function returns an array
$arr = array();
$conn = odbc_connect("sqlserver","jenzwebuser","pumpkin@pplepi3");
$rs = odbc_exec($conn,$sql);
$x = 1;
$ycount=0;
while (odbc_fetch_array($rs, $rownumber=null))
{
for ($y = 1; $y <= odbc_num_fields($rs); $y++)
{
$arr[$x][$y] = odbc_result($rs,$y);
$ycount=$y;
}
$x++;
}
// echo "x:".$x." y:".$ycount."<br />";
if ($x > 1)
return $arr;
else
return null;
}
$array = dbquery($query);
//$arraysize = count($array);
//echo "arraysize:".$arraysize."<br />";
// Main table for formatting - Beginning
echo "<table width='700' cellpadding='10' border='0'>";
echo "<tr><td width='5'></td><td align='left' valign='top'>";
// Dummy table beginning for proper output
echo "<table width='100%'><tr><td>";
// report info
echo "<table width='100%'><tr><td><font color='white'><b>Session: $sess $EXyear </td><td align='right'><font color='white'><b>Campuses: $report</td></tr></table>";
// search by department ---------------------seacrh by faculty id
// 1 - crs_cde 1 - crs_cde
// 2 - crs_comp1 2 - professor_id_num
// 3 - crs_comp2 3 - comment_txt
// 4 - crs_comp3 4 - crs_meet_type
// 5 - crs_comp4 5 - last_name
// 6 - loc_cde 6 - first_name
// 7 - crs_enrollment 7
// 8 - section_sts 8
// 9 - crs_capacity 9
// 10 - crs_title 10
if($array!=null )
{
echo "<table border='0' bgcolor='#BFBFBF' width='100%' style='border-collapse: collapse' bordercolor='black'><tr><td>";
$last_crsno = null;
for ($i=1; $i<count($array)+1; $i++)// step through array to get course info
{
//execute the SQL query and return course information
if (isset($FacID)) //search by faculty id
{
$crsmeettype = $array[$i][4];
$comtxt = $array[$i][3];
$crscde_1 = trim($array[$i][1]);
//$crscdearr = explode(" ",$crscde_1);
//$crscde_1 = trim($crscdearr[0])." ".trim($crscdearr[1])." ".trim($crscdearr[2]);
//if ( sizeof($crscdearr)==4 )
//{ $crscde_1 .= " ".trim($crscdearr[3]); }
$query = " select distinct section_master_v.crs_comp1, section_master_v.crs_comp2, section_master_v.crs_comp3, section_master_v.crs_comp4, section_master_v.loc_cde, section_master_v.crs_enrollment, section_master_v.section_sts, section_master_v.crs_capacity, section_master_v.crs_title FROM section_master_v WHERE ( section_master_v.yr_cde = '".$EXyear."' ) AND ( section_master_v.trm_cde = '".$sess."' ) AND ( section_master_v.crs_cde = '". trim($crscde_1)."' )";
// echo "q2:".$query."<br />";
$conn = odbc_connect("sqlserver","jenzwebuser","pumpkin@pplepi3");
$result = odbc_exec($conn,$query);
$row = odbc_fetch_array($result); //put results in array
$crscomp1 = $row["crs_comp1"]; // get 1st element
$crscomp2 = $row["crs_comp2"]; // get second element
$crscomp3 = $row["crs_comp3"]; // get thrid element
$crscomp4 = $row["crs_comp4"]; // get fourth element
$loccde = $row["loc_cde"]; // get fifth element
$crsenrll = $row["crs_enrollment"]; // get sixth element
$secsts = $row["section_sts"]; // get seventh element
$crscap = $row["crs_capacity"]; // get eighth element
$crstitle = $row["crs_title"]; // get eighth element
//fix instrutor name incase there in a peron called "Staff" (last name only)
$instructor_name = null;
if (trim($array[$i][6])==null ) // check first name
$instructor_name=$array[$i][5];
else
$instructor_name=$array[$i][5].", ".$array[$i][6];
//set course name
if ( trim($crscomp4) == 'L' ) // if comp4 is empty (not a lab)
$crs_no = trim($crscomp1)." ".trim($crscomp2)." ".trim($crscomp4); // add lab "L" to course name
else
$crs_no = trim($crscomp1)." ".trim($crscomp2); // don't add lab "L" to course name
if ( $last_crsno == $crs_no) //if last course name and current course name are the same, reset course name (do nothing really)
{
$crs_no = ""; // print nothing
}
else
{// current course name different then last course name. Make a new table with course name header
echo "<table border='0' width='100%'><tr>";
echo "<td colspan='2' width='40%'><font color='black'><b>" . $crs_no . "</b></font></td>";
echo "<td colspan='4' align='right'><b>". $crstitle. "</td></tr>";
echo "<tr bgcolor='white'>";
echo "<td align='center' width='10%'></td>";
echo "<td align='center'><b><font color='#2A4266'>Section</font></td>";
echo "<td align='center'><b><font color='#2A4266'>Campus</font></td>";
echo "<td align='center'><b><font color='#2A4266'>Instructor</font></td>";
echo "<td align='center'><b><font color='#2A4266'># Students</font></td>";
echo "<td align='center'><b><font color='#2A4266'>Notes</font></td></tr>";
$last_crsno = $crs_no;
}
}// end if seach by FacID
else //search by department
{
$crscde = trim($array[$i][1]); // get 1st element
$crscomp1 = trim($array[$i][2]); // get 2st element
$crscomp2 = trim($array[$i][3]); // get 3rd element
$crscomp3 = trim($array[$i][4]); // get 4th element
$crscomp4 = trim($array[$i][5]); // get 5th element
$loccde = trim($array[$i][6]); // get 6th element
$crsenrll = trim($array[$i][7]); // get 7th element
$secsts = trim($array[$i][8]); // get 8th element
$crscap = trim($array[$i][9]); // get 9th element
$crstitle = trim($array[$i][10]);
if ( $crscomp4 == 'L' ) // if comp4 is empty (not a lab)
$crs_no = $crscomp1." ".$crscomp2." ".$crscomp4; // add lab "L" to course name
else
$crs_no = $crscomp1." ".$crscomp2; // don't add lab "L" to course name
if ( $last_crsno == $crs_no) //if last course name and current course name are the same, reset course name (do nothing really)
{
$crs_no = ""; // print nothing
}
else
{// current course name different then last course name. Make a new table with course name header
echo "<table border='0' width='100%'><tr>";
echo "<td colspan='2' width='40%'><font color='black'><b>" . $crs_no . "</b></font></td>";
echo "<td colspan='4' align='right'><b>". $crstitle. "</td></tr>";
echo "<tr bgcolor='white'>";
echo "<td align='center' width='10%'></td>";
echo "<td align='center'><b><font color='#2A4266'>Section</font></td>";
echo "<td align='center'><b><font color='#2A4266'>Campus</font></td>";
echo "<td align='center'><b><font color='#2A4266'>Instructor</font></td>";
echo "<td align='center'><b><font color='#2A4266'># Students</font></td>";
echo "<td align='center'><b><font color='#2A4266'>Notes</font></td></tr>";
$last_crsno = $crs_no;
}
$query = " SELECT crs_meet_type, comment_txt, professor_id_num, name_master.last_name, name_master.first_name FROM section_schedules left outer join name_master on section_schedules.professor_id_num=name_master.id_num WHERE ( section_schedules.yr_cde = '".$EXyear."' ) AND ( section_schedules.trm_cde = '".$sess."' ) AND ( section_schedules.crs_cde like '". $crscde . "' ); ";
//if ($i==10){ echo "q2:".$query."<br />";}
$conn = odbc_connect("sqlserver","jenzwebuser","pumpkin@pplepi3");
$result = odbc_exec($conn,$query);
$row = odbc_fetch_array($result); //put results in array
$crsmeettype = $row["crs_meet_type"]; // get 1st element
$comtxt = $row["comment_txt"]; // get second element
$facid = $row["professor_id_num"];
$last_name = $row["last_name"];
$first_name = $row["first_name"];
//fix instrutor name incase there in a peron called "Staff" (last name only)
$instructor_name = null;
if (trim($first_name)==null ) // check first name
$instructor_name=trim($last_name);
else
$instructor_name=trim($last_name).", ".$first_name;
}// else search by department
if ($secsts=='C')
{// class cancelled
echo "<tr bgcolor='white'>";
echo "<td align='center' width='10%'><font color='gray'><b>CANC</font></td>";
echo "<td align='center' width='13%'><font color='gray'><b>" . $crscomp3 . "</td>";
echo "<td align='center' width='13%'><font color='gray'><b>" . $loccde . "</td>";
echo "<td align='center' width='25%'><font color='gray'><b>" . $instructor_name . "</td>";
echo "<td align='center' width='15%'><font color='gray'><b>" . $crsenrll. "/" . $crscap . "</font></td>";
//display itv if set
if ( (trim($crsmeettype)=='LC') || (trim($crsmeettype)=='LB') )
echo "<td align='center' width='19%'><font color='gray'><b>-</td>";
else
echo "<td align='center' width='19%'><font color='gray'><b>" . $crsmeettype."-".$comtxt . "</td>";
echo "</tr>";
}// end if class cancelled
else if ($secsts=='F')
{// class full
echo "<tr bgcolor='white'>";
echo "<td align='center' width='10%'><font color='red'><b>CLOS</font></td>";
echo "<td align='center' width='13%'><font color='red'><b>" . $crscomp3 . "</td>";
echo "<td align='center' width='13%'><font color='red'><b>" . $loccde . "</td>";
echo "<td align='center' width='25%'><font color='red'><b>" . $instructor_name . "</td>";
echo "<td align='center' width='15%'><font color='red'><b>" .$crsenrll. "</font><font color='gray'>/" . $crscap. "</font></td>";
//display itv if set
if ( (trim($crsmeettype)=='LC') || (trim($crsmeettype)=='LB') )
echo "<td align='center' width='19%'><font color='red'><b> - </td>";
else
echo "<td align='center' width='19%'><font color='red'><b>" .$crsmeettype."-". $comtxt . "</td>";
echo "</tr>";
}// end if class full
else
{// class open
echo "<tr bgcolor='white'>";
echo "<td align='center' width='10%'><font color='#006B00'><b>OPEN</td>";
echo "<td align='center' width='13%'><font color='#006B00'><b>" . $crscomp3 . "</td>";
echo "<td align='center' width='13%'><font color='#006B00'><b>" . $loccde . "</td>";
echo "<td align='center' width='25%'><font color='#006B00'><b>" . $instructor_name . "</td>";
echo "<td align='center' width='15%'><font color='#006B00'><b>" . $crsenrll . "</font><font color='gray'>/" . $crscap. "</font></td>";
//display itv if set
if ( (trim($crsmeettype)=='LC') || (trim($crsmeettype)=='LB') )
echo "<td align='center' width='19%'><font color='#006B00'><b> - </td>";
else
echo "<td align='center' width='19%'><font color='#006B00'><b>" . $crsmeettype."-".$comtxt . "</td>";
echo "</tr>";
}// end class open
}// for loop
// Finish up tables
echo "</table></td></tr></table><br>";
odbc_close($conn);
}// if array is not empty
else
{
echo "<table width='100%'><tr><td bgcolor='#CCCCCC'>";
if (isset($FacID))
echo "<font size=2><b>Sorry, no courses being offered for <font color='red'>specified ID</font> for <font color='red'> $sess $EXyear</font> at the specified campuses.</b></font>";
else
echo "<font size=2><b>Sorry, no <font color='red'>$crs</font> courses being offered for <font color='red'>$sess $EXyear</font> at the specified campuses.</b></font>";
echo "</td></tr></table>";
}// end else array empty
///////////////////////////
// Main table for formatting - End
echo "</td></tr>";
echo "</table>";
//echo "</center>";
?>
- Output for git.master, git.master_jit, rfc.property-hooks
- <h1 align='center'>Sorry, Improper Access</h1>
This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.
Active branches
Archived branches
Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page
preferences:
43.65 ms | 401 KiB | 8 Q