Location: PHPKode > projects > Alliances Manager > control/ControlGrupo.php
<?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 ControlGrupo extends ControlBase
{
	public function resumen()
	{
		include $this->c_modelos."ModeloGrupo.php";
		$grupo = new ModeloGrupo;
		
		$resultado = $grupo->resumen();
		include $this->c_vistas."grupos.php";

	}
//---------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------
	public function nuevo()
	{
		include $this->c_modelos."ModeloGrupo.php";
		$grupo = new ModeloGrupo;

		$error = "";
		$titulo = self::$texto->get('HEAD04');
		$accion = "new_group";
		$direccion = "?ctrl=Grupo&mod=nuevo";
		$target = "?ctrl=Grupo&mod=resumen";
		
		if (isset($_POST['form']) and $_POST['form']=="new_group") {
			$error = $grupo->nuevo();
			include $this->c_vistas."error.php";
		} else {
			include $this->c_vistas."am_grupo.php";
		}
	}
//---------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------
	public function editar()
	{
		include $this->c_modelos."ModeloGrupo.php";
		$grupo = new ModeloGrupo;

		$error = "";
		$titulo = self::$texto->get('HEAD05');
		$accion = "edit_group";
		$direccion = "?ctrl=Grupo&mod=editar";
		$target = "?ctrl=Grupo&mod=resumen";
		
		if (isset($_POST['form']) and $_POST['form']=="edit_group") {
			$error = $grupo->editar();
			include $this->c_vistas."error.php";
		} else {
			if ($_GET['g']!=0) {
				$datos = $grupo->get_data(((int) $_GET['g']));
				include $this->c_vistas."am_grupo.php";
			} else {
				$error = 'EBG04';
				include $this->c_vistas."error.php";
			}
		}
	}
//---------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------
	public function eliminar()
	{
		include $this->c_modelos.'ModeloGrupo.php';
		$grupo = new ModeloGrupo;
		
		$titulo = self::$texto->get('HEAD27');
		$target = "?ctrl=Grupo&mod=resumen";
		$direccion = "?ctrl=Grupo&mod=eliminar";
		
		$error = $grupo->eliminar();
		include $this->c_vistas.'error.php';
	}
//---------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------
	public function procesar()
	{
		include $this->c_modelos.'ModeloGrupo.php';
		$grupo = new ModeloGrupo;
		
		if (isset($_POST['query']) and $_POST['query']=="procesar_grupo" )
			$grupo->procesar();
		else { // NOTA A FUTURO: utilizar otra vista o modificar la de error
			$sql = 'procesar_grupo';
			$titulo = self::$texto->get('HEAD28');
			$direccion = "?ctrl=Grupo&mod=procesar"; $target = "?ctrl=Grupo&mod=resumen";
			$msj = self::$texto->get('MPG01');
			include $this->c_vistas.'error.php';
		}
	}
//---------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------
	public function detalles()
	{
		include $this->c_modelos.'ModeloGrupo.php';
		$grupo = new ModeloGrupo;
		$datos = array(); $miembros = array();
		
		$grupo->ver_detalle($aux, $miembros, $grupos);
		include $this->c_vistas.'detalle_grupo.php';
	}
//--------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------	
	public function modgrupo()
	{
		include $this->c_modelos.'ModeloGrupo.php';
		$grupo = new ModeloGrupo;
		$error=""; 

		if ( isset ( $_POST['confirm'] ) and $_POST['confirm']=="cg" )
			{
				$error = $grupo->modificar_grupo();
				
				$titulo = self::$texto->get('HEAD26');
				$target="?ctrl=Grupo&mod=detalles&g=".$_POST['volver'];
				include $this->c_vistas."error.php";
			}
		
	}
//--------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------	
	public function compas()
	{
		include $this->c_modelos.'ModeloGrupo.php';
		$grupo = new ModeloGrupo;

		$grupo->campanieros($NGrupo, $Compas);
				
		include $this->c_vistas."companieros.php";	
	}
} // Fin Clase
?>
Return current item: Alliances Manager