Location: PHPKode > projects > Chalange > com_chalange/models/registerform.php
<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport('joomla.application.component.model');
 class ChalangeModelRegisterform extends JModel{

 	function getCategories($idCarrera){
 		$query='SELECT #__gcd_categories.* '
 		.'FROM #__gcd_categories INNER JOIN #__gcd_categoriesrace ON #__gcd_categories.id=#__gcd_categoriesrace.idCategory INNER JOIN #__gcd_carreras ON #__gcd_categoriesrace.idRace=#__gcd_carreras.id '
 		."WHERE #__gcd_carreras.id=$idCarrera";
 		return$this->_getList($query);
 	}

 	function getPlayer($playerId){
 		$query='SELECT * '
 		.'FROM #__gcd_players '
 		."WHERE #__gcd_players.id=$playerId";
 		$aux=$this->_getList($query);
 		return $aux[0];
 	}
  	//retorna la lista de dorsales para este corredor en esta competición
 	function getDorsal($playerId, $chalangeId){
 		$query='SELECT dorsal '
 		.'FROM #__gcd_registered INNER JOIN #__gcd_carrerasChalange ON #__gcd_registered.idRace=#__gcd_carrerasChalange.idCarrera '
 		."WHERE #__gcd_carrerasChalange.idChalange=$chalangeId AND #__gcd_registered.idPlayer=$playerId AND dorsal !='' GROUP BY dorsal";
 		$aux=$this->_getList($query);
 		if (count($aux)==1)	return $aux[0]->dorsal;
 	}
 	
 }
?>
Return current item: Chalange