aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorjhunkeler <jhunkeler@c5b2fb0a-d05d-0410-98c8-828840a80ff6>2010-01-03 17:22:00 -0500
committerjhunkeler <jhunkeler@c5b2fb0a-d05d-0410-98c8-828840a80ff6>2010-01-03 17:22:00 -0500
commitedcc2f1bd2de5602390fc7a5d313428255afd0b6 (patch)
tree9015081c412b02964e8bdaa79d668976e18f7cf0 /modules
parenta0e57d6a4ada58e25e713882c8af4483c6734acb (diff)
downloadbayonetcms-edcc2f1bd2de5602390fc7a5d313428255afd0b6.tar.gz
- view.roster.php replaced view.current.php
- Roster generation code completed by OC (yay!). - Class RUDI_Information added to grab unit information. - Views have been added from Unit/Platoon information, however, OC decided not to use the right table so everything needs to be moved around (not so yay!) git-svn-id: http://svn.3rd-infantry-division.org/testing/branches/Bayonet CMS v2@442 c5b2fb0a-d05d-0410-98c8-828840a80ff6
Diffstat (limited to 'modules')
-rw-r--r--modules/rudi/images.tar.bz2bin32628764 -> 0 bytes
-rw-r--r--modules/rudi/includes/common.class.php392
-rw-r--r--modules/rudi/includes/information.class.php34
-rw-r--r--modules/rudi/includes/rudi.css55
-rw-r--r--modules/rudi/index.php34
-rw-r--r--modules/rudi/views/view.awards.php22
-rw-r--r--modules/rudi/views/view.current.php134
-rw-r--r--modules/rudi/views/view.drills.php28
-rw-r--r--modules/rudi/views/view.information.php20
-rw-r--r--modules/rudi/views/view.platoon.php22
-rw-r--r--modules/rudi/views/view.profile.php82
-rw-r--r--modules/rudi/views/view.ranks.php18
-rw-r--r--modules/rudi/views/view.roster.php23
-rw-r--r--modules/rudi/views/view.unit.php22
14 files changed, 509 insertions, 377 deletions
diff --git a/modules/rudi/images.tar.bz2 b/modules/rudi/images.tar.bz2
deleted file mode 100644
index 6dd8bb8..0000000
--- a/modules/rudi/images.tar.bz2
+++ /dev/null
Binary files differ
diff --git a/modules/rudi/includes/common.class.php b/modules/rudi/includes/common.class.php
index 7436863..2880afa 100644
--- a/modules/rudi/includes/common.class.php
+++ b/modules/rudi/includes/common.class.php
@@ -7,20 +7,61 @@ class Soldier
{
public function __construct()
{
- decho("Constructing " . get_class($this));
+ decho("Constructing " . get_class($this) . " -> " . $this);
}
public function __destruct()
{
decho("Destructing " . get_class($this));
}
+
+ public function __toString()
+ {
+ return $this->name;
+ }
+}
+
+class Role
+{
+ public function __construct()
+ {
+ decho("Constructing " . get_class($this) . " -> " . $this);
+ }
+
+ public function __destruct()
+ {
+ decho("Destructing " . get_class($this));
+ }
+
+ public function __toString()
+ {
+ return $this->role_name;
+ }
+}
+
+class UnitInfo
+{
+ public function __construct()
+ {
+ decho("Constructing " . get_class($this) . " -> " . $this);
+ }
+
+ public function __destruct()
+ {
+ decho("Destructing " . get_class($this));
+ }
+
+ public function __toString()
+ {
+ return $this->name;
+ }
}
class Award
{
public function __construct()
{
- decho("Constructing " . get_class($this));
+ decho("Constructing " . get_class($this) . " -> " . $this);
}
public function __destruct()
@@ -38,7 +79,7 @@ class AwardClass
{
public function __construct()
{
- decho("Constructing " . get_class($this));
+ decho("Constructing " . get_class($this) . " -> " . $this);
}
public function __destruct()
@@ -56,7 +97,7 @@ class Rank
{
public function __construct()
{
- decho("Constructing " . get_class($this));
+ decho("Constructing " . get_class($this) . " -> " . $this);
}
public function __destruct()
@@ -74,7 +115,7 @@ class Drill
{
public function __construct()
{
- decho("Constructing " . get_class($this));
+ decho("Constructing " . get_class($this) . " -> " . $this);
}
public function __destruct()
@@ -88,6 +129,60 @@ class Drill
}
}
+class ServiceRecord
+{
+ public function __construct()
+ {
+ decho("Constructing " . get_class($this) . " -> " . $this);
+ }
+
+ public function __destruct()
+ {
+ decho("Destructing " . get_class($this));
+ }
+
+ public function __toString()
+ {
+ return $this->name;
+ }
+}
+
+class AwardRecord
+{
+ public function __construct()
+ {
+ decho("Constructing " . get_class($this) . " -> " . $this);
+ }
+
+ public function __destruct()
+ {
+ decho("Destructing " . get_class($this));
+ }
+
+ public function __toString()
+ {
+ return $this->name;
+ }
+}
+
+class CombatRecord
+{
+ public function __construct()
+ {
+ decho("Constructing " . get_class($this) . " -> " . $this);
+ }
+
+ public function __destruct()
+ {
+ decho("Destructing " . get_class($this));
+ }
+
+ public function __toString()
+ {
+ return $this->name;
+ }
+}
+
/**
* does Stat actually need to exist?
*/
@@ -104,10 +199,12 @@ class RUDI_Common
public function __construct()
{
- global $config;
+ global $config, $db;
+
$this->images_path = $config['rudi']['images_path'];
- $this->db = new Bayonet_SQL();
- $this->link = $this->db->Connect($config['sql']['hostname'], $config['sql']['username'], $config['sql']['password']);
+ //$this->db = new RUDI_SQL();
+ //$this->link = $this->db->Connect($config['sql']['hostname'], $config['sql']['username'], $config['sql']['password']);
+ $this->db = $db;
$this->db->Select_db('thirdid_oc');
}
@@ -192,37 +289,39 @@ class RUDI_Common
protected function evalData($data)
{
- return $data ? $data : "N/A";
+ if(is_array($data))
+ return (count($data) < 1) ? true : false;
+ else
+ return $data ? $data : "N/A";
}
protected function getCumulativeStats()
{
//$stats = array();
$result = $this->db->Query("SELECT platoon_id AS id, name FROM rudi_platoons");
- $stats['platoon'] = mysql_num_rows($result);
+ $stats['platoon'] = $this->db->Rows($result);
$result = $this->db->Query("SELECT squad_id AS id, name FROM rudi_squads");
- $stats['squad'] = mysql_num_rows($result);
+ $stats['squad'] = $this->db->Rows($result);
decho($stats['platoon']);
decho($stats['squad']);
- $this->db->Free($result);
-
+
return $stats;
}
protected function getMembersOfPlatoon($id)
{
- $id = mysql_escape_string($id);
- $result = $this->db->Query("SELECT platoon_id AS id FROM rudi_unit_members WHERE platoon_id = '$id'");
- $members = mysql_num_rows($result);
-
+ $query = sprintf("SELECT platoon_id AS id FROM rudi_unit_members WHERE platoon_id = %d", (int)$id);
+ $result = $this->db->Query($query);
+ $members = $this->db->Rows($result);
+
return (int)$members;
}
protected function getMembersOfSquad($id)
{
- $id = mysql_escape_string($id);
- $result = $this->db->Query("SELECT squad_id AS id FROM rudi_unit_members WHERE squad_id = '$id'");
+ $query = sprintf("SELECT squad_id AS id FROM rudi_unit_members WHERE squad_id = %d", (int)$id);
+ $result = $this->db->Query($query);
$members = mysql_num_rows($result);
return (int)$members;
@@ -230,20 +329,17 @@ class RUDI_Common
protected function getSquadMembers($squad_id)
{
- //$squad_id = addslashes($squad_id);
- $squad_id = mysql_escape_string($id);
- $result = $this->db->Query("SELECT m.last_name,
+ $query = sprintf("SELECT m.last_name,
m.first_name,
r.shortname AS rank_short
FROM rudi_unit_members AS m
- LEFT OUTER JOIN rudi_ranks AS r ON r.rank_id = m.rank_id WHERE m.squad_id = '$squad_id' ORDER BY m.rank_id ");
- while(($row = $this->db->FetchObject($result,'Soldier'))!=false)
- {
- $data[] = $row;
- }
- $this->db->Free($result);
-
- return $data;
+ LEFT OUTER JOIN rudi_ranks AS r ON r.rank_id = m.rank_id WHERE m.squad_id = %d ORDER BY m.rank_id ",
+ (int)$squad_id);
+
+ $result = $this->db->Query($query);
+ $row = $this->db->FetchObject($result,'Soldier');
+
+ return $row;
}
/**
@@ -255,21 +351,12 @@ class RUDI_Common
*/
protected function getRoles($member_id, $rank_id)
{
- $member_id = mysql_escape_string($member_id);
- $query =
- "SELECT r.role_id, "
- ."r.name AS role_name "
- ."FROM rudi_roles AS r "
- ."LEFT OUTER JOIN rudi_roles_container AS rl ON rl.role_id = r.role_id "
- ."RIGHT OUTER JOIN rudi_unit_members AS m ON m.member_id = rl.member_id "
- ."WHERE m.member_id = '$member_id' ORDER BY r.name ASC";
+ $data = NULL;
+ $query = sprintf("SELECT r.role_id, r.name AS role_name FROM rudi_roles AS r LEFT OUTER JOIN rudi_roles_container AS rl USING(role_id) INNER JOIN rudi_unit_members AS rm USING(member_id) WHERE rm.member_id = %d AND r.name IS NOT NULL ORDER BY r.role_id ASC",
+ (int)$member_id);
$result = $this->db->Query($query);
- while(($row = $this->db->FetchObject($result,'Soldier'))!=false)
- {
- $data[] = $row;
- }
- $this->db->Free($result);
+ $data = $this->db->FetchObject($result,'Role');
return $data;
}
@@ -316,16 +403,12 @@ class RUDI_Common
"SELECT r.record_id, r.date_added, r.record_note "
."FROM rudi_service_record AS r "
."LEFT OUTER JOIN rudi_unit_members AS m ON m.member_id = r.member_id "
- ."WHERE r.member_id = '%d' ORDER BY r.date_added DESC",
- mysql_real_escape_string($member_id));
+ ."WHERE r.member_id = %d ORDER BY r.date_added DESC",
+ (int)$member_id);
$result = $this->db->Query($query);
- while(($row = $this->db->FetchObject($result,'Soldier'))!=false)
- {
- $data[] = $row;
- }
- $this->db->Free($result);
-
+ $data = $this->db->FetchObject($result,'ServiceRecord');
+
return $data;
}
@@ -343,15 +426,12 @@ class RUDI_Common
."FROM rudi_award_record AS r "
."RIGHT OUTER JOIN rudi_awards AS a ON a.award_id = r.award_id "
."LEFT OUTER JOIN rudi_unit_members AS m ON m.member_id = r.member_id "
- ."WHERE r.member_id = '%d' ORDER BY r.date_added DESC ",
- mysql_real_escape_string($member_id));
+ ."WHERE r.member_id = %d ORDER BY r.date_added DESC ",
+ (int)$member_id);
$result = $this->db->Query($query);
- while(($row = $this->db->FetchObject($result,'Soldier'))!=false)
- {
- $data[] = $row;
- }
- $this->db->Free($result);
+ $data = $this->db->FetchObject($result,'AwardRecord');
+
return $data;
}
@@ -371,16 +451,12 @@ class RUDI_Common
."RIGHT OUTER JOIN rudi_war_stats AS u ON u.visit_unit_id = c.visitor_id "
."RIGHT OUTER JOIN rudi_war_units AS u1 ON u1.name "
."LEFT OUTER JOIN rudi_unit_members AS m ON m.member_id = c.member_id "
- ."WHERE c.member_id = '%d' ORDER BY c.date DESC ",
- mysql_real_escape_string($member_id));
+ ."WHERE c.member_id = %d ORDER BY c.date DESC ",
+ (int)$member_id);
$result = $this->db->Query($query);
- while(($row = $this->db->FetchObject($result,'Soldier'))!=false)
- {
- $data[] = $row;
- }
- $this->db->Free($result);
-
+ $data = $this->db->FetchObject($result,'CombatRecord');
+
return $data;
}
@@ -397,12 +473,11 @@ class RUDI_Common
."CONCAT(m.last_name, \", \", m.first_name) AS name "
."FROM rudi_units AS u "
."RIGHT OUTER JOIN rudi_unit_members AS m ON m.member_id = u.leader_id "
- ."WHERE u.unit_id = '%d' ",
- mysql_real_escape_string($id));
+ ."WHERE u.unit_id = %d ",
+ (int)$id);
$result = $this->db->Query($query);
$data = $this->db->FetchObject($result,'Soldier');
- $this->db->Free($result);
return $data;
}
@@ -420,12 +495,11 @@ class RUDI_Common
."CONCAT(m.last_name, \", \", m.first_name) AS name "
."FROM rudi_platoons AS p "
."RIGHT OUTER JOIN rudi_unit_members AS m ON m.member_id = p.leader_id "
- ."WHERE p.platoon_id = '%d' ",
- mysql_real_escape_string($id));
+ ."WHERE p.platoon_id = %d ",
+ (int)$id);
$result = $this->db->Query($query);
$data = $this->db->FetchObject($result,'Soldier');
- $this->db->Free($result);
return $data;
}
@@ -443,12 +517,11 @@ class RUDI_Common
."CONCAT(m.last_name, \", \", m.first_name) AS name "
."FROM rudi_squads AS s "
."RIGHT OUTER JOIN rudi_unit_members AS m ON m.member_id = s.leader_id "
- ."WHERE s.squad_id = '%d' ",
- mysql_real_escape_string($id));
+ ."WHERE s.squad_id = %d ",
+ (int)$id);
$result = $this->db->Query($query);
$data = $this->db->FetchObject($result,'Soldier');
- $this->db->Free($result);
return $data;
}
@@ -466,12 +539,11 @@ class RUDI_Common
."CONCAT(m.last_name, \", \", m.first_name) AS name "
."FROM rudi_teams AS t "
."RIGHT OUTER JOIN rudi_unit_members AS m ON m.member_id = t.leader_id "
- ."WHERE t.team_id = '%d' ",
- mysql_real_escape_string($id));
+ ."WHERE t.team_id = %d ",
+ (int)$id);
$result = $this->db->Query($query);
$data = $this->db->FetchObject($result,'Soldier');
- $this->db->Free($result);
return $data;
}
@@ -517,8 +589,8 @@ class RUDI_Common
"SELECT name "
."FROM rudi_units AS u "
."LEFT OUTER JOIN rudi_unit_members AS m ON m.unit_id = u.unit_id "
- ."WHERE m.member_id = '%d' ",
- mysql_real_escape_string($id));
+ ."WHERE m.member_id = %d ",
+ (int)$id);
$result = $this->db->Query($query);
$data = $this->db->FetchObject($result,'Soldier');
@@ -538,11 +610,12 @@ class RUDI_Common
"SELECT name "
."FROM rudi_platoons AS p "
."LEFT OUTER JOIN rudi_unit_members AS m ON m.platoon_id = p.platoon_id "
- ."WHERE m.member_id = '%d' ",
- mysql_real_escape_string($id));
+ ."WHERE m.member_id = %d ",
+ (int)$id);
$result = $this->db->Query($query);
$data = $this->db->FetchObject($result,'Soldier');
+
return $data;
}
@@ -557,8 +630,8 @@ class RUDI_Common
$query = sprintf(
"SELECT last_name "
."FROM rudi_unit_members AS m "
- ."WHERE m.squad_id = '%d' ",
- mysql_real_escape_string($id));
+ ."WHERE m.squad_id = %d ",
+ (int)$id);
$result = $this->db->Query($query);
$data = $this->db->FetchObject($result,'Soldier');
@@ -579,17 +652,74 @@ class RUDI_Common
."CONCAT(m.last_name, \", \", m.first_name) AS name "
."FROM rudi_teams AS t "
."RIGHT OUTER JOIN rudi_unit_members AS m ON m.member_id = t.leader_id "
- ."WHERE t.team_id = '%d' ",
- mysql_real_escape_string($id));
+ ."WHERE t.team_id = %d ",
+ (int)$id);
$result = $this->db->Query($query);
$data = $this->db->FetchObject($result,'Soldier');
return $data;
}
-
+ /**
+ * RUDI_Core::printRoster()
+ *
+ * @param int $unit_id
+ * @param int $leader_id
+ */
+ public function printRoster($unit_id, $leader_id){
+ foreach($this->data as $member){
+ if($member->unit_id == $unit_id && $member->status_id < 4){
+?>
+ <tr>
+ <!-- Rank -->
+ <td class="roster"><img src="<?php echo "modules/rudi/images/ranks/small/{$member->rank_short}.png"; ?>" alt="<?php echo $member->rank_short; ?>" /></td>
+ <!-- Name -->
+ <td class="roster"><a href="?load=rudi&amp;profile=<?php echo $member->member_id ?>"><?php echo $member->last_name . ', ' . $member->first_name; ?></a></td>
+ <!-- Roles -->
+ <td class="roster">
+ <?php
+ decho(count($member->Roles) . ' roles attached to: ' . $member->last_name);
+ for($role = 0; $role < count($member->Roles); ++$role)
+ {
+ if($member->Roles[$role]->role_name)
+ {
+ //decho($role . " = (" . $member->Roles[$role]->role_name . ")");
+
+ echo $member->Roles[$role]->role_name;
+ if($role < count($member->Roles) - 1) echo ', ';
+
+ echo '&nbsp;';
+ }
+ }
+ ?>
+ </td>
+ <!-- Weapon -->
+ <td class="roster"><?php echo $member->weapon_manufacturer . ' ' . $member->weapon_model; ?></td>
+ <!-- Status -->
+ <td class="roster"><?php echo $member->status; ?></td>
+ </tr>
+<?php
+ }
+ }
+ }
+ /**
+ * RUDI_Core::displayUnitsRec()
+ *
+ * @param int $unit_id
+ */
+ public function displayUnitsRec($unit_id){
+ $result = $this->db->Query("SELECT * FROM `rudi_combat_units` WHERE `detachment` = '$unit_id'");
+ $row = $this->db->FetchObject($result,'UnitInfo');
+ foreach($row as $unit){
+ echo "<tr><th colspan=\"5\">{$unit->name}</th></tr>";
+ $this->printRoster($unit->unit_id, $unit->leader_id);
+ $this->displayUnitsRec($unit->unit_id);
+ }
+ }
+
public function Update($query_t = RUDI_PROFILE_BIG)
{
+ decho(get_class($this) . "::" . __FUNCTION__ . "($query_t)");
$id = NULL;
if(isset($_GET['profile']))
{
@@ -611,6 +741,7 @@ class RUDI_Common
."m.image AS member_image, "
."m.location_city, "
."m.location_province, "
+ ."m.primary_mos, "
."r.rank_id, "
."r.image AS rank_image, "
."r.longname AS rank_long, "
@@ -666,10 +797,14 @@ class RUDI_Common
."m.last_name, "
."m.member_id, "
."m.status_id, "
+ ."m.date_promotion, "
+ ."m.date_enlisted, "
+ ."m.primary_mos, "
."r.rank_id, "
."r.image AS rank_image, "
."r.longname AS rank_long, "
."r.shortname AS rank_short, "
+ ."r.weight AS rank_weight, "
."u.unit_id, "
."u.name AS unit_name, "
."p.platoon_id, "
@@ -690,7 +825,7 @@ class RUDI_Common
."FROM rudi_unit_members AS m "
."LEFT OUTER JOIN rudi_weapons AS w ON w.weapon_id = m.weapon_id "
- ."LEFT OUTER JOIN rudi_units AS u ON u.unit_id = m.unit_id "
+ ."LEFT OUTER JOIN rudi_combat_units AS u ON u.unit_id = m.cunit_id "
."LEFT OUTER JOIN rudi_squads AS s ON s.squad_id = m.squad_id "
."LEFT OUTER JOIN rudi_teams AS t ON t.team_id = m.team_id "
."LEFT OUTER JOIN rudi_platoons AS p ON p.platoon_id = m.platoon_id "
@@ -700,33 +835,39 @@ class RUDI_Common
if(!is_null($id))
{
- $sql .= "WHERE m.member_id = '" . (int)$id . "' ";
+ $sql .= "WHERE m.member_id = " . (int)$id . " ";
}
- $sql .= "ORDER BY p.platoon_id,s.squad_id,t.team_id,r.rank_id DESC ";
+ $sql .= "ORDER BY r.weight DESC , m.date_promotion ASC, m.date_enlisted ASC";
$result = $this->db->Query($sql);
$count = 0;
- while(($row = $this->db->FetchObject($result,'Soldier'))!=false)
+ $row = $this->db->FetchObject($result,'Soldier');
+
+ foreach($row as $member)
{
- $count = $row->member_id;
- $this->data[$row->member_id] = $row;
- $this->data[$count]->Roles = $this->getRoles($row->member_id,$row->rank_id);
+ $count = $member->member_id;
+ $this->data[$member->member_id] = $member;
+ $this->data[$count]->Roles = $this->getRoles($member->member_id,$member->rank_id);
+ if(is_object($this->data[$count]->Roles))
+ {
+ $this->data[$count]->Roles = array((object)$nothing);
+ }
+
if($query_t != RUDI_PROFILE_SMALL)
{
- $this->data[$count]->service_record = $this->getServiceRecord($row->member_id);
- $this->data[$count]->award_record = $this->getAwardRecord($row->member_id);
- $this->data[$count]->combat_record = $this->getCombatRecord($row->member_id);
- $this->data[$count]->superior->unit = $this->getSuperiorUnit($row->unit_id);
- $this->data[$count]->superior->platoon = $this->getSuperiorPlatoon($row->platoon_id);
- $this->data[$count]->superior->squad = $this->getSuperiorSquad($row->squad_id);
- $this->data[$count]->superior->team = $this->getSuperiorTeam($row->team_id);
- $this->data[$count]->superior_next = $this->getSuperiorTrue($row->member_id);
+ $this->data[$count]->service_record = $this->getServiceRecord($member->member_id);
+ $this->data[$count]->award_record = $this->getAwardRecord($member->member_id);
+ $this->data[$count]->combat_record = $this->getCombatRecord($member->member_id);
+ $this->data[$count]->superior->unit = $this->getSuperiorUnit($member->unit_id);
+ $this->data[$count]->superior->platoon = $this->getSuperiorPlatoon($member->platoon_id);
+ $this->data[$count]->superior->squad = $this->getSuperiorSquad($member->squad_id);
+ $this->data[$count]->superior->team = $this->getSuperiorTeam($member->team_id);
+ $this->data[$count]->superior_next = $this->getSuperiorTrue($member->member_id);
}
- //++$count;
- }
- $this->db->Free($result);
-
+ $count++;
+ }
+
return $this->data;
}
@@ -737,50 +878,37 @@ class RUDI_Common
."LEFT OUTER JOIN rudi_award_classes AS c ON c.class_id = a.class_id "
."ORDER BY c.class_id, a.award_id ASC";
$result = $this->db->Query($query);
- while(($row = $this->db->FetchObject($result,'Award'))!=false)
- {
- $data[] = $row;
- }
- $this->db->Free($result);
-
- return $data;
+ $row = $this->db->FetchObject($result,'Award');
+ return $row;
}
protected function getAwardClasses()
{
$query = "SELECT class_id, name FROM rudi_award_classes";
$result = $this->db->Query($query);
- while(($row = $this->db->FetchObject($result,'AwardClass'))!=false)
- {
- $data[] = $row;
- }
- $this->db->Free($result);
-
- return $data;
+ $row = $this->db->FetchObject($result,'AwardClass');
+ return $row;
}
protected function getRanks()
{
$query = "SELECT rank_id, shortname, longname, image FROM rudi_ranks ORDER BY weight DESC";
$result = $this->db->Query($query);
- while(($row = $this->db->FetchObject($result,'Rank'))!=false)
- {
- $data[] = $row;
- }
- $this->db->Free($result);
+ $row = $this->db->FetchObject($result,'Rank');
- return $data;
+ return $row;
}
protected function getDrills($id = NULL)
{
if(!is_null($id))
{
- $query = "SELECT * FROM rudi_drills
+ $query = sprintf("SELECT * FROM rudi_drills
LEFT OUTER JOIN rudi_drills_record AS dr ON dr.drill_id = rudi_drills.drill_id
RIGHT OUTER JOIN rudi_unit_members AS m ON m.member_id = dr.member_id
LEFT OUTER JOIN rudi_statuses AS st ON st.status_id = m.status_i
- WHERE rudi_drills.drill_id = '$id' ORDER BY date DESC";
+ WHERE rudi_drills.drill_id = %d ORDER BY date DESC",
+ (int)$id);
}
else
{
@@ -788,13 +916,9 @@ class RUDI_Common
}
$result = $this->db->Query($query);
- while(($row = $this->db->FetchObject($result,'Drill'))!=false)
- {
- $data[] = $row;
- }
- $this->db->Free($result);
+ $row = $this->db->FetchObject($result,'Drill');
- return $data;
+ return $row;
}
}
diff --git a/modules/rudi/includes/information.class.php b/modules/rudi/includes/information.class.php
new file mode 100644
index 0000000..2632675
--- /dev/null
+++ b/modules/rudi/includes/information.class.php
@@ -0,0 +1,34 @@
+<?php
+
+class RUDI_Information extends RUDI_Common
+{
+ public function __construct()
+ {
+ global $db;
+ $this->db = $db;
+ }
+
+ public function Unit($unit_id)
+ {
+ $query = sprintf("SELECT leader_id, name, logo, url, creed, bio
+ FROM rudi_units
+ WHERE unit_id = %d", (int)$unit_id);
+ $result = $this->db->Query($query);
+ $unit = $this->db->FetchObject($result, 'UnitInfo', true);
+ return $unit;
+ }
+
+ public function Platoon($unit_id, $platoon_id)
+ {
+ $query = sprintf("SELECT leader_id, name, logo, creed, bio
+ FROM rudi_platoons
+ WHERE unit_id = %d AND platoon_id = %d", (int)$unit_id, (int)$platoon_id);
+ $result = $this->db->Query($query);
+ $platoon = $this->db->FetchObject($result, 'UnitInfo', true);
+ decho($platoon);
+
+ return $platoon;
+ }
+}
+
+?> \ No newline at end of file
diff --git a/modules/rudi/includes/rudi.css b/modules/rudi/includes/rudi.css
index e009384..8c4ebf2 100644
--- a/modules/rudi/includes/rudi.css
+++ b/modules/rudi/includes/rudi.css
@@ -1,3 +1,7 @@
+table.rudi {
+ /* background: green; */
+}
+/*
table{
border:1px solid #000;
}
@@ -15,8 +19,53 @@ td{
text-align:center;
padding:2px;
border:1px solid #000;
-}
+} */
-td.data{
+table.rudi td.data{
text-align:left;
-} \ No newline at end of file
+}
+
+table.rudi th {
+ width:175px;
+ color:white;
+ text-align:center;
+ background:#333;
+ font-family: arial;
+}
+
+table.rudi td {
+ text-align:center;
+ vertical-align: middle;
+ /* border: 1px solid #a1a1a1; */
+}
+
+table.rudi td.roster {
+ text-align:center;
+ vertical-align: middle;
+ border: 1px solid #a1a1a1;
+}
+
+table.rudi th.header {
+ /* table has a 5px padding so everything is 10px bigger than these values */
+ width:100px;
+ height:19px;
+ color: #FFF;
+ background:#333;
+ border: 1px solid #666;
+ font-family: arial, helvetica, sans-serif;
+ font-size:12px;
+}
+
+table.rudi td.info {
+ color: #333;
+ vertical-align: middle;
+ text-align:left;
+ padding-left: 5px;
+ border: 1px solid #666;
+ font-family: arial, helvetica, sans-serif;
+ font-size:12px;
+}
+
+#thin {
+ border:1px outset #333;
+}
diff --git a/modules/rudi/index.php b/modules/rudi/index.php
index 79de570..2bc08a3 100644
--- a/modules/rudi/index.php
+++ b/modules/rudi/index.php
@@ -1,9 +1,14 @@
+<link rel="stylesheet" type="text/css" href="modules/rudi/includes/rudi.css" media="screen"/>
<?php
//include 'header.php';
//include 'includes/debug.php';
-//include 'includes/sql.class.php';
-include 'includes/common.class.php';
+//require 'includes/sql.class.php';
+include_once 'includes/common.class.php';
+include_once 'includes/information.class.php';
+OpenContent();
+ echo "<div class=\"contentHeading\">RUDI: Realism Unit Data Interface</div>";
+ echo "<div class=\"content\">";
class RUDI_Gateway extends RUDI_Common
{
protected $awards, $ranks, $drills;
@@ -19,12 +24,23 @@ class RUDI_Gateway extends RUDI_Common
return;
}
+ if(isset($_GET['info']))
+ {
+ $info = new RUDI_Information();
+ OpenTable();
+ echo "<tr><td>\n";
+ include 'views/view.information.php';
+ echo "</tr></td>";
+ CloseTable();
+ return;
+ }
+
if(isset($_GET['profile']))
{
$this->Update();
OpenTable();
- echo "<tr><th>RUDI</th></tr><tr><td>\n";
+ echo "<tr><td>\n";
include 'views/view.profile.php';
echo "</td></tr>";
CloseTable();
@@ -33,7 +49,7 @@ class RUDI_Gateway extends RUDI_Common
elseif(isset($_GET['show']))
{
OpenTable();
- echo "<tr><th>RUDI</th></tr><tr><td>\n";
+ echo "<tr><td>\n";
switch($_GET['show'])
{
case 'awards':
@@ -47,7 +63,7 @@ class RUDI_Gateway extends RUDI_Common
case 'drills':
$this->drills = $this->getDrills($_GET['id']);
include 'views/view.drills.php';
- break;
+ break;
}
echo "</td></tr>";
CloseTable();
@@ -57,11 +73,10 @@ class RUDI_Gateway extends RUDI_Common
{
$this->Update(RUDI_PROFILE_SMALL);
$stats = $this->getCumulativeStats();
- decho($stats);
OpenTable();
- echo "<tr><th>RUDI</th></tr><tr><td>\n";
- include 'views/view.current.php';
+ echo "<tr><td>\n";
+ include 'views/view.roster.php';
echo "</td></tr>";
CloseTable();
return;
@@ -72,6 +87,9 @@ class RUDI_Gateway extends RUDI_Common
ob_start();
$rudi = new RUDI_Gateway();
ob_flush();
+ echo "</div>";
+ echo "</div>";
+CloseContent();
//include 'footer.php';
//decho($test->foo[0]->member_id);
diff --git a/modules/rudi/views/view.awards.php b/modules/rudi/views/view.awards.php
index 6a60536..5039e56 100644
--- a/modules/rudi/views/view.awards.php
+++ b/modules/rudi/views/view.awards.php
@@ -1,4 +1,4 @@
-<?php define('BLOCK_RIGHT_DISABLE','block_right_disable'); ?>
+<?php //define('BLOCK_RIGHT_DISABLE','block_right_disable'); ?>
<?php $medals_path = $this->images_path . "/medals/"; ?>
<html>
@@ -6,9 +6,7 @@
<title>Awards and Medals</title>
<style type="text/css">
-p {color: white; }
-body {background-color: black; }
-th.header {
+/*th.header {
width:175px;
background:#333;
}
@@ -16,14 +14,14 @@ th.header {
td.rudi {
text-align: center;
vertical-align: middle;
-}
+} */
</style>
</head>
<body>
<?php $classes = $this->getAwardClasses(); ?>
-<table align="center" style="width: 100%;">
+<table class="rudi" align="center" style="width: 100%;">
<?php
$i = 0;
@@ -33,9 +31,9 @@ td.rudi {
echo "<tr>";
echo "<th colspan=\"3\">{$classes[$cl]->name}s</th>";
echo "</tr>";
- echo '<th scope="col" class="header" style="width:1px;">Image</th>';
- echo '<th scope="col" class="header" style="width:1px;">Award</th>';
- echo '<th scope="col" class="header" style="width:85%;">Description</th>';
+ echo '<th scope="col">Image</th>';
+ echo '<th scope="col" width=\"100px\">Award</th>';
+ echo '<th scope="col">Description</th>';
foreach($this->awards as $award)
{
@@ -43,9 +41,9 @@ td.rudi {
{
echo "
<tr>
- <td align=\"center\" class=\"rudi\"><img src=\"{$medals_path}{$award->image}\" alt=\"{$award->image}\"/></td>
- <td align=\"center\" class=\"rudi\">{$award->name}&nbsp;</td>
- <td align=\"left\" class=\"rudi\" style=\"text-align:left;\">{$award->description}&nbsp;</td>
+ <td><img src=\"modules/rudi/images/medals/{$award->image}\" alt=\"{$award->image}\"/></td>
+ <td>{$award->name}&nbsp;</td>
+ <td style=\"text-align:left;\">{$award->description}&nbsp;</td>
</tr>";
}
diff --git a/modules/rudi/views/view.current.php b/modules/rudi/views/view.current.php
deleted file mode 100644
index b0e1316..0000000
--- a/modules/rudi/views/view.current.php
+++ /dev/null
@@ -1,134 +0,0 @@
-<?php
- $platoon_temp_count = 0; $squad_temp_count = 0;
-
-?>
-
-<html>
-<head>
- <title>Roster Current</title>
-
-<style type="text/css">
-p {color: white; }
-body {background-color: black; }
-th.header {
- width:175px;
- background:#333;
-}
-
-td.rudi {
- text-align: center;
- vertical-align: middle;
-}
-</style>
-
-</head>
-<body>
-
- <?php
- /*
- echo "<table align=\"center\">";
-
- echo "<tr>
- <th>Rank</th>
- <th>Name</th>
- <th>Weapon</th>
- <th>Status</th>
- </tr>";
-
- $p = 1;
- $s = 1;
- $u = 1;
- $members = $this->data;
- while($u != count($members))
- {
- while($p != $stats['platoon'])
- {
- echo "<tr>
- <th>a platoon</th>
- </tr>";
-
- while($s != $stats['squad'])
- {
- if($members[$u]->squad_id)
- echo "<tr>
- <td>{$members[$u]->rank_short}</td>
- <td>{$members[$u]->name}</td>
- <td>{$members[$u]->weapon_name}</td>
- <td>{$members[$u]->status}</td>
- </tr>";
-
- echo "<tr>
- <th>a squad</th>
- </tr>";
-
- ++$s;
- }
-
- ++$p;
- }
-
- ++$u;
- }
- echo "</table>";
- */
- ?>
-
- <table align="center">
-
- <?php for($platoon_count = 0; $platoon_count <= $stats['platoon']; ++$platoon_count): ?>
-
- <?php if($this->getMembersOfPlatoon($platoon_count) > 0): ?>
- <?php if($platoon_count):?>
- <tr>
- <!-- Platoon table marker -->
- <th class="header" colspan="5"><?php echo $platoon_count . ' Platoon'; ?></th></tr>
- <?php endif; ?>
-
- <tr>
- <!-- Table header -->
- <th class="header">Rank</th>
- <th class="header">Name</th>
- <th class="header">Role</th>
- <th class="header">Weapon</th>
- <th class="header">Status</th>
- </tr>
- <?php foreach($this->data as $member): ?>
- <?php if($member->platoon_id == $platoon_count && $member->status_id < 2): ?>
- <tr>
- <!-- Rank -->
- <td class="rudi"><img src="<?php echo "{$this->images_path}/ranks/small/{$member->rank_short}.png"; ?>" alt="<?php echo $member->rank_short; ?>" /></td>
- <!-- Name -->
- <td class="rudi"><a href="?load=rudi&amp;profile=<?php echo $member->member_id ?>"><?php echo $member->last_name . ', ' . $member->first_name; ?></a></td>
- <!-- Roles -->
- <td class="rudi">
- <?php
- decho(count($member->Roles) . ' roles attached to: ' . $member->last_name);
- for($role = 0; $role < count($member->Roles); ++$role)
- {
- if($member->Roles[$role]->role_name)
- {
- decho($role . " = (" . $member->Roles[$role]->role_name . ")");
- echo $member->Roles[$role]->role_name;
- echo '&nbsp;';
- }
- else
- {
- echo "Soldier";
- }
- }
- ?>
- </td>
- <!-- Weapon -->
- <td class="rudi"><?php echo $member->weapon_manufacturer . ' ' . $member->weapon_model; ?></td>
- <!-- Status -->
- <td class="rudi"><?php echo $member->status; ?></td>
- </tr>
- <?php endif; ?>
-
- <?php endforeach; ?>
- <?php endif; ?>
- <?php endfor; ?>
-
- </table>
-</body>
-</html>
diff --git a/modules/rudi/views/view.drills.php b/modules/rudi/views/view.drills.php
index 084be97..06fbe62 100644
--- a/modules/rudi/views/view.drills.php
+++ b/modules/rudi/views/view.drills.php
@@ -1,24 +1,3 @@
-<html>
-<head>
- <title>Drills</title>
-
-<style type="text/css">
-p {color: white; }
-body {background-color: black; }
-th.header {
- width:175px;
- background:#333;
-}
-
-td.rudi {
- text-align: center;
- vertical-align: middle;
-}
-</style>
-
-</head>
-<body>
-
<?php
function Rating($val)
@@ -45,7 +24,7 @@ OpenTable("Drills");
if(isset($_GET['id']))
{
-
+ decho($this->drills);
foreach($this->drills as $drill)
{
$name = $drill->last_name . ', ' . $drill->first_name;
@@ -93,7 +72,4 @@ foreach($this->drills as $drill)
}
CloseTable();
-?>
-
-</body>
-</html> \ No newline at end of file
+?> \ No newline at end of file
diff --git a/modules/rudi/views/view.information.php b/modules/rudi/views/view.information.php
new file mode 100644
index 0000000..a62ba8a
--- /dev/null
+++ b/modules/rudi/views/view.information.php
@@ -0,0 +1,20 @@
+<?php
+$unit_id = $_GET['unit_id'];
+$platoon_id = $_GET['platoon_id'];
+switch($_GET['info'])
+{
+ case 'unit':
+ if(isset($unit_id))
+ include_once 'view.unit.php';
+ break;
+
+ case 'platoon':
+ if(isset($unit_id, $platoon_id))
+ include_once 'view.platoon.php';
+ break;
+
+ default:
+ ReportError('Invalid info entry');
+ return;
+}
+?> \ No newline at end of file
diff --git a/modules/rudi/views/view.platoon.php b/modules/rudi/views/view.platoon.php
new file mode 100644
index 0000000..dbbb455
--- /dev/null
+++ b/modules/rudi/views/view.platoon.php
@@ -0,0 +1,22 @@
+<?php $data = $info->Platoon($unit_id, $platoon_id); ?>
+
+<table align="center">
+ <tr>
+ <th>&nbsp;</th>
+ <td><img src="<?php echo '/cms/modules/rudi/images/units/' . $data->logo; ?>" alt="<?php echo $data->logo; ?>"/></td>
+ </tr>
+ <tr>
+ <th width="25%">Platoon</th>
+ <td><?php echo $data->name; ?></td>
+ </tr>
+ <tr>
+ <th>Creed</th>
+ <td><?php echo $data->creed; ?></td>
+ </tr>
+ <tr>
+ <th valign="top">Biography</th>
+ <td><?php echo $data->bio; ?></td>
+ </tr>
+</table>
+
+<?php decho($data); ?> \ No newline at end of file
diff --git a/modules/rudi/views/view.profile.php b/modules/rudi/views/view.profile.php
index 877fab0..7244b8d 100644
--- a/modules/rudi/views/view.profile.php
+++ b/modules/rudi/views/view.profile.php
@@ -1,50 +1,34 @@
<?php
-define('BLOCK_RIGHT_DISABLE','block_right_disable');
+//define('BLOCK_RIGHT_DISABLE','block_right_disable');
$member =& $this->data[$_GET['profile']];
-$uniform_image = strtolower($member->first_name[0] . $member->last_name . ".png");
-$uniform_image[0] = strtoupper($uniform_image[0]);
-$uniform_image[1] = strtoupper($uniform_image[1]);
+$uniform_image = $member->first_name[0].str_replace(array("'", "\""), "", $member->last_name).".png";
+decho($member);
?>
-
-<html>
-<head>
-<title>Profile page of, <?php echo $member->last_name ?></title>
<style type="text/css">
-p {color: white; }
-body {background-color: black; }
-th.header {
- width:100px;
- background:#333;
-}
-
-td {
- vertical-align: middle;
-}
-#thin {
- border:1px outset #333;
-}
</style>
-</head>
-<body>
-<table width="100%" border="1" align="center" cellpadding="1" cellspacing="0">
+
+<table class="rudi" width="100%" border="1" align="center" cellpadding="1" cellspacing="0">
<tr>
- <th>Viewing Profile of: <?php echo $member->rank_long . " " . $member->first_name . " " . $member->last_name; ?></th>
+ <th class="header">Viewing Profile of: <?php echo $member->rank_long . " " . $member->first_name . " " . $member->last_name; ?></th>
</tr>
<tr>
- <td><center><img src="<?php echo $this->images_path ?>/uniform/<?php echo $uniform_image; ?>" />&nbsp;</center></td>
+ <td><center><img src="modules/rudi/images/uniform/<?php echo $uniform_image; ?>" />&nbsp;</center></td>
</tr>
<tr>
<td><table width="100%" border="0" cellpadding="1">
<tr>
<td width="20%">
<table width="100%" border="0" cellpadding="5" align="center" style="border: 0px;">
+ <tr>
+ <td><center><?php echo $member->primary_mos; ?></center></td>
+ </tr>
<tr>
- <td><center><img src="<?php echo $this->images_path ?>/ranks/large/<?php echo $member->rank_image ?>" />&nbsp;</center></td>
+ <td><center><img src="modules/rudi/images/ranks/large/<?php echo $member->rank_image ?>" />&nbsp;</center></td>
</tr>
<tr>
- <td><center><img src="<?php echo $this->images_path ?>/flags/<?php echo $member->country_image?>" />&nbsp;</center></td>
+ <td><center><img src="modules/rudi/images/flags/<?php echo $member->country_image?>" />&nbsp;</center></td>
</tr>
</table>
</td>
@@ -52,9 +36,9 @@ td {
<table width="100%" border="0" cellpadding="5">
<tr>
<th class="header" scope="row">Location</th>
- <td ><?php echo $this->evalData($member->location) ?>&nbsp;</td>
+ <td class="info"><?php echo $this->evalData($member->location) ?>&nbsp;</td>
<th class="header">Superior</th>
- <td><?php
+ <td class="info"><?php
if(!is_null($member->superior_next->leader_id))
echo "<a href=\"?load=rudi&profile={$member->superior_next->leader_id}\">";
@@ -65,44 +49,44 @@ td {
</tr>
<tr>
<th class="header" scope="row">Status</th>
- <td><?php echo $this->evalData($member->status) ?>&nbsp;</td>
+ <td class="info"><?php echo $this->evalData($member->status) ?>&nbsp;</td>
<th class="header">Position</th>
- <td><?php echo $this->evalData($member->position) ?>&nbsp;</td>
+ <td class="info"><?php echo $this->evalData($member->position) ?>&nbsp;</td>
</tr>
<tr>
<th class="header" scope="row">Unit</th>
- <td><?php echo $this->evalData($member->unit_name) ?>&nbsp;</td>
+ <td class="info"><?php echo $this->evalData($member->unit_name) ?>&nbsp;</td>
<th class="header">Weapon</th>
- <td><?php echo $this->evalData($member->weapon_name) ?>&nbsp;</td>
+ <td class="info"><?php echo $this->evalData($member->weapon_name) ?>&nbsp;</td>
</tr>
<tr>
<th class="header" scope="row">Platoon</th>
- <td><?php echo $this->evalData($member->platoon_name) ?>&nbsp;</td>
+ <td class="info"><?php echo $this->evalData($member->platoon_name) ?>&nbsp;</td>
<th class="header" scope="row">Enlisted</th>
- <td><?php echo $this->evalData($member->enlist_date) ?>&nbsp;</td>
+ <td class="info"><?php echo $this->evalData($member->enlist_date) ?>&nbsp;</td>
</tr>
<tr>
<th class="header" scope="row">Squad</th>
- <td><?php echo $this->evalData($member->squad_name) ?>&nbsp;</td>
+ <td class="info"><?php echo $this->evalData($member->squad_name) ?>&nbsp;</td>
<th class="header">Time In Service</th>
<?php if($member->discharge_date): ?>
- <td><?php echo $this->getDiffTime($member->enlist_date_st, $member->discharge_date)?>&nbsp;</td>
+ <td class="info"><?php echo $this->getDiffTime($member->enlist_date_st, $member->discharge_date)?>&nbsp;</td>
<?php else: ?>
- <td><?php echo $this->getDiffTime($member->enlist_date_st)?></td>
+ <td class="info"><?php echo $this->getDiffTime($member->enlist_date_st)?></td>
<?php endif; ?>
</tr>
<tr>
<th class="header">Team</th>
- <td><?php echo $this->evalData($member->team_name) ?>&nbsp;</td>
+ <td class="info"><?php echo $this->evalData($member->team_name) ?>&nbsp;</td>
<th class="header">Time In Grade</th>
- <td><?php echo $this->getDiffTime($member->promo_date_st) ?>&nbsp;</td>
+ <td class="info"><?php echo $this->getDiffTime($member->promo_date_st) ?>&nbsp;</td>
</tr>
<tr>
<?php if($member->discharge_date): ?>
- <td colspan="2"></td>
+ <td class="info" colspan="2"></td>
<th class="header" scope="row">Separated</th>
- <td><?php echo $this->evalData($member->discharge_date) ?>&nbsp;</td>
+ <td class="info"><?php echo $this->evalData($member->discharge_date) ?>&nbsp;</td>
<?php endif; ?>
</tr>
@@ -127,7 +111,7 @@ td {
<th class="header" scope="col" colspan="3">Service Record</th>
</tr>
<tr>
- <?php if(is_null($member->service_record)):?>
+ <?php decho($member->service_record); if($this->evalData($member->service_record)):?>
<td>No service record available&nbsp;</td>
<?php else:?>
<?php foreach($member->service_record as $record): ?>
@@ -147,14 +131,14 @@ td {
<th class="header" scope="col" colspan="4">Award Record</th>
</tr>
<tr>
- <?php if(is_null($member->award_record)):?>
+ <?php if($this->evalData($member->award_record)):?>
<td>No award record available&nbsp;</td>
<?php else:?>
<?php foreach($member->award_record as $record): ?>
<tr>
<th class="header" width="25%"><?php echo $record->date_added?>&nbsp;</th>
<td ><?php echo $this->evalData($record->award_name); ?>&nbsp;</td>
- <td style="vertical-align:middle;"><center><img src="<?php echo $this->images_path; ?>/medals/<?php echo $record->image; ?>"/></center></td>
+ <td style="vertical-align:middle;"><center><img src="modules/rudi/images/medals/<?php echo $record->image; ?>"/></center></td>
<td width="40%"><?php echo $record->record_note ?>&nbsp;</td>
</tr>
<?php endforeach; ?>
@@ -169,7 +153,7 @@ td {
<th class="header" scope="col" colspan="3">Combat Record</th>
</tr>
<tr>
- <?php if(is_null($member->combat_record)):?>
+ <?php if($this->evalData($member->combat_record)):?>
<td>No combat record available&nbsp;</td>
<?php else:?>
<?php foreach($member->combat_record as $record): ?>
@@ -183,6 +167,4 @@ td {
</tr>
</table></td>
</tr>
-</table>
-</body>
-</html> \ No newline at end of file
+</table> \ No newline at end of file
diff --git a/modules/rudi/views/view.ranks.php b/modules/rudi/views/view.ranks.php
index 2bb1823..4792049 100644
--- a/modules/rudi/views/view.ranks.php
+++ b/modules/rudi/views/view.ranks.php
@@ -1,13 +1,11 @@
-<?php define('BLOCK_RIGHT_DISABLE','block_right_disable'); ?>
+<?php //define('BLOCK_RIGHT_DISABLE','block_right_disable'); ?>
<html>
<head>
<title>Awards and Medals</title>
<style type="text/css">
-p {color: white; }
-body {background-color: black; }
-th.header {
+/*th.header {
width:175px;
background:#333;
}
@@ -15,21 +13,21 @@ th.header {
td.rudi {
text-align: center;
vertical-align: middle;
-}
+} */
</style>
</head>
<body>
- <table align="center" style="width: 100%;">
+ <table class="rudi" align="center" style="width: 100%;">
<tr>
- <th scope="col" class="header">Image</th>
- <th scope="col" class="header">Rank</th>
+ <th scope="col">Image</th>
+ <th scope="col">Rank</th>
</tr>
<?php foreach($this->ranks as $rank): ?>
<tr>
- <td align='center' class="rudi"><img src="<?php echo "{$this->images_path}/ranks/small/{$rank->image}"; ?>"></img>&nbsp;</td>
- <td align='center' class="rudi"><?php echo $rank->longname; ?>&nbsp;</td>
+ <td><img src="<?php echo "modules/rudi/images/ranks/small/{$rank->image}"; ?>" />&nbsp;</td>
+ <td><?php echo $rank->longname; ?>&nbsp;</td>
</tr>
<?php endforeach; ?>
diff --git a/modules/rudi/views/view.roster.php b/modules/rudi/views/view.roster.php
new file mode 100644
index 0000000..01da5ea
--- /dev/null
+++ b/modules/rudi/views/view.roster.php
@@ -0,0 +1,23 @@
+<table width="100%" class="rudi">
+<?php
+ $result = $this->db->query("SELECT * FROM `rudi_combat_units` WHERE `detachment` = 0");
+ $row = $this->db->fetch($result);
+ foreach($row as $unit){
+ echo "<tr><th colspan=\"5\">{$unit['name']}</th></tr>";
+?>
+ <tr>
+ <!-- Table header -->
+ <th class="header">Rank</th>
+ <th class="header">Name</th>
+ <th class="header">Role</th>
+ <th class="header">Weapon</th>
+ <th class="header">Status</th>
+ </tr>
+<?php
+ $this->printRoster($unit['unit_id'], $unit['leader_id']);
+ $this->displayUnitsRec($unit['unit_id']);
+ }
+
+?>
+</table>
+
diff --git a/modules/rudi/views/view.unit.php b/modules/rudi/views/view.unit.php
new file mode 100644
index 0000000..fcc66ac
--- /dev/null
+++ b/modules/rudi/views/view.unit.php
@@ -0,0 +1,22 @@
+<?php $data = $info->Unit($unit_id); ?>
+
+<table align="center">
+ <tr>
+ <th>&nbsp;</th>
+ <td><img src="<?php echo '/cms/modules/rudi/images/units/' . $data->logo; ?>" alt="<?php echo $data->logo; ?>"/></td>
+ </tr>
+ <tr>
+ <th width="25%">Unit</th>
+ <td><?php echo $data->name; ?></td>
+ </tr>
+ <tr>
+ <th>Creed</th>
+ <td><?php echo $data->creed; ?></td>
+ </tr>
+ <tr>
+ <th valign="top">Biography</th>
+ <td><?php echo $data->bio; ?></td>
+ </tr>
+</table>
+
+<?php decho($data); ?> \ No newline at end of file