return false;
}
+ function show_competitor($competitor) {
+ $sq = new ShipQuery;
+ $sq->joinWith('Ship.Hull');
+ $ships = $sq->findByCompetitorId($competitor->getId());
+ if (! count($ships)) return;
+
+ foreach ($ships as $ship) {
+ $hull_name = $ship->getHull()->getLink();
+ $ship_name = $ship->getLink();
+ echo "<p>Ship: $ship_name ($hull_name)</p>\n";
+ $eq = new EntryQuery;
+ $eq->joinWith('Entry.Race');
+ $eq->joinWith('Entry.Ship');
+ $eq->joinWith('Ship.Hull');
+ $entries = $eq->orderById()->findByShip($ship);
+ if (! count($entries)) continue;
+
+ foreach ($entries as $entry) {
+ $entry_link = $entry->getLink();
+ $race_name = $entry->getRace()->getLink();
+ echo "<p>Entry $entry_link in <strong>$race_name</strong></p>\n";
+ }
+ }
+ }
+
function module_competitor($action) {
if ($_POST['add_competitor']) {
if (add_competitor($_POST["cmdr_name"], $_POST["forum_name"])) unset($_POST);
}
$q = new CompetitorQuery;
+ if ($action) $q->filterById($action);
$competitors = $q->orderByCmdrName()->find();
if (! count($competitors)) echo "<p>No competitors</p>\n";
foreach ($competitors as $competitor) {
$forum = $competitor->getForumName();
if ($forum && $forum != $cmdr) echo " ($forum)";
"</p>\n";
+ if ($action) show_competitor($competitor);
}
echo "<hr>\n";
foreach ($entries as $entry) {
$entry_link = $entry->getLink();
$race_name = $entry->getRace()->getLink();
+ $hull_name = $entry->getShip()->getHull()->getLink();
$ship_name = $entry->getShip()->getLink();
$cmdr_name = $entry->getShip()->getCompetitor()->getLink();
- echo "<p>CMDR <strong>$cmdr_name</strong> flying <strong>$ship_name</strong> in <strong>$race_name</strong> [$entry_link]</p>\n";
+ echo "<p>CMDR <strong>$cmdr_name</strong> flying $hull_name <strong>$ship_name</strong> in <strong>$race_name</strong> [$entry_link]</p>\n";
}
}
echo "<hr>\n";
return false;
}
+ function show_hull($hull) {
+ $sq = new ShipQuery;
+ $sq->joinWith('Ship.Competitor');
+ $ships = $sq->findByHullId($hull->getId());
+ if (! count($ships)) return;
+
+ foreach ($ships as $ship) {
+ $cmdr_name = $ship->getCompetitor()->getLink();
+ $ship_name = $ship->getLink();
+ echo "<p>Ship: $ship_name flown by CMDR $cmdr_name</p>\n";
+ $eq = new EntryQuery;
+ $eq->joinWith('Entry.Race');
+ $entries = $eq->orderById()->findByShip($ship);
+ if (! count($entries)) continue;
+
+ foreach ($entries as $entry) {
+ $entry_link = $entry->getLink();
+ $race_name = $entry->getRace()->getLink();
+ echo "<p>Entry $entry_link in <strong>$race_name</strong></p>\n";
+ }
+ }
+ }
+
function module_hull($action) {
if ($_POST['add_hull']) {
if (add_hull($_POST["name"])) unset($_POST);
}
$q = new HullQuery;
+ if ($action) $q->filterById($action);
$hulls = $q->find();
if (! count($hulls)) echo "<p>No hulls</p>\n";
foreach ($hulls as $hull) {
$name = $hull->getName();
echo "<p><strong>$name</strong></p>\n";
+ if ($action) show_hull($hull);
}
echo "<hr>\n";
return false;
}
+ function show_ship($ship) {
+ $eq = new EntryQuery;
+ $eq->joinWith('Entry.Race');
+ $eq->joinWith('Entry.Ship');
+ $eq->joinWith('Ship.Hull');
+ $entries = $eq->orderById()->findByShip($ship);
+ if (! count($entries)) return;
+
+ foreach ($entries as $entry) {
+ $entry_link = $entry->getLink();
+ $race_name = $entry->getRace()->getLink();
+ echo "<p>Entry $entry_link in <strong>$race_name</strong></p>\n";
+ }
+ }
+
function module_ship($action) {
if ($_POST['add_ship']) {
if (add_ship($_POST["competitor_id"], $_POST["hull_id"], $_POST["name"])) unset($_POST);
$q = new ShipQuery;
$q->joinWith("Ship.Competitor");
$q->joinWith("Ship.Hull");
+ if ($action) $q->filterById($action);
$ships = $q->orderByName()->find();
if (! count($ships)) echo "<p>No ships</p>\n";
foreach ($ships as $ship) {
$hull_name = $hull->getLink();
$competitor = $ship->getCompetitor();
$cmdr_name = $competitor->getLink();
- echo "<p><strong>$name</strong> ($hull_name) CMDR $cmdr_name</p>\n";
+ echo "<p><strong>$name</strong> ($hull_name) flown by CMDR $cmdr_name</p>\n";
+ if ($action) show_ship($ship);
}
echo "<hr>\n";