<?php

Doo::loadCore('db/DooModel');

class tagCompanyNexus extends DooModel {

    public $tcid;
    public $sid;
    public $company;
    public $tag;
    
    public $_table = 'CLD_tagCompanyNexus';
    public $_primarykey = 'tcid';
    public $_fields = array('tcid', 'sid','company','tag');

    function getTagClientBySCid($cid,$sid){
    	return $this->getOne(array('where'=>'sid='.$sid.' and company='.$cid,  'asArray' => true));
    }
    
    function getTagClientBySid($sid){
    	return $this->find(array('where'=>'sid='.$sid,  'asArray' => true));
    }
    
    function getClientByTag($tag){
    	$sql = "select * from " . $this->_table . " as a left join CLD_staff as b on (a.sid=b.sid)  where a.cid= '".$cid."' " ;
    	$query = Doo::db ()->query ( $sql );
		$result = $query->fetch ();
		return $result;
    }
}

?>