Location: PHPKode > projects > Chalange > com_chalange/administrator/controllers/category.php
<?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 ChalangeAdminControllerCategory 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('Categories','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=categoryAdmin&task=edit&cid[]='.(JRequest::getCmd('id'))); //recargamos la página
  			$this->setMessage(JText::_('LA CATEGORIA HA SIDO CORRECTAMENTE MODIFICADA'));	 //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('Categories','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=categoriesAdmin'); //volvemos al listado
		}  	
  		function cancel(){
  			JRequest::setVar('view','categoriesAdmin');
  			parent::display();
  		}	  		
	
}
Return current item: Chalange