<?php

class Model_DbTable_Organisations extends Zend_Db_Table
{
    protected $_name = 'tournament';
    
    // Add Tournaments
    public function insertData($data)
        {
            try 
            {
                $data["LastUpdate"] = date("Y-m-d H:i:s");
                return $this->insert($data);
            } 
            catch (Exception $ex) 
            {
                return false;
            }
        }

        
    
    // Update Tournaments
    public function updateData($data,$id)
        {

            try
            {
                $data["LastUpdate"] = date("Y-m-d H:i:s");
                return $this->update($data,"TID ='".$id."'");        
            }
            catch(Exception $e)
            {
                return false;
            }
        }
    
   
    public function getLevels()
    {
        $select = $this->select();
        $select->from(array('T' =>"fp_org_levels" ));
        $select->setIntegrityCheck(false);
        return $this->fetchAll($select);
    }
	//get types
	public function getTypes()
    {
        $select = $this->select();
        $select->from(array('T' =>"ef_institutions_type" ))->where("dropdown =1");
        $select->setIntegrityCheck(false);
        return $this->fetchAll($select);
    }
    
    //get school types
	public function getSchoolTypes()
    {
        $select = $this->select();
        $select->from(array('T' =>"fp_School_Types" ));
        $select->setIntegrityCheck(false);
        return $this->fetchAll($select);
    }
    
     //get association types
	public function getAssociationTypes()
    {
        $select = $this->select();
        $select->from(array('T' =>"fp_Association_Types" ));
        $select->setIntegrityCheck(false);
        return $this->fetchAll($select);
    }
	
	//get parents 
	public function getParents($query)
    {
        $select = $this->select();
        $select->from(array('T' =>"ef_unions" ),array("un_id","un_name","un_type"));
        $select->where($query);
        $select->setIntegrityCheck(false);
        return $this->fetchAll($select);
    }
	
	
}

