<?php

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

class district_staff extends DooModel {

    public $dsid;
    public $did;
    public $sid;
   
    public $_table = 'CLD_district_staff';
    public $_primarykey = 'dsid';
    public $_fields = array('dsid', 'did', 'sid');


    function getClientByCid($cid){
    	$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;
    }
    
	function getClientByStaff($condition,$limit){
    	
    	$sql = "select * from " . $this->_table . " as a left join CLD_client as b on (a.cid=b.cid)  where 1 ".$condition." ".$limit ;
		
    	$query = Doo::db ()->query ( $sql );
		
		$result = $query->fetchAll ();
		
		return $result;
    	
    }
    
    public function getProject(){
    	
    	return $this->find ( array ('asc' => 'pid', 'asArray' => TRUE ) );
    }
    
    public function getProjectByIdList($projectid){
    	return $this->find ( array ('where' => "pid= '".$projectid."'", 'asArray' => TRUE ) );
    }
    
}

?>