<?php

class Model_DbTable_EthnicityCount extends Zend_Db_Table
{
    protected $_name = 'profile';

    public function getCount($jobtype)

    {
    	$auth = Zend_Auth::getInstance();
		$user = $auth->getIdentity();

         $select = $this->select();
if($user->UnionType <3){
	$select->from(array('P' => 'EthnicityCountTotal_view'));
 			$select->where("JobType = '".$jobtype."'");
}else{
	$select->from(array('P' => 'EthnicityCountTotal_Union_view'));
 			$select->where("JobType = '".$jobtype."' AND un_id ='".$user->UnionID."'");
}
            
           $select->setIntegrityCheck(false);

            return $this->fetchRow($select);

    } 
    public function getPlayersCount()
    {
         $select = $this->select();
            $select->from(array('P' => 'Players_Ethnicity_Count_view'));
           $select->setIntegrityCheck(false);
            return $this->fetchRow($select);
    } 
    public function getCoachesCount()
    {
         $select = $this->select();
            $select->from(array('P' => 'Coach_Ethnicity_Count_view'));
           $select->setIntegrityCheck(false);
            return $this->fetchRow($select);
    } 
    public function getRefereesCount()
    {
         $select = $this->select();
            $select->from(array('P' => 'Referees_Ethnicity_Count_view'));
           $select->setIntegrityCheck(false);
            return $this->fetchRow($select);
    } 
    public function getMedicalCount()
    {
         $select = $this->select();
            $select->from(array('P' => 'Medicals_Ethnicity_Count_view'));
           $select->setIntegrityCheck(false);
            return $this->fetchRow($select);
    } 
}
