<?php


/**
* Tábor típus osztály
*/
class camp_type
{
	private $ct_id;
	private $ct_name;
	private $ct_deleted;




    /**
     * Gets the value of ct_id.
     *
     * @return mixed
     */
    public function get_ct_id()
    {
        return $this->ct_id;
    }

    /**
     * Sets the value of ct_id.
     *
     * @param mixed $ct_id the ct id
     *
     * @return self
     */
    private function set_ct_id($ct_id)
    {
        $this->ct_id = $ct_id;

        return $this;
    }

    /**
     * Gets the value of ct_name.
     *
     * @return mixed
     */
    public function get_ct_name()
    {
        return $this->ct_name;
    }

    /**
     * Sets the value of ct_name.
     *
     * @param mixed $ct_name the ct name
     *
     * @return self
     */
    private function set_ct_name($ct_name)
    {
        $this->ct_name = $ct_name;

        return $this;
    }

    public function get_ct_deleted() {
    	return $this->ct_deleted;
    }

    private function set_ct_deleted($_item) {
    	$this->ct_deleted = $_item;

    	return $this;
    }


    public function set_ct_data_by_id($_ct_id) {
		global $sql;
		$ct_data_assoc_array = $sql->assoc_array("select * from camp_type where ct_id = " . $_ct_id);
		$ct_data_array = $ct_data_assoc_array[0];
		foreach ($ct_data_array as $field => $value) {
			$function_name = "set_" . $field;
			$this->$function_name($value); 
		}
	}

	public static function create_camp_type($_name) {
		global $sql;
		return $sql->insert_into('camp_type', array('ct_name' => $_name));
	}

	public static function update_camp_type($_id, $_name) {
		global $sql;
		$sql->update_table('camp_type', array('ct_name' => $_name), array('ct_id' => $_id));
	}


}

?>