<?php

/**
 *      【橙创家校通v4.0】 (C)2010-2012 Tuntron Inc.
 *      
 *    	 http://www.tuntron.com   QQ：1121251729
 *
 *      &系统管理类文件&
 */

if (!defined('IS_RUN')) die('Forbidden');

class tj_schedule extends tj_model {

    var $table = 'dbpre_schedule';
	var $key = 'bid';
    function __construct() {
        parent::__construct();
        $this->init_field();
    }

    function init_field() {
        $this->add_field('bid,arraystr');
		$this->add_field_fun('bid', 'intval');
		$this->add_field_fun('arraystr', '_T');
    }
	
	 function read_all($type=null) {
        $this->db->from($this->table);
        $this->db->select('bid,arraystr');
        return $this->db->fetch_all_assoc();
    }
	
	function read_one($bid) {
        $this->db->from($this->table);
        $this->db->where('bid', $bid);
        return $this->db->once_fetch_assoc();
    }

    function save($post,$variable=null) {
        $variable = parent::save($post,$variable);
        return $variable;
    }

    function write_cache() {
      
    }

    function check_post(& $post, $edit = FALSE) {
        if(!$post['bid']) Note('课程表所属班级不能为空！');
    }
}
?>