<?php 
class Note_Model extends Model{
	function __construct(){
		parent::__construct();
	}
	function  insert($data){
		$this->db->insert("note",$data);
	}
	function update($data,$noteid){
		$this->db->where("noteid",$noteid);
		return $this->db->update("note",$data);
	}
	function delete($ids){
		return $this->db->in("noteid",$ids)->delete("note");
	}
	function get($id=false,$page=1,$showlines=20){
		if($id){	$this->db->where("noteid",$id);	}
		$this->db->join("user as u","u.user_id","n.userid","left");
		$this->db->orderby("times","DESC");
		if($page){
			$this->db->limit($showlines,$page*$showlines-$showlines);
		}
		return $this->db->get("note as n");
	}
}