<?php
class TData {
	public static $tablename = "t";

	public function select(){
		$sql = "update ".self::$tablename." set is_active=0";
		$query = Executor::doit($sql);
		$sql = "update ".self::$tablename." set is_active=1 where id=$this->id";
		$query = Executor::doit($sql);
	}



	public static function getById($id){
		$sql = "select * from ".self::$tablename." where id=$id";
		$query = Executor::doit($sql);
		return Model::one($query[0],new TData());
	}



	public static function getAll(){
		$sql = "select * from ".self::$tablename;
		$query = Executor::doit($sql);
		return Model::many($query[0],new TData());
	}

	public static function getSelected(){
		$sql = "select * from ".self::$tablename." where is_active=1";
		$query = Executor::doit($sql);
		return Model::many($query[0],new TData());
	}


}

?>