<?php

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

class staffDynamic extends DooModel {
	
	public $sdid;
	public $content;
	public $time;
	public $category;
	public $cid;
	public $sid;
	public $staff;
	public $status;
	
	public $_table = 'CLD_staffDynamic';
	public $_primarykey = 'sdid';
	public $_fields = array ('sdid', 'content','time','category', 'cid','sid','staff','status');
	
	public function getStaffDynamic(){
		return $this->find ( array ('desc' => 'sdid','limit'=>'20', 'asArray' => TRUE ) );
	}

	public function getStaffBirthday($date,$sid){
		return $this->getOne ( array ('where' => "sid= '".$sid."'  and  FROM_UNIXTIME(time, '%m-%d')= '".$date."'", 'asArray' => TRUE ) );
	}
	
	public function checkUser($uid,$passwork){
		return $this->find ( array ('select'=>'sid,username,isadmin,cid,othercid,category,othercategory,gender,qq,phone,telephone,email,avatar','where' => "username= '".$uid."' and passwork = '".addslashes($passwork)."'", 'asArray' => TRUE ) );
	}
	
	public function getStaffByCid($cid=0) {
		return $this->find ( array ('asc' => 'sid','where' => "cid= '".$cid."'", 'asArray' => TRUE ) );
	}
	
	
	public function getUserById($sid=0) {
		return $this->find ( array ('asc' => 'sid','where' => "sid= '".$sid."'", 'asArray' => TRUE ) );
	}

	public function getUserByIdList($puid){
		return $this->find ( array ('where' => "sid= '".$puid."'", 'asArray' => TRUE ) );
	}
	
}

?>