aboutsummaryrefslogtreecommitdiff
path: root/modules/rudi
diff options
context:
space:
mode:
authorjhunkeler <jhunkeler@c5b2fb0a-d05d-0410-98c8-828840a80ff6>2010-01-16 22:02:16 -0500
committerjhunkeler <jhunkeler@c5b2fb0a-d05d-0410-98c8-828840a80ff6>2010-01-16 22:02:16 -0500
commit6d28ed7cd510621e571da1d5a20848d58d079f53 (patch)
tree55fcf0144f3e79b9c059ced07cdf9def097037b2 /modules/rudi
parenta65e949fefc86be87118238ccde7b6a55c29b0be (diff)
downloadbayonetcms-6d28ed7cd510621e571da1d5a20848d58d079f53.tar.gz
Combat records appear to have a bug. For no reason it displays the unix epoch.
More work on the drills. Mostly works-ish. git-svn-id: http://svn.3rd-infantry-division.org/testing/branches/Bayonet CMS v2@462 c5b2fb0a-d05d-0410-98c8-828840a80ff6
Diffstat (limited to 'modules/rudi')
-rw-r--r--modules/rudi/includes/common.class.php35
-rw-r--r--modules/rudi/views/view.drills.php140
-rw-r--r--modules/rudi/views/view.profile.php8
3 files changed, 89 insertions, 94 deletions
diff --git a/modules/rudi/includes/common.class.php b/modules/rudi/includes/common.class.php
index ab8120e..2e64e48 100644
--- a/modules/rudi/includes/common.class.php
+++ b/modules/rudi/includes/common.class.php
@@ -113,20 +113,22 @@ class Rank
class Drill
{
- public function __construct()
- {
- decho("Constructing " . get_class($this) . " -> " . $this);
- }
-
- public function __destruct()
- {
- decho("Destructing " . get_class($this));
- }
-
- public function __toString()
- {
- return $this->date;
- }
+ public $members;
+ public function __construct()
+ {
+ decho("Constructing " . get_class($this) . " -> " . $this);
+ //$this->members = array('Newly constructed');
+ }
+
+ public function __destruct()
+ {
+ decho("Destructing " . get_class($this));
+ }
+
+ public function __toString()
+ {
+ return $this->date;
+ }
}
class ServiceRecord
@@ -203,10 +205,7 @@ class RUDI_Common
global $config, $db;
$this->images_path = $config['rudi']['images_path'];
- //$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');
+ $this->db = $db;
}
public function __destruct()
diff --git a/modules/rudi/views/view.drills.php b/modules/rudi/views/view.drills.php
index bc80f83..5fcd18e 100644
--- a/modules/rudi/views/view.drills.php
+++ b/modules/rudi/views/view.drills.php
@@ -1,5 +1,10 @@
<?php
+function back()
+{
+ echo "<a href=\"?load=rudi&amp;show=drills\">Back</a>";
+}
+
function Rating($val)
{
define('EXCELLENT',100);
@@ -20,86 +25,77 @@ function Rating($val)
return "Bad Value";
}
-OpenTable("Drills");
+?>
+<?php if(isset($_GET['id'])): ?>
-if(isset($_GET['stats']))
-{
-
- return;
-}
+<table cellspacing="20" class="rudi" align="left" style="width: 100%;">
+<tr>
+ <th class="header">News</th>
+</tr>
-if(isset($_GET['id']))
-{
- 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 ? "Yes" : "No") . "</td>
- <td class=\"rudi\">{$drill->excusal_reason}</td>
-
- </tr>";
- }
- CloseTable();
- echo "<a href=\"?load=rudi&amp;show=drills\">Back</a>";
- decho('DATA FOR QUERY');
+<tr>
+ <td style="text-align:left;"><?php echo bbcode_format($drills->manifest->news); ?>&nbsp;</td>
+</tr>
+
+<tr>
+ <th class="header">Notes</th>
+</tr>
+
+<tr>
+ <td style="text-align:left;"><?php echo bbcode_format($drills->manifest->notes); ?>&nbsp;</td>
+</tr>
+</table>
+
+<br />
+
+<table class="rudi" align="center" style="width: 100%;">
+<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>
+<?php foreach($drills->manifest->members as $member): ?>
+<?php
+ $name = $member->last_name . ', ' . $member->first_name;
+ $pRating = Rating($member->performance);
+ $iRating = Rating($member->initiative);
+?>
+<tr>
+ <td class="rudi"><?php echo $name; ?>&nbsp;</td>
+ <td class="rudi"><?php echo $pRating; ?>&nbsp;</td>
+ <td class="rudi"><?php echo $iRating; ?>&nbsp;</td>
+ <td class="rudi"><?php echo ($member->excusal ? "Yes" : "No"); ?>&nbsp;</td>
+ <td class="rudi"><?php echo $member->excusal_reason; ?>&nbsp;</td>
+</tr>
+<?php endforeach; ?>
+</table>
+ <?php echo "<br/>"; back();
+ decho("DRILL DATA FOR ID({$_GET['id']}) QUERY");
decho($drills->manifest);
return;
-}
+ ?>
-echo "<tr>
-<th class=\"header\">&nbsp;</th>
-<th class=\"header\">Date</th>
-<!-- <th class=\"header\">News</th> -->
-<th class=\"header\">Notes</th>
-</tr>";
+<?php endif; ?>
-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>
- <td class=\"rudi\">{$drill->date}</td>
- <!-- <td class=\"rudi\">{$drill->news}</td> -->
- <td class=\"rudi\">{$drill->notes}</td>
- </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');
+<table class="rudi" align="center" style="width: 100%;">
+<tr>
+<th class="header">&nbsp;</th>
+<th class="header">Date</th>
+</tr>
-$drill = $drills->getAttendenceOf(2);
-$drill['stats'] = $drills->getMemberStatistics($drills->getAttendenceOf(2));
+<?php foreach($drills->manifest as $drill): ?>
+<tr>
+ <td class="rudi"><a href="?load=rudi&amp;show=drills&amp;id=<?php echo $drill->drill_id; ?>">View</a></td>
+ <td class="rudi"><?php echo $drill->date; ?> </td>
+</tr>
+<?php endforeach; ?>
+</table>
-$member = $drills->getMemberAttendenceOf(2,1);
-$member[] = $drills->getMemberStatistics($member);
-*/
+<?php
-decho('DATA FOR QUERY');
+decho('DATA FOR NO ID 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 1010985..6135ea4 100644
--- a/modules/rudi/views/view.profile.php
+++ b/modules/rudi/views/view.profile.php
@@ -116,13 +116,13 @@ define('BLOCK_RIGHT_DISABLE', true);
<th class="header" scope="col" colspan="3">Service Record</th>
</tr>
<tr>
- <?php decho($member->service_record); if($this->evalData($member->service_record)):?>
+ <?php if($this->evalData($member->service_record)):?>
<td>No service record available&nbsp;</td>
<?php else:?>
<?php foreach($member->service_record as $record): ?>
<tr>
<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>
+ <td><?php echo $record->record_note; ?>&nbsp;</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
@@ -141,7 +141,7 @@ define('BLOCK_RIGHT_DISABLE', true);
<?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 date('M j, Y', strtotime($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>
@@ -163,7 +163,7 @@ define('BLOCK_RIGHT_DISABLE', true);
<?php else:?>
<?php foreach($member->combat_record as $record): ?>
<tr>
- <th class="header" width="25%"><?php echo $record->date; ?>&nbsp;</th>
+ <th class="header" width="25%"><?php echo date('M j, Y', strtotime($record->date_added)); ?>&nbsp;</th>
<td><a href="<?php echo $record->website; ?>"><?php echo $record->name; ?></a>&nbsp;</td>
<td><?php echo $record->status; ?>&nbsp;</td>
</tr>