<?php
/*
* Alliances Manager (Gestionador de Alianzas) - Travian
* Copyright (C) 2008-12 Viva Mayer, Francisco Mesías <hide@address.com>
*
* 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/>.
*/
cabecera("",self::$texto->get('HEAD25'));
?>
</head>
<body>
<div id="top"><?php include("libs/top.php"); ?></div>
<div id="contenido">
<div id="left"> <?php $top = 'panel'; include("libs/menu.php"); ?></div>
<div id="cuerpo">
<?php
if ($bandera)
{ ?>
<form id="form1" name="form1" method="post" action="?ctrl=Tropas&mod=nueva">
<table width="400" border="0" cellspacing="1" cellpadding="2" align="center" class="tabla">
<tr>
<td width="138"><?=self::$texto->get('intro.t.en')?></td>
<td width="175"><select name="aldea" tabindex="1">
<?php
$tot_filas = count($tropas_en);
$cont = 0;
while ($cont < $tot_filas) {
echo "<option value=\"".$tropas_en[$cont]['x']."|".$tropas_en[$cont]['y']."\">".$tropas_en[$cont]['aldea']."</option>";
$cont++;
}
?>
</select> </td>
<td width="71"><input type="submit" class="boton" value="<?=self::$texto->get('ejecutar')?>" /></td>
</tr>
</table>
</form>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="tabla2">
<tr class="E1">
<td colspan="14"><?=self::$texto->get('titulo.en')?></td>
</tr>
<tr class="E2">
<td width="150"><?=self::$texto->get('aldea')?></td>
<?php
foreach (self::$texto->get($_SESSION['raza']) as $id => $nombre)
echo "<td><img src=\"imagenes/tropas/".$_SESSION['raza']."/".$id.".gif\" alt=\"".$nombre."\" width=\"16\" height=\"16\" title=\"".$nombre."\"/></td> \n\t\t ";
?>
<td><?=self::$texto->get('consumo')?></td>
<td width="20"> </td>
<td width="20"> </td>
</tr>
<?php
$alter = 0; // Permite alterar los colores de las filas en la tabla
$cont = 0;
$total = array ( 0=>0, 1=>0, 2=>0, 3=>0, 4=>0, 5=>0, 6=>0, 7=>0, 8=>0, 9=>0);
while ($cont < $tot_filas)
{
// Alternamos los colores de las filas
if ($alter%2 == 0) echo "<tr class=\"c1\">";
else echo "<tr class=\"c2\">";
++$alter;
// Escapamos los datos de la aldea
echo "<td title=\"( ".$tropas_en[$cont]['x']." | ".$tropas_en[$cont]['y']." )\" align=\"left\">".$tropas_en[$cont]['aldea']."</td>\n";
// Metemos las cantidades de tropas y acumulamos
for ($i=0; $i<10; $i++) {
echo "<td>".$tropas_en[$cont]['t'.$i]."</td>";
$total[$i] += $tropas_en[$cont]['t'.$i];
}
// Escapamos el consumo de las tropas
echo "<td> ········ </td>";
echo "<td width=\"20\"><a href=\"index.php?crtl=Tropa&mod=editar&x=".$tropas_en[$cont]['x']."&y=".$tropas_en[$cont]['y']."\"><img src=\"imagenes/botones/edit.png\" width=\"16\" height=\"16\" border=\"0\" /></a></td>";
echo "<td width=\"20\"><a href=\"index.php?crtl=Tropa&mod=borrar&x=".$tropas_en[$cont]['x']."&y=".$tropas_en[$cont]['y']."\"><img src=\"imagenes/botones/del.png\" width=\"16\" height=\"16\" border=\"0\" onclick=\"return confirm('".self::$texto->get('MBT02')."( ".$tropas_en[$cont]['x']." | ".$tropas_en[$cont]['y']." ) ".self::$texto->get('MBT04')."')\" /></a></td>";
echo "</tr>\n";
$cont++;
} //fin mientras
echo "<tr class=\"E2\"><td>TOTAL</td>";
for ($i=0; $i<10; $i++)
echo "<td>".$total[$i]."</td>";
echo "<td> </td><td> </td><td> </td></tr>";
?>
</table>
<br />
<form id="form1" name="form1" method="post" action="?ctrl=Tropas&mod=nueva">
<input type="hidden" name="refuerzo" value="1">
<table width="430" border="0" cellspacing="1" cellpadding="2" align="center" class="tabla">
<tr>
<td width="174"><?=self::$texto->get('intro.ref')?></td>
<td width="160"><select name="aldea" tabindex="1">
<?php
$cont = 0;
while ($cont < $tot_filas) {
echo "<option value=\"".$tropas_en[$cont]['x']."|".$tropas_en[$cont]['y']."\">".$tropas_en[$cont]['aldea']."</option>";
$cont++;
}
?>
</select> </td>
<td width="80"><input type="submit" class="boton" value="<?=self::$texto->get('ejecutar')?>" /></td>
</tr>
</table>
</form>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="tabla2">
<tr class="E1">
<td colspan="14"><?=self::$texto->get('titulo.ref')?></td>
</tr>
<tr class="E2">
<td width="150"><?=self::$texto->get('origen')?></td>
<td width="100"><?=self::$texto->get('ubicacion')?></td>
<?php
foreach (self::$texto->get($_SESSION['raza']) as $id => $nombre)
echo "<td><img src=\"imagenes/tropas/".$_SESSION['raza']."/".$id.".gif\" alt=\"".$nombre."\" width=\"16\" height=\"16\" title=\"".$nombre."\"/></td> \n\t\t ";
?>
<td width="20"> </td>
<td width="20"> </td>
</tr>
<?php
$alter = 0; // Permite alterar los colores de las filas en la tabla
$cont = 0; $tot_filas = count($tropas_ref);
$total = array ( 0=>0, 1=>0, 2=>0, 3=>0, 4=>0, 5=>0, 6=>0, 7=>0, 8=>0, 9=>0);
if (!empty($tropas_ref))
{
while ($cont < $tot_filas)
{
// Alternamos los colores de las filas
if ($alter%2 == 0) echo "<tr class=\"c1\">";
else echo "<tr class=\"c2\">";
++$alter;
// Escapamos la aldea de origen
echo "<td title=\"( ".$tropas_ref[$cont]['ox']." | ".$tropas_ref[$cont]['oy']." )\" align=\"left\">".$tropas_ref[$cont]['aldea']."</td>\n";
// Escapamos la aldea donde se encuentran los refuerzos
echo "<td>( ".$tropas_ref[$cont]['dx']." | ".$tropas_ref[$cont]['dy']." )</td>";
// Metemos las cantidades de tropas y acumulamos
for ($i=0; $i<10; $i++) {
echo "<td>".$tropas_ref[$cont]['t'.$i]."</td>";
$total[$i] += $tropas_ref[$cont]['t'.$i];
}
echo "<td width=\"20\"><a href=\"index.php?crtl=Tropa&mod=editar&x=".$tropas_ref[$cont]['ox']."&y=".$tropas_ref[$cont]['oy']."&rx=".$tropas_ref[$cont]['dx']."&ry=".$tropas_ref[$cont]['dy']."\"><img src=\"imagenes/botones/edit.png\" width=\"16\" height=\"16\" border=\"0\" /></a></td>";
echo "<td width=\"20\"><a href=\"index.php?crtl=Tropa&mod=borrar&x=".$tropas_ref[$cont]['ox']."&y=".$tropas_ref[$cont]['oy']."&rx=".$tropas_ref[$cont]['dx']."&ry=".$tropas_ref[$cont]['dy']."\"><img src=\"imagenes/botones/del.png\" width=\"16\" height=\"16\" border=\"0\" onclick=\"return confirm('".self::$texto->get('MBT02')."( ".$tropas_ref[$cont]['dx']." | ".$tropas_ref[$cont]['dy']." ) ".self::$texto->get('MBT04')."')\" /></a></td></tr>\n";
echo "</tr>\n";
$cont++;
} //fin mientras
echo "<tr class=\"E2\"><td colspan=\"2\">TOTAL</td>";
for ($i=0; $i<10; $i++)
echo "<td>".$total[$i]."</td>";
echo "<td width=\"20\"> </td><td width=\"20\"> </td></tr>\n";
} else {
echo "<tr><td colspan=\"14\"> No hay tropas en otras aldeas cargadas </td></tr>\n";
}
unset($total,$tropas_ref,$tropas_en)
?>
</table>
<br />
<?php
} else { ?>
<table width="300" border="0" align="center" cellpadding="2" cellspacing="1" class="tabla_msj">
<tr><td><?=self::$texto->get('MBT03'); ?></td></tr>
<tr class="E1" align="center"><td><input type="button" class="boton" onClick="parent.location='?ctrl=Aldeas&mod=nueva'" value="<?=self::$texto->get('nueva_aldea')?>" /></td>
</tr>
</table>
<br><br>
<?php
}
?>
</div>
</body>
</html>