<?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/>.
*/
class ControlTropas extends ControlBase
{
public function tropas()
{
include $this->c_modelos.'ModeloTropas.php';
$truppen = new ModeloTropas;
$truppen->propias($tropas_en, $tropas_ref, $bandera);
include $this->c_vistas.'tropas.php';
}
public function nueva()
{
include $this->c_modelos.'ModeloTropas.php';
$truppen = new ModeloTropas;
$error = "";
$titulo = self::$texto->get('HEAD06');
$accion = "new_troop";
$direccion = "?ctrl=Tropas&mod=nueva";
$target = "?ctrl=Tropas&mod=tropas";
if (isset($_POST['accion']) and $_POST['accion']=="new_troop") {
$error = $truppen->cargar();
include $this->c_vistas.'error.php';
} elseif (isset($_POST['aldea'])) {
$aldea = array();
$error = $truppen->datosaldea($aldea);
(empty($error)) ? $aux = 'am_tropas.php' : $aux = 'error.php';
include $this->c_vistas.$aux;
}
}
public function editar()
{
include $this->c_modelos.'ModeloTropas.php';
$truppen = new ModeloTropas;
$error = "";
$titulo = self::$texto->get('HEAD07');
$accion = "edit_troop";
$direccion = "?ctrl=Tropas&mod=editar";
$target = "?ctrl=Tropas&mod=tropas";
if ( isset($_POST['accion']) and $_POST['accion']=="edit_troop" ) {
$truppen->actualizar();
} elseif (isset($_GET['x']) and isset($_GET['y']) ) {
$aldea = array();
$tropas = array();
$truppen->verunidades($aldea, $tropas, $tot_aldeas);
include $this->c_vistas.'am_tropas.php';
}
}
public function borrar()
{
include $this->c_modelos.'ModeloTropas.php';
$truppen = new ModeloTropas;
$titulo = self::$texto->get('HEAD29');
$target = "?ctrl=Tropas&mod=tropas";
$error = "";
$error = $truppen->borrando();
include $this->c_vistas.'error.php';
}
public function todas()
{
include $this->c_modelos.'ModeloTropas.php';
$truppen = new ModeloTropas;
$tropas = $truppen->todas();
include $this->c_vistas.'resumen_tropas.php';
}
public function Buscador()
{
include $this->c_modelos.'ModeloTropas.php';
$truppen = new ModeloTropas;
$titulo = self::$texto->get('HEAD30');
$target = "?ctrl=Tropas&mod=Buscador";
$error = "";
if (isset($_POST['x'])) $resultado = $truppen->Buscar($error);
if ($error) include $this->c_vistas.'error.php';
else include $this->c_vistas.'buscador.php';
}
} // Fin clase
?>