<?php
/**
 * Copy Right IJH.CC
 * Each engineer has a duty to keep the code elegant
 * $Id$
 */

if(!defined('__CORE_DIR')){
    exit("Access Denied");
}

class Mdl_Member_Mystaff extends Mdl_Table
{

    protected $_table = 'member_mystaff';
    protected $_pk = 'staff_id,uid';
    protected $_cols = 'staff_id,uid,dateline';

    public function create($data, $checked=false)
    {
        if (!$checked && !($data = $this->_check($data))) {
            return true;
        }
        $data['dateline'] = $data['dateline'] ? $data['dateline'] : __CFG::TIME;
        if ($this->db->insert($this->_table, $data, false)) {
            return true;
        }
    }


    public function del($uid, $staff_id)
    {
        if(!($uid = (int)$uid) || !($staff_id = (int)$staff_id)){
            return false;
        }
        $sql = "DELETE FROM ". $this->db->table($this->_table) . " WHERE uid = $uid" . " AND staff_id = $staff_id";
        if($this->db->query($sql)){
            return true;
        }else{
            return false;
        }
        
    }


}
