| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801 |
- <?php
- $errstring="";
- //$_SESSION['paddle_dirty']=false;
- function paddle_list()
- {
- global $sql;
- $qry="SELECT id FROM paddles GROUP BY id";
- $res=mysqli_query($sql, $qry);
-
- $accum=array();
-
- while($row=mysqli_fetch_assoc($res))
- {
- $accum[]=$row['id'];
- }
-
- return $accum;
- }
- function load_stops_name()
- {
- global $sql;
- $qry="SELECT id,latitude,longitude,name FROM stops ORDER BY name";
- $res=mysqli_query($sql,$qry);
-
- $accum=array();
-
- while($row=mysqli_fetch_assoc($res))
- {
- $accum[$row['id']]=$row;
- }
-
- return $accum;
- }
- function load_stops_id()
- {
- global $sql;
- $qry="SELECT id,latitude,longitude,name FROM stops ORDER BY id";
- $res=mysqli_query($sql, $qry);
-
- $accum=array();
-
- while($row=mysqli_fetch_assoc($res))
- {
- $accum[$row['id']]=$row;
- }
-
- return $accum;
- }
- function generate_stop_name_select($stops,$formname,$nums=false,$selid=-1)
- {
- echo "<select name=\"$formname\">";
- echo '<option value="-1">Select a Stop</option>';
- foreach($stops as $stop)
- {
- if($nums)
- {
- $label=$stop['id'] . ": " . $stop['name'];
- }
- else
- {
- $label=$stop['name'];
- }
-
- if($stop['id'] == $selid)
- {
- echo "<option value=\"${stop['id']}\" selected>$label</option>";
- }
- else
- {
- echo "<option value=\"${stop['id']}\">$label</option>";
- }
- }
- echo '</select>';
- }
- function load_paddle($paddlenum)
- {
- global $sql;
- $safenum=mysqli_escape_string($sql,$paddlenum);
- $qry="SELECT id, DATE_FORMAT(arrival, '%H:%i') AS arrival, route, trip, stage, stop, stopid FROM paddles WHERE id='$paddlenum' ORDER BY slot ASC";
- $res=mysqli_query($sql,$qry);
-
- $accum=array();
-
- while($row=mysqli_fetch_assoc($res))
- {
- $accum[]=array( 'id' => $row['id'], 'arrival' => $row['arrival'], 'route' => $row['route'], 'trip' => $row['trip'], 'stage' => $row['stage'], 'stop' => $row['stop'], 'stopid' => $row['stopid']);
- }
-
- return $accum;
- }
- function move_up($index)
- {
- if($index > 0)
- {
- $temp=$_SESSION['paddle'][$index];
- $_SESSION['paddle'][$index]=$_SESSION['paddle'][$index-1];
- $_SESSION['paddle'][$index-1]=$temp;
- return true;
- }
- return false;
- }
- function move_down($index)
- {
- if($index < (count($_SESSION['paddle']) - 1))
- {
- $temp=$_SESSION['paddle'][$index];
- $_SESSION['paddle'][$index]=$_SESSION['paddle'][$index+1];
- $_SESSION['paddle'][$index+1]=$temp;
- return true;
- }
- return false;
- }
- function del_stop($index)
- {
- $accum=array();
- foreach($_SESSION['paddle'] as $key => $record)
- {
- if($key != $index)
- {
- $accum[] = $record;
- }
- }
- $_SESSION['paddle']=$accum;
- }
- function compare_paddle($paddle1, $legend1, $paddle2, $legend2)
- {
- global $count;
- global $stops;
-
- // $ugly=' bgcolor="#0000FF" ';
- $ugly='';
-
- echo "<center><table width =\"80%\" border=\"1\"><tr><th colspan=\"7\">$legend1</th><th $ugly>with</th><th colspan=\"7\">$legend2</th></tr>";
- echo '<tr>';
- echo '<th>Arrival</th><th>Route</th><th>Trip</th><th>Stage</th><th>Stop</th><th>Stop<br>ID</th><th>Stop Name</th>';
- echo '<th> </th>';
- echo '<th>Arrival</th><th>Route</th><th>Trip</th><th>Stage</th><th>Stop</th><th>Stop<br>ID</th><th>Stop Name</th>';
- echo '</tr>';
-
- $idx=0;
-
- while( isset($paddle1[$idx]) || isset($paddle2[$idx]) )
- {
- if(isset($paddle1[$idx]))
- {
- $p1a=$paddle1[$idx]['arrival'];
- $p1s=$paddle1[$idx]['stopid'];
- $p1n=$stops[$p1s]['name'];
- $p1rt=$paddle1[$idx]['route'];
- $p1tr=$paddle1[$idx]['trip'];
- $p1st=$paddle1[$idx]['stop'];
- $p1sg=$paddle1[$idx]['stage'];
- }
- else
- {
- $p1a=$p1s=$p1n=$p1rt=$p1tr=$p1st=$p1sg=" ";
- }
-
- if(isset($paddle2[$idx]))
- {
- $p2a=$paddle2[$idx]['arrival'];
- $p2s=$paddle2[$idx]['stopid'];
- $p2n=$stops[$p2s]['name'];
- $p2rt=$paddle2[$idx]['route'];
- $p2tr=$paddle2[$idx]['trip'];
- $p2st=$paddle2[$idx]['stop'];
- $p2sg=$paddle2[$idx]['stage'];
- }
- else
- {
- $p2a=$p2s=$p2n=$p2rt=$p2tr=$p2st=$p2sg=" ";
- }
-
- if( ($count % 2) == 1)
- {
- $bkgr="#E0FFE0";
- }
- else
- {
- $bkgr="#FFE0E0";
- }
-
- echo "<tr bgcolor=\"$bkgr\">";
-
- if($p1s < 0)
- {
- echo "<td>$p1a</td><td>$p1rt</td><td>$p1tr</td><td>$p1sg</td><td>$p1st</td><td colspan=\"2\"><i>Deleted Stop</i></td>";
- }
- else
- {
- echo "<td>$p1a</td><td>$p1rt</td><td>$p1tr</td><td>$p1sg</td><td>$p1st</td><td>$p1s</td><td>$p1n</td>";
- }
-
- echo "<td $ugly> </td>";
-
- if($p2s < 0)
- {
- echo "<td>$p2a</td><td>$p2rt</td><td>$p2tr</td><td>$p2sg</td><td>$p2st</td><td colspan=\"2\"><i>Deleted Stop</i></td>";
- }
- else
- {
- echo "<td>$p2a</td><td>$p2rt</td><td>$p2tr</td><td>$p2sg</td><td>$p2st</td><td>$p2s</td><td>$p2n</td>";
- }
-
- echo "</tr>";
-
- $idx++;
- }
-
- echo "</table></center>";
- }
- function commit_test()
- {
- $firstidx=0;
- $lastidx=count($_SESSION['paddle']) - 1;
-
- if($lastidx > 0)
- {
- if( strlen($_SESSION['paddle'][$firstidx]['arrival']) == 0 )
- {
- echo "First stop in paddle must have an arrival time.<br>";
- return false;
- }
- if( strlen($_SESSION['paddle'][$lastidx]['arrival']) == 0 )
- {
- echo "Last stop in paddle must have an arrival time.<br>";
- return false;
- }
- }
-
- return true;
- }
- function commit_paddle()
- {
- global $sql;
- if(!commit_test())
- return false;
-
- $safeid=mysqli_escape_string($sql,$_SESSION['current_paddle']);
-
- mysqli_query($sql,'BEGIN');
- mysqli_query($sql,"DELETE FROM paddles WHERE id='$safeid'");
-
- $idx=1;
-
- foreach($_SESSION['paddle'] as $stop)
- {
- if(strlen($stop['arrival']) > 0)
- {
- $arrclause="'" . mysqli_escape_string($sql,$stop['arrival']) . "'";
- }
- else
- {
- $arrclause = "NULL";
- }
-
- $safe_stopid=mysqli_escape_string($sql,$stop['stopid']);
-
- $sroute=mysqli_escape_string($sql,$stop['route']);
- $strip=mysqli_escape_string($sql,$stop['trip']);
- $sstage=mysqli_escape_string($sql,$stop['stage']);
- $sstop=mysqli_escape_string($sql,$stop['stop']);
-
- $qry="INSERT INTO paddles SET id='$safeid', slot='$idx', route='$sroute', trip='$strip', stage='$sstage', stop='$sstop', arrival=$arrclause, stopid='$safe_stopid'";
-
- mysqli_query($sql,$qry);
-
- $idx++;
-
- }
-
- mysqli_query($sql,'COMMIT');
- return true;
- }
- $stops=load_stops_name();
- $stopsid=load_stops_id();
- if(!isset($_SESSION['current_paddle']))
- {
- $_SESSION['current_paddle']=0;
- }
- if(!isset($_SESSION['paddle']))
- {
- if($_SESSION['current_paddle'] > 0)
- {
- $_SESSION['paddle']=load_paddle($_SESSION['current_paddle']);
- $_SESSION['paddle_dirty']=false;
- }
- }
- if(isset($_REQUEST['up']))
- {
- if(isset($_SESSION['paddle'][$_REQUEST['key']]))
- {
- if(move_up($_REQUEST['key']))
- {
- $_SESSION['paddle_dirty']=true;
- }
- }
- redirect('index.php');
- exit;
- }
- if(isset($_REQUEST['dn']))
- {
- if(isset($_SESSION['paddle'][$_REQUEST['key']]))
- {
- if(move_down($_REQUEST['key']))
- {
- $_SESSION['paddle_dirty']=true;
- }
- }
- redirect('index.php');
- exit;
- }
- if(isset($_REQUEST['del']))
- {
- if(isset($_SESSION['paddle'][$_REQUEST['key']]))
- {
- del_stop($_REQUEST['key']);
- }
- $_SESSION['paddle_dirty']=true;
- redirect('index.php');
- exit;
- }
- if(isset($_REQUEST['commit_paddle']))
- {
- if(commit_test())
- {
- echo '<h1><center>Replace this paddle?</center></h1>';
- compare_paddle(load_paddle($_SESSION['current_paddle']),"Old",$_SESSION['paddle'],"New");
- echo "<tr><td colspan=\"7\"><center><big><a href=\"index.php\">(Cancel)</a> <a href=\"index.php?commit_paddleconf\">(OK)</a></big></center></td></tr>";
- exit;
- }
- }
- else if(isset($_REQUEST['commit_paddleconf']))
- {
- if(commit_paddle())
- {
- unset($_SESSION['paddle']);
- unset($_SESSION['paddle_list']);
- redirect('index.php');
- }
- }
- if(isset($_REQUEST['revert_paddle']))
- {
- echo '<h1><center>Replace this paddle?</center></h1>';
- compare_paddle($_SESSION['paddle'],"New",load_paddle($_SESSION['current_paddle']),"Old");
- echo "<tr><td colspan=\"7\"><center><big><a href=\"index.php\">(Cancel)</a> <a href=\"index.php?revert_paddleconf\">(OK)</a></big></center></td></tr>";
- exit;
- }
- else if(isset($_REQUEST['revert_paddleconf']))
- {
- unset($_SESSION['paddle']);
- unset($_SESSION['paddle_list']);
- redirect('index.php');
- }
- if(isset($_REQUEST['addstop']))
- {
- $s1=$_REQUEST['stopid_1'];
- $s2=$_REQUEST['stopid_2'];
- $arr=$_REQUEST['arrival'];
-
- $rte=$_REQUEST['route'];
- $trp=$_REQUEST['trip'];
- $stg=$_REQUEST['stage'];
- $stp=$_REQUEST['stop'];
-
-
- $okay=true;
-
- if( ($s1 < 0) && ($s2 < 0) )
- {
- $okay=false;
- $errstring .= "You must select a stop to add to this paddle.<br>";
- }
- if( ($s1 >= 0) && ($s2 >= 0) )
- {
- if($s1 != $s2)
- {
- $okay=false;
- $errstring .= "Selected stops conflict. Please select either by number OR by name.<br>";
- }
- }
-
- if(!preg_match('/[\d]+/',$rte))
- {
- $okay=false;
- $errstring .= "Route must be numeric.<br>";
- }
-
- if(!preg_match('/[\d]+/',$trp))
- {
- $okay=false;
- $errstring .= "Trip must be numeric.<br>";
- }
-
- if(!preg_match('/[\d]+/',$stp))
- {
- $okay=false;
- $errstring .= "Stop must be numeric.<br>";
- }
- if(!preg_match('/[\d]+/',$stg))
- {
- $stg=0;
- }
-
- if( strlen($arr) > 0)
- {
- $mats=array();
- if(!preg_match('/([\d][\d]?):([\d][\d])/',$arr,$mats))
- {
- $okay=false;
- $errstring .= "Arrival time must be blank, or in the form HH:MM using 24 hour time.<br>";
- }
- else
- {
- if( ($mats[1] > 23) || ($mats[2] > 59) )
- {
- $okay=false;
- $errstring .= "Arrival time must be blank, or in the form HH:MM using 24 hour time.<br>";
- }
- }
- }
-
- if($okay)
- {
- if($s1 >= 0)
- {
- $stopid=$s1;
- }
- else
- {
- $stopid=$s2;
- }
-
- $_SESSION['paddle'][]=array( 'id' => $_SESSION['current_paddle'], 'arrival' => $_REQUEST['arrival'], 'route' => $rte, 'stop' => $stp, 'trip' => $trp, 'stage' => $stg, 'stopid' => $stopid);
- $_SESSION['paddle_dirty']=true;
- redirect('index.php');
- }
- }
- if(isset($_REQUEST['edit_done']))
- {
- $s1=$_REQUEST['stopid_1'];
- $s2=$_REQUEST['stopid_2'];
- $arr=$_REQUEST['arrival'];
-
- $rte=$_REQUEST['route'];
- $trp=$_REQUEST['trip'];
- $stg=$_REQUEST['stage'];
- $stp=$_REQUEST['stop'];
-
-
- $okay=true;
-
- if( ($s1 < 0) && ($s2 < 0) )
- {
- $okay=false;
- $errstring .= "You must select a valid stop.<br>";
- }
- if( ($s1 >= 0) && ($s2 >= 0) )
- {
- if($s1 != $s2)
- {
- $okay=false;
- $errstring .= "Selected stops conflict. Please select either by number OR by name.<br>";
- }
- }
-
- if(!preg_match('/[\d]+/',$rte))
- {
- $okay=false;
- $errstring .= "Route must be numeric.<br>";
- }
-
- if(!preg_match('/[\d]+/',$trp))
- {
- $okay=false;
- $errstring .= "Trip must be numeric.<br>";
- }
-
- if(!preg_match('/[\d]+/',$stp))
- {
- $okay=false;
- $errstring .= "Stop must be numeric.<br>";
- }
- if(!preg_match('/[\d]+/',$stg))
- {
- $stg=0;
- }
-
- if( strlen($arr) > 0)
- {
- $mats=array();
- if(!preg_match('/([\d][\d]?):([\d][\d])/',$arr,$mats))
- {
- $okay=false;
- $errstring .= "Arrival time must be blank, or in the form HH:MM using 24 hour time.<br>";
- }
- else
- {
- if( ($mats[1] > 23) || ($mats[2] > 59) )
- {
- $okay=false;
- $errstring .= "Arrival time must be blank, or in the form HH:MM using 24 hour time.<br>";
- }
- }
- }
-
- if($okay)
- {
- if($s1 >= 0)
- {
- $stopid=$s1;
- }
- else
- {
- $stopid=$s2;
- }
-
- $_SESSION['paddle'][$_REQUEST['key']]=array( 'id' => $_SESSION['current_paddle'], 'arrival' => $_REQUEST['arrival'], 'route' => $rte, 'stop' => $stp, 'trip' => $trp, 'stage' => $stg, 'stopid' => $stopid);
- $_SESSION['paddle_dirty']=true;
- redirect('index.php');
- }
- }
- function generate_edit_line($dflt)
- {
- global $stopsid;
- global $stops;
- global $errstring;
-
- if(strlen($errstring) > 0)
- {
- echo "<tr><td colspan=\"8\" style=\"color: red;\"><center><big>$errstring</big></center></td></tr>";
- }
- $myreq=$_REQUEST;
-
- if(!isset($myreq['stopid_1']))
- {
- if (!array_key_exists('arrival',$dflt)) { $dflt['arrival'] = null; }
- if (!array_key_exists('route',$dflt)) { $dflt['route'] = null; }
- if (!array_key_exists('trip',$dflt)) { $dflt['trip'] = null; }
- if (!array_key_exists('stage',$dflt)) { $dflt['stage'] = null; }
- if (!array_key_exists('stop',$dflt)) { $dflt['stop'] = null; }
- if (!array_key_exists('stopid',$dflt)) { $dflt['stopid'] = null; }
- echo $dflt['arrival'];
- $myreq['arrival']=$dflt['arrival'];
- $myreq['route']=$dflt['route'];
- $myreq['trip']=$dflt['trip'];
- $myreq['stage']=$dflt['stage'];
- $myreq['stop']=$dflt['stop'];
- $myreq['stopid_1']=$dflt['stopid'];
- $myreq['stopid_2']=$dflt['stopid'];
- }
-
- echo "<tr><form name=\"frm\"><td><input type=\"text\" size=\"8\" name=\"arrival\" value=\"${myreq['arrival']}\"></td>";
- echo "<td><input type=\"text\" size=\"4\" name=\"route\" value=\"${myreq['route']}\"></td>";
- echo "<td><input type=\"text\" size=\"4\" name=\"trip\" value=\"${myreq['trip']}\"></td>";
- echo "<td><input type=\"text\" size=\"4\" name=\"stage\" value=\"${myreq['stage']}\"></td>";
- echo "<td><input type=\"text\" size=\"4\" name=\"stop\" value=\"${myreq['stop']}\"></td>";
- echo "<td colspan=\"2\">";
- //--------------sub table that lives in the colspanned cell containing stop ID and stop name---
- echo '<center><table>';
- echo '<tr><td><center>By number:</center></td><td><b>or</b></td><td><center>By name:</center></td></tr>';
- echo '<tr><td>';
- generate_stop_name_select($stopsid,'stopid_1',true,$myreq['stopid_1']);
- echo '</td><td></td><td>';
- generate_stop_name_select($stops,'stopid_2',false,$myreq['stopid_2']);
- echo '</td></tr>';
- echo '</table></center>';
- //---------------------------------------------------------------------------------------------
- if(isset($_REQUEST['edit']))
- {
- echo "</td><td><input type=\"hidden\" name=\"edit\" value=\"1\"><input type=\"hidden\" name=\"key\" value=\"${_REQUEST['key']}\"><input type=\"submit\" name=\"edit_done\" value=\"Done\"> <a href=\"index.php\">(Cancel)</a></td></form></tr>";
- }
- else
- {
- echo '</td><td><input type="submit" name="addstop" value="Add Stop to Paddle"></td></form></tr>';
- }
- }
- //--------------------------------------------If the paddle is unmodified from its last saved state, allow the user to browse to a different one,
- //------------------------------------------create a new one, etc...
- if(isset($_REQUEST['submitadv']))
- {
- $_SESSION['paddle']=array();
- $lines=preg_split("/[\r\n]+/",$_REQUEST['advtxt']);
-
- foreach($lines as $line)
- {
- $mats=array();
- if(preg_match("/([\d]+:[\d]+)[\s]+([\d]+)[\s]+([\d]+)[\s]+([\d]+)[\s]+([\d]+)[\s]+([\d]+)/",$line,$mats))
- {
- //echo "<pre>";
- //print_r($mats);
- //echo "</pre>";
- $_SESSION['paddle'][]=array('arrival' => $mats[1], 'route' => $mats[2], 'trip' => $mats[3], 'stage' => $mats[4], 'stop' => $mats[5], 'stopid' => $mats[6]);
- }
- }
-
- $_SESSION['paddle_dirty']=true;
-
- //echo "<pre>";
- //print_r($lines);
- //echo "</pre>";
- //exit;
- }
- if(!$_SESSION['paddle_dirty'])
- {
-
- if(!isset($_SESSION['paddle_list']))
- {
- $_SESSION['paddle_list']=paddle_list();
- }
- if( isset($_REQUEST['selectpaddle']) && ($_REQUEST['selectpaddle'] != $_SESSION['current_paddle']) )
- {
- $_SESSION['current_paddle']=$_REQUEST['selectpaddle'];
- unset($_SESSION['paddle']);
- redirect('index.php');
- exit;
- }
- else if( isset($_REQUEST['createnewpaddle']) )
- {
- $newpaddle=$_REQUEST['newpaddle'];
-
- if(preg_match('/[\d]+/', $newpaddle) && (intval($newpaddle > 0)) && !in_array($newpaddle,$_SESSION['paddle_list']) )
- {//the above test insures that the new paddle number is unique, numeric, and non-zero
-
- $_SESSION['paddle_list'][]=$newpaddle;
- $_SESSION['current_paddle']=$newpaddle;
- unset($_SESSION['paddle']);
- redirect('index.php');
- exit;
- }
- else
- {
- echo '<h3 style="color: red;"><center>New Paddle number must be unique and non-zero.</center></h3>';
- }
-
- }
-
-
- echo '<form name="jump1">';
- echo '<center><big>';
- echo 'Select an existing paddle: ';
- echo '<select name="myjumpbox" OnChange="location.href=jump1.myjumpbox.options[selectedIndex].value">';
- echo '<option value="index.php?selectpaddle=-1">Select a Paddle</option>';
- foreach($_SESSION['paddle_list'] as $paddle)
- {
- if($paddle == $_SESSION['current_paddle'])
- {
- echo "<option value=\"index.php?selectpaddle=$paddle\" selected>$paddle</option>";
- }
- else
- {
- echo "<option value=\"index.php?selectpaddle=$paddle\">$paddle</option>";
- }
- }
- echo '</select>';
-
- echo ' or create a new one: ';
- echo '<input type="text" name="newpaddle" size="6"> <input type="submit" name="createnewpaddle" value="Create New Paddle">';
-
- echo '</form>';
- echo '</big></center>';
- echo '<hr>';
- }
- if(isset($_REQUEST['advanced_edit']))
- {
- $accum="Time Route Trp Stg Stp StopID Stopname\n";
- foreach($_SESSION['paddle'] as $key => $record)
- {
- $accum .= sprintf("%6s %5d %3d %3d %3d %5d %s\n",$record['arrival'],$record['route'],$record['trip'],$record['stage'],$record['stop'],$record['stopid'],$stops[$record['stopid']]['name']);
- }
-
- echo '<form method="POST" action="index.php">';
- echo '<textarea rows="40" cols="90" name="advtxt">';
- echo htmlspecialchars($accum);
- echo '</textarea>';
- echo '<input type="submit" name="submitadv" value="Apply Change">';
- echo '</form>';
- }
- else if($_SESSION['current_paddle'] > 0)
- { //only draw the current paddle edit UI if we actually have a valid paddle selected
- //--------------------------------------------------------------BELOW DEALS WITH DISPLAYING THE MAIN PADDLE MANAGEMENT SCREEN-------------
- echo '<center><table width="90%" border="1">';
- echo '<tr><td colspan="8"><center><a href="index.php?advanced_edit">Advanced Edit</a></center></td></tr>';
- echo "<tr><th colspan=\"8\"><center>Paddle Number ${_SESSION['current_paddle']}</center></th></tr>";
- echo '<tr><th>Scheduled<br>Arrival</th><th>Route #</th><th>Trip #</th><th>Stage #</th><th>Stop #</th><th>Unique<br>Stop ID</th><th>Stop<br>Name</th><th>Actions</th></tr>';
- $count=0;
- foreach($_SESSION['paddle'] as $key => $record)
- {
- $stopname=$stops[$record['stopid']]['name'];
- $stopid=$record['stopid'];
- $arrival=$record['arrival'];
-
- $route=$record['route'];
- $trip=$record['trip'];
- $stage=$record['stage'];
- $stop=$record['stop'];
- $upurl="index.php?up&key=$key";
- $dnurl="index.php?dn&key=$key";
- $delurl="index.php?del&key=$key";
- $editurl="index.php?edit&key=$key";
- if( ($count % 2) == 1)
- {
- $bkgr="#E0FFE0";
- }
- else
- {
- $bkgr="#FFE0E0";
- }
-
- if(isset($_REQUEST['edit']) && ($_REQUEST['key'] == $key) )
- {
- generate_edit_line($record);
- }
- else
- {
- if($stopid >= 0)
- {
- echo "<tr bgcolor=\"$bkgr\"><td>$arrival</td><td>$route</td><td>$trip</td><td>$stage</td><td>$stop</td><td>$stopid</td><td>$stopname</td><td><a href=\"$upurl\">(Move Up)</a> <a href=\"$dnurl\">(Move Down)</a> <a href=\"$delurl\">(Delete)</a> <a href=\"$editurl\">(Edit)</a></td></tr>";
- }
- else
- {
- echo "<tr bgcolor=\"$bkgr\"><td colspan=7><center><i>This stop has been deleted.</i></center></td><td><a href=\"$upurl\">(Move Up)</a> <a href=\"$dnurl\">(Move Down)</a> <a href=\"$delurl\">(Delete)</a> </td></tr>";
- }
- }
-
- $count++;
- }
- if(!isset($_REQUEST['edit']))
- {
- generate_edit_line(array());
- }
- if($_SESSION['paddle_dirty'])
- {
- echo '<tr bgcolor="#FFA0A0"><td colspan="8"><center><big><a href="index.php?commit_paddle">(Commit Changes to Paddle)</a> <a href="index.php?revert_paddle">(Revert to Saved Paddle)</a></big></center></td></tr>';
- }
- echo '</table></center>';
- }
- ?>
|