Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
- <html>
- <style>
- DIV#header {position: absolute; top: 0; bottom: 90%; left: 0; right: 0;
- background: #00d0a0; margin-bottom: 0px;
- border-style: solid; }
- DIV#main {position: absolute; top: 10%; bottom: 0; left: 0; right: 0;
- overflow: scroll; background: white; margin-left: 4px;
- padding: 10px; font-family: Times, serif; font-size: large; }
- P { font: Helvetica; font-size: large; }
- </style>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="GENERATOR" content="Mozilla/4.51 [en] (X11; I; Linux 2.2.5-15 i68 6) [Netscape]">
- <title>OUAL Operator Training Information</title>
- </head>
- <body>
- <DIV ID="header">
- <CENTER><font color=black><H1>OUAL Operator Training Information</h1></font></CENTER>
- </DIV>
- <DIV ID="main">
- <H2>List Operator Training Certifications</H2>
- <?php
- global $_SERVER, $_GET;
- if ( array_key_exists('REMOTE_ADDR',$_SERVER) ) {
- echo "Connection from IP address ";
- echo $_SERVER['REMOTE_ADDR'];
- } else {
- echo "Connection information not available";
- }
- if ( array_key_exists('REMOTE_HOST',$_SERVER) ) {
- echo " (" . $_SERVER['REMOTE_HOST'] . ")";
- }
- echo "<br>Time: ";
- echo date("Y M d G:i:s");
- echo '<BR>Logged in as ' . $_SERVER['REMOTE_USER'] . '<BR>';
- ?>
- <FORM METHOD=POST ACTION="https://edwards2.phy.ohio.edu/~oual/operators/training/optrain.php">
- <BUTTON TYPE=SUBMIT NAME="BACK" VALUE="BACK">Back to Operator Training Page</BUTTON>
- </FORM>
- <FORM METHOD=POST ACTION="https://edwards2.phy.ohio.edu/~oual/operators/training/optrainlist.php">Sort for:
- <BUTTON TYPE=SUBMIT NAME="SORTBY" VALUE="ascending">Oldest first</BUTTON>
- <BUTTON TYPE=SUBMIT NAME="SORTBY" VALUE="descending">Most recent first</BUTTON>
- <BUTTON TYPE=SUBMIT NAME="SORTBY" VALUE="name">Operator</BUTTON>
- <BUTTON TYPE=SUBMIT NAME="SORTBY" VALUE="certification">Certification</BUTTON>
- <BUTTON TYPE=SUBMIT NAME="SORTBY" VALUE="expire">Expiration date</BUTTON>
- <BUTTON TYPE=SUBMIT NAME="SORTBY" VALUE="status">Status</BUTTON>
- <?php
- echo '<BR><INPUT TYPE=CHECKBOX NAME="NOKH" VALUE="nokh"';
- if (array_key_exists('NOKH',$_POST)) echo ' CHECKED="checked"';
- echo '>Do not show keyholder</INPUT>';
- echo '<BR><INPUT TYPE=CHECKBOX NAME="NOOP" VALUE="noop"';
- if (array_key_exists('NOOP',$_POST)) echo ' CHECKED="checked"';
- echo '>Do not show operator levels</INPUT></FORM>';
- // echo "<H3>Logged in as $_SERVER[\'REMOTE_USER\']</H3>";
- // var_dump($_POST);
- // echo "<br>";
- require_once('DB.php');
- $db = DB::connect("mysql://something:soomething@localhost/tandem");
- IF ( DB::isError($db) ) {
- echo "<font color=red>";
- echo DB::errorMessage($db->code);
- echo "</font><br>";
- die( DB::errorMessage($db->code));
- }
- // echo "Connected to database<BR>";
- // ---------------------------------------
- function make_op_table() {
- global $db,$op_name,$op_fname,$op_id,$op_status;
- $sql = 'SELECT seq_nmbr,name,fname,status FROM operators;';
- // echo "<BR> Get op nmbr sql is '$sql'<BR>";
- $q = $db->query($sql);
- IF ( DB::isError($db) ) {
- echo "<font color=red>";
- echo DB::errorMessage($db->code);
- echo "</font><br>";
- die( DB::errorMessage($db->code));
- }
- while ($opid = $q->fetchRow()) {
- // echo "<BR> OpId result is <BR>"; var_dump($opid);
- $op_id[$opid[1]] = $opid[0]; // Ptr by name
- $op_name[$opid[0]] = $opid[1]; // Name by ptr
- $op_fname[$opid[0]] = $opid[2]; // Fullname by ptr
- $op_status[$opid[0]] = $opid[3]; // Status by ptr
- }
- // var_dump($op_id);
- // var_dump($op_name);
- }
- // ---------------------------------------
- function make_cert_table() {
- global $db,$tlist,$cert_name,$cert_id,$_SERVER;
- $sql = 'SELECT seq_nmbr,certification FROM certifications ORDER BY certification;';
- // echo "<BR> Get cert nmbr sql is '$sql'<BR>";
- $q = $db->query($sql);
- IF ( DB::isError($db) ) {
- echo "<font color=red>";
- echo DB::errorMessage($db->code);
- echo "</font><br>";
- die( DB::errorMessage($db->code));
- }
- while ($row = $q->fetchRow()) {
- IF ( DB::isError($db) ) {
- echo "<font color=red>";
- echo DB::errorMessage($db->code);
- echo "</font><br>";
- die( DB::errorMessage($db->code));
- }
- $cert_id[$row[1]] = $row[0]; // Ptr by certification
- $cert_name[$row[0]] = $row[1]; // Certification by ptr
- }
- // var_dump($cert_id);
- // var_dump($cert_name);
- }
- // ---------------------------------------
- function make_train_table() {
- global $db,$tlist,$tc_op,$tc_opf,$tc_cert,$tc_date,$tc_tr,$tc_stat;
- global $op_name,$op_fname,$cert_name;
- global $tc_expire,$tc_id,$_SERVER;
- $sql = 'SELECT * FROM optraining ORDER BY entered DESC;';
- $q = $db->query($sql);
- IF ( DB::isError($db) ) {
- echo "<font color=red>";
- echo DB::errorMessage($db->code);
- echo "</font><br>";
- die( DB::errorMessage($db->code));
- }
- while ($row = $q->fetchRow()) {
- IF ( DB::isError($db) ) {
- echo "<font color=red>";
- echo DB::errorMessage($db->code);
- echo "</font><br>";
- die( DB::errorMessage($db->code));
- }
- $tc_op[$row[0]] = $op_name[$row[1]]; // Name
- $tc_opf[$row[0]] = $op_fname[$row[1]]; // Full name
- $tc_cert[$row[0]] = $cert_name[$row[2]];// Certification
- $tc_tr[$row[0]] = $op_name[$row[3]]; // Trainer name
- $tc_stat[$row[0]] = $row[4]; // Status
- $tc_date[$row[0]] = $row[5]; // Entered date
- $tc_expire[$row[0]] = $row[6]; // Expire date
- }
- } // end of make_train_table(_) function
- // ---------------------------------------
- make_op_table();
- make_cert_table();
- make_train_table();
- //
- // See if the user wants to sort the list
- $sortby = 'ascending'; // What order is wanted
- if (array_key_exists('SORTBY',$_POST)) {
- $sortby = $_POST['SORTBY'];
- }
- switch ($sortby) {
- case 'ascending': // Oldest record first
- array_multisort($tc_date,SORT_ASC,$tc_op,$tc_opf,$tc_cert,
- $tc_tr,$tc_stat,$tc_expire);
- break;
- default:
- case 'descending': // Most recent first
- array_multisort($tc_date,SORT_DESC,$tc_op,$tc_opf,$tc_cert,
- $tc_tr,$tc_stat,$tc_expire);
- break;
- case 'name': // Operator Name
- array_multisort($tc_op,SORT_ASC,$tc_opf,$tc_cert,
- $tc_date,$tc_tr,$tc_stat,$tc_expire);
- break;
- case 'certification': // Certification
- array_multisort($tc_cert,SORT_ASC,$tc_op,$tc_opf,
- $tc_date,$tc_tr,$tc_stat,$tc_expire);
- break;
- case 'expire': // Expiration date
- array_multisort($tc_expire,SORT_DESC,$tc_op,SORT_ASC,$tc_opf,$tc_cert,
- $tc_date,$tc_tr,$tc_stat);
- break;
- case 'status': // Certification status
- array_multisort($tc_stat,SORT_DESC,$tc_op,SORT_ASC,$tc_opf,$tc_cert,
- $tc_date,$tc_tr,$tc_expire);
- break;
- }
- // Colors from the X11 rgb.txt database (sorry about the names...)
- $color1 = "LEMONCHIFFON";
- $color2 = "HONEYDEW";
- $bgcolor = $color1;
- echo '<TABLE CELLSPACING=10>';
- echo "<TH>Operator<TH>Certification<TH>Date Entered<TH>Trained By";
- echo "<TH>Status<TH>Expires<TR>";
- $last_name = "";
- foreach ( $tc_op as $seqid => $name ) {
- if (array_key_exists('NOKH',$_POST) &&
- $tc_cert[$seqid] == 'Keyholder') continue;
- if (array_key_exists('NOOP',$_POST) &&
- $tc_cert[$seqid] == 'Operator 1') continue;
- if (array_key_exists('NOOP',$_POST) &&
- $tc_cert[$seqid] == 'Operator 2') continue;
- if ( $name != $last_name ) {
- if ($bgcolor==$color1) {
- $bgcolor=$color2;
- } else {
- $bgcolor=$color1;
- }
- }
- $last_name = $name;
- echo "<TR BGCOLOR=$bgcolor>";
- echo "<TD ALIGN=RIGHT>" . $tc_opf[$seqid] . "</TD>";
- switch($tc_cert[$seqid]) {
- case 'Keyholder':
- $STCOLOR = 'MAROON';
- break;
- case 'Operator 1':
- $STCOLOR = 'DARKORANGE'; // Yellow doesn't show up well
- break;
- case 'Operator 2':
- $STCOLOR = 'GREEN'; // Yellow doesn't show up well
- break;
- default:
- $STCOLOR = 'BLACK';
- }
- echo "<TD ALIGN=CENTER><FONT COLOR={$STCOLOR}> ";
- echo $tc_cert[$seqid] . '</FONT></TD>';
- echo "<TD ALIGN=CENTER>" . substr($tc_date[$seqid],0,10) . "</TD>";
- echo "<TD ALIGN=CENTER>" . $tc_tr[$seqid] . "</TD>";
- switch($tc_stat[$seqid]) {
- case 'Active':
- $STCOLOR = 'GREEN';
- break;
- case 'Pending':
- $STCOLOR = 'ORANGE'; // Yellow doesn't show up well
- break;
- default:
- $STCOLOR = 'RED';
- }
- echo "<TD ALIGN=CENTER><FONT COLOR={$STCOLOR}> ";
- echo $tc_stat[$seqid] . '</FONT></TD>';
- if ( $tc_expire[$seqid] == "") {
- $expstring = "<FONT COLOR=GREY>(N/A)</FONT>";
- } else {
- $expstring = substr($tc_stat[$seqid],0,10);
- }
- echo "<TD ALIGN=CENTER>" . $expstring . "</TD>";
- echo "</TR>";
- }
- echo '</TABLE>';
- ?>
- <FORM METHOD=POST ACTION="http://edwards2.phy.ohio.edu/~oual/operators/training/optrain.php">
- <BUTTON TYPE=SUBMIT NAME="BACK" VALUE="BACK">Back to Operator Training Page</BUTTON>
- </FORM>
- </DIV>
- </HTML>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement