<?
include('../Code/confHeader.inc');
$Me -> goIfInvalid("../index.php");
$Me -> goIfNotChair('../index.php');
$Conf -> connect();
?>

<html>

<? $Conf->header("Switch Roles To That Of Someone Else") ?>

<body>
<?
//
// Process actions from this form..
//
if (IsSet($becomePerson)) {
  $Me -> invalidate();
  $Me -> lookupById($become, $Conf);
}
?>

<FORM METHOD="POST" ACTION="<?echo $PHP_SELF ?>">
<table align=center>
<tr> <td>
<? $Conf->makePCSelector('become', $Me->contactId); ?>  
</td>
<td>
<INPUT TYPE="SUBMIT" name="becomePerson" value="Become this PC member">
</td> </tr>
</table>
</form>

<br> <br>

<FORM METHOD="POST" ACTION="<?echo $PHP_SELF ?>">
<table align=center>
<tr> <td>
  <SELECT name=become SINGLE SIZE=10>
  <?
  $query = "SELECT ContactInfo.contactId, firstName, lastName, email "
  . " FROM ContactInfo, ChairAssistant "
  . " WHERE ChairAssistant.contactId=ContactInfo.contactId "
  . " ORDER BY email, lastName, firstName ";
$result = $Conf->qe($query);
 if (!DB::isError($result)) {
   while($row=$result->fetchRow()) {
     print "<OPTION VALUE=\"$row[0]\" ";
     if ( $row[0] == $Me -> contactId) {
       print " SELECTED ";
     }
     print "> $row[1] $row[2] ($row[3]) </OPTION>";
   }
 }
 ?>
 </SELECT>
</td>
<td>
<INPUT TYPE="SUBMIT" name="becomePerson" value="Become assistant to the chair">
</td> </tr>
</table>
</form>
<br> <br>

<FORM METHOD="POST" ACTION="<?echo $PHP_SELF ?>">
<table align=center>
<tr> <td>
  <SELECT name=become SINGLE SIZE=10>
  <?
  $query = "SELECT contactId, firstName, lastName, email "
  . " FROM ContactInfo "
 . " ORDER BY email,lastName, firstName ";
$result = $Conf->qe($query);
 if (!DB::isError($result)) {
   while($row=$result->fetchRow()) {
     print "<OPTION VALUE=\"$row[0]\" ";
     if ( $row[0] == $Me -> contactId) {
       print " SELECTED ";
     }
     print "> $row[1] $row[2] ($row[3]) </OPTION>";
   }
 }
 ?>
 </SELECT>
</td> <td>
     <INPUT TYPE="SUBMIT" name="becomePerson" value="Become this random person">
</td> </tr>
</table>
</form>
</body>
<? $Conf->footer() ?>
</html>

