<?php $award = getAward($award_id); $form = new BayonetForm("", "POST"); if ($form->verifySubmit('processed')) { global $db; $name = $form->request['name']; $text = $form->request['text']; $db->Query("UPDATE `rudi_awards` SET `name` = '{$name}', `description` = '{$text}' WHERE `award_id` = '{$award_id}' LIMIT 1"); PageRedirect(1, "?op=rudi&show=awards&award={$award_id}"); return; } echo LinkInternal("Cancel", "?op=rudi&show=awards&cid={$award['class_id']}"); OpenTable(); ?> <tr><th>Name:</th><td><?php $form->textField('name', $award['name'], false, "50"); ?> </td><tr> <tr><th>Image:</th><td><?php ?> </td></tr> <tr><th>Text:</th><td><?php $form->textArea('text', 10, 30, $award['description']); ?> </td></tr> <tr><td><?php $form->submitButton('processed', 'Update'); ?> </td></tr>
function EditStatus($member_id) { global $db; $form = new BayonetForm("", "POST"); if ($form->VerifySubmit('processed')) { echo "Please wait while your information is being processed..."; $status_id = $form->request['status']; $db->query("UPDATE `rudi_unit_members` SET `status_id` = '{$status_id}' WHERE `member_id` = '{$member_id}' LIMIT 1"); PageRedirect(1, "?op=adjutant&edit=loas&member={$member_id}"); return; } $result = $db->Query("SELECT * FROM `rudi_unit_members` JOIN `rudi_ranks` ON rudi_unit_members.rank_id=rudi_ranks.rank_id WHERE `member_id` = '{$member_id}' LIMIT 1"); $row = $db->FetchRow($result); ?> <center> <table width="50%" style="text-align:center;"> <tr><th>Rank</th><th>Soldier</th><th>Status</th></tr> <tr> <td><?php echo $row['shortname']; ?> </td> <td><?php echo $row['first_name'] . " " . $row['last_name']; ?> </td> <td style="text-align:left;"> <?php $form->radioButton('status', 1, $row['status_id'] == 1 ? true : false); ?> Active<br /> <?php $form->radioButton('status', 2, $row['status_id'] == 2 ? true : false); ?> On Leave<br /> <?php $form->radioButton('status', 3, $row['status_id'] == 3 ? true : false); ?> On Extended Leave </td> </tr> <tr><td colspan="3"><?php $form->submitButton('processed'); ?> </td></tr> </table> </center> <?php $form->__destruct(); }
<?php global $db; $result = $db->Query("SELECT `name`, `class_id` FROM `rudi_awards` WHERE `award_id` = '{$award_id}' LIMIT 1"); $award = $db->FetchRow($result); $form = new BayonetForm("", "POST"); if (isset($_POST['proceed'])) { echo "Award '{$award['name']}', was deleted."; $db->Query("DELETE FROM `rudi_awards` WHERE `award_id` = '{$award_id}' LIMIT 1"); PageRedirect(2, "?op=rudi&show=awards&cid={$award['class_id']}"); return; } if (isset($_POST['cancel'])) { echo "User cancelled deletion of award: '{$award['name']}'"; PageRedirect(2, "?op=rudi&show=awards&cid={$award['class_id']}"); return; } OpenTable(); ?> <th>Are you <u>SURE</u> you want to delete the award titled: '<?php echo $award['name']; ?> '?<br />All users who have recieved this award will lose it off their records (not yet at least).</th> <tr><th><button name="proceed">Yes</button> <button name="cancel">No</button></th></tr> <?php CloseTable(); $form->__destruct();
<?php $class_id = $_GET['cid']; $form = new BayonetForm("", "POST"); if ($form->verifySubmit('processed')) { global $db; $name = $form->request['name']; $text = $form->request['text']; decho("INSERT INTO `rudi_awards` SET `class_id` = '{$class_id}', `name` = '{$name}', `description` = '{$text}'"); $db->Query("INSERT INTO `rudi_awards` SET `class_id` = '{$class_id}', `name` = '{$name}', `image` = '', `description` = '{$text}'"); PageRedirect(1, "?op=rudi&show=awards&cid=" . $class_id); return; } echo LinkInternal("Cancel", "?op=rudi&show=awards&cid=" . $class_id); OpenTable(); ?> <tr><th>Name:</th><td><?php $form->textField('name', "", false, "50"); ?> </td><tr> <tr><th>Image:</th><td><?php ?> </td></tr> <tr><th>Text:</th><td><?php $form->textArea('text', 10, 30); ?> </td></tr> <tr><td><?php $form->submitButton('processed', 'Add'); ?>
function AddAwardRecord($member_id) { global $db; $form = new BayonetForm("", "POST"); if ($form->verifySubmit('processed')) { $date = $form->request['date']; $details = $form->request['details']; $award_id = $_POST['award']; decho($form->request); $db->Query("INSERT INTO `rudi_award_record` SET `member_id` = '{$member_id}', `award_id` = '{$award_id}', `date_added` = '{$date}', `record_note` = '{$details}', `added_by` = 1"); PageRedirect(1, "?op=rudi&show=members&award={$member_id}"); return; } $result = $db->Query("SELECT `date_added`, `record_note`, `member_id` FROM `rudi_service_record` WHERE `record_id` = '{$record_id}' LIMIT 1"); $row = $db->FetchRow($result); echo "<a href=\"?op=rudi&show=members&award={$member_id}\">Cancel</a>"; OpenTable(); ?> <tr><td>Award:</td><td> <select name="award"> <?php $awards = GetAllAwards(); foreach ($awards as $award) { echo "<option value=\"{$award['award_id']}\">{$award['name']}</option>"; } ?> </select> </td></tr> <tr><td>Date:</td><td><?php $form->textField('date'); ?> </td></tr> <tr><td>Details:</td><td><?php $form->textArea('details', 10, 30); ?> </td></tr> <tr><td colspan="2"><?php $form->submitButton('processed', 'Add'); ?> </td></tr> <?php CloseTable(); $form->__destruct(); }