<?php
/**
* @version $Id: application.php 13243 2009-10-20 04:01:04Z ian $
* @package Joomla
* @subpackage Config
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant to the
* GNU General Public License, and as distributed it includes or is derivative
* of works licensed under the GNU General Public License or other free or open
* source software licenses. See COPYRIGHT.php for copyright notices and
* details.
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
require_once( JPATH_COMPONENT.DS.'views'.DS.'categoryadmin'.DS.'view.html.php' );
/**
* @package Joomla
* @subpackage Config
*/
class ChalangeAdminControllerPlayer extends ChalangeAdminController
{
//Guardamos y nos quedamos en la pantalla actual
function apply(){
//recuperamos los valores y los guardamos en la tabla
JTable::addIncludePath(JPATH_COMPONENT.DS.'tables');
$row=& JTable::getInstance('Players','Table');
if(!$row->bind(JRequest::get('post'))){
echo "<script>alert('".$row->getError()."');
window.history.go(-1);</script>\n";
exit();
}
if(!$row->store()){
echo "<script>alert('".$row->getError()."');
window.history.go(-1);</script>\n";
exit();
}
$this->setRedirect('index.php?option=com_chalange&view=playerAdmin&task=edit&cid[]='.(JRequest::getCmd('id'))); //recargamos la página
$this->setMessage(JText::_('EL DEPORTISTA HA SIDO CORRECTAMENTE MODIFICADO')); //mostramos mensaje de confirmación.
}
//guardamos y salimos al listado general
function save(){
//recuperamos los valores y los guardamos en la tabla
JTable::addIncludePath(JPATH_COMPONENT.DS.'tables');
$row=& JTable::getInstance('Players','Table');
$post=JRequest::get('post');
$post['birthday']=$post['birthyear']."-".$post['birthmonth']."-".$post['birthday'];
if(!$row->bind($post)){
echo "<script>alert('".$row->getError()."');
window.history.go(-1);</script>\n";
exit();
}
if(!$row->store()){
echo "<script>alert('".$row->getError()."');
window.history.go(-1);</script>\n";
exit();
}
$this->setRedirect('index.php?option=com_chalange&view=playersAdmin'); //volvemos al listado
}
function cancel(){
JRequest::setVar('view','playersadmin');
parent::display();
}
}