// We got here from form submission after person reported correction // echo "Arrived as form submission"; $id_person = $_POST['id']; } else { echo '<p class="error"> This page has been accessed in error.</p>'; exit_with_footer(); } $query = "SELECT name_person, name_group, Groups.id_group " . "FROM Persons, Groups " . "WHERE Persons.id_person = {$id_person} " . "AND Persons.id_group=Groups.id_group"; if (DEBUG) { echo "Query to database is: {$query}<p>"; } $result = mysqli_query($cxn, $query) or die("Couldn't execute query"); while ($row = mysqli_fetch_assoc($result)) { extract($row); echo "<div class='page-header'>" . form_title($name_person); echo form_subtitle("Member of " . live_link("list.php?group={$id_group}", "{$name_group}")); include "../templates/warning.php"; // includes the warning text about paper precedence echo "</small>"; if (permissions("Herald") >= 3 or permissions("Marshal") >= 3) { // TODO: Make this link more visible? echo "<br>" . button_link("./edit_person.php?id={$id_person}", "Edit {$name_person}'s record"); } echo "</div>"; } echo "\n<div class='row'>\n\n <div class='col-md-8 col-md-offset-2'>"; $query = "SELECT waiver_person, youth_person, birthdate_person\n FROM Persons\n WHERE id_person={$id_person}"; if (DEBUG) { echo "Waiver query is:{$query}<p>"; } $result = mysqli_query($cxn, $query) or die("Couldn't execute waiver query");
// configuration echo form_title("Fighter Authorization Card"); echo "<div><p><a href=\"combat.php\">Return to the Combat Page</a></p></div>"; // First: confirm that we reached this page through a POST submission if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (isset($_POST["mem_num"]) && is_numeric($_POST["mem_num"])) { $mem_num = $_POST["mem_num"]; } else { echo form_subtitle('Must include fighter membership number to print fighter authorization card'); exit_with_footer(); } if (isset($_POST["id_combat"]) && is_numeric($_POST["id_combat"])) { $id_combat = $_POST["id_combat"]; } } else { echo form_subtitle("Page accessed in error."); exit_with_footer(); } if (DEBUG) { echo form_subsubtitle("Now using values mem_num={$mem_num} and id_combat={$id_combat}"); } // Open database $cxn = open_db_browse(); // Confirm that there is a fighter authorization card on file for this person and combat type $query = "SELECT Persons.id_person, id_person_combat_card, Combat.id_combat, name_combat " . "FROM Persons, Persons_CombatCards, Combat " . "WHERE Persons.id_person=Persons_CombatCards.id_person " . "AND membership_person={$mem_num} " . "AND Combat.id_combat = Persons_CombatCards.id_combat " . "AND Combat.id_combat={$id_combat};"; if (DEBUG) { echo "Find person query is: {$query}<p>"; } $result = mysqli_query($cxn, $query) or die("Couldn't find authorization card"); // Now check: if we returned a result we have id_person. If not, exit out with card not found. // Note: we will return either 1 row, or 0.
echo '<form action="awards_group.php" method="post">'; echo "<table class='table table-condensed table-bordered'>"; echo '<tr><td class="text-right">Start of Range</td><td> <input type="date" class="date" name="start_date" value=""> (format if no datepicker: yyyy-mm-dd)</td></tr>'; echo '<tr><td class="text-right">End of Range</td><td> <input type="date" class="date" name="end_date" value=""> (format if no datepicker: yyyy-mm-dd)</td></tr>'; echo '<tr><td class="text-right">SCA Group:</td><td>'; echo '<select name="id_group" ><option value="-1" selected>' . HOST_KINGDOM . '</option>'; while ($row = mysqli_fetch_array($groups)) { echo '<option value="' . $row["id_group"] . '">' . $row["Name_Group"] . '</option>'; } echo "</td></tr>"; echo "</table>"; echo '<input type="submit" value="Show Awards" class="btn btn-primary">'; echo '</form>'; echo "</div>"; echo "</div><!-- ./col-md-6 -->"; /////////////////////////////////////////////////////////////////////////////// // News column on right /////////////////////////////////////////////////////////////////////////////// echo '<div class="col-md-3 well">'; echo form_subtitle("Most recent awards"); $query = "SELECT Persons.id_person, name_person, name_award, date_award, Awards.id_award " . "FROM Persons, Persons_Awards, Awards " . "WHERE Persons.id_person=Persons_Awards.id_person " . "AND Awards.id_award = Persons_Awards.id_award " . "ORDER BY date_award DESC " . "LIMIT 20"; $result = mysqli_query($cxn, $query) or die("Couldn't execute query"); while ($row = mysqli_fetch_assoc($result)) { extract($row); echo "<li><a href='person.php?id={$id_person}'>" . "{$name_person}</a> received <a href='list.php?award={$id_award}'>{$name_award}</a> on {$date_award}" . "</li>"; } include "warning.php"; // includes the warning text about paper precedence echo "<div> <!-- ./col-md-3 --></div> <!-- ./row -->"; mysqli_close($cxn); /* close the db connection */
if (DEBUG) { echo "Now testing {$name_marshal}: dynmidauth[{$id_marshal}]="; if (isset($dynmidauth[$id_marshal])) { echo $dynmidauth[$id_marshal]; } else { echo "unset"; } if ($ipcc != NULL) { echo " with card for {$name_combat}"; } echo "<p>"; } if ($ipcc == NULL) { // No combat card info means no warrants if (isset($dynmidauth[$id_marshal])) { echo form_subtitle("Cannot authorize {$name_marshal} " . "until the card information for {$name_combat} combat " . "is completed.<p>"); } } else { // We have a combat card and can now start doing stuff. if ($ia != NULL && !isset($dynmidauth[$id_marshal])) { // Authorization exists in database, but box is no longer ticked $update = "DELETE FROM Persons_Marshals " . "WHERE id_person={$id_person} " . "AND id_marshal = {$id_marshal}"; $result = update_query($cxn, $update); if (DEBUG) { echo "Deleting marshal's warrant: {$update}<p>"; } if ($result !== 1) { echo "Error deleting {$name_marshal} marshal's warrants: " . mysqli_error($cxn); } } if ($ia == NULL && isset($dynmidauth[$id_marshal])) {
<p class="text-center"> <?php // Build links to the list beginning with the appropriate initial, which is returned as $Initial $query = "select count(*) as ct, substring(name_person,1,1) as Initial from Persons group by Initial"; $result = mysqli_query($cxn, $query) or die("Couldn't execute query"); echo form_subtitle("Click letter to list all people with that initial"); while ($row = mysqli_fetch_assoc($result)) { // extract($row); $init = $row['Initial']; $link = "<a href='/public/list.php?initial={$init}'>{$init}</a> "; echo $link; } ?> </p>
echo '>' . $row["name_combat"] . '</option>'; } echo '</select></td></tr>'; echo '</tr> <td class="text-right">SCA Membership #:<br>(required)</td> <td><input type="number" name="mem_num" min="1" step="1"></td> </tr>'; echo '</table>'; echo '<input type="submit" value="Show Card" class="btn btn-primary">'; echo '</form>'; echo "</div>"; // Center block echo "</div>"; // Center block echo "</div><!-- ./col-md-6 -->"; /////////////////////////////////////////////////////////////////////////////// // News column on right /////////////////////////////////////////////////////////////////////////////// echo '<div class="col-md-3 well">'; echo form_subtitle("Upcoming Expirations"); $query = "SELECT Persons.id_person, name_person, expire_authorize, PCC.id_combat, name_combat " . "FROM Persons, Persons_CombatCards as PCC, Combat " . "WHERE Persons.id_person=PCC.id_person " . "AND PCC.id_combat=Combat.id_combat " . "AND active_authorize='Yes' " . "AND expire_authorize>= now() " . "ORDER BY expire_authorize " . "LIMIT 20;"; $result = mysqli_query($cxn, $query) or die("Couldn't execute query"); while ($row = mysqli_fetch_assoc($result)) { extract($row); if (permissions("Marshal") >= 3) { echo "<li><a href='edit_person.php?id={$id_person}'>"; } else { echo "<li><a href='person.php?id={$id_person}'>"; } echo "{$name_person}</a> has an expiring authorization for <b>{$name_combat}</b> on {$expire_authorize}" . "</li>"; }
echo "<tr>"; echo "<td ><a href='person.php?id={$id_person}'>{$name_person}</a></td>"; echo "<td class='text-left'><a href='list.php?award={$id_award}'>{$name_award}</a></td>"; echo "</tr>"; } echo "</table><p>"; } else { echo "<p>Currently no recipients known for this event.<p>"; } echo "</div><!-- ./col-md-8 --></div><!-- ./row -->"; //close out list and open divs if (permissions("Herald") >= 3) { /* Now let's list potential recipients for the herald's eyes only */ echo "<div class='row'><div class='col-md-8 col-md-offset-2'>"; echo form_subtitle("People Who May Have Received This Award At This Event"); echo form_subtitle("(due to the date of the Award)"); $query = "SELECT Persons.id_person, name_person, name_award, Awards.id_award " . "FROM Persons, Awards, Persons_Awards " . "WHERE id_event=-1 " . "AND date_award >= '{$date_event_start}' " . "AND date_award <= '{$date_event_stop}' " . "AND Persons.id_person = Persons_Awards.id_person " . "AND Awards.id_award = Persons_Awards.id_award"; if (DEBUG) { echo "Potential Recipients query is:<p>{$query}"; } $result = mysqli_query($cxn, $query) or die("Couldn't execute potential recipients query"); echo "<table class='table table-condensed table-bordered'>\n<thead>\n<td ><strong>Recipient</strong></td>\n<td class='text-left'><strong>Award</strong></td>\n</thead>"; while ($row = mysqli_fetch_assoc($result)) { extract($row); echo "<tr>"; echo "<td ><a href='edit_person.php?id={$id_person}'>{$name_person}</a></td>"; echo "<td class='text-left'><a href='list.php?award={$id_award}'>{$name_award}</a></td>"; echo "</tr>"; } echo "</table><p>"; echo "</div><!-- ./col-md-8 --></div><!-- ./row -->";