diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2011-04-17 20:13:07 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2011-04-17 20:13:07 -0400 |
commit | 0077cb99704fe863cf731fc5cab792af2ede96c2 (patch) | |
tree | dd68f44971aa2aee821f588d33b250dcd2fe57e3 /admin/rudi | |
parent | e8b28c5e910d92cbec3d4baa6e98f025e8418d28 (diff) | |
download | bayonetcms-0077cb99704fe863cf731fc5cab792af2ede96c2.tar.gz |
Backporting retarded amount of changes outside of version control
Diffstat (limited to 'admin/rudi')
-rw-r--r-- | admin/rudi/functions.php | 140 | ||||
-rw-r--r-- | admin/rudi/includes/functions.awards.php | 38 | ||||
-rw-r--r-- | admin/rudi/includes/functions.battles.php | 70 | ||||
-rw-r--r-- | admin/rudi/includes/functions.members.php | 48 | ||||
-rw-r--r-- | admin/rudi/includes/functions.units.php | 33 | ||||
-rw-r--r-- | admin/rudi/index.php | 120 | ||||
-rw-r--r-- | admin/rudi/views/view.awards.add.php | 27 | ||||
-rw-r--r-- | admin/rudi/views/view.awards.delete.php | 29 | ||||
-rw-r--r-- | admin/rudi/views/view.awards.edit.php | 54 | ||||
-rw-r--r-- | admin/rudi/views/view.awards.php | 78 | ||||
-rw-r--r-- | admin/rudi/views/view.battles.list.php | 18 | ||||
-rw-r--r-- | admin/rudi/views/view.battles.php | 36 | ||||
-rw-r--r-- | admin/rudi/views/view.members.award.php | 39 | ||||
-rw-r--r-- | admin/rudi/views/view.members.new.php | 179 | ||||
-rw-r--r-- | admin/rudi/views/view.members.php | 20 | ||||
-rw-r--r-- | admin/rudi/views/view.members.profile.php | 50 | ||||
-rw-r--r-- | admin/rudi/views/view.units.php | 51 |
17 files changed, 755 insertions, 275 deletions
diff --git a/admin/rudi/functions.php b/admin/rudi/functions.php index b22468b..dc6faea 100644 --- a/admin/rudi/functions.php +++ b/admin/rudi/functions.php @@ -1,71 +1,71 @@ -<?php
-/**
- * Bayonet Content Management System
- * Copyright (C) 2008 Joseph Hunkeler & Evan O'Connell
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- /*
- include $basedir.'rudi/functions.php';
-
- //chek to see if the person is indeed an quartermaster
-
- if(isset($_GET['edit'])){
-
- if($_GET['edit'] == "profile"){
- $member_id = $_GET['id'];
- EditProfile($member_id);
- return;
- }
- if($_GET['edit'] == "service"){
- if(isset($_GET['var'])){
- if($_GET['var'] == "add"){
- $member_id = $_GET['id'];
- AddServiceRecord($member_id);
- }
- if($_GET['var'] == "edit"){
- $record_id = $_GET['id'];
- EditServiceRecord($record_id);
- }
- if($_GET['var'] == "delete"){
- $record_id = $_GET['id'];
- }
- }else{
- $member_id = $_GET['id'];
- ListServiceRecord($member_id);
- }
- return;
- }
- if($_GET['edit'] == "medals"){
- if(isset($_GET['var'])){
- if($_GET['var'] == "add"){
-
- }
- if($_GET['var'] == "edit"){
-
- }
- if($_GET['var'] == "delete"){
-
- }
- }else{
- $member_id = $_GET['id'];
- ListMedalRecord($member_id);
- }
-
- return;
- }
- }
-
- ListMembers(); */
+<?php +/** + * Bayonet Content Management System + * Copyright (C) 2008 Joseph Hunkeler & Evan O'Connell + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + /* + include $basedir.'rudi/functions.php'; + + //chek to see if the person is indeed an quartermaster + + if(isset($_GET['edit'])){ + + if($_GET['edit'] == "profile"){ + $member_id = $_GET['id']; + EditProfile($member_id); + return; + } + if($_GET['edit'] == "service"){ + if(isset($_GET['var'])){ + if($_GET['var'] == "add"){ + $member_id = $_GET['id']; + AddServiceRecord($member_id); + } + if($_GET['var'] == "edit"){ + $record_id = $_GET['id']; + EditServiceRecord($record_id); + } + if($_GET['var'] == "delete"){ + $record_id = $_GET['id']; + } + }else{ + $member_id = $_GET['id']; + ListServiceRecord($member_id); + } + return; + } + if($_GET['edit'] == "medals"){ + if(isset($_GET['var'])){ + if($_GET['var'] == "add"){ + + } + if($_GET['var'] == "edit"){ + + } + if($_GET['var'] == "delete"){ + + } + }else{ + $member_id = $_GET['id']; + ListMedalRecord($member_id); + } + + return; + } + } + + ListMembers(); */ ?>
\ No newline at end of file diff --git a/admin/rudi/includes/functions.awards.php b/admin/rudi/includes/functions.awards.php index 439f0e1..0b4b1e2 100644 --- a/admin/rudi/includes/functions.awards.php +++ b/admin/rudi/includes/functions.awards.php @@ -1,20 +1,20 @@ -<?php
-
- function getAwardClasses(){
- global $db;
- $result = $db->Query("SELECT `name`, `class_id` FROM `rudi_award_classes`");
- return $db->Fetch($result);
- }
-
- function getAwardsByClass($class_id){
- global $db;
- $result = $db->Query("SELECT `award_id`, `name`, `image`, `description` FROM `rudi_awards` WHERE `class_id` = '$class_id' ORDER BY `name`");
- return $db->Fetch($result);
- }
-
- function getAward($award_id){
- global $db;
- $result = $db->Query("SELECT `award_id`, `name`, `image`, `description`, `class_id` FROM `rudi_awards` WHERE `award_id` = '$award_id' LIMIT 1");
- return $db->FetchRow($result);
- }
+<?php + + function getAwardClasses(){ + global $db; + $result = $db->Query("SELECT `name`, `class_id` FROM `rudi_award_classes`"); + return $db->Fetch($result); + } + + function getAwardsByClass($class_id){ + global $db; + $result = $db->Query("SELECT `award_id`, `name`, `image`, `description` FROM `rudi_awards` WHERE `class_id` = '$class_id' ORDER BY `name`"); + return $db->Fetch($result); + } + + function getAward($award_id){ + global $db; + $result = $db->Query("SELECT `award_id`, `name`, `image`, `description`, `class_id` FROM `rudi_awards` WHERE `award_id` = '$award_id' LIMIT 1"); + return $db->FetchRow($result); + } ?>
\ No newline at end of file diff --git a/admin/rudi/includes/functions.battles.php b/admin/rudi/includes/functions.battles.php new file mode 100644 index 0000000..2b878da --- /dev/null +++ b/admin/rudi/includes/functions.battles.php @@ -0,0 +1,70 @@ +<?php + + function getAllBattles(){ + global $db; + + $result = $db->Query("SELECT w.war_id, + w.title, + w.visit_unit_id, + w.home_score, + w.visit_score, + w.date, + w.status, + v.name + FROM rudi_war_stats AS w + LEFT OUTER JOIN rudi_war_units AS v + ON v.visitor_id = w.visit_unit_id + ORDER BY w.date"); + $data = $db->Fetch($result); + + return $data; + } + + function getBattleInfo($war_id){ + global $db; + + $result = $db->Query("SELECT w.war_id, + w.title, + w.visit_unit_id, + w.home_score, + w.visit_score, + w.date, + w.status, + v.name + FROM rudi_war_stats AS w + LEFT OUTER JOIN rudi_war_units AS v + ON v.visitor_id = w.visit_unit_id + WHERE w.war_id = {$war_id}"); + $data = $db->FetchRow($result); + + return $data; + } + + function getCombatSoldiers($war_id){ + global $db; + + $query = "SELECT m.member_id, + m.first_name, + m.last_name, + r.shortname, + r.longname, + w.record_id, + + FROM rudi_combat_record AS w + JOIN rudi_unit_members AS m + ON m.member_id = w.member_id + JOIN rudi_ranks AS r + ON m.rank_id = r.rank_id + WHERE m.status_id < 4, w.war_id = {$war_id} OR w.war_id IS NULL + ORDER BY r.weight DESC , m.date_promotion ASC , m.date_enlisted ASC"; + + decho($query); + $result = $db->Query($query); + $data = $db->Fetch($result); + + + + return $data; + } + +?>
\ No newline at end of file diff --git a/admin/rudi/includes/functions.members.php b/admin/rudi/includes/functions.members.php index 6a4970e..86848dc 100644 --- a/admin/rudi/includes/functions.members.php +++ b/admin/rudi/includes/functions.members.php @@ -48,9 +48,17 @@ function GetRoles(){ global $db; - $result = $db->Query("SELECT * FROM `rudi_roles`"); - $row = $db->Fetch($result); - return $row; + $data = array(); + $result = $db->Query("SELECT * FROM `rudi_role_classes` ORDER BY `weight` ASC"); + $classes = $db->Fetch($result); + + foreach($classes as $class){ + $rclass_id = $class['rclass_id']; + $result2 = $db->Query("SELECT * FROM rudi_roles WHERE rclass_id = '$rclass_id' ORDER BY `weight` ASC"); + $data[] = array("name" => $class['name'], "roles" => $db->Fetch($result2)); + } + + return $data; } function GetCountry(){ @@ -177,7 +185,7 @@ <td><?php echo date("M j Y", strtotime($record['date_added'])); ?></td> <td><?php echo $record['record_note']; ?></td> <td><a href="?op=rudi&show=members&award=<?php echo $member_id; ?>&edit=<?php echo $record['record_id']; ?>">Edit</a></td> - <td><a href="?op=rudi&show=members&award=<?php echo $row['member_id']; ?>&delete=<?php echo $record['record_id']; ?>">Delete</a></td> + <td><a href="?op=rudi&show=members&award=<?php echo $member_id; ?>&delete=<?php echo $record['record_id']; ?>">Delete</a></td> </tr> <?php } @@ -224,6 +232,38 @@ } + function DeleteAwardRecord($record_id){ + global $db; + + $result = $db->Query("SELECT r.date_added, r.record_note, r.member_id, a.name FROM rudi_award_record AS r LEFT OUTER JOIN rudi_awards AS a ON a.award_id = r.award_id WHERE r.record_id = '$record_id' LIMIT 1"); + $record = $db->FetchRow($result); + decho($record_id); + decho($record); + $form = new BayonetForm("", "POST"); + + if(isset($_POST['proceed'])) + { + echo "Award '{$record['name']}', was deleted from that soldiers record."; + $db->Query("DELETE FROM `rudi_award_record` WHERE `record_id` = '$record_id' LIMIT 1"); + PageRedirect(2, "?op=rudi&show=members&award={$record['member_id']}"); + return; + } + if(isset($_POST['cancel'])) + { + echo "User cancelled deletion of award: '{$record['name']}'"; + PageRedirect(2, "?op=rudi&show=members&award={$award['member_id']}"); + return; + } + + OpenTable(); +?> + <th>Are you <u>SURE</u> you want to delete the award record: '<?php echo $record['name'];?>'? for this member?<br />All changes are final.</th> + <tr><th><button name="proceed">Yes</button> <button name="cancel">No</button></th></tr> +<?php + CloseTable(); + $form->__destruct(); + } + function AddAwardRecord($member_id){ global $db; diff --git a/admin/rudi/includes/functions.units.php b/admin/rudi/includes/functions.units.php new file mode 100644 index 0000000..5005fa0 --- /dev/null +++ b/admin/rudi/includes/functions.units.php @@ -0,0 +1,33 @@ +<?php + + function DisplayUnits(){ + global $db; + $result = $db->Query("SELECT `unit_id`, `name` FROM `rudi_combat_units` WHERE `detachment` = 0 "); + $row = $db->Fetch($result); + foreach($row as $unit){ + $unit_name = $unit['name']; + $unit_id = $unit['unit_id']; + echo '<img src="images/tree_branch.gif" /> '.$unit_name.'<br />'; + selectUnits($unit_id, 0, $member['cunit_id']); + } + } + + function selectUnits($previous_unit, $indent, $members_unit){ + global $db; + + $indent++; + //$formatting = str_repeat(" ", $indent); + $formatting = str_repeat('<img src="images/tree_leaf.gif" />', $indent); + + $result = $db->Query("SELECT `unit_id`, `name` FROM `rudi_combat_units` WHERE `detachment` = '$previous_unit'"); + $row = $db->Fetch($result); + foreach($row as $unit){ + $unit_id = $unit['unit_id']; + $unit_name = $unit['name']; + echo $formatting.'<img src="images/tree_branch.gif" /> '.$unit_name.'<br />'; + + selectUnits($unit_id, $indent, $members_unit); + } + } + +?>
\ No newline at end of file diff --git a/admin/rudi/index.php b/admin/rudi/index.php index 2e4a42a..62eaacf 100644 --- a/admin/rudi/index.php +++ b/admin/rudi/index.php @@ -1,59 +1,63 @@ -<?php
-/**
- * Bayonet Content Management System
- * Copyright (C) 2008 Joseph Hunkeler & Evan O'Connell
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
- ?>
- <link rel="stylesheet" type="text/css" href="rudi/style.css" media="screen"/>
- <div style="text-align:left;"><h2>- RUDI/Quartermaster Control Panel</h2></div>
- <?php
- if(!defined("ADMIN_FILE"))
- {
- die("Access denied.");
- }
-
- if(isset($_GET['show'])){
-
- switch($_GET['show']){
- case 'members':
- include $basedir.'rudi/views/view.members.php';
- break;
- case 'units':
- include $basedir.'rudi/views/view.units.php';
- break;
- case 'awards':
- include $basedir.'rudi/views/view.awards.php';
- break;
- case 'ranks':
- include $basedir.'rudi/views/view.ranks.php';
- break;
- case 'drills':
- include $basedir.'rudi/views/view.drills.php';
- break;
- }
- }else{
- $th = array('Rudi Options','');
- $td = array(
- LinkInternal('Roster','?op=rudi&show=members'),
- LinkInternal('Units','?op=rudi&show=units'),
- LinkInternal('Awards', '?op=rudi&show=awards')
- );
-
- //render administration table
- CompileAdmin($th,$td);
- }
+<?php +/** + * Bayonet Content Management System + * Copyright (C) 2008 Joseph Hunkeler & Evan O'Connell + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + + ?> + <link rel="stylesheet" type="text/css" href="rudi/style.css" media="screen"/> + <div style="text-align:left;"><h2>- RUDI/Quartermaster Control Panel</h2></div> + <?php + if(!defined("ADMIN_FILE")) + { + die("Access denied."); + } + + if(isset($_GET['show'])){ + + switch($_GET['show']){ + case 'members': + include $basedir.'rudi/views/view.members.php'; + break; + case 'units': + include $basedir.'rudi/views/view.units.php'; + break; + case 'awards': + include $basedir.'rudi/views/view.awards.php'; + break; + case 'ranks': + include $basedir.'rudi/views/view.ranks.php'; + break; + case 'drills': + include $basedir.'rudi/views/view.drills.php'; + break; + case 'battles': + include $basedir.'rudi/views/view.battles.php'; + break; + } + }else{ + $th = array('Rudi Options',''); + $td = array( + LinkInternal('Roster','?op=rudi&show=members'), + LinkInternal('Units','?op=rudi&show=units'), + LinkInternal('Awards', '?op=rudi&show=awards'), + LinkInternal('Battles', '?op=rudi&show=battles') + ); + + //render administration table + CompileAdmin($th,$td); + } ?>
\ No newline at end of file diff --git a/admin/rudi/views/view.awards.add.php b/admin/rudi/views/view.awards.add.php new file mode 100644 index 0000000..9c97c54 --- /dev/null +++ b/admin/rudi/views/view.awards.add.php @@ -0,0 +1,27 @@ +<?php + $class_id = $_GET['cid']; + $form = new BayonetForm("", "POST"); + if($form->verifySubmit('processed')) + { + global $db; + $name = $form->request['name']; + $text = $form->request['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'); ?></td></tr> + +<?php + CloseTable(); + $form->__destruct(); +?> + diff --git a/admin/rudi/views/view.awards.delete.php b/admin/rudi/views/view.awards.delete.php new file mode 100644 index 0000000..6fde068 --- /dev/null +++ b/admin/rudi/views/view.awards.delete.php @@ -0,0 +1,29 @@ +<?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(); +?>
\ No newline at end of file diff --git a/admin/rudi/views/view.awards.edit.php b/admin/rudi/views/view.awards.edit.php index 21ec156..0b82ef6 100644 --- a/admin/rudi/views/view.awards.edit.php +++ b/admin/rudi/views/view.awards.edit.php @@ -1,27 +1,27 @@ -<?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>
-
-<?php
- CloseTable();
- $form->__destruct();
-?>
-
+<?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> + +<?php + CloseTable(); + $form->__destruct(); +?> + diff --git a/admin/rudi/views/view.awards.php b/admin/rudi/views/view.awards.php index b4c912f..3a5729f 100644 --- a/admin/rudi/views/view.awards.php +++ b/admin/rudi/views/view.awards.php @@ -1,40 +1,40 @@ -<?php
- include $basedir.'rudi/includes/functions.awards.php';
- if(isset($_GET['award'])){
- $award_id = $_GET['award'];
- include 'view.awards.edit.php';
- }else if(isset($_GET['add'])){
- include 'view.awards.add.php';
- }else if(isset($_GET['delete'])){
- $award_id = $_GET['delete'];
- include 'view.awards.delete.php';
- }else{
- echo "<h3>Award Classes</h3>";
- $classes = getAwardClasses();
- OpenTable();
- echo "<tr style=\"text-align:center\">";
- foreach($classes as $class){
- echo "<td>".LinkInternal($class['name'],'?op=rudi&show=awards&cid='.$class['class_id'])."</td>";
- }
- echo "</tr>";
- CloseTable();
-
- if(isset($_GET['cid'])){
- $class_id = $_GET['cid'];
- $awards = getAwardsByClass($class_id);
- echo "<h3>Awards</h3>";
- echo LinkInternal('<img src="images/add.png" /> Add New Award','?op=rudi&show=awards&cid={$class_id}&add=true');
- OpenTable();
- foreach($awards as $award){
- echo "<tr><td>".$award['name']."</td>
- <td><a href=\"?op=rudi&show=awards&award={$award['award_id']}\">Edit</a></td>
- <td><a href=\"?op=rudi&show=awards&delete={$award['award_id']}\">Delete</a></td></tr>";
- }
- CloseTable();
- //include 'view.members.profile.php';
- }else if(isset($_GET['aid'])){
- $award_id = $_GET['aid'];
- //include 'view.members.service.php';
- }
- }
+<?php + include $basedir.'rudi/includes/functions.awards.php'; + if(isset($_GET['award'])){ + $award_id = $_GET['award']; + include 'view.awards.edit.php'; + }else if(isset($_GET['add'])){ + include 'view.awards.add.php'; + }else if(isset($_GET['delete'])){ + $award_id = $_GET['delete']; + include 'view.awards.delete.php'; + }else{ + echo "<h3>Award Classes</h3>"; + $classes = getAwardClasses(); + OpenTable(); + echo "<tr style=\"text-align:center\">"; + foreach($classes as $class){ + echo "<td>".LinkInternal($class['name'],'?op=rudi&show=awards&cid='.$class['class_id'])."</td>"; + } + echo "</tr>"; + CloseTable(); + + if(isset($_GET['cid'])){ + $class_id = $_GET['cid']; + $awards = getAwardsByClass($class_id); + echo "<h3>Awards</h3>"; + echo LinkInternal('<img src="images/add.png" /> Add New Award','?op=rudi&show=awards&cid={$class_id}&add=true'); + OpenTable(); + foreach($awards as $award){ + echo "<tr><td>".$award['name']."</td> + <td><a href=\"?op=rudi&show=awards&award={$award['award_id']}\">Edit</a></td> + <td><a href=\"?op=rudi&show=awards&delete={$award['award_id']}\">Delete</a></td></tr>"; + } + CloseTable(); + //include 'view.members.profile.php'; + }else if(isset($_GET['aid'])){ + $award_id = $_GET['aid']; + //include 'view.members.service.php'; + } + } ?>
\ No newline at end of file diff --git a/admin/rudi/views/view.battles.list.php b/admin/rudi/views/view.battles.list.php new file mode 100644 index 0000000..573d422 --- /dev/null +++ b/admin/rudi/views/view.battles.list.php @@ -0,0 +1,18 @@ +<?php + + global $db; + + // get all active members and members that attended the match + // each member has a checkbox + // -> Use AJAX oncheck to save the status of that member + + $battle = getBattleInfo($war_id); + + decho($battle); + + $members = getCombatSoldiers($war_id); + + decho($members); + +?> +<h3>Engagement : <?php echo $battle['title']; ?></h3>
\ No newline at end of file diff --git a/admin/rudi/views/view.battles.php b/admin/rudi/views/view.battles.php new file mode 100644 index 0000000..d00452e --- /dev/null +++ b/admin/rudi/views/view.battles.php @@ -0,0 +1,36 @@ +<?php + + // list all battles + // -> click one to view who was attending (lists everyone in the unit and those attending) + // buttons to add/edit/delete battles + + // definitely gonna use ajax for this... + + include $basedir.'rudi/includes/functions.battles.php'; + + if(isset($_GET['id'])){ + $war_id = $_GET['id']; + include 'view.battles.list.php'; + }else if(isset($_GET['service'])){ + $member_id = $_GET['service']; + include 'view.members.service.php'; + }else{ + + // list all battles + $battles = getAllBattles(); + decho($battles); + +?> + <h3>Unit Engagement:</h3> + <table width="100%" style="text-align:center;"> + <tr><th>Title</th><th>Opponent</th><th>Result</th><th>Date</th></tr> +<?php + foreach($battles as $battle){ + echo "<tr><td><a href=\"?op=rudi&show=battles&id={$battle['war_id']}\">{$battle['title']}</a></td><td>vs {$battle['name']}</td><td>{$battle['status']} {$battle['home_score']}-{$battle['visit_score']}</td><td>"; + echo date("M j Y", strtotime($battle['date'])); + echo "</td><tr>"; + + } + CloseTable(); + } +?>
\ No newline at end of file diff --git a/admin/rudi/views/view.members.award.php b/admin/rudi/views/view.members.award.php index cda8595..db6f88e 100644 --- a/admin/rudi/views/view.members.award.php +++ b/admin/rudi/views/view.members.award.php @@ -1,19 +1,22 @@ -<?php
- global $db;
- $result = $db->Query("SELECT `first_name`, `last_name` FROM `rudi_unit_members` WHERE `member_id` = '$member_id' LIMIT 1");
- $member = $db->FetchRow($result);
- echo "<h3>Award Record of {$member['first_name']} {$member['last_name']}</h3>";
-
- if(isset($_GET['edit'])){
- $record_id = $_GET['edit'];
- EditAwardRecord($record_id);
- }else if(isset($_GET['add'])){
- if($_GET['add']){
- AddAwardRecord($_GET['award']);
- }
- }else{
-
- echo "<div style=\"text-align:left;\">".LinkInternal('Back to Roster', '?op=rudi&show=members')."</div>";
- ListAwardRecord($_GET['award']);
- }
+<?php + global $db; + $result = $db->Query("SELECT `first_name`, `last_name` FROM `rudi_unit_members` WHERE `member_id` = '$member_id' LIMIT 1"); + $member = $db->FetchRow($result); + echo "<h3>Award Record of {$member['first_name']} {$member['last_name']}</h3>"; + + if(isset($_GET['edit'])){ + $record_id = $_GET['edit']; + EditAwardRecord($record_id); + }else if(isset($_GET['add'])){ + if($_GET['add']){ + AddAwardRecord($_GET['award']); + } + }else if(isset($_GET['delete'])){ + $record_id = $_GET['delete']; + DeleteAwardRecord($record_id); + }else{ + + echo "<div style=\"text-align:left;\">".LinkInternal('Back to Roster', '?op=rudi&show=members')."</div>"; + ListAwardRecord($_GET['award']); + } ?>
\ No newline at end of file diff --git a/admin/rudi/views/view.members.new.php b/admin/rudi/views/view.members.new.php new file mode 100644 index 0000000..cbc086f --- /dev/null +++ b/admin/rudi/views/view.members.new.php @@ -0,0 +1,179 @@ +<?php
+ global $db;
+
+ if(isset($_POST['processed'])){
+
+ echo "Please wait while the information is processed...";
+
+ $rank_id = $_POST['rank'];
+ $country_id = $_POST['country'];
+ $status_id = $_POST['status'];
+ $role_id = $_POST['role'];
+ $unit_id = $_POST['unit'];
+ $weapon_id = $_POST['weapon'];
+ $first_name = addslashes($_POST['first']);
+ $last_name = addslashes($_POST['last']);
+ $username = addslashes($_POST['username']);
+ $city = addslashes($_POST['city']);
+ $province = addslashes($_POST['province']);
+ $primary_mos = addslashes($_POST['primmos']);
+ $enlisted = addslashes($_POST['enlist']);
+ $promoted = addslashes($_POST['promote']);
+ $discharged = addslashes($_POST['discharge']);
+ $xfire = addslashes($_POST['xfire']);
+ $email = addslashes($_POST['email']);
+ $bio = addslashes($_POST['bio']);
+
+ //$discharged = empty($discharged) ? NULL : "'{$discharged}'";
+
+ $query = "INSERT INTO `rudi_unit_members` SET"
+ ." `rank_id` = '$rank_id',"
+ ." `country_id` = '$country_id',"
+ ." `status_id` = '$status_id',"
+ ." `cunit_id` = '$unit_id',"
+ ." `weapon_id` = '$weapon_id',"
+ ." `username` = '$username',"
+ ." `email` = '$email',"
+ ." `xfire` = '$xfire',"
+ ." `first_name` = '$first_name',"
+ ." `last_name` = '$last_name',"
+ ." `location_city` = '$city',"
+ ." `location_province` = '$province',"
+ ." `bio` = '$bio',"
+ ." `date_enlisted` = '$enlisted',"
+ ." `date_promotion` = '$promoted',"
+ ." `primary_mos` = '$primary_mos',";
+ if(empty($discharged))
+ $query = $query." `date_discharged` = null";
+ else
+ $query = $query." `date_discharged` = '$discharged'";
+ decho($query);
+ $db->Query($query);
+
+ $member_id = $db->InsertID();
+ decho($member_id);
+ $db->Query("INSERT INTO `rudi_roles_container` SET `role_id` = '$role_id', `member_id` = '$member_id'");
+
+ PageRedirect(1, "?op=rudi&show=members");
+ return;
+ }
+?>
+ <a href="?op=rudi&show=members">Cancel</a><br />
+ <form method="POST" action="">
+ <table width="100%" style="text-align:center;">
+ <tr><th colspan="2" style="background-color:#c4c4c4;">Personnel File of <?php echo $member['first_name']." ".$member['last_name']; ?></th></tr>
+ <tr><td class="right" width="50%">Rank:</td><td class="left">
+ <select name="rank">
+<?php $ranks = GetRanks();
+ foreach($ranks as $rank){
+ echo "<option value=\"{$rank['rank_id']}\">{$rank['longname']}</option>";
+ }
+?>
+ </select>
+ </td></tr>
+ <tr><td class="right">Country:</td><td class="left">
+ <select name="country">
+<?php $countries = GetCountry();
+ foreach($countries as $country){
+ echo "<option value=\"{$country['country_id']}\">{$country['name']}</option>";
+ }
+?>
+ </select>
+ </td></tr>
+ </table>
+ <table width="100%" style="text-align:center;">
+ <tr><th colspan="2" style="background-color:#c4c4c4;">Vital Statistics</th></tr>
+ <tr>
+ <td class="right" width="50%">First:</td>
+ <td class="left"><input type="text" name="first" value="" /></td>
+ </tr>
+ <tr>
+ <td class="right">Last:</td>
+ <td class="left"><input type="text" name="last" value="" /></td>
+ </tr>
+ <tr><td class="right">Username:</td><td class="left"><input type="text" name="username" value="" /></td></tr>
+ <tr><td class="right">City:</td><td class="left"><input type="text" name="city" value=""/></td></tr>
+ <tr><td class="right">Province:</td><td class="left"><input type="text" name="province" value="" /></td></tr>
+ <tr><td class="right">Status:</td><td class="left">
+ <select name="status">
+<?php $statuses = GetStatuses();
+ foreach($statuses as $status){
+ echo "<option value=\"{$status['status_id']}\">{$status['name']}</option>";
+ }
+?>
+ </select>
+ </td></tr>
+ <tr><td class="right">Primary MOS:</td><td class="left"><input type="text" name="primmos" value="" /></td></tr>
+ <tr>
+ <td class="right">Role:</td>
+ <td class="left">
+ <select name="role">
+<?php
+ $roles = GetRoles();
+ foreach($roles as $role){
+ echo "<option value=\"{$role['role_id']}\">{$role['name']}</option>";
+ }
+?>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td class="right" style="font-weight:bold;">Unit:</td>
+ <td class="left">
+ <select name="unit">
+ <option value="0">N/A</option>
+<?php
+ $result = $db->Query("SELECT `unit_id`, `name` FROM `rudi_combat_units` WHERE `detachment` = 0 ");
+ $row = $db->Fetch($result);
+ foreach($row as $unit){
+ $unit_name = $unit['name'];
+ $unit_id = $unit['unit_id'];
+ if($member['cunit_id']==$unit_id)
+ echo '<option value="'.$unit_id.'" selected>'.$unit_name.'</option>';
+ else
+ echo '<option value="'.$unit_id.'">'.$unit_name.'</option>';
+ selectUnits($unit_id, 0, $member['cunit_id']);
+ }
+?>
+ </select>
+ </td>
+ </tr>
+ <tr><td class="right">Weapons:</td><td class="left">
+ <select name="weapon">
+<?php $weapons = GetWeapons();
+ foreach($weapons as $weapon){
+ echo "<option value=\"{$weapon['weapon_id']}\">{$weapon['model']}</option>";
+ }
+?>
+ </select>
+ </td></tr>
+ <tr>
+ <td class="right">Enlisted Date:</td>
+ <td class="left"><input type="text" name="enlist" value="" /></td>
+ </tr>
+ <tr>
+ <td class="right">Promotion Date:</td>
+ <td class="left">
+ <input type="text" name="promote" value="" />
+ </td>
+ </tr>
+ <tr>
+ <td class="right">Discharge Date:</td>
+ <td class="left"><input type="text" name="discharge" value="" /></td>
+ </tr>
+ <tr>
+ <td class="right">Xfire:</td>
+ <td class="left"><input type="text" name="xfire" value=""/></td>
+ </tr>
+ <tr>
+ <td class="right">E-Mail:</td>
+ <td class="left"><input type="text" name="email" value=""/></td>
+ </tr>
+ </table>
+ <br />
+ <table width="100%" style="text-align:center;">
+ <tr><th colspan="2" style="background-color:#c4c4c4;">Personal Bio</th></tr>
+ <tr><td><textarea rows="7" name="bio" cols="60"></textarea></td></tr>
+ <tr><td colspan="2"><input type="submit" value="Submit" name="processed" /></td>
+ </table>
+ </form>
\ No newline at end of file diff --git a/admin/rudi/views/view.members.php b/admin/rudi/views/view.members.php index 38929df..9013b8e 100644 --- a/admin/rudi/views/view.members.php +++ b/admin/rudi/views/view.members.php @@ -9,13 +9,18 @@ }else if(isset($_GET['award'])){ $member_id = $_GET['award']; include 'view.members.award.php'; + }else if(isset($_GET['create']) && $_GET['create'] == "soldier"){ + include 'view.members.new.php'; }else{ global $db; - echo "<h3>Current Members</h3>"; - echo "<table width=\"100%\" style=\"text-align:center;\">"; - echo "<tr><th>Rank</th><th>Soldier</th><th>Main Info</th><th>Service Record</th><th>Medal Record</th></tr>"; + echo LinkInternal('New Soldier','?op=rudi&show=members&create=soldier'); +?> + <h3>Current Members</h3> + <table width="100%" style="text-align:center;"> + <tr><th>Rank</th><th>Soldier</th><th>Main Info</th><th>Service Record</th><th>Medal Record</th></tr> +<?php $result = $db->Query("SELECT * FROM `rudi_unit_members` JOIN `rudi_ranks` ON rudi_unit_members.rank_id=rudi_ranks.rank_id WHERE rudi_unit_members.status_id <= 3 ORDER BY rudi_ranks.weight DESC , rudi_unit_members.date_promotion ASC , rudi_unit_members.date_enlisted ASC"); $row = $db->Fetch($result); @@ -28,10 +33,11 @@ echo "<tr>"; } CloseTable(); - - echo "<h3>Previous Members</h3>"; - echo "<table width=\"100%\" style=\"text-align:center;\">"; - echo "<tr><th>Rank</th><th>Soldier</th><th>Main Info</th><th>Service Record</th><th>Medal Record</th></tr>"; +?> + <h3>Previous Members</h3> + <table width="100%" style="text-align:center;"> + <tr><th>Rank</th><th>Soldier</th><th>Main Info</th><th>Service Record</th><th>Medal Record</th></tr> +<?php $result = $db->Query("SELECT * FROM `rudi_unit_members` JOIN `rudi_ranks` ON rudi_unit_members.rank_id=rudi_ranks.rank_id WHERE rudi_unit_members.status_id > 3 ORDER BY rudi_ranks.weight DESC, rudi_unit_members.date_promotion ASC, rudi_unit_members.date_enlisted ASC"); $row = $db->Fetch($result); diff --git a/admin/rudi/views/view.members.profile.php b/admin/rudi/views/view.members.profile.php index bd776d7..6355d2e 100644 --- a/admin/rudi/views/view.members.profile.php +++ b/admin/rudi/views/view.members.profile.php @@ -10,7 +10,10 @@ $status_id = $_POST['status']; $role_id = $_POST['role']; $unit_id = $_POST['unit']; + $a2_id = $_POST['a2_id']; + $oa_id = $_POST['oa_id']; $weapon_id = $_POST['weapon']; + $weapon2_id = $_POST['weapon2']; $first_name = addslashes($_POST['first']); $last_name = addslashes($_POST['last']); $username = addslashes($_POST['username']); @@ -29,9 +32,13 @@ $query = "UPDATE `rudi_unit_members` SET" ." `rank_id` = '$rank_id'," ." `country_id` = '$country_id'," + ." `role_id` = '$role_id', " ." `status_id` = '$status_id'," ." `cunit_id` = '$unit_id'," ." `weapon_id` = '$weapon_id'," + ." `weapon2_id` = '$weapon2_id'," + ." `a2_id` = '$a2_id'," + ." `oa_id` = '$oa_id'," ." `username` = '$username'," ." `email` = '$email'," ." `xfire` = '$xfire'," @@ -51,10 +58,10 @@ decho($query); $db->Query($query); - $db->Query("UPDATE `rudi_roles_container` SET `role_id` = '$role_id' WHERE `member_id` = '$member_id' LIMIT 1"); + //$db->Query("UPDATE `rudi_roles_container` SET `role_id` = '$role_id' WHERE `member_id` = '$member_id' LIMIT 1"); /* do the role query as well */ - PageRedirect(1, "?op=rudi&show=members&profile={$member_id}"); + PageRedirect(1, "?op=rudi&show=members"); return; } $member = GetMember($member_id); @@ -87,6 +94,8 @@ ?> </select> </td></tr> + <tr><td class="right" width="50%">ArmA2 ID</td><td class="left"><input type="text" name="a2_id" value="<?php echo $member['a2_id']; ?>"/></td></tr> + <tr><td class="right" width="50%">ArmA2:OA ID</td><td class="left"><input type="text" name="oa_id" value="<?php echo $member['oa_id']; ?>"/></td></tr> </table> <table width="100%" style="text-align:center;"> <tr><th colspan="2" style="background-color:#c4c4c4;">Vital Statistics</th></tr> @@ -118,15 +127,21 @@ <td class="right">Role:</td> <td class="left"> <select name="role"> + <option value="0">---SELECT-POSITION---</option> <?php - $member_roles = GetMembersRoles($member['member_id']); - $roles = GetRoles(); - foreach($member_roles as $member_role){} - foreach($roles as $role){ - if($role['role_id']==$member_role['role_id']) - echo "<option value=\"{$role['role_id']}\" selected>{$role['name']}</option>"; - else - echo "<option value=\"{$role['role_id']}\">{$role['name']}</option>"; + //$member_roles = GetMembersRoles($member['member_id']); + $groups = GetRoles(); + decho($groups); + //foreach($member_roles as $member_role){} + foreach($groups as $group){ + echo "<optgroup label=\"{$group['name']}\">"; + foreach($group['roles'] as $role){ + if($role['role_id']==$member['role_id']) + echo "<option value=\"{$role['role_id']}\" selected>{$role['name']}</option>"; + else + echo "<option value=\"{$role['role_id']}\">{$role['name']}</option>"; + } + echo "</optgroup>"; } ?> </select> @@ -153,7 +168,7 @@ </select> </td> </tr> - <tr><td class="right">Weapons:</td><td class="left"> + <tr><td class="right">Primary Weapon:</td><td class="left"> <select name="weapon"> <?php $weapons = GetWeapons(); foreach($weapons as $weapon){ @@ -165,6 +180,19 @@ ?> </select> </td></tr> + <tr><td class="right">Secondary Weapon:</td><td class="left"> + <select name="weapon2"> + <option value="0">None</option> +<?php + foreach($weapons as $weapon){ + if($weapon['weapon_id'] == $member['weapon2_id']) + echo "<option value=\"{$weapon['weapon_id']}\" selected>{$weapon['model']}</option>"; + else + echo "<option value=\"{$weapon['weapon_id']}\">{$weapon['model']}</option>"; + } +?> + </select> + </td></tr> <tr> <td class="right">Enlisted Date:</td> <td class="left"><input type="text" name="enlist" value="<?php echo !empty($member['date_enlisted']) ? date('Y-m-d', strtotime($member['date_enlisted'])) : ""; ?>" /></td> diff --git a/admin/rudi/views/view.units.php b/admin/rudi/views/view.units.php index 2ccf35a..ab3dedd 100644 --- a/admin/rudi/views/view.units.php +++ b/admin/rudi/views/view.units.php @@ -1,22 +1,29 @@ -<?php
- include $basedir.'rudi/includes/functions.units.php';
- if(isset($_GET['unit'])){
-
- }else{
- //list units
- DisplayUnits();
-
- }
-
-
-?>
-<div style="text-align:left;">
-<img src="images/tree_branch.gif" /> Kilo Company<br />
-<img src="images/tree_blank.gif" /><img src="images/tree_branch.gif" /> 1st Platoon<br />
-<img src="images/tree_blank.gif" /><img src="images/tree_blank.gif" /><img src="images/tree_branch.gif" /> 1st Squad<br />
-<img src="images/tree_blank.gif" /><img src="images/tree_blank.gif" /><img src="images/tree_leaf.gif" /><img src="images/tree_branch.gif" /> Fireteam Alpha<br />
-<img src="images/tree_blank.gif" /><img src="images/tree_blank.gif" /><img src="images/tree_leaf.gif" /><img src="images/tree_branch.gif" /> Fireteam Bravo<br />
-<img src="images/tree_blank.gif" /><img src="images/tree_blank.gif" /><img src="images/tree_branch.gif" /> 2nd Squad<br />
-<img src="images/tree_blank.gif" /><img src="images/tree_blank.gif" /><img src="images/tree_blank.gif" /><img src="images/tree_branch.gif" /> Fireteam Alpha<br />
-<img src="images/tree_blank.gif" /><img src="images/tree_blank.gif" /><img src="images/tree_blank.gif" /><img src="images/tree_branch.gif" /> Fireteam Bravo<br />
-</div>
\ No newline at end of file +<h3>Unit Structure</h3> +<center> +<?php + include $basedir.'rudi/includes/functions.units.php'; + if(isset($_GET['unit'])){ + + }else{ + //list units + echo '<div style="text-align:left; width:300px;">'; + DisplayUnits(); + echo '</div>'; + + } + + +?> +</center> +<!-- +<div style="text-align:left;"> +<img src="images/tree_branch.gif" /> Kilo Company<br /> +<img src="images/tree_blank.gif" /><img src="images/tree_branch.gif" /> 1st Platoon<br /> +<img src="images/tree_blank.gif" /><img src="images/tree_blank.gif" /><img src="images/tree_branch.gif" /> 1st Squad<br /> +<img src="images/tree_blank.gif" /><img src="images/tree_blank.gif" /><img src="images/tree_leaf.gif" /><img src="images/tree_branch.gif" /> Fireteam Alpha<br /> +<img src="images/tree_blank.gif" /><img src="images/tree_blank.gif" /><img src="images/tree_leaf.gif" /><img src="images/tree_branch.gif" /> Fireteam Bravo<br /> +<img src="images/tree_blank.gif" /><img src="images/tree_blank.gif" /><img src="images/tree_branch.gif" /> 2nd Squad<br /> +<img src="images/tree_blank.gif" /><img src="images/tree_blank.gif" /><img src="images/tree_blank.gif" /><img src="images/tree_branch.gif" /> Fireteam Alpha<br /> +<img src="images/tree_blank.gif" /><img src="images/tree_blank.gif" /><img src="images/tree_blank.gif" /><img src="images/tree_branch.gif" /> Fireteam Bravo<br /> +</div> +-->
\ No newline at end of file |