<?php 

class TimelineData extends CodonData   {
	
	public static function get_events($id)   {
        $query = "SELECT * FROM `icrew_timeline` WHERE id=$id";
        
        return DB::get_row($query);
    }
    
    public static function get_all_events()  {
        $query = "SELECT * FROM `icrew_timeline`
                    ORDER BY date ASC";
        
        return DB::get_results($query);
    }
    
    public static function get_event($id)   {
        $query = "SELECT * FROM `icrew_timeline` WHERE id=$id";
        
        return DB::get_row($query);
    }
    
    public static function save() {
		$name = DB::escape($event->name);
		$date = DB::escape($event->date);

		$sql = "INSERT INTO icrew_timeline(name, date) VALUES('$name', '$date')";
		DB::query($sql);
	}
	
	public static function update($id,$name,$date) {
		$sql = "UPDATE icrew_timeline SET name ='$name', date ='$date', id='$id'";
		DB::query($sql);
	}
	
	public static  function delete_event($id)    {
        $query = "DELETE FROM `icrew_timeline` WHERE id='$id'";

        DB::query($query);
    }
	
    
    
}
?>