<?php

error_reporting(E_ALL);
ini_set('display_errors', 0);
   
ini_set("memory_limit","800M");

class Union_JsonController extends Zend_Controller_Action
{
	
    public function init()
    {
	
		$this->_helper->viewRenderer->setNoRender();
		$this->_helper->layout->disableLayout();
		
    }	
	
    public function indexAction(){
            
            
            
    }
    
    
    public function getplayersAction(){
         $PlayersDB = new Model_Profile;
        $ListPlayers = $PlayersDB->getAllForTest();
       
        echo json_encode($ListPlayers);
            
    }
    
    public function getplayerAction(){
        
        $request = $this->getRequest();
        $id = $request->getParam("id");
        
         $PlayersDB = new Model_Profile;
        $ListPlayer = $PlayersDB->fetchRow("UserID ='".$id."'");
       
        echo json_encode($ListPlayer->toArray());
            
    }
    
    
    function playersData()
    {
        $PlayersDB = new Model_Profile;
        $ListPlayers = $PlayersDB->getAllForTest();
         $players = array();
         
         foreach($ListPlayers as $player){
                $players[0]["UserID"] = 1;
                $players[0]["name"] = "Jose Gerreiro";
                $players[0]["Age"] = "27";
                $players[0]["Ethnicity"] = "African";
                $players[0]["Position"] = "Business Developemnt";
         }
         
         
         
         return $players;
    }
	
	
}