aboutsummaryrefslogtreecommitdiff
path: root/modules/rudi
diff options
context:
space:
mode:
authorjhunkeler <jhunkeler@c5b2fb0a-d05d-0410-98c8-828840a80ff6>2010-01-16 17:40:46 -0500
committerjhunkeler <jhunkeler@c5b2fb0a-d05d-0410-98c8-828840a80ff6>2010-01-16 17:40:46 -0500
commita65e949fefc86be87118238ccde7b6a55c29b0be (patch)
tree90f0df3d864cee2858dcda9606e95ab9907f155e /modules/rudi
parent2b31e8a6f30ebcd145b3394ac1a2ef8a768924ac (diff)
downloadbayonetcms-a65e949fefc86be87118238ccde7b6a55c29b0be.tar.gz
Looks like I'm about to break something terribly, so it's time to save.
Initial rewrite of drill displays -jhunk Truncated date display for service records -OC git-svn-id: http://svn.3rd-infantry-division.org/testing/branches/Bayonet CMS v2@461 c5b2fb0a-d05d-0410-98c8-828840a80ff6
Diffstat (limited to 'modules/rudi')
-rw-r--r--modules/rudi/includes/common.class.php25
-rw-r--r--modules/rudi/index.php10
-rw-r--r--modules/rudi/views/view.drills.php86
-rw-r--r--modules/rudi/views/view.profile.php53
4 files changed, 110 insertions, 64 deletions
diff --git a/modules/rudi/includes/common.class.php b/modules/rudi/includes/common.class.php
index 21c7ccc..ab8120e 100644
--- a/modules/rudi/includes/common.class.php
+++ b/modules/rudi/includes/common.class.php
@@ -199,6 +199,7 @@ class RUDI_Common
public function __construct()
{
+ decho("Constructing " . get_parent_class($this));
global $config, $db;
$this->images_path = $config['rudi']['images_path'];
@@ -210,7 +211,7 @@ class RUDI_Common
public function __destruct()
{
-
+ decho("Destructing " . get_parent_class($this));
}
/**
@@ -264,9 +265,9 @@ class RUDI_Common
$m_mod = NULL;
$d_mod = NULL;
- if($test['years'] > 1)
+ if($test['years'] > 1 || $test['years'] < 1)
$y_mod = 's';
- if($test['months'] > 1)
+ if($test['months'] > 1 || $test['months'] < 1)
$m_mod = 's';
if($test['days'] > 1 && $test['days'] < 1)
$d_mod = 's';
@@ -674,7 +675,7 @@ class RUDI_Common
<!-- 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>
+ <td class="roster"><a class="rudi_roster" 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
@@ -724,7 +725,7 @@ class RUDI_Common
if(isset($_GET['profile']))
{
$id = addslashes($_GET['profile']);
- decho("Update() ID: $id");
+ decho("Update() Profile ID: $id");
}
if($query_t != RUDI_PROFILE_SMALL)
@@ -898,16 +899,16 @@ class RUDI_Common
return $row;
}
-
+/*
protected function getDrills($id = NULL)
{
if(!is_null($id))
{
- $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 = %d ORDER BY date DESC",
+ $query = sprintf("SELECT rd.drill_id, rd.date, rd.news, rd.notes, dr.performance, dr.excusal, dr.excusal_reason, dr.initiative, m.first_name, m.last_name FROM rudi_drills AS rd
+ LEFT OUTER JOIN rudi_drills_record AS dr ON dr.drill_id = rd.drill_id
+ LEFT 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_id
+ WHERE rd.drill_id = %d ORDER BY date DESC",
(int)$id);
}
else
@@ -920,6 +921,8 @@ class RUDI_Common
return $row;
}
+*/
+
}
?> \ No newline at end of file
diff --git a/modules/rudi/index.php b/modules/rudi/index.php
index 2bc08a3..995c90d 100644
--- a/modules/rudi/index.php
+++ b/modules/rudi/index.php
@@ -4,6 +4,7 @@
//include 'includes/debug.php';
//require 'includes/sql.class.php';
include_once 'includes/common.class.php';
+include_once 'includes/drills.class.php';
include_once 'includes/information.class.php';
OpenContent();
@@ -15,6 +16,7 @@ class RUDI_Gateway extends RUDI_Common
public function __construct()
{
+ decho("Constructing " . get_class($this));
parent::__construct();
if(isset($_GET['admin']))
@@ -61,7 +63,8 @@ class RUDI_Gateway extends RUDI_Common
include 'views/view.ranks.php';
break;
case 'drills':
- $this->drills = $this->getDrills($_GET['id']);
+ //$this->drills = $this->getDrills($_GET['id']);
+ $drills = new RUDI_Drills($_GET['id']);
include 'views/view.drills.php';
break;
}
@@ -82,6 +85,11 @@ class RUDI_Gateway extends RUDI_Common
return;
}
}
+
+ public function __destruct()
+ {
+ decho("Destructing " . get_class($this));
+ }
}
ob_start();
diff --git a/modules/rudi/views/view.drills.php b/modules/rudi/views/view.drills.php
index 06fbe62..bc80f83 100644
--- a/modules/rudi/views/view.drills.php
+++ b/modules/rudi/views/view.drills.php
@@ -2,11 +2,11 @@
function Rating($val)
{
- define(EXCELLENT,100);
- define(GOOD, 75);
- define(FAIR, 50);
- define(POOR, 25);
- define(TERRIBLE, 0);
+ define('EXCELLENT',100);
+ define('GOOD', 75);
+ define('FAIR', 50);
+ define('POOR', 25);
+ define('TERRIBLE', 0);
if($val == EXCELLENT)
return "Excellent";
@@ -22,35 +22,42 @@ function Rating($val)
OpenTable("Drills");
+if(isset($_GET['stats']))
+{
+
+ return;
+}
+
if(isset($_GET['id']))
{
- decho($this->drills);
- foreach($this->drills as $drill)
- {
- $name = $drill->last_name . ', ' . $drill->first_name;
- $pRating = Rating($drill->performance);
- $iRating = Rating($drill->initiative);
-
- echo "<tr>
- <th class=\"header\">Soldier</th>
- <th class=\"header\">Performance Rating</th>
- <th class=\"header\">Initiative Rating</th>
- <th class=\"header\">Early Excusal</th>
- <th class=\"header\">Excusal Reason</th>
-
- </tr>";
+ echo "
+ <tr>
+ <th class=\"header\">Soldier</th>
+ <th class=\"header\">Performance Rating</th>
+ <th class=\"header\">Initiative Rating</th>
+ <th class=\"header\">Early Excusal</th>
+ <th class=\"header\">Excusal Reason</th>
+ </tr>";
+ foreach($drills->manifest['members'] as $drill)
+ {
+ $name = $drill->last_name . ', ' . $drill->first_name;
+ $pRating = Rating($drill->performance);
+ $iRating = Rating($drill->initiative);
- echo "<tr>
- <td class=\"rudi\">{$name}</td>
- <td class=\"rudi\">{$pRating}</td>
- <td class=\"rudi\">{$iRating}</td>
- <td class=\"rudi\">{$drill->excusal}</td>
- <td class=\"rudi\">{$drill->excusal_reason}</td>
+ echo "
+ <tr>
+ <td class=\"rudi\">{$name}</td>
+ <td class=\"rudi\">{$pRating}</td>
+ <td class=\"rudi\">{$iRating}</td>
+ <td class=\"rudi\"> " . ($drill->excusal ? "Yes" : "No") . "</td>
+ <td class=\"rudi\">{$drill->excusal_reason}</td>
- </tr>";
+ </tr>";
}
CloseTable();
echo "<a href=\"?load=rudi&amp;show=drills\">Back</a>";
+ decho('DATA FOR QUERY');
+ decho($drills->manifest);
return;
}
@@ -61,7 +68,7 @@ echo "<tr>
<th class=\"header\">Notes</th>
</tr>";
-foreach($this->drills as $drill)
+foreach($drills->manifest as $drill)
{
echo "<tr>
<td class=\"rudi\"><a href=\"?load=rudi&amp;show=drills&amp;id={$drill->drill_id}\">View</a></td>
@@ -71,5 +78,28 @@ foreach($this->drills as $drill)
</tr>";
}
+/*
+decho('manifest');
+decho($drills->manifest);
+decho('attendence of drill 2');
+decho($drills->getAttendenceOf(2));
+decho('member 1 attendence of drill 2');
+decho($drills->getMemberAttendenceOf(2,1));
+decho('member 1 attendence in general');
+decho($drills->getMemberAttendence(1));
+decho('statistics of member 1 in general');
+
+$drill = $drills->getAttendenceOf(2);
+$drill['stats'] = $drills->getMemberStatistics($drills->getAttendenceOf(2));
+
+$member = $drills->getMemberAttendenceOf(2,1);
+$member[] = $drills->getMemberStatistics($member);
+*/
+
+
+decho('DATA FOR QUERY');
+decho($drills->manifest);
+decho($drill);
+decho($member);
CloseTable();
?> \ No newline at end of file
diff --git a/modules/rudi/views/view.profile.php b/modules/rudi/views/view.profile.php
index 7244b8d..1010985 100644
--- a/modules/rudi/views/view.profile.php
+++ b/modules/rudi/views/view.profile.php
@@ -3,6 +3,7 @@
$member =& $this->data[$_GET['profile']];
$uniform_image = $member->first_name[0].str_replace(array("'", "\""), "", $member->last_name).".png";
decho($member);
+define('BLOCK_RIGHT_DISABLE', true);
?>
<style type="text/css">
@@ -25,10 +26,10 @@ decho($member);
<td><center><?php echo $member->primary_mos; ?></center></td>
</tr>
<tr>
- <td><center><img src="modules/rudi/images/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="modules/rudi/images/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>
@@ -36,7 +37,7 @@ decho($member);
<table width="100%" border="0" cellpadding="5">
<tr>
<th class="header" scope="row">Location</th>
- <td class="info"><?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 class="info"><?php
if(!is_null($member->superior_next->leader_id))
@@ -49,44 +50,48 @@ decho($member);
</tr>
<tr>
<th class="header" scope="row">Status</th>
- <td class="info"><?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 class="info"><?php echo $this->evalData($member->position) ?>&nbsp;</td>
+ <td class="info"><?php echo $this->evalData($member->position); ?>&nbsp;</td>
</tr>
- <tr>
+ <tr>
<th class="header" scope="row">Unit</th>
- <td class="info"><?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 class="info"><?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 class="info"><?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 class="info"><?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 class="info"><?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 class="info"><?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 class="info"><?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 class="info"><?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 class="info"><?php echo $this->getDiffTime($member->promo_date_st) ?>&nbsp;</td>
+ <?php if($member->discharge_date): ?>
+ <td class="info"><?php echo $this->getDiffTime($member->promo_date_st, $member->discharge_date); ?>&nbsp;</td>
+ <?php else: ?>
+ <td class="info"><?php echo $this->getDiffTime($member->promo_date_st); ?></td>
+ <?php endif; ?>
</tr>
<tr>
<?php if($member->discharge_date): ?>
<td class="info" colspan="2"></td>
<th class="header" scope="row">Separated</th>
- <td class="info"><?php echo $this->evalData($member->discharge_date) ?>&nbsp;</td>
+ <td class="info"><?php echo $this->evalData($member->discharge_date); ?>&nbsp;</td>
<?php endif; ?>
</tr>
@@ -100,7 +105,7 @@ decho($member);
<th class="header" scope="col">Biography</th>
</tr>
<tr >
- <td style="text-align:left;"><?php echo $member->bio ?>&nbsp;</td>
+ <td style="text-align:left;"><?php echo $member->bio; ?>&nbsp;</td>
</tr>
</table>
@@ -116,8 +121,8 @@ decho($member);
<?php else:?>
<?php foreach($member->service_record as $record): ?>
<tr>
- <th class="header" width="25%"><?php echo $record->date_added ?>&nbsp;</th>
- <td><?php echo $record->record_note ?>&nbsp;</td>
+ <th class="header" width="25%"><?php echo date('M j, Y', strtotime($record->date_added)); ?>&nbsp;</th>
+ <td style="text-align:left;"><?php echo $record->record_note; ?>&nbsp;</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
@@ -136,10 +141,10 @@ decho($member);
<?php else:?>
<?php foreach($member->award_record as $record): ?>
<tr>
- <th class="header" width="25%"><?php echo $record->date_added?>&nbsp;</th>
+ <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="modules/rudi/images/medals/<?php echo $record->image; ?>"/></center></td>
- <td width="40%"><?php echo $record->record_note ?>&nbsp;</td>
+ <td width="40%"><?php echo $record->record_note; ?>&nbsp;</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
@@ -158,9 +163,9 @@ decho($member);
<?php else:?>
<?php foreach($member->combat_record as $record): ?>
<tr>
- <th class="header" width="25%"><?php echo $record->date ?>&nbsp;</th>
- <td><a href="<?php echo $record->website ?>"><?php echo $record->name ?></a>&nbsp;</td>
- <td><?php echo $record->status ?>&nbsp;</td>
+ <th class="header" width="25%"><?php echo $record->date; ?>&nbsp;</th>
+ <td><a href="<?php echo $record->website; ?>"><?php echo $record->name; ?></a>&nbsp;</td>
+ <td><?php echo $record->status; ?>&nbsp;</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>