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

<html>

<? $Conf->header("Remove Program Committee Members From Reviewing") ?>

<body>
<?
  //
  // We're removing a specific contactId from reviewing a primary or secondary paper.
  //
  if ( !IsSet($who) || !IsSet($paperId) || !IsSet($reviewType) ) {
    $Conf->errorMsg("You're missing some vital data about which review "
		 . "to remove. <a href=\"AssignPapers.php\"> go back </a> "
		 . "and try again");
  } else {
    if ($reviewType=="Primary") {
      $result = $Conf->q("DELETE FROM PrimaryReviewer "
			    . " WHERE reviewer='$who' AND paperId='$paperId'");
      if ( ! DB::isError($result) ) {
	$Conf->errorMsg("I removed " . $DB->affectedRows() . "  primary reviews ");
      } else {
	$Conf->errorMsg("There was an error removing the reviewers: " . $result->getMessage());
      }
    } else if ($reviewType=="Secondary") {
      $result = $Conf->q("DELETE FROM SecondaryReviewer "
			 . " WHERE reviewer='$who' AND paperId='$paperId'");
      if (!DB::isError($result) ) {
	$Conf->errorMsg("I removed " . $DB->affectedRows() . "  secondary reviews ");

      } else {
	$Conf->errorMsg("There was an error removing the reviewers: " . $result->getMessage());
      }
    } else {
      $Conf->errorMsg("You need to remove either primary or secondary reviews");
    }
  }
?>

<p> You can <a href="AssignPapers.php"> return to the paper assignment page. </a>

</body>
<? $Conf->footer() ?>
</html>


