<?php
Doo::loadCore ( 'db/DooModel' );
/**
 * 
 * @author CP.
 * @version 1.0
 * @namespace invoice
 * @package invoiceModel
 */
class staffLeaveManage extends DooModel {
	/**
	 *
	 * @var integer $iid 管理组ID
	 */
	public $icid;
	/**
	 *
	 * @var string $staff 管理组人员
	 */
	public $staff;
	public $category;
	public $cid;
	public $CC;
	
	public $_table = 'CLD_staffLeaveManage';
	public $_primarykey = 'icid';
	public $_fields = array (
			'icid',
			'staff',
			'category',
			'CC',
			'cid'
	);
	
	/**
	 * 获得查看人员
	 * @param number $icid
	 */
	public function getInvoiceCMByIcid($icid=0){
		$lsit=array();
		if (! empty ( $icid ))
			$lsit = $this->getOne ( array (
					'where' => 'icid='.$icid,
					'asArray' => TRUE
			) );
		
		return $lsit;
	}
	
	/**
	 * 是否有该用户在权限列表中
	 * @param number $sid
	 */
	public function getInvoiceCMByStaff($sid = 0) {
		$lsit=array();
		if (! empty ( $sid ))
			$lsit = $this->find ( array (
					'select'=>'cid',
					'where' => 'staff like "%[\"' . $sid . '\",%"',
					'asArray' => TRUE
			) );
	
			return $lsit;
	}
	
	/**
	 * 根据cid获得审批组
	 * @param string $cidMode
	 */
	public function getStaffManageByCid($cidMode = '') {
		$detail = array ();
		if (! empty ( $cidMode ))
			$detail = $this->getOne ( array (
					'where' => 'cid ="' . $cidMode . '" ',
					'asArray' => true
			) );
			if (empty ( $detail ['staff'] ))
				$detail ['staffList'] = array ();
				else
					$detail ['staffList'] = json_decode ( $detail ['staff'], true );
					return $detail;
	}
	
}

// ?>