<?php

class Model_DbTable_AccessControl extends Zend_Db_Table
{
    
    protected $_name = "AccessControl";
    
		public function insertData($data)
    {
        try 
        {
            return $this->insert($data);
        } 
        catch (Exception $ex) 
        {
            return $ex;
        }
    }
		
		public function updateData($data,$id)
    {
        try
        {
            return $this->update($data,"CID ='".$id."'");        
        }
        catch(Exception $e)
        {
            print_r($e);
            return false;
        }
    }
		
    public function getAll()
    {
    	
				$auth = Zend_Auth::getInstance();
				$user = $auth->getIdentity();
        $select = $this->select();
        $select->from(array('U'=>$this->_name))->order("Title ASC");
				if($user->UnionType !=1){
					$select->where("Private =0");
				}
        $select->setIntegrityCheck(false);
        return $this->fetchAll($select); 
    }
    
}